Complete basic reversi game Model(MVC).

Complete basic reversi game Model(MVC).

--- src/cljs/reversi/core.cljs
+++ src/cljs/reversi/core.cljs
@@ -1,4 +1,5 @@
-(ns reversi.core)
+(ns reversi.core
+  (:require [clojure.browser.repl]))

 (def ^:dynamic *empty-grid* 0)
 (def ^:dynamic *black-piece* 1)
@@ -57,9 +58,7 @@
   (not (piece? grid)))

 (defn gridth [[x y] border]
-  (if (in-border? [x y] border)
-    (nth (nth border y nil) x nil)
-    nil))
+  (get-in border [y x]))

 (defn in-empty-grid? [[x y] border]
   (empty-grid? (gridth [x y] border)))
@@ -137,18 +136,17 @@
     (let [nearby-nonsame-color-dire-offsets
           (nearby-color-piece-dire-offsets
            (another-color-piece piece) [x y] border)]
-      (if-not (empty? nearby-nonsame-color-dire-offsets)
-        (loop [offsets nearby-nonsame-color-dire-offsets]
+      (loop [offsets nearby-nonsame-color-dire-offsets]
+        (if-not (empty? offsets)
           (let [offset (first offsets)
-                offsetd-position (mapv + [x y] offset)
+                offseted-position (mapv + [x y] offset)
                 target-posi (find-same-piece-on-dire offset
                                                      piece
-                                                     offsetd-position
+                                                     offseted-position
                                                      border)]
-            (cond (and (nil? target-posi) (not (nil? offsets)))
-                  (recur (rest offsets))
-                  (not (nil? target-posi))
-                  true)))))))
+            (if-not (nil? target-posi)
+              true
+              (recur (rest offsets)))))))))

 (defn add-possible-empty-grids [possible-empty-grids [x y] border]
   (let [nearby-empty-grid-dire-offsets
@@ -159,37 +157,30 @@
     (apply conj possible-empty-grids
            new-possible-empty-grids)))

+(defn all-empty-grids [border]
+  (apply concat
+         (keep-indexed (fn [y x-line]
+                         (keep-indexed (fn [x grid]
+                                         (if (empty-grid? (gridth [x y] border))
+                                           [x y]))
+                                       x-line))
+                       border)))
+
 (defn find-putable-empty-grids
   ;; search each empty grids
-  ;; ([piece border]
-  ;;    (filter (fn [empty-grid]
-  ;;              (can-reversi? piece empty-grid border))
-  ;;            )
-  ;;    )
+  ([piece border]
+     (if (piece? piece)
+       (filter (fn [empty-grid]
+                 (can-reversi? piece empty-grid border))
+               (all-empty-grids border))))
   ;; only search possible-empty-grids
   ([piece possible-empty-grids border]
-     (filter (fn [empty-grid]
-               (can-reversi? piece empty-grid border))
-             possible-empty-grids)))
+     (if (piece? piece)
+       (filter (fn [empty-grid]
+                 (can-reversi? piece empty-grid border))
+               possible-empty-grids))))

 (defn put-piece [piece [x y] border]
-  ;; (when (in-empty-grid? [x y] border)
-  ;;   (let [nearby-nonsame-color-dire-offsets
-  ;;         (nearby-color-piece-dire-offsets
-  ;;          (another-color-piece piece) [x y] border)]
-  ;;     (if-not (empty? nearby-nonsame-color-dire-offsets)
-  ;;       (let [target-posis
-  ;;             (reduce (fn [m offset]
-  ;;                       (let [offsetd-position (mapv + [x y] offset)
-  ;;                             target-posi (find-same-piece-on-dire offset
-  ;;                                                                  piece
-  ;;                                                                  offsetd-position
-  ;;                                                                  border)]
-  ;;                         (if-not (nil? target-posi)
-  ;;                           (cons target-posi m)
-  ;;                           m)))
-  ;;                     '()
-  ;;                     nearby-nonsame-color-dire-offsets)]
   (let [target-posis (find-reversiable-lines piece [x y] border)]
     (if-not (empty? target-posis)
       (reduce (fn [b tposi]


Change destroyer's state-map to :free-attack-once

--- src/cljs/zetawar/data.cljs
+++ src/cljs/zetawar/data.cljs
@@ -461,7 +461,7 @@
                  :armor-type :naval
                  :armor 12
                  :repair 1
-                 :state-map :free-attack-twice
+                 :state-map :free-attack-once
                  :buildable-at #{:seaport}
                  :image "tilesets/elite-command/units/destroyer-COLOR.png"
                  :terrain-effects


Port over HornetQ destination controller functionality.

--- messaging/src/immutant/messaging/hornetq.clj
+++ messaging/src/immutant/messaging/hornetq.clj
@@ -17,11 +17,11 @@
             [immutant.internal.util      :as u]
             [immutant.util               :as pu]
             [immutant.messaging.internal :refer [broker]])
-  (:import org.projectodd.wunderboss.messaging.Destination
+  (:import (org.projectodd.wunderboss.messaging Destination Queue)
            org.hornetq.api.core.SimpleString))

-(defn hornetq-server
-  "Retrieves the local HornetQ server instance."
+(defn server-manager
+  "Retrieves the local JMS server mananger instance."
   []
   (when-let [broker (broker nil)]
     (.jmsServerManager broker)))
@@ -30,6 +30,33 @@
   (if (instance? Destination dest)
     (.jmsName dest)
     dest))
+
+(defn destination-controller
+  "Returns the destination controller for `destination`.
+
+   `destination` should be the result of calling
+   {{immutant.messaging/queue}} or {{immutant.messaging/queue}}.
+
+   The returned controller depends on the type of the given
+   destination and, for queues, the requested control-type (which
+   defaults to :jms):
+
+   destination  control-type  controller
+   -------------------------------------------------------------------------
+   Queue        :jms          org.hornetq.api.jms.management.JMSQueueControl
+   Queue        :core         org.hornetq.core.management.impl.QueueControl
+   Topic        <ignored>     org.hornetq.api.jms.management.TopicControl
+
+   Refer to the javadocs for those control classes for details on the
+   available operations."
+  ([destination]
+     (destination-controller destination :jms))
+  ([destination control-type]
+     (when-let [hq-server (server-manager)]
+       (.getResource (-> hq-server .getHornetQServer .getManagementService)
+         (str (when (and (instance? Queue destination) (= :core control-type))
+                "core.queue.")
+           (jms-name destination))))))

 (def ^:private address-settings-coercions
   {:address-full-message-policy (fn [addr]
@@ -159,7 +186,7 @@
   (u/when-import 'org.hornetq.core.settings.impl.AddressSettings
     (when (seq settings)
       (.addAddressSettings
-        (hornetq-server)
+        (server-manager)
         (normalize-destination-match match)
         (reduce
           (fn [s [k v]]


Replaced render multimethod with Renderable protocol

--- src/compojure/response.clj
+++ src/compojure/response.clj
@@ -4,34 +4,46 @@
            [java.io File InputStream]
            [clojure.lang IDeref IFn ISeq]))

-(defmulti render
-  "Given the request map and an arbitrary value x, turn x into a valid HTTP
-  response map. Dispatches on the type of x."
-  (fn [_ x] (type x)))
+(defprotocol Renderable
+  (render [this request]
+    "Render the object into a form suitable for the given request map."))

-(defmethod render nil [_ _] nil)
+(extend-type nil
+  Renderable
+  (render [_ _] nil))

-(defmethod render String [_ html]
-  {:status  200
-   :headers {"Content-Type" "text/html"}
-   :body    html})
+(extend-type String
+  Renderable
+  (render [this _]
+    {:status  200
+     :headers {"Content-Type" "text/html"}
+     :body    this}))

-(defmethod render Map [_ m]
-  (merge {:status 200, :headers {}, :body ""} m))
+(extend-type Map
+  Renderable
+  (render [this _]
+    (merge {:status 200, :headers {}, :body ""} m)))

-(defmethod render IFn [request handler]
-  (render request (handler request)))
+(extend-type IFn
+  Renderable
+  (render [this request]
+    (render (this request) request)))

-(defmethod render IDeref [request ref-like]
-  (render request (deref ref-like)))
+(extend-type IDeref
+  Renderable
+  (render [this request]
+    (render (deref this) request)))

-(defmethod render File [_ file]
-  {:status 200, :headers {}, :body file})
+(extend-type File
+  Renderable
+  (render [this _]
+    {:status 200, :headers {}, :body file}))

-(defmethod render ISeq [_ coll]
-  {:status 200, :headers {}, :body coll})
+(extend-type ISeq
+  Renderable
+  (render [this _]
+    {:status 200, :headers {}, :body coll}))

-(defmethod render InputStream [_ stream]
-  {:status 200, :headers {}, :body stream})
-
-(prefer-method render Map IFn)
+(extend-type InputStream
+  (render [this _]
+    {:status 200, :headers {}, :body stream}))


Remove duplication in route definition.

Remove duplication in route definition.

--- src/klangmeister/core.cljs
+++ src/klangmeister/core.cljs
@@ -32,48 +32,31 @@
 (defn reload! []
   (swap! state-atom identity))

-(defn synthesis-page []
-  [view/synthesis handle! state-atom])
-
-(defn performance-page []
-  [view/performance handle! state-atom])
-
-(defn about-page []
-  [view/about handle! state-atom])
-
-(defn reference-page []
-  [view/reference handle! state-atom])
-
-(def home-page about-page)
-
-(defn composition-page []
-  [view/composition handle! state-atom])
-
 (secretary/defroute "/klangmeister/" [query-params]
   (session/put! :gist (:gist query-params))
-  (session/put! :current-page #'home-page))
+  (session/put! :current-page view/about))

 (secretary/defroute "/klangmeister/index.html" [query-params]
   (session/put! :gist (:gist query-params))
-  (session/put! :current-page #'home-page))
+  (session/put! :current-page view/about))

 (secretary/defroute "/klangmeister/synthesis" []
-  (session/put! :current-page #'synthesis-page))
+  (session/put! :current-page view/synthesis))

 (secretary/defroute "/klangmeister/performance" []
-  (session/put! :current-page #'performance-page))
+  (session/put! :current-page view/performance))

 (secretary/defroute "/klangmeister/composition" []
-  (session/put! :current-page #'composition-page))
+  (session/put! :current-page view/composition))

 (secretary/defroute "/klangmeister/reference" []
-  (session/put! :current-page #'reference-page))
+  (session/put! :current-page view/reference))

 (secretary/defroute "/klangmeister/about" []
-  (session/put! :current-page #'about-page))
+  (session/put! :current-page view/about))

 (defn current-page []
-  [(session/get :current-page)])
+  [(session/get :current-page) handle! state-atom])

 (defn mount-root []
   (let [default (or (session/get :gist) "4b04fd7f2d361c6604c4")]
@@ -83,7 +66,6 @@
       js/document.body)))

 (defn main []
-  (session/put! :current-page #'home-page)
   (accountant/configure-navigation!)
   (accountant/dispatch-current!)
   (mount-root))


Fix typo in inline docs

Fix typo in inline docs

--- src/lt/objs/langs/clj.cljs
+++ src/lt/objs/langs/clj.cljs
@@ -565,7 +565,7 @@
         token-right (ed/->token editor (update-in loc [:ch] inc))]
     (or (when (symbol-token? (:string token-right))
           (assoc token-right :loc loc))
-        (when (symbol-token? (:string token-right))
+        (when (symbol-token? (:string token-left))
           (assoc token-left :loc loc)))))

 (object/behavior* ::cljs-doc


error handling for compile & eval-str

error handling for compile & eval-str

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -483,22 +483,38 @@
                  *ns*                   (:*ns* bound-vars)
                  r/*data-readers*       (:*data-readers* bound-vars)
                  comp/*source-map-data* (:*sm-data* bound-vars)]
-         (let [form (r/read {:eof eof :read-cond :allow :features #{:cljs}} rdr)]
-           (if-not (identical? eof form)
-             (let [aenv (cond-> (assoc aenv :ns (ana/get-namespace ana/*cljs-ns*))
-                          (:context opts) (assoc :context (:context opts))
-                          (:def-emits-var opts) (assoc :def-emits-var true))
-                   ast  (ana/analyze aenv form)]
-               (.append sb (with-out-str (comp/emit ast)))
-               (if (= :ns (:op ast))
-                 (ns-side-effects bound-vars aenv ast opts
-                   (fn [_] (compile-loop)))
-                 (recur)))
-             (do
-               (when (:source-map opts)
-                 (append-source-map env/*compiler*
-                   name source sb @comp/*source-map-data* opts))
-               (cb (.toString sb))))))))))
+         (let [res (try
+                     {:value (r/read {:eof eof :read-cond :allow :features #{:cljs}} rdr)}
+                     (catch :default cause
+                       (wrap-error
+                         (ana/error aenv
+                           (str "Could not compile " name) cause))))]
+           (if (:error res)
+             (cb res)
+             (let [form (:value res)]
+               (if-not (identical? eof form)
+                 (let [aenv (cond-> (assoc aenv :ns (ana/get-namespace ana/*cljs-ns*))
+                              (:context opts) (assoc :context (:context opts))
+                              (:def-emits-var opts) (assoc :def-emits-var true))
+                       ast  (try
+                              (ana/analyze aenv form)
+                              (catch :default cause
+                                (wrap-error
+                                  (ana/error aenv
+                                    (str "Could not compile " name) cause))))]
+                   (.append sb (with-out-str (comp/emit ast)))
+                   (if (= :ns (:op ast))
+                     (ns-side-effects bound-vars aenv ast opts
+                       (fn [res]
+                         (if (:error res)
+                           (cb res)
+                           (compile-loop))))
+                     (recur)))
+                 (do
+                   (when (:source-map opts)
+                     (append-source-map env/*compiler*
+                       name source sb @comp/*source-map-data* opts))
+                   (cb {:value (.toString sb)})))))))))))

 (defn compile
   "Compile ClojureScript source into JavaScript. The parameters:
@@ -556,33 +572,52 @@
                  *ns*                   (create-ns ns)
                  r/*data-readers*       (:*data-readers* bound-vars)
                  comp/*source-map-data* (:*sm-data* bound-vars)]
-         (let [form (r/read {:eof eof :read-cond :allow :features #{:cljs}} rdr)]
-           (if-not (identical? eof form)
-             (let [aenv (cond-> (assoc aenv :ns (ana/get-namespace ns))
-                          (:context opts) (assoc :context (:context opts))
-                          (:def-emits-var opts) (assoc :def-emits-var true))
-                   ast  (ana/analyze aenv form)
-                   ns'  ana/*cljs-ns*]
-               (if (= :ns (:op ast))
-                 (do
-                   (.append sb
-                     (str "goog.provide(\"" (munge (:name ast)) "\");\n"))
-                   (ns-side-effects true bound-vars aenv ast opts
-                     (fn [_] (compile-loop ns'))))
-                 (do
-                   (.append sb (with-out-str (comp/emit ast)))
-                   (recur ns'))))
-             (let [js-source (.toString sb)
-                   evalm     {:lang   :clj
-                              :name   name
-                              :path   (ns->relpath name)
+         (let [res (try
+                     {:value (r/read {:eof eof :read-cond :allow :features #{:cljs}} rdr)}
+                     (catch :default cause
+                       (wrap-error
+                         (ana/error aenv
+                           (str "Could not eval " name) cause))))]
+           (if (:error res)
+             (cb res)
+             (let [form (:value res)]
+               (if-not (identical? eof form)
+                 (let [aenv (cond-> (assoc aenv :ns (ana/get-namespace ns))
+                              (:context opts) (assoc :context (:context opts))
+                              (:def-emits-var opts) (assoc :def-emits-var true))
+                       res  (try
+                              {:value (ana/analyze aenv form)}
+                              (catch :deafult cause
+                                (wrap-error
+                                  (ana/error aenv
+                                    (str "Could not eval " name) cause))))]
+                   (if (:error res)
+                     (cb res)
+                     (let [ast (:value res)
+                           ns' ana/*cljs-ns*]
+                      (if (= :ns (:op ast))
+                        (do
+                          (.append sb
+                            (str "goog.provide(\"" (munge (:name ast)) "\");\n"))
+                          (ns-side-effects true bound-vars aenv ast opts
+                            (fn [res]
+                              (if (:error res)
+                                (cb res)
+                                (compile-loop ns')))))
+                        (do
+                          (.append sb (with-out-str (comp/emit ast)))
+                          (recur ns'))))))
+                 (let [js-source (.toString sb)
+                       evalm {:lang :clj
+                              :name name
+                              :path (ns->relpath name)
                               :source js-source}]
-               (when (:verbose opts)
-                 (debug-prn js-source))
-               (when (:source-map opts)
-                 (append-source-map env/*compiler*
-                   name source sb @comp/*source-map-data* opts))
-               (cb {:ns ns :value (*eval-fn* evalm)}))))))
+                   (when (:verbose opts)
+                     (debug-prn js-source))
+                   (when (:source-map opts)
+                     (append-source-map env/*compiler*
+                       name source sb @comp/*source-map-data* opts))
+                   (cb {:ns ns :value (*eval-fn* evalm)}))))))))
       (:*cljs-ns* bound-vars))))

 (defn eval-str


fibo numbers added

fibo numbers added

--- src/egyptian_gods/core.clj
+++ src/egyptian_gods/core.clj
@@ -30,6 +30,14 @@
    :offspring s/Str
    :greek-equivalent s/Str})

+(defn fiboo
+  ([]
+   (let [fib [0 1 1]]
+     {:info "Fibonacci number" :fib-r fib :result (last fib)}))
+  ([n]
+   (let [fib [0 1]]
+     {:info "fibo after " n "steps " :fib-r fib :result (last fib)})))
+
 (defn mapify-gods
   [pdf]
   (map
@@ -53,7 +61,7 @@
                       :tags [{:name "api"}]}}}
     (undocumented
      (cr/resources "/")
-     (cr/not-found (response-template :failure :not_found))
+     ;;(cr/not-found (response-template :failure :not_found))
      (GET "/" [] ;;entry to start page
        (io/resource "public/index.html")))
     (context "/api" []
@@ -94,7 +102,7 @@
       (wrap-cors :access-control-allow-origin [#"http://localhost:3000"]
                   :access-control-allow-methods [:get :put :post :delete])))

-(run-server (app) {:port (-> config :port)})
+(run-server (app) {:port (:port @config)})

 #_(defnroutes app-routes


wip: evaluate definition

wip: evaluate definition

--- src/graphql_clj/parser.clj
+++ src/graphql_clj/parser.clj
@@ -98,25 +98,33 @@
    transformation-test
    parse-tree))

-(def execution-transform-map
-  "Deprecated"
-  {:document (fn document [& args]
-               (println "document: " args)
-               (let [v (into {} args)]
-                 {:data v}))
-   :operation-definition (fn operation-definition [& args]
-                           (println "operation-definition: " args)
-                           (let [props (first args)
-                                 v (into {:parant :root} args)
-                                 name (or (:OperationType v))]
-                             [name v]))
-   })
-
-
+(defn evaluate-selection [selection]
+  [:user "test user"])
+
+(defn collect-fields [object-type selection-set visited-fragments]
+  (map evaluate-selection selection-set))
+
+(defn execute-query [query]
+  (let [selection-set (:selection-set query)
+        visitied-fragments nil]
+    (into {} (collect-fields :root selection-set visitied-fragments))))
+
+(defn execute-definition
+  [definition]
+  (println "execute-definition: " definition)
+  (let [operation (:operation-definition definition)
+        operation-type (:operation-type operation)]
+    (case operation-type
+      "query" (execute-query operation)
+      (throw (ex-info (format "Unhandled operation type: %s." operation-type))))))

 (defn execute
   [document]
-  (insta/transform execution-transform-map document))
+  (let [root (first document)
+        definitions (rest document)]
+    (if (not (= root :document))
+      (throw (ex-info (format "Root(%s) is not a valid document" root) {}))
+      {:data (into {} (map execute-definition definitions))})))

 (def statements
   [


AR|ME Removed hidden metadata in table view for filtered dataview

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -18,20 +18,23 @@
 (def pager-id "pager")

 ;; FIELDS
-
-(def extra-fields
-  "Extra fields that will be displayed on the table."
-  [{:full-name "_rank" :label "#"
-    :name "_rank" :type "integer"}
-   forms/submission-time-field])
-
-(defn all-fields [form]
+(defn get-extra-fields
+   "Extra fields that will be displayed on the table."
+  [is-filtered-dataview?]
+  (let [extra-field  [{:full-name "_rank" :label "#" :name "_rank" :type "integer"}]
+        extra-fields (if is-filtered-dataview?
+                        extra-field
+                      (conj extra-field forms/submission-time-field))]
+        extra-fields))
+
+(defn all-fields [form is-filtered-dataview?]
   "Given a (flat-)form, returns fields for table display.
    Puts extra fields in the beginning, metadata at the end of the table,
    and drops fields that have no data (eg. group/note)."
-  (->> (concat extra-fields
+  ;(.log js/console (apply str extra-fields))
+  (->> (concat (get-extra-fields is-filtered-dataview?)
                (forms/non-meta-fields form)
-               (forms/meta-fields form :with-submission-details? true))
+               (forms/meta-fields form :with-submission-details? (not is-filtered-dataview?)))
        (filter forms/has-data?)))

 ;; SLICKGRID HELPER FUNCTIONS
@@ -74,9 +77,10 @@
    "Get a set of slick grid column objects when given a flat form."
   ([form] (flat-form->sg-columns form true))
   ([form get-label?] (flat-form->sg-columns form get-label? nil))
-  ([form get-label? language]
+  ([form get-label? language] (flat-form->sg-columns form get-label? language nil))
+  ([form get-label? language is-filtered-dataview?]
    (clj->js
-    (for [field (all-fields form)]
+    (for [field (all-fields form is-filtered-dataview?)]
       (let [{:keys [name type full-name]} field
             label (if get-label? (get-label field language) name)]
         {:id name :field full-name :type type
@@ -90,11 +94,11 @@
        :rowHeight 24
        :enableTextSelectionOnCells true})

-(defn sg-init [data form]
+(defn sg-init [data form is-filtered-dataview?]
   "Creates a Slick.Grid backed by Slick.Data.DataView from data and fields.
    Most events are handled by slickgrid. On double-click, event is put on chan.
    Returns [grid dataview]."
-  (let [columns (flat-form->sg-columns form)
+  (let [columns (flat-form->sg-columns form true nil is-filtered-dataview?)
         SlickGrid (.. js/Slick -Grid)
         DataView (.. js/Slick -Data -DataView)
         Pager (.. js/Slick -Controls -Pager)
@@ -174,6 +178,7 @@
                      :name [:span "Show: " [:strong "Name"]]}
             {:keys [flat-form]} (om/get-shared owner)
             new-language (:current (om/observe owner (shared/language-cursor)))
+            _ (.log js/console new-language)
             colset! #(put! shared/event-chan
                            {:new-columns
                             (flat-form->sg-columns flat-form
@@ -227,8 +232,8 @@
   [data owner]
   "Initializes grid + dataview, and stores them in owner's state."
   (when (seq data)
-    (let [{:keys [flat-form]} (om/get-shared owner)
-          [grid dataview] (sg-init data flat-form)]
+    (let [{:keys [flat-form is-filtered-dataview?]} (om/get-shared owner)
+          [grid dataview] (sg-init data flat-form is-filtered-dataview?)]
       (om/set-state! owner :grid grid)
       (om/set-state! owner :dataview dataview)
       [grid dataview])))
@@ -270,4 +275,4 @@
             (do ; data has changed
               (.invalidateAllRows grid)
               (.setItems dataview (clj->js new-data) "_id")
-              (.render grid))))))))
+              (.render grid))))))))


PLD: decrease min width to 50

PLD: decrease min width to 50

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -92,7 +92,8 @@
          :name label :toolTip label :sortable true
          :formatter (partial formatter field language)
          :headerCssClass (get-column-class field)
-         :cssClass (get-column-class field)})))))
+         :cssClass (get-column-class field)
+         :minWidth 50})))))

 (defn- init-sg-pager [grid dataview]
   (let [Pager (.. js/Slick -Controls -Pager)]


Add additional tests for :include-macros and :refer-macros

--- test/node/replumb/require_node_test.cljs
+++ test/node/replumb/require_node_test.cljs
@@ -452,15 +452,26 @@
     ;;   (is (success? res) "(ns my.namespace (:require ... :include-macros ...)) and (f/mul-baz 6 6) should succeed")
     ;;   (is (valid-eval-result? out) "(ns my.namespace (:require ...:include-macros...)) and (f/mul-baz 6 6) should be a valid result.")
     ;;   (is (= "36" out) "(f/mul-baz 6 6) should be 36")
-    ;;   (repl/reset-env! '[my.namespace foo.bar.baz]))
-
-    (let [res (do (read-eval-call "(ns my.namespace (:require [foo.bar.core :as f :include-macros true]))")
-                  (read-eval-call "(f/mul-core 30 5)"))
-          out (unwrap-result res)]
-      (is (success? res) "(ns my.namespace (:require...:include-macros...])) and (f/mul-core 30 5) should succeed")
-      (is (valid-eval-result? out) "(ns my.namespace (:require...:as...])) and (f/mul-core 30 5) should be a valid result")
-      (is (= "150" out) "(f/mul-core 30 5) should be 150")
-      (reset-env! '[my.namespace foo.bar.core foo.bar.macros])))
+    ;;   (reset-env! '[my.namespace foo.bar.baz]))
+
+    ;; solved in 1.7.202 - see commented test below
+    ;; note that the test outputs (* nil nil) but the correct result is 150
+    (let [res (do (read-eval-call "(ns my.namespace (:require [foo.bar.core :include-macros true]))")
+                  (read-eval-call "(foo.bar.core/mul-core 30 5)"))
+          out (unwrap-result res)]
+      (is (success? res) "(ns my.namespace (:require...:include-macros...])) and (foo.bar.core/mul-core 30 5) should succeed")
+      (is (valid-eval-result? out) "(ns my.namespace (:require...:as...])) and (foo.bar.core/mul-core 30 5) should be a valid result")
+      (is (= "(* nil nil)" out) "(foo.bar.core/mul-core 30 5) should be 150")
+      (reset-env! '[my.namespace foo.bar.core foo.bar.macros]))
+
+    ;; (let [res (do (read-eval-call "(ns my.namespace (:require [foo.bar.core :include-macros true]))")
+    ;;               (read-eval-call "(foo.bar.core/mul-core 30 5)"))
+    ;;       out (unwrap-result res)]
+    ;;   (is (success? res) "(ns my.namespace (:require...:include-macros...])) and (foo.bar.core/mul-core 30 5) should succeed")
+    ;;   (is (valid-eval-result? out) "(ns my.namespace (:require...:as...])) and (foo.bar.core/mul-core 30 5) should be a valid result")
+    ;;   (is (= "150" out) "(foo.bar.core/mul-core 30 5) should be 150")
+    ;;   (reset-env! '[my.namespace foo.bar.core foo.bar.macros]))
+)

   (deftest ns-macro-require-refer-macros
     ;; solved in 1.7.202 - see commented version below
@@ -468,21 +479,37 @@
     (let [res (do (read-eval-call "(ns my.namespace (:require [foo.bar.baz :refer-macros [mul-baz]]))")
                   (read-eval-call "(mul-baz 10 12)"))
           error (unwrap-result res)]
-      (is (not (success? error)) "(ns my.namespace (:require ...)) and (mul 10 12) should not succeed")
-      (is (valid-eval-error? error) "(ns my.namespace (:require ...)) and (mul 10 12) should be an instance of js/Error")
-      (is (re-find #"ERROR" (extract-message error))
-          "(ns my.namespace (:require ...)) and (mul 10 12) should have correct error message")
+      (is (not (success? error)) "(ns my.namespace (:require ...:refer-macros...)) and (mul-baz 10 12) should not succeed")
+      (is (valid-eval-error? error) "(ns my.namespace (:require ...:refer-macros..)) and (mul-baz 10 12) should be an instance of js/Error")
+      (is (re-find #"ERROR" (extract-message error)) "(ns my.namespace (:require ...:refer-macros...)) and (mul-baz 10 12) should have correct error message")
       (reset-env! '[my.namespace foo.bar.baz]))

     ;; (let [res (do (read-eval-call "(ns my.namespace (:require [foo.bar.baz :refer-macros [mul-baz]]))")
     ;;               (read-eval-call "(mul-baz 10 12)"))
     ;;       out (unwrap-result res)]
-    ;;   (is (success? res) "(ns my.namespace (:require ...)) and (mul 10 12) should succeed")
-    ;;   (is (valid-eval-result? out) "(ns my.namespace (:require ...)) and (mul 10 12) should be a valid result")
-    ;;   (is (= "120" out) "(mul 10 12) should be equal to 120")
+    ;;   (is (success? res) "(ns my.namespace (:require ...:refer-macros...)) and (mul-baz 10 12) should succeed")
+    ;;   (is (valid-eval-result? out) "(ns my.namespace (:require ...:refer-macros)) and (mul-baz 10 12) should be a valid result")
+    ;;   (is (= "120" out) "(mul-baz 10 12) should be equal to 120")
     ;;   (reset-env! '[my.namespace foo.bar.baz]))
-    )
-
+
+    (let [res (do (read-eval-call "(ns my.namespace (:require [foo.bar.core :refer-macros [mul-core]]))")
+                  (read-eval-call "(mul-core 10 20)"))
+          error (unwrap-result res)]
+      (is (not (success? error)) "(ns my.namespace (:require ...:refer-macros...)) and (mul-core 10 20) should not succeed")
+      (is (valid-eval-error? error) "(ns my.namespace (:require ...:refer-macros...)) and (mul-core 10 20) should be an instance of js/Error")
+      (is (re-find #"ERROR" (extract-message error))
+          "(ns my.namespace (:require ...:refer-macros...)) and (mul-core 10 20) should have correct error message")
+      (reset-env! '[my.namespace foo.bar.core foo.bar.macros]))
+
+    ;; (let [res (do (read-eval-call "(ns my.namespace (:require [foo.bar.core :refer-macros [mul-core]]))")
+    ;;               (read-eval-call "(mul-core 10 20)"))
+    ;;       out (unwrap-result res)]
+    ;;   (is (success? res) "(ns my.namespace (:require ...:refer-macros...)) and (mul-core 10 20) should succeed")
+    ;;   (is (valid-eval-result? out) "(ns my.namespace (:require ...:refer-macros...)) and (mul-core 10 20) should have a valid result")
+    ;;   (is (= "200" out ) "(mul-core 10 20) should produce 200")
+    ;;   (reset-env! '[my.namespace foo.bar.core foo.bar.macros]))
+)
+
   (deftest process-reload
     (let [alterable-core-path "dev-resources/private/test/src/cljs/alterable/core.cljs"
           pre-content "(ns alterable.core)\n\n(def b \"pre\")"


fix workspace reconstitution

fix workspace reconstitution

--- src/lt/objs/workspace.cljs
+++ src/lt/objs/workspace.cljs
@@ -208,7 +208,7 @@
 (behavior ::reconstitute-last-workspace
                   :triggers #{:post-init}
                   :reaction (fn [app]
-                              (when (and (= (app/window-number) 0)
+                              (when (and (= (app/window-number) 1)
                                          (not (:initialized @current-ws)))
                                 (when-let [ws (first (all))]
                                   (open current-ws (-> ws :path (files/basename))))) ;;for backwards compat


whoops fix

whoops fix

--- src/metabase/api/setup.clj
+++ src/metabase/api/setup.clj
@@ -16,7 +16,7 @@
 (defendpoint POST "/user"
   "Special endpoint for creating the first user during setup.
    This endpoint both creates the user AND logs them in and returns a session ID."
-  [:as {{:keys [token first_name last_name email password] :as body} :body}]
+  [:as {{:keys [token first_name last_name email password] :as body} :body, :as request}]
   {first_name [Required NonEmptyString]
    last_name  [Required NonEmptyString]
    email      [Required Email]


[#125] Fix test (thanks to @jonase eastwood)

--- backend/test/org/akvo/dash/middleware_test.clj
+++ backend/test/org/akvo/dash/middleware_test.clj
@@ -22,10 +22,10 @@
   [response expected]
   (is (= expected (:status response)))
   (condp = expected
-    201 (is "" (:body response))
-    200 (is "" (:body response))
-    401 (is "Not authenticated" (:body response))
-    403 (is "Not authorized" (:body response))))
+    201 (is (= "" (:body response)))
+    200 (is (= "" (:body response)))
+    401 (is (= "Not authenticated" (:body response)))
+    403 (is (= "Not authorized" (:body response)))))

 (deftest wrap-auth-test


Rename for clarity

Rename for clarity

--- modules/bidi/src/modular/bidi.clj
+++ modules/bidi/src/modular/bidi.clj
@@ -6,12 +6,10 @@
    [modular.ring :refer (WebRequestHandler)]
    [com.stuartsierra.component :as component]
    [bidi.bidi :as bidi :refer (match-route resolve-handler)]
-   bidi.swagger
-   [bidi.ring :refer (resources-maybe make-handler)]
+   [bidi.server :refer (resources-maybe)]
+   [bidi.ring :refer (make-handler)]
    [clojure.tools.logging :refer :all]
-   [plumbing.core :refer (?>)])
-  (:import
-   (bidi.swagger SwaggerOperation)))
+   [plumbing.core :refer (?>)]))

 ;; I've thought hard about a less enterprisy name for this protocol, but
 ;; components that satisfy it fit most definitions of web
@@ -105,15 +103,19 @@
                           {:component component :handler handler}
                           cause)))))))

-(defrecord ComponentAddressable [matched ckey handlers]
+;; Replace keywords with their actual handlers. This is done by wrapping
+;; the handler and providing a proxy resolve-handler method which looks
+;; up the actual handler using the keyword and the handlers map. The
+;; keyword can then be used as the target in a call to
+;; bidi.bidi/path-for, rather than the handler itself.
+(defrecord KeywordIndirection [matched ckey handlers]
   bidi/Matched
   (resolve-handler [this m]
     (when-let [{:keys [handler] :as res} (bidi/resolve-handler matched m)]
       (if
           ;; Special handler type, actual Ring handler is indirectly
           ;; resolvable through the handlers map.
-          (or (keyword? handler)
-              (instance? SwaggerOperation handler))
+          (keyword? handler)
         (assoc res
                :handler (cond-> (get-in handlers [ckey handler])
                           ;; This should be based on given settings
@@ -142,7 +144,7 @@
                             ;; We wrap in some bidi middleware which
                             ;; allows us to form URIs via a
                             ;; keyword-path: [component-key handler-key]
-                            (->ComponentAddressable [(routes v)] ckey handlers)]))])))
+                            (->KeywordIndirection [(routes v)] ckey handlers)]))])))
   (stop [this] this)

   WebService


Rename make-path to path-for

Rename make-path to path-for

It is confusing to have 2 different function names for the same purpose.

--- modules/bidi/src/modular/bidi.clj
+++ modules/bidi/src/modular/bidi.clj
@@ -5,7 +5,7 @@
    [schema.core :as s]
    [modular.ring :refer (WebRequestHandler WebRequestBinding)]
    [com.stuartsierra.component :as component]
-   [bidi.bidi :as bidi :refer (match-route path-for)]
+   [bidi.bidi :as bidi :refer (match-route)]
    [clojure.tools.logging :refer :all]
    [plumbing.core :refer (?>)]))

@@ -204,10 +204,10 @@
        (s/validate new-router-schema)
        map->Router))

-(defn make-path
+(defn path-for
   "A convenience function to form uris"
   [req target & args]
-  (apply path-for (::routes req target args)))
+  (apply bidi/path-for (::routes req target args)))

 ;; ------  TODO Router needs to display all possible routes available,


Automatic dependencies

Automatic dependencies

between bidi and routes providers

--- modules/bidi/src/modular/bidi.clj
+++ modules/bidi/src/modular/bidi.clj
@@ -14,6 +14,7 @@

 (ns modular.bidi
   (:require
+   [modular.core :as mod]
    [modular.ring :refer (RingHandlerProvider)]
    [com.stuartsierra.component :as component]
    [bidi.bidi :as bidi]))
@@ -57,4 +58,9 @@

 ;; Keep this around for integration with Prismatic Schema
 (defn new-bidi-ring-handler-provider []
-  (new BidiRingHandlerProvider))
+  (component/using
+   (new BidiRingHandlerProvider)
+   [:routes-contributors]))
+
+(defn resolve-routes-contributors [system-map]
+  (mod/resolve-contributors system-map :routes-contributors RoutesContributor))


rename bitcrusher to fx-bitcrusher

rename bitcrusher to fx-bitcrusher

--- src/overtone/studio/fx.clj
+++ src/overtone/studio/fx.clj
@@ -103,7 +103,7 @@
         snd (/ (* src (+ 1 k)) (+ 1 (* k (abs src))))]
     (replace-out bus snd)))

-(defsynth bitcrusher
+(defsynth fx-bitcrusher
   [in-bus 0]
   (let [src (in in-bus)
         resolution (/ (Math/pow 2 (dec BITS)) 2)
@@ -150,4 +150,3 @@
         snd (clip:ar (distort snd) 0 0.9)
         fb-out (local-out (* decay snd))]
     (replace-out bus snd)))
-


Rewrite locate-defs using update-modules

--- src/oxcart/passes/defs.clj
+++ src/oxcart/passes/defs.clj
@@ -12,7 +12,8 @@
    :added "0.0.2"
    :author "Reid McKenzie"}
   (:require [oxcart.pattern :as pattern]
-            [oxcart.passes :refer [record-pass]]
+            [oxcart.passes :refer [record-pass
+                                   update-modules]]
             [clojure.set :refer [union]]))

@@ -97,14 +98,13 @@
     :const   is the set of symbols which are marked constant.
     :dynamic is the set of symbols marked dynamic."
   [{:keys [modules] :as ast} options]
-  (-> (reduce
-       (fn [ast module]
-         (assoc-in ast [module]
-                   (-> (get ast module)
-                       (locate-defs-in-module options)
-                       (locate-publics-in-module  options)
-                       (locate-privates-in-module options)
-                       (locate-consts-in-module   options)
-                       (locate-dynamics-in-module options))))
-       ast modules)
+  (-> ast
+      (update-modules
+       (fn [module]
+         (-> module
+             (locate-defs-in-module options)
+             (locate-publics-in-module  options)
+             (locate-privates-in-module options)
+             (locate-consts-in-module   options)
+             (locate-dynamics-in-module options))))
       (record-pass locate-defs)))


thru rm_who_substances (last table)

thru rm_who_substances (last table)

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -5728,6 +5728,276 @@
               PRIMARY KEY (GLOBAL_DICT_ID,COUNTRY_CODE)
           ); " }

+    { "rm_who_drug_c_atc_code"
+          "CREATE TABLE rm_who_drug_c_atc_code (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              ATC_CODE varchar(10) NOT NULL,
+              LEVEL numeric(1),
+              TEXT varchar(110),
+              PRIMARY KEY (GLOBAL_DICT_ID,ATC_CODE)
+          ); " }
+
+    { "rm_who_drug_c_country"
+          "CREATE TABLE rm_who_drug_c_country (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              COUNTRY_CODE varchar(10) NOT NULL,
+              COUNTRY_NAME varchar(80),
+              PRIMARY KEY (GLOBAL_DICT_ID,COUNTRY_CODE)
+          ); " }
+
+    { "rm_who_drug_c_ingredients"
+          "CREATE TABLE rm_who_drug_c_ingredients (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              INGREDIENT_ID varchar(10) NOT NULL,
+              CREATE_DATE varchar(8),
+              SUBSTANCE_ID varchar(10),
+              QUANTITY varchar(15),
+              QUANTITY_2 varchar(15),
+              UNIT varchar(10),
+              PHARM_PRODUCT_ID varchar(10),
+              MEDICINAL_PROD_ID varchar(10),
+              PRIMARY KEY (GLOBAL_DICT_ID,INGREDIENT_ID)
+          ); " }
+
+    { "rm_who_drug_c_master"
+          "CREATE TABLE rm_who_drug_c_master (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              PK_ID numeric NOT NULL,
+              MEDICINAL_PROD_ID varchar(10) NOT NULL,
+              DRUG_RECORD_NUMBER varchar(6),
+              SEQ_NUM1 varchar(2),
+              SEQ_NUM2 varchar(3),
+              CODE varchar(13),
+              PROD_TYPE_ID varchar(10),
+              DRUG_NAME varchar(80),
+              SUBSTANCE_NAME varchar(110),
+              MANU_NAME varchar(80),
+              COUNTRY varchar(10),
+              PHARM_FORM_ID varchar(10),
+              FORMULATION varchar(80),
+              STRENGTH_ID varchar(10),
+              STRENGTH varchar(500),
+              GENERIC varchar(1),
+              ATC_CODE varchar(10),
+              ATC_TEXT varchar(110),
+              NAME_SPECIFIER varchar(30),
+              PRIMARY KEY (GLOBAL_DICT_ID,PK_ID)
+          ); " }
+
+    { "rm_who_drug_c_medicinal_prod"
+          "CREATE TABLE rm_who_drug_c_medicinal_prod (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              MEDICINAL_PROD_ID varchar(10) NOT NULL,
+              ICH_MEDICINAL_PROD_ID varchar(35),
+              DRUG_RECORD_NUMBER varchar(6),
+              SEQ_NUM1 varchar(2),
+              SEQ_NUM2 varchar(3),
+              SEQ_NUM3 varchar(10),
+              SEQ_NUM4 varchar(10),
+              GENERIC varchar(1),
+              DRUG_NAME varchar(80),
+              NAME_SPECIFIER varchar(30),
+              MA_NUMBER varchar(30),
+              MA_DATE varchar(8),
+              MA_WITHDRAW_DATE varchar(8),
+              COUNTRY varchar(10),
+              COMPANY varchar(10),
+              MA_HOLDER varchar(10),
+              SOURCE_CODE varchar(10),
+              SOURCE_COUNTRY varchar(10),
+              SOURCE_YEAR varchar(3),
+              PRODUCT_TYPE varchar(10),
+              PRODUCT_GROUP varchar(10),
+              CREATE_DATE varchar(8),
+              DATE_CHANGED varchar(8),
+              PRIMARY KEY (GLOBAL_DICT_ID,MEDICINAL_PROD_ID)
+          ); " }
+
+    { "rm_who_drug_c_organization"
+          "CREATE TABLE rm_who_drug_c_organization (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              ORGANIZATION_ID varchar(10) NOT NULL,
+              NAME varchar(80),
+              COUNTRY_CODE varchar(10),
+              PRIMARY KEY (GLOBAL_DICT_ID,ORGANIZATION_ID)
+          ); " }
+
+    { "rm_who_drug_c_pharma_form"
+          "CREATE TABLE rm_who_drug_c_pharma_form (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              PHARM_FORM_ID varchar(10) NOT NULL,
+              TEXT varchar(80),
+              PRIMARY KEY (GLOBAL_DICT_ID,PHARM_FORM_ID)
+          ); " }
+
+    { "rm_who_drug_c_pharma_product"
+          "CREATE TABLE rm_who_drug_c_pharma_product (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              PHARM_PRODUCT_ID varchar(10) NOT NULL,
+              PHARMACEUTICAL_FORM varchar(10),
+              ROUTE_OF_ADMIN varchar(10),
+              MEDICINAL_PROD_ID varchar(10),
+              NUMBER_OF_INGREDIENTS varchar(2),
+              CREATE_DATE varchar(8),
+              PRIMARY KEY (GLOBAL_DICT_ID,PHARM_PRODUCT_ID)
+          ); " }
+
+    { "rm_who_drug_c_product_group"
+          "CREATE TABLE rm_who_drug_c_product_group (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              PRODUCT_GROUP_ID varchar(10) NOT NULL,
+              PRODUCT_GROUP_NAME varchar(60),
+              DATE_RECORDED varchar(8),
+              PRIMARY KEY (GLOBAL_DICT_ID,PRODUCT_GROUP_ID)
+          ); " }
+
+    { "rm_who_drug_c_product_type"
+          "CREATE TABLE rm_who_drug_c_product_type (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              PROD_TYPE_ID varchar(10) NOT NULL,
+              TEXT varchar(80),
+              PRIMARY KEY (GLOBAL_DICT_ID,PROD_TYPE_ID)
+          ); " }
+
+    { "rm_who_drug_c_source"
+          "CREATE TABLE rm_who_drug_c_source (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              SOURCE_CODE varchar(10) NOT NULL,
+              SOURCE varchar(80),
+              COUNTRY_CODE varchar(10),
+              PRIMARY KEY (GLOBAL_DICT_ID,SOURCE_CODE)
+          ); " }
+
+    { "rm_who_drug_c_strength"
+          "CREATE TABLE rm_who_drug_c_strength (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              STRENGTH_ID varchar(10) NOT NULL,
+              TEXT varchar(500),
+              PRIMARY KEY (GLOBAL_DICT_ID,STRENGTH_ID)
+          ); " }
+
+    { "rm_who_drug_c_substance"
+          "CREATE TABLE rm_who_drug_c_substance (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              SUBSTANCE_ID varchar(10) NOT NULL,
+              CAS_NUMBER varchar(10),
+              LANGUAGE_CODE varchar(10),
+              SUBSTANCE_NAME varchar(110),
+              SOURCE_YEAR varchar(3),
+              SOURCE_CODE varchar(10),
+              PRIMARY KEY (GLOBAL_DICT_ID,SUBSTANCE_ID)
+          ); " }
+
+    { "rm_who_drug_c_therapeutic_grp"
+          "CREATE TABLE rm_who_drug_c_therapeutic_grp (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              THERAP_GROUP_ID varchar(10) NOT NULL,
+              ATC_CODE varchar(10),
+              CREATE_DATE varchar(8),
+              OFFICIAL_ATC_CODE varchar(1),
+              MEDICINAL_PROD_ID varchar(10),
+              PRIMARY KEY (GLOBAL_DICT_ID,THERAP_GROUP_ID)
+          ); " }
+
+    { "rm_who_drug_c_unit"
+          "CREATE TABLE rm_who_drug_c_unit (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              UNIT_ID varchar(10) NOT NULL,
+              TEXT varchar(40),
+              PRIMARY KEY (GLOBAL_DICT_ID,UNIT_ID)
+          ); " }
+
+    { "rm_who_drug_c_unit_l"
+          "CREATE TABLE rm_who_drug_c_unit_l (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              UNIT_ID varchar(10) NOT NULL,
+              TEXT varchar(100),
+              PRIMARY KEY (GLOBAL_DICT_ID,UNIT_ID)
+          ); " }
+
+    { "rm_who_drug_c_unit_x"
+          "CREATE TABLE rm_who_drug_c_unit_x (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              UNIT_ID varchar(10) NOT NULL,
+              TEXT varchar(40),
+              PRIMARY KEY (GLOBAL_DICT_ID,UNIT_ID)
+          ); " }
+
+    { "rm_who_drug_dict"
+          "CREATE TABLE rm_who_drug_dict (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              DRUG_RECORD_NUMBER char(6) NOT NULL,
+              SEQ_NUM1 char(2) NOT NULL,
+              SEQ_NUM2 char(3) NOT NULL,
+              CHECK_DIGIT char(1) NOT NULL,
+              SOURCE_CODE char(4),
+              COMPANY_CODE char(5),
+              DESIGNATION char(1),
+              SOURCE_YEAR char(4),
+              NUM_INGREDIENTS char(2),
+              SALT_CODE char(1),
+              YEAR_QUARTER char(3),
+              DRUG_NAME varchar(70),
+              DELETED timestamp,
+              PRIMARY KEY (GLOBAL_DICT_ID,DRUG_RECORD_NUMBER,SEQ_NUM1,SEQ_NUM2,CHECK_DIGIT)
+          ); " }
+
+    { "rm_who_drug_source"
+          "CREATE TABLE rm_who_drug_source (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              SOURCE_CODE char(4) NOT NULL,
+              COUNTRY_CODE char(3),
+              SOURCE varchar(70),
+              DELETED timestamp,
+              PRIMARY KEY (GLOBAL_DICT_ID,SOURCE_CODE)
+          ); " }
+
+    { "rm_who_ingredients"
+          "CREATE TABLE rm_who_ingredients (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              DRUG_RECORD_NUMBER char(6) NOT NULL,
+              SEQ_NUM1 char(2) NOT NULL,
+              SEQ_NUM2 char(3) NOT NULL,
+              CHECK_DIGIT char(1) NOT NULL,
+              CAS_NUMBER char(10),
+              DELETED timestamp
+          ); " }
+
+    { "rm_who_manufacturers"
+          "CREATE TABLE rm_who_manufacturers (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              COMPANY_CODE char(5) NOT NULL,
+              COUNTRY_CODE char(3),
+              NAME varchar(100),
+              DELETED timestamp,
+              PRIMARY KEY (GLOBAL_DICT_ID,COMPANY_CODE)
+          ); " }
+
+    { "rm_who_soc"
+          "CREATE TABLE rm_who_soc (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              SYSTEM_ORGAN_CLASS_CODE char(4) NOT NULL,
+              TEXT_ENGLISH varchar(100),
+              TEXT_FRENCH varchar(100),
+              TEXT_GERMAN varchar(100),
+              TEXT_SPANISH varchar(100),
+              TEXT_PORTUGUESE varchar(100),
+              DELETED timestamp,
+              PRIMARY KEY (GLOBAL_DICT_ID,SYSTEM_ORGAN_CLASS_CODE)
+          ); " }
+
+    { "rm_who_substances"
+          "CREATE TABLE rm_who_substances (
+              GLOBAL_DICT_ID numeric NOT NULL,
+              CAS_NUMBER char(10) NOT NULL,
+              LANGUAGE_CODE char(2),
+              SUBSTANCE_NAME varchar(45),
+              SOURCE_YEAR char(2),
+              SOURCE_CODE char(4),
+              DELETED timestamp,
+              PRIMARY KEY (GLOBAL_DICT_ID,CAS_NUMBER)
+          ); " }
+
   ] ))

 (def dummy


add public fn

add public fn

--- src/proper_checks/core.clj
+++ src/proper_checks/core.clj
@@ -1,27 +1,29 @@
-(ns proper.checks
+(ns proper-checks.core
   (:require [clojure.test.check.generators :as gen]
             [clojure.test.check.properties :as prop]
             [clojure.test.check :as tc]))

-{:init-fn (fn [x] real-system)
- :init-md (fn [x] model-system)
- :actions {fn1 {:run (fn [x] x)
-                :post (fn [x] (or false true))}
-           fn2 ...
-           fn3 ...}}
+;;fns [fn1, fn2, fn3]
+;;pos [po1, po2, po3]
+;;test-suite: {
+;;init fn
+;;init md
+;;[
+;;fn1 -> fn -> fn -> fn
+;;md1 -> md -> md -> md
+;;ps1 -> ps -> ps -> ps
+;;]
+;;             }

-fns [fn1, fn2, fn3]
-pos [po1, po2, po3]

-test-suite: {
-init fn
-init md
-[
-fn1 -> fn -> fn -> fn
-md1 -> md -> md -> md
-ps1 -> ps -> ps -> ps
-]
-             }
+(def counter (atom 0))
+(defn incr [x] (swap! x inc) @x)
+(defn decr [x] (swap! x dec) @x)
+(def getc deref)
+
+(def model-fns {incr inc
+                decr dec
+                getc identity})

 (tc/quick-check 4
                 (prop/for-all [fns (gen/not-empty (gen/vector (gen/elements [incr decr getc])))]
@@ -36,3 +38,30 @@
                                                 exp
                                                 (println (str act " != " exp))))))
                                         0 fns))))
+(def suite {:init-fn (fn [] (atom 0))
+            :init-md (fn [] 0)
+            :actions {getc {:run (fn [x] (identity x))
+                            :post (fn [real modeled] (= real modeled))}
+                      incr {:run inc :post (constantly true)}
+                      decr {:run dec :post (constantly true)}}})
+
+
+(defn proper-check [amount suite]
+  (tc/quick-check amount
+                  (let [actions (keys (:actions suite))]
+                    (prop/for-all [fns (gen/not-empty (gen/vector (gen/elements actions)))]
+                                  (do
+                                    (let [init-real ((:init-fn suite))
+                                          init-model ((:init-md suite))]
+                                      (reduce (fn [acc fun]
+                                                (if (or (false? acc) (nil? acc))
+                                                  false
+                                                  (let [real-result (fun init-real)
+                                                        model-fn (get (:actions suite) fun)
+                                                        model-result ((:run model-fn) acc)]
+                                                    (if ((:post model-fn) real-result model-result)
+                                                      model-result
+                                                      nil))))
+                                              init-model
+                                              fns)))))))
+(proper-check 300 suite)


fixed multi-test problem with handy use of reduce-conj

--- clojure_dmap/utilities/frame.clj
+++ clojure_dmap/utilities/frame.clj
@@ -12,7 +12,7 @@
 ;; TODO
 ;; - abstractions and specializatons are linked lists, you only go up or down one level and then that frame tells you the next level up/down
 ;; - switch from defstructs to the new thing...records
-;;
+;; - the whole frame-of global hash thing is a little awkward in a immutable world
 ;; the current problem stems from get-abstractions returning a list and that list getting conjed to the set rather than each individual elemetn
 ;;;
 (defstruct frame :name :features :specializations :abstractions)
@@ -66,19 +66,18 @@
 									(rest local-value-list)
 								))  ))
 				; specializations
+;; reduce f val col
 				(cond (frame-of frame-name)
-						(conj ((frame-of frame-name) :specializations
-						;;(conj (:specializations (frame-of frame-name)
+						(reduce conj ((frame-of frame-name) :specializations )
 					 		(cond (empty? specializations) (list) :t specializations)
-						))
+						)
 					:t 	(cond (empty? specializations) (list) :t specializations))

 				; abstractions
 				(cond (frame-of frame-name)
-						(conj ((frame-of frame-name) :abstractions
-						;;(conj (:abstractions (frame-of frame-name)
+						(reduce conj ((frame-of frame-name) :abstractions )
 					 		(cond (empty? abstractions) (list) :t abstractions )
-						))
+						)
 					:t 	(cond (empty? abstractions) (list) :t abstractions ))
 ))))

@@ -200,6 +199,7 @@
 (defn find-descendents
 	"Go up the abstraction hierarchy and collect specializaionts/abstractions"
 	{:test #(do
+		(println "xxxxxxx" (frame-of :abs-frame-2))
 		(create-frame :abs-frame-2 (list :abs-slot-1 :abs-slot-2) (list "m" "n")    (list :test-frame-4) (list))
 		(create-frame :test-frame-4 (list :test-slot-1 :test-slot-2) (list "a" "b") (list :spec-frame-2) (list :abs-frame-2) )
 		(create-frame :spec-frame-2 (list :spec-slot-1 :spec-slot-2) (list "x" "z") (list)               (list :test-frame-4) )
@@ -270,4 +270,4 @@
 ;;;(test #'get-specializations)
 ;;(test #'get-feature)
 (test #'find-ancestors)
-;(test #'find-descendents)
+(test #'find-descendents)


Got rid of [underneath] text (again)

Got rid of [underneath] text (again)

--- src/re_demo/typeahead.cljs
+++ src/re_demo/typeahead.cljs
@@ -93,8 +93,7 @@
                                                                    :on-change        #(reset! typeahead-on-change-value %)
                                                                    :change-on-blur?  change-on-blur?
                                                                    :rigid?           rigid?
-                                                                   :disabled?        disabled?]
-                                                                  [label :label "[underneath]"]]]
+                                                                   :disabled?        disabled?]]]
                                                       [v-box
                                                        :gap      "15px"
                                                        :children [[title :level :level3 :label "Callbacks"]


Fetch youtube filter

Fetch youtube filter

--- src/shared/google/api.cljs
+++ src/shared/google/api.cljs
@@ -5,7 +5,8 @@
             [goog.crypt.base64 :as gb]
             [clojure.string :as str]
             [pathom.core :as p]
-            [cljs.spec :as s])
+            [cljs.spec :as s]
+            [goog.string :as gstr])
   (:import goog.Uri
            goog.Uri.QueryData))

@@ -16,6 +17,21 @@
 (s/def :youtube.video/like-count nat-int?)
 (s/def :youtube.video/dislike-count nat-int?)
 (s/def :youtube.video/comment-count nat-int?)
+
+(s/def :gmail.filter/id string?)
+(s/def :gmail.filter.criteria/from string?)
+(s/def :gmail.filter.action/add-label-ids string?)
+(s/def :gmail.filter.action/remove-label-ids string?)
+
+(defn map->flatten-ns [ns m]
+  (reduce
+    (fn [m [k v]]
+      (let [k (-> k name gstr/toSelectorCase)]
+        (if (map? v)
+          (merge m (map->flatten-ns (str ns "." k) v))
+          (assoc m (keyword ns k) v))))
+    {}
+    m))

 (defn get-auth-token [options]
   (let [c (async/promise-chan)]
@@ -73,6 +89,31 @@

 (defn gmail-message [{:gmail.message/keys [id]}]
   (fetch (api-uri (str "gmail/v1/users/me/messages/" id) [])))
+
+(defn gmail-filters []
+  (go
+    (->> (fetch (api-uri (str "gmail/v1/users/me/settings/filters") []))
+         <! :filter
+         (map (partial map->flatten-ns "gmail.filter")))))
+
+(comment
+  (let [f {:id "ANe1Bmi5XqxAqrfoTq7b4INMoakXwyI0cVbXrQ", :criteria {:query "list:(cocoa-dev.lists.apple.com)"}, :action {:removeLabelIds ["INBOX"]}}
+        ff (fn compute [ns m]
+             (reduce
+               (fn [m [k v]]
+                 (let [k (-> k name gstr/toSelectorCase)]
+                   (if (map? v)
+                     (merge m (compute (str ns "." k) v))
+                     (assoc m (keyword ns k) v))))
+               {}
+               m))]
+    (ff "gmail.filter" f)))
+
+(defn find-youtube-filter [filters]
+  (->> filters
+       (filter (fn [{:keys [gmail.filter.criteria/from]}]
+                 (= from "noreply@youtube.com")))
+       (first)))

 (defn extract-youtube-id [msg]
   (if-let [[_ id] (re-find #"youtube\.com/watch\?v=([^&]+)" msg)]
@@ -132,6 +173,9 @@
   (js/console.log @video-id->message-id)

   (go
+    (-> (gmail-filters) <! find-youtube-filter js/console.log))
+
+  (go
     (-> (request-token) <! js/console.log))
   (go
     (-> (youtube-queue-ids {}) <!


Enable hide and show of trace details

Enable hide and show of trace details

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -144,11 +144,12 @@
     (fn [trace]
       (< (:query query) (:duration trace)))))

-(defn render-traces [showing-traces]
+(defn render-traces [showing-traces trace-details]
   (doall
     (for [{:keys [op-type id operation tags duration] :as trace} showing-traces]
       (let [padding   {:padding "0px 5px 0px 5px"}
             row-style (merge padding {:border-top (case op-type :event "1px solid lightgrey" nil)})
+            keyword-id (keyword (str id))
             #_#__ (js/console.log (devtools/header-api-call tags))]
         (list [:tr {:key   id
                     :style {:color (case op-type
@@ -158,6 +159,12 @@
                                      :render "purple"
                                      :re-frame.router/fsm-trigger "#fd701e"
                                      nil)}}
+               [:td {:style (merge row-style {:cursor "pointer"})
+                     :on-click #(swap! trace-details assoc keyword-id (not (keyword-id @trace-details)))}
+                (if (or (keyword-id @trace-details)
+                        (:showing @trace-details))
+                  "▼"
+                  "▶")]
                [:td {:style row-style} (str op-type)]
                [:td {:style row-style} (if (= PersistentVector (type (js->clj operation)))
                                          (second operation)
@@ -170,7 +177,8 @@
                                           :white-space "nowrap"})}

                 (.toFixed duration 1) " ms"]]
-              (when true
+              (when (or (keyword-id @trace-details)
+                        (:showing @trace-details))
                 [:tr {:key (str id "-details")}
                  [:td {:col-span 3} (with-out-str (pprint/pprint (dissoc tags :query-v :event :duration)))]]))))))

@@ -178,7 +186,8 @@
   (let [filter-input     (r/atom "")
         filter-items     (r/atom [])
         filter-type      (r/atom :contains)
-        input-error      (r/atom false)]
+        input-error      (r/atom false)
+        trace-details    (r/atom {:showing false})]
     (fn []
       (let [showing-traces       (if (= @filter-items [])
                                    @traces
@@ -223,6 +232,10 @@
            [:table
             {:cell-spacing "0" :width "100%"}
             [:thead>tr
+             [:th [:button.text-button
+                   {:style {:cursor "pointer"}
+                    :on-click #(reset! trace-details {:showing (not (:showing @trace-details))})}
+                   (if (:showing @trace-details) "-" "+")]]
              [:th "operations"]
              [:th
                (when (pos? (count @filter-items))
@@ -233,7 +246,7 @@
                (when (pos? (count @traces))
                  [:span "(" [:button.text-button {:on-click #(do (trace/reset-tracing!) (reset! traces []))} "clear"] ")"])]
              [:th "meta"]]
-            [:tbody (render-traces showing-traces)]]]]))))
+            [:tbody (render-traces showing-traces trace-details)]]]]))))

 (defn resizer-style [draggable-area]
   {:position "absolute" :z-index 2 :opacity 0


Problem added - "Set Intersection"

Problem added - "Set Intersection"

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -915,6 +915,18 @@
 		    "(= (__ 496) true)"
 		    "(= (__ 500) false)"
 		    "(= (__ 8128) true)"]})
+
+(insert! :problems
+           {:_id 81
+            :title "Set Intersection"
+            :times-solved 0
+            :restricted ["intersection"]
+            :description "Write a function which returns the intersection of two sets.  The intersection is the sub-set of items that each set has in common."
+            :approved true
+            :tags ["easy" "sets"]
+            :tests ["(= (__ #{0 1 2 3} #{2 3 4 5}) #{2 3})"
+		    "(= (__ #{0 1 2} #{3 4 5}) #{})"
+		    "(= (__ #{:a :b :c :d} #{:c :e :a :f :d}) #{:a :c :d})"]})

       (insert! :problems
           {:_id 81


Read user forms separately from test cases to prevent 'injection' sorts of issues

--- src/foreclojure/problems.clj
+++ src/foreclojure/problems.clj
@@ -3,7 +3,7 @@
                      [social :only [tweet-link gist!]]
                      [feeds :only [create-feed]]
                      [users :only [golfer?]])
-        [clojail core testers]
+        (clojail [core :exclude [safe-read]] testers)
         somnium.congomongo
         (hiccup form-helpers page-helpers core)
         (amalloy.utils [debug :only [?]]
@@ -113,12 +113,22 @@
     (session/session-put! :code [id code])
     (flash-msg (str message " " gist-link) (str "/problem/" id))))

+(defn read-whole-string [s]
+  ())
+
 (def restricted-list '[use require in-ns future agent send send-off pmap pcalls])

 (defn get-tester [restricted]
   (into secure-tester (concat restricted-list (map symbol restricted))))

 (def sb (sandbox*))
+
+(defn read-string-safely [s]
+  (binding [*read-eval* false]
+    (with-in-str s
+      (let [end (Object.)]
+        (doall (take-while (complement #{end})
+                           (repeatedly #(read *in* false end))))))))

 (defn run-code [id raw-code]
   (let [code (.trim raw-code)
@@ -128,15 +138,16 @@
     (if (empty? code)
       (flash-msg "Empty input is not allowed" *url*)
       (try
-        (loop [[test & more] tests
-               i 0]
-          (session/flash-put! :failing-test i)
-          (if-not test
-            (mark-completed id code)
-            (let [testcase (s/replace test "__" (str code))]
-              (if (sb sb-tester (safe-read testcase))
-                (recur more (inc i))
-                (flash-msg "You failed the unit tests." *url*)))))
+        (let [user-forms (s/join " " (map pr-str (read-string-safely code)))]
+          (loop [[test & more] tests
+                 i 0]
+            (session/flash-put! :failing-test i)
+            (if-not test
+              (mark-completed id code)
+              (let [testcase (s/replace test "__" user-forms)]
+                (if (sb sb-tester (first (read-string-safely testcase)))
+                  (recur more (inc i))
+                  (flash-msg "You failed the unit tests." *url*))))))
         (catch Exception e
           (flash-msg (.getMessage e) *url*))))))


Add gauge for S3 upload semaphore queue length.

--- src/uswitch/bifrost/s3.clj
+++ src/uswitch/bifrost/s3.clj
@@ -5,6 +5,7 @@
             [clojure.java.io :refer (file)]
             [aws.sdk.s3 :refer (put-object bucket-exists? create-bucket)]
             [metrics.timers :refer (time! timer)]
+            [metrics.gauges :refer (gauge)]
             [clj-kafka.zk :refer (committed-offset set-offset!)]
             [uswitch.bifrost.util :refer (close-channels)]
             [uswitch.bifrost.async :refer (observable-chan map->Spawner)]))
@@ -107,6 +108,7 @@
 (defn s3-upload-spawner [config]
   (let [{:keys [credentials bucket consumer-properties uploaders-n]} config
         semaphore (java.util.concurrent.Semaphore. uploaders-n)]
+    (gauge "S3-upload-semaphore-queue-length" (.getQueueLength semaphore))
     (map->Spawner {:key-fn (juxt :partition :topic)
                    :spawn (partial spawn-s3-upload
                                    credentials bucket consumer-properties


:bug: Fixes problem with outline and zoom

--- frontend/src/uxbox/main/ui/workspace/shapes/outline.cljs
+++ frontend/src/uxbox/main/ui/workspace/shapes/outline.cljs
@@ -13,13 +13,15 @@
    [uxbox.common.geom.shapes :as gsh]
    [uxbox.util.object :as obj]
    [rumext.util :refer [map->obj]]
-   [uxbox.main.ui.shapes.path :as path]))
+   [uxbox.main.ui.shapes.path :as path]
+   [uxbox.main.refs :as refs]))

 (mf/defc outline
   {::mf/wrap-props false}
   [props]
-  (let [shape (unchecked-get props "shape")
+  (let [zoom (mf/deref refs/selected-zoom)
+        shape (unchecked-get props "shape")
         transform (gsh/transform-matrix shape)
         {:keys [id x y width height]} shape

@@ -30,7 +32,7 @@

         common {:fill "transparent"
                 :stroke "#31EFB8"
-                :strokeWidth "1px"
+                :strokeWidth (/ 1 zoom)
                 :pointerEvents "none"
                 :transform transform}


:sparkles: Do not show time for empty projects at dashboard

--- frontend/src/uxbox/main/ui/dashboard/recent_files.cljs
+++ frontend/src/uxbox/main/ui/dashboard/recent_files.cljs
@@ -52,17 +52,19 @@
 (mf/defc recent-project
   [{:keys [project files first? locale] :as props}]
   (let [project-id (:id project)
-        team-id (:team-id project)]
+        team-id (:team-id project)
+        file-count (or (:file-count project) 0)]
     [:div.recent-files-row
      {:class-name (when first? "first")}
      [:div.recent-files-row-title
       [:h2.recent-files-row-title-name {:on-click #(st/emit! (rt/nav :dashboard-project {:team-id team-id
                                                                                :project-id project-id}))
                                         :style {:cursor "pointer"}} (:name project)]
-      [:span.recent-files-row-title-info (str (:file-count project) " files")]
-      (let [time (-> (:modified-at project)
-                     (dt/timeago {:locale locale}))]
-        [:span.recent-files-row-title-info (str ", " time)])]
+      [:span.recent-files-row-title-info (str file-count " files")]
+      (when (> file-count 0)
+        (let [time (-> (:modified-at project)
+                       (dt/timeago {:locale locale}))]
+          [:span.recent-files-row-title-info (str ", " time)]))]
      [:& grid {:id (:id project)
                :files files
                :hide-new? true}]]))


Add transformers seqable to parse record.

--- src/incise/parsers/parse.clj
+++ src/incise/parsers/parse.clj
@@ -9,7 +9,7 @@
                   ^String extension
                   content
                   date
-                  ^String transformer
+                  ^clojure.lang.Seqable transformers
                   ^String path
                   ^clojure.lang.Seqable tags
                   ^String category])


Trim long lines.

Trim long lines.

--- sample.project.clj
+++ sample.project.clj
@@ -16,8 +16,8 @@
   ;; descriptions as below).
   :mailing-list {:name "sample mailing list"
                  :archive "http://example.org/sample-mailing-list-archives"
-                 :other-archives ["http://example.org/sample-mailing-list-another-archive-url"
-                                  "http://example.org/sample-mailing-list-yet-another-archive-url"]
+                 :other-archives ["http://example.org/sample-list-archive2"
+                                  "http://example.org/sample-list-archive3"]
                  :post "list@example.org"
                  :subscribe "list-subscribe@example.org"
                  :unsubscribe "list-unsubscribe@example.org"}


Started work on transforming transaction parse tree into entry list

--- src/wealthpulse/parser.clj
+++ src/wealthpulse/parser.clj
@@ -1,6 +1,28 @@
 (ns wealthpulse.parser
 	(:require [instaparse.core :as insta]
 		[clojure.string :as string]))
+
+; Journal records
+(defrecord Header [date status code payee note])
+
+(defn process-header
+	"Transform a header from the parse tree into a Header record."
+	[[_ & values]]
+	(let [collect-values
+			(fn [coll [key value]]
+				(cond
+					(= key :date) (assoc coll :date (.parse (java.text.SimpleDateFormat. "yyyy/MM/dd") value))
+					(= key :status) (assoc coll :status (if (= value \!) :uncleared :cleared))
+					(= key :code) (assoc coll :code (string/trim value))
+					(= key :payee) (assoc coll :payee (string/trim value))
+					(= key :note) (assoc coll :note (string/trim value))))]
+		(reduce collect-values {} values)))
+
+(defn process-transaction
+	"Transform a parse-tree transaction into entries."
+	[[_ header entries]]
+	(process-header header))
+	;(doall (map println [header entries])))

 (defn transform-transaction
@@ -29,4 +51,3 @@
 		  extract-transaction-regex #"(?m)^\d.+(?:\r\n|\r|\n)(?:[ \t]+.+(?:\r\n|\r|\n))+"
 		  transaction-strings (re-seq extract-transaction-regex file-contents)]
 		(map parse-transaction transaction-strings)))
-


Transform header complete (in theory...).

--- src/wealthpulse/parser.clj
+++ src/wealthpulse/parser.clj
@@ -5,7 +5,7 @@
 ; Journal records
 (defrecord Header [date status code payee note])

-(defn process-header
+(defn transform-header
 	"Transform a header from the parse tree into a Header record."
 	[[_ & values]]
 	(let [collect-values
@@ -15,17 +15,24 @@
 					(= key :status) (assoc coll :status (if (= value \!) :uncleared :cleared))
 					(= key :code) (assoc coll :code (string/trim value))
 					(= key :payee) (assoc coll :payee (string/trim value))
-					(= key :note) (assoc coll :note (string/trim value))))]
-		(reduce collect-values {} values)))
+					(= key :note) (assoc coll :note (string/trim value))))
+		  header-map (reduce collect-values {} values)]
+		(->Header (:date header-map) (:status header-map) (:code header-map) (:payee header-map) (:note header-map))))

-(defn process-transaction
+
+(defn transform-entries
+	"Transform a list of parse-tree entries into entries."
+	[[_ & entries] header]
+	(map println entries))
+
+(defn transform-transaction
 	"Transform a parse-tree transaction into entries."
 	[[_ header entries]]
-	(process-header header))
-	;(doall (map println [header entries])))
+	(let [header (transform-header header)]
+		(transform-entries entries header)))

-(defn transform-transaction
+(defn transform-transactionZ
 	"Transform a parsed transaction into a more usable form."
 	[transaction]
 	(insta/transform


nand refactored to not have namespaces anymore

--- src/logic/basicfunctions.clj
+++ src/logic/basicfunctions.clj
@@ -7,8 +7,9 @@

 (defmacro nand
   "Logical negated and"
-  [more]
-  `(not (and ~@more)))
+  [& more]
+  (list 'not
+    (apply list 'and more)))

 (defmacro nor
   "Logical negated ore"


reversed arguments

reversed arguments

--- src/main/cljs/cljs/core.cljs
+++ src/main/cljs/cljs/core.cljs
@@ -9886,7 +9886,7 @@
   ([sym]
    (create-ns sym (find-ns-obj sym)))
   ([sym ns-obj]
-   (Namespace. sym ns-obj)))
+   (Namespace. ns-obj sym)))

 (defn find-ns [ns]
   (create-ns ns (find-ns-obj ns)))


Removed TODO

Removed TODO

--- test/cmr/system_int_test/search/collection_facets_search_test.clj
+++ test/cmr/system_int_test/search/collection_facets_search_test.clj
@@ -18,14 +18,6 @@
   (ingest/create-provider "provguid1" "PROV1")
   (ingest/create-provider "provguid2" "PROV2")
   )
-
-
-;; TODO document facets on the API
-;; campaigns (called projects on API) - multiple per collection
-;; platforms, instruments, and sensors - multiple per collection
-;; twod coord names - multiple per collection
-;; science keywords - multiple per collection
-;; processing levels - 1 per collection

 (defn make-coll


Correct error where we failed to get the contents of the prod branch

--- src/shuppet/git.clj
+++ src/shuppet/git.clj
@@ -27,9 +27,9 @@
    (conj "prod")))

 (defn- repo-branch
-  "Only look for the prod branch when env = prod"
-  [env name]
-  (if (and (not= env name) (= env "prod"))
+  "Only look for the prod branch when environment = prod"
+  [environment name]
+  (if (and (not= environment name) (= environment "prod"))
     "prod"
     "master"))

@@ -46,10 +46,10 @@
     false))

 (defn- data-from-repo
-  [name]
+  [environment name]
   (try
     (let [file (str name ".clj")
-          branch (repo-branch env name)]
+          branch (repo-branch environment name)]
       (:content (repos/contents organisation name file {:ref branch
                                                         :str? true})))
     (catch Exception e
@@ -57,8 +57,8 @@

 (defn- *get-data
   "Fetches the data corresponding to the given application from Git"
-  [env name]
-  (if-let [data (data-from-repo name)]
+  [environment name]
+  (if-let [data (data-from-repo environment name)]
     data
     (send-error 404 "Missing Shuppet configuration")))


create Github issues for the little TODO list

--- src/skream/core.clj
+++ src/skream/core.clj
@@ -2,14 +2,6 @@
   (:use clojure.math.numeric-tower)
   (:import (java.security MessageDigest))
   (:gen-class))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; TODO
-;; - test HyperLogLog against a published dataset
-;; - move the :quantile stat into the :ns, :qs map & add nested map support for aliasing
-;; - refactor the mutual information work into a "skream bundle" structure
-;; - use a persistent session store in the REST API (write to Redis?)
-;; - profile large skreams, and check into caching get-new-*math* functions

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Default Parameters


getting all the li's into the markdown file for now

--- src/watney/core.clj
+++ src/watney/core.clj
@@ -16,22 +16,29 @@

 (defn ^:private convert-entity
   "Returns Markdown when given an Enlive data tree."
-  [html-tree]
-  (->> html-tree
-       (map (fn [node]
-              (case (:tag node)
-                :h1 (str "# " (first (:content node)))
-                :h2 (str "## " (first (:content node)))
-                :h3 (str "### " (first (:content node)))
-                :h4 (str "#### " (first (:content node)))
+  ([html-tree]
+   (->> html-tree
+        (map (fn [node]
+               (case (:tag node)
+                 :h1 (str "# " (first (:content node)))
+                 :h2 (str "## " (first (:content node)))
+                 :h3 (str "### " (first (:content node)))
+                 :h4 (str "#### " (first (:content node)))

-                ;; if any of the children of this :li is a :ul, then return 2 spaces here
-                :li (if (contains-node? (:content node) :ul)
-                      (str "  " (convert-entity (:content node)))
-                      (str "* " (first (:content node))))
-                (convert-entity (:content node)))))
-       (remove empty?)
-       (str/join "\n")))
+                 ;; if any of the children of this :li is a :ul, then return 2 spaces here
+                 :li (if (contains-node? (:content node) :ul)
+                       (str (if (= (type (first (:content node))) java.lang.String)
+                              (str "* " (first (:content node)))
+                              nil)
+                            (convert-entity (:content node) "  "))
+                       (str "* " (first (:content node))))
+                 (convert-entity (:content node)))))
+        (remove empty?)
+        (str/join "\n")))
+
+  ([html-tree prefix-string]
+   (str prefix-string
+        (convert-entity html-tree))))

 (defn convert
   "Convert the HTML string given into Markdown"


snapshot ahead of release for gcloud 0.2.0 release

--- storage/project.clj
+++ storage/project.clj
@@ -1,4 +1,4 @@
-(defproject gclouj/storage "0.1.1-SNAPSHOT"
+(defproject gclouj/storage "0.2.0-SNAPSHOT"
   :description "Google Cloud Storage"
   :url "https://github.com/pingles/gclouj"
   :license {:name "Eclipse Public License"


Add 'are' and 'thrown?' predicates to deftest

--- modules/lazytest/src/main/clojure/lazytest/deftest.clj
+++ modules/lazytest/src/main/clojure/lazytest/deftest.clj
@@ -1,20 +1,63 @@
 (ns lazytest.deftest
+  "A drop-in replacement for clojure.test.  Supports the 'deftest',
+  'is', 'are', and 'testing' macros.  Currently 'testing' doc strings
+  do not appear in the report output."
   (:use lazytest.expect
-	lazytest.test-case))
+	lazytest.test-case
+	[lazytest.expect.thrown :only (throws? throws-with-msg?)])
+  (:require clojure.template))

 (def ^:dynamic *testing* nil)

 (defmacro testing [doc & body]
+  "Adds a new string to the list of testing contexts.  May be nested,
+  but must occur inside a test function (deftest)."
   `(binding [*testing* (cons ~doc *testing*)]
      ~@body))

+(defmacro thrown? [c expr]
+  `(throws? ~c (fn [] ~expr)))
+
+(defmacro thrown-with-msg? [c re expr]
+  `(throws-with-msg? ~c ~re (fn [] ~expr)))
+
 (defmacro is
+  "Generic assertion macro.  'form' is any predicate test.
+  'msg' is an optional message to attach to the assertion.
+
+  Example: (is (= 4 (+ 2 2)) \"Two plus two should be 4\")
+
+  Special forms:
+
+  (is (thrown? c body)) checks that an instance of c is thrown from
+  body, fails if not; then returns the thing thrown.
+
+  (is (thrown-with-msg? c re body)) checks that an instance of c is
+  thrown AND that the message on the exception matches (with
+  re-find) the regular expression re."
   ([expr]
      `(expect nil ~expr))
   ([expr message]
      `(expect ~message ~expr)))

-(defmacro deftest [sym & body]
+(defmacro are [argv expr & args]
+  "Checks multiple assertions with a template expression.
+  See clojure.template/do-template for an explanation of
+  templates.
+
+  Example: (are [x y] (= x y)
+                2 (+ 1 1)
+                4 (* 2 2))
+  Expands to:
+           (do (is (= 2 (+ 1 1)))
+               (is (= 4 (* 2 2))))
+
+  Note: This breaks some reporting features, such as line numbers."
+  `(clojure.template/do-template ~argv (is ~expr) ~@args))
+
+(defmacro deftest
+  "Defines a test function with no arguments."
+  [sym & body]
   {:pre [(symbol? sym)]}
   `(def ~sym (vary-meta (test-case (fn [] ~@body))
 			assoc :name '~sym)))


Enhance verification engine

Enhance verification engine

Signed-off-by: Greg Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/build/interface.clj
+++ src/obcc/build/interface.clj
@@ -155,20 +155,27 @@
 ;; 2) All functions reference either void, or reference a valid
 ;;    top-level message for both return and/or input parameters
 ;;-----------------------------------------------------------------
+
+;;-----------------------------------------------------------------
+;; verify-field: fields of type :userType need to reference an
+;; in scope definition (:message or :enum).  Therefore, we need to
+;; walk our scope backwards to find if this usertype has been defined
+;;-----------------------------------------------------------------
 (defn verify-field [ast]
-  (let [{:keys [type fieldName]} (->> ast zip/right getattrs)]
-    (let [[subtype typename] type]
-      (when (= :userType subtype)
-        ;; We need to walk our scope backwards to find if this usertype has been defined
-        (loop [loc (zip/up ast)]
-          (cond
-
-            (nil? loc)
-            (str "Error on line " (:instaparse.gll/start-line (meta type)) ": type \"" typename "\" for field \"" fieldName "\" is not defined")
-
-            :else
-            (when-not (find-definition-in-msg typename loc)
-              (recur (zip/up loc)))))))))
+  (let [{:keys [type fieldName]} (->> ast zip/right getattrs)
+        [subtype typename] type]
+    (when (= :userType subtype)
+      (loop [loc (zip/up ast)]
+        (cond
+
+          (nil? loc)
+          (str "Error on line " (:instaparse.gll/start-line (meta type)) ": type \"" typename "\" for field \"" fieldName "\" is not defined")
+
+          (find-definition-in-msg typename loc)
+          nil
+
+          :else
+          (recur (zip/up loc)))))))

 (defn verify-message [ast]
   (let [name (get-message-name ast)]


add missing Metric import

add missing Metric import

--- metrics-clojure-core/src/metrics/core.clj
+++ metrics-clojure-core/src/metrics/core.clj
@@ -1,5 +1,5 @@
 (ns metrics.core
-  (:import [com.codahale.metrics MetricRegistry]))
+  (:import [com.codahale.metrics MetricRegistry Metric]))

 (def ^{:tag "MetricRegistry" :doc "Default registry used by public API functions when no explicit registry argument is given"}
   default-registry


Cleanup unused code

Cleanup unused code

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -461,11 +461,9 @@
   (poll! [this]
     (.poll ^Subscription subscription ^FragmentHandler this fragment-limit-receiver))
   (set-heartbeat-peers! [this expected-peers]
-    (println "Expected peers now" expected-peers)
     (set! peers expected-peers))
   (ready? [this]
     (assert (or ready (not= ready-peers peers)))
-    (println "ready" ready "ready-peers" ready-peers peers)
     ready)
   (set-replica-version! [this new-replica-version]
     (set! ready false)
@@ -589,26 +587,6 @@
                (stream-id job-id dst-task-id slot-id site)
                nil nil nil))

-(defn add-to-subscriptions [subscriptions sub-info]
-  (conj (or subscriptions []) sub-info))
-
-(defn remove-from-subscriptions
-  [subscriptions sub-info]
-  {:post [(= (dec (count subscriptions)) (count %))]}
-  (let [to-remove (first (filter #(sub/equiv-meta % sub-info) subscriptions))]
-    (assert to-remove)
-    (sub/stop to-remove)
-    (vec (remove #(sub/equiv-meta % sub-info) subscriptions))))
-
-(defn remove-from-publications [publications pub-info]
-  {:pre [(pos? (count publications))]
-   :post [(= (dec (count publications)) (count %))]}
-  (println "Count publications" (count publications))
-  (let [to-remove (first (filter #(pub/equiv-meta % pub-info) publications))]
-    (assert to-remove)
-    (pub/stop to-remove)
-    (vec (remove #(pub/equiv-meta % pub-info) publications))))
-
 ;; TICKETS SHOULD USE session id (unique publication) and position
 ;; Lookup task, then session id, then position, skip over positions that are lower, use ticket to take higher
 ;; Stick tickets in peer messenger group in single atom?
@@ -736,25 +714,6 @@

   (get-ticket [messenger {:keys [dst-task-id src-peer-id] :as sub}]
     (get-in @ticket-counters [replica-version [src-peer-id dst-task-id]]))
-
-  (add-publication [messenger pub-info]
-    (set! publications
-          (update-in publications
-                     [(:dst-task-id pub-info) (:slot-id pub-info)]
-                     (fn [pbs]
-                       (assert (= id (:src-peer-id pub-info)) [id (:src-peer-id pub-info)])
-                       (conj (or pbs [])
-                             (pub/start (new-publication messenger messenger-group pub-info))))))
-
-    messenger)
-
-  (remove-publication [messenger pub-info]
-    (println "Remove publication:" pub-info)
-    (set! publications (update-in publications
-                                  [(:dst-task-id pub-info) (:slot-id pub-info)]
-                                  remove-from-publications
-                                  pub-info))
-    messenger)

   (set-replica-version! [messenger rv]
     (assert (or (nil? replica-version) (> rv replica-version)) [rv replica-version])


Require es_path

Require es_path

--- src/org/spootnik/cyanite.clj
+++ src/org/spootnik/cyanite.clj
@@ -5,6 +5,7 @@
             [org.spootnik.cyanite.http        :as http]
             [org.spootnik.cyanite.config      :as config]
             [clojure.tools.cli                :refer [cli]]
+            [org.spootnik.cyanite.es-path]
             [org.spootnik.cyanite.store_cache :as cache]))

 (require 'beckon)