mapv based on @sw1nn's comment

mapv based on @sw1nn's comment

--- src-cljs/kixi/hecuba/tabs/hierarchy/property_details.cljs
+++ src-cljs/kixi/hecuba/tabs/hierarchy/property_details.cljs
@@ -97,21 +97,21 @@
   (zipmap [:name :device_id :type] (clojure.string/split (name label) #":")))

 (defn extract-calcs [property_details]
-  (into [] (map (fn [[k v]]
-                  (let [{:keys [name device_id type]} (parse-label k)
-                        device-description (->> property_details
-                                                :devices
-                                                (filter #(= (:device_id %) device_id))
-                                                first
-                                                :description)]
-                    {:label device-description
-                     :name name
-                     :type type
-                     :last-calc (if-let [timestamp (get (:calculated_fields_last_calc property_details) k)]
-                                  (common/unparse-date timestamp "yyyy-MM-dd")
-                                  "No date.")
-                     :value v}))
-                (:calculated_fields_values property_details))))
+  (mapv (fn [[k v]]
+          (let [{:keys [name device_id type]} (parse-label k)
+                device-description (->> property_details
+                                        :devices
+                                        (filter #(= (:device_id %) device_id))
+                                        first
+                                        :description)]
+            {:label device-description
+             :name name
+             :type type
+             :last-calc (if-let [timestamp (get (:calculated_fields_last_calc property_details) k)]
+                          (common/unparse-date timestamp "yyyy-MM-dd")
+                          "No date.")
+             :value v}))
+        (:calculated_fields_values property_details)))

 (defn calculation-type [type]
   (case type


Adds require of clojure.core.async to make lein uberjar work (#10)

* Adds require of clojure.core.async to make lein uberjar work

* Adds a comment for why the async require is there

--- kitchen/src/kitchen/utils.clj
+++ kitchen/src/kitchen/utils.clj
@@ -1,6 +1,10 @@
 (ns kitchen.utils
+  ; Despite not being explicitly used, the clojure.core.async
+  ; require is needed because lein uberjar fails in some
+  ; environments without it (https://github.com/twosigma/waiter/pull/10).
   (:require [clj-time.core :as t]
             [clj-time.format :as f]
+            [clojure.core.async :as async]
             [clojure.data.json :as json]
             [clojure.string :as str])
   (:import clojure.core.async.impl.channels.ManyToManyChannel


use text/x-clojure as mime type for .cljs files in browser repl server

--- src/clj/cljs/repl/browser.clj
+++ src/clj/cljs/repl/browser.clj
@@ -87,7 +87,7 @@
             ".html" "text/html"
             ".jpg" "image/jpeg"
             ".js" "text/javascript"
-            ".cljs" "text/clojurescript"
+            ".cljs" "text/x-clojure"
             ".map" "application/json"
             ".png" "image/png"
             "text/plain"))


Add an API endpoint for getting all comics

--- src/clj/comic_reader/core.clj
+++ src/clj/comic_reader/core.clj
@@ -8,6 +8,8 @@
 (c/defroutes routes
   (c/GET "/" [] "Hello World!")
   (c/context "/api/v1" []
+    (c/GET "/comics" []
+      "All the comics.")
     (c/GET "/comic/:name" [name]
       (str "Hello comic" name)))
   (route/resources "/"))


Enable mqtt auto-reconnect

Enable mqtt auto-reconnect

--- src/clj/mokkameister/mqtt.clj
+++ src/clj/mokkameister/mqtt.clj
@@ -25,9 +25,10 @@
   (let [
         my-uri (uri/uri (system :mqtt-uri))
         short-url (str "tcp://" (:host my-uri) ":" (:port my-uri))
-        creds {:username (:user my-uri)
-               :password (:password my-uri)}
-        conn (mh/connect short-url {:opts creds})]
+        opts {:username (:user my-uri)
+              :password (:password my-uri)
+              :auto-reconnect true}
+        conn (mh/connect short-url {:opts opts})]
     conn))

 (defn connect-and-process! []


Allow harvesting adjacent plants and grass

--- src/cljc/robinson/update.cljc
+++ src/cljc/robinson/update.cljc
@@ -1271,32 +1271,30 @@
                                       (= 0 (rr/uniform-int 1000)))
                                 [(rr/rand-nth [(ig/gen-item :unhusked-coconut) (ig/gen-item :plant-fiber)])]
                                 []))
-                          (and (= (get target-cell :type) :tall-grass)
-                               (= direction :center))
+                          (= (get target-cell :type) :tall-grass)
                             (concat
                               (if (or harvestable
                                       (= 0 (rr/uniform-int 1000)))
                                 [(rr/rand-nth [(ig/gen-item :grass) (ig/gen-item :plant-fiber)])]
                                 []))
-                          (and (= (get target-cell :type) :gravel)
-                               (= direction :center))
-                             (if (get target-cell :near-lava)
-                               (concat
-                                 (if (or harvestable
-                                         (= 0 (rr/uniform-int 1000)))
-                                   [(rr/rand-nth [(ig/gen-item :rock) (ig/gen-item :obsidian)])]
-                                   []))
-                               (concat
-                                 (if (or harvestable
-                                         ;; Make large flint stone have a higher chance of dropping away
-                                         ;; from the player's starting-pos.
-                                         (= 0 (rr/uniform-int 1000)))
-                                   (concat
-                                     (repeat (rr/uniform-int 4 6) (ig/gen-item :rock))
-                                     [(rr/rand-nth [(ig/gen-item :rock) (if (< 300 (rr/uniform-double 100 (max 101 distance)))
-                                                                          (ig/gen-item :large-flint)
-                                                                          (ig/gen-item :flint))])])
-                                   [])))
+                          (= (get target-cell :type) :gravel)
+                            (if (get target-cell :near-lava)
+                              (concat
+                                (if (or harvestable
+                                        (= 0 (rr/uniform-int 1000)))
+                                  [(rr/rand-nth [(ig/gen-item :rock) (ig/gen-item :obsidian)])]
+                                  []))
+                              (concat
+                                (if (or harvestable
+                                        ;; Make large flint stone have a higher chance of dropping away
+                                        ;; from the player's starting-pos.
+                                        (= 0 (rr/uniform-int 1000)))
+                                  (concat
+                                    (repeat (rr/uniform-int 4 6) (ig/gen-item :rock))
+                                    [(rr/rand-nth [(ig/gen-item :rock) (if (< 300 (rr/uniform-double 100 (max 101 distance)))
+                                                                         (ig/gen-item :large-flint)
+                                                                         (ig/gen-item :flint))])])
+                                  [])))
                           :else [])
                         [])]
     (log/info "harvested" harvest-items)


Indentation

Indentation

--- src/cljs/iframe_app/core.cljs
+++ src/cljs/iframe_app/core.cljs
@@ -29,45 +29,47 @@
 (defcomponent condition-detail [condition owner]
   (render-state [_ state]
     (let [{:keys [master-field field-value slave-fields]} condition]
-      (html (let [{:keys [name value]} field-value]
-              [:li.value.selectedRule.hardSelect
-               [:a.ruleItem
-                {:value value
-                 :on-click (fn [_]
-                             (let [{:keys [selector-channel]} (om/get-shared owner)]
-                               (put! selector-channel
-                                     {:selection-to-update :master-field
-                                      :new-value           master-field})
-                               (put! selector-channel
-                                     {:selection-to-update :field-value
-                                      :new-value           field-value})))}
-                [:i.icon-arrow-right] name]
-               [:div.pull-right
-                [:a.deleteRule {:value value} "×"]]
-               [:p
-                [:i.icon-arrow-right]
-                " "
-                (let [slave-field-names (->> slave-fields
-                                             (map :name)
-                                             (clojure.string/join ", "))]
-                  [:em slave-field-names])]])))))
+      (html
+        (let [{:keys [name value]} field-value]
+          [:li.value.selectedRule.hardSelect
+           [:a.ruleItem
+            {:value    value
+             :on-click (fn [_]
+                         (let [{:keys [selector-channel]} (om/get-shared owner)]
+                           (put! selector-channel
+                                 {:selection-to-update :master-field
+                                  :new-value           master-field})
+                           (put! selector-channel
+                                 {:selection-to-update :field-value
+                                  :new-value           field-value})))}
+            [:i.icon-arrow-right] name]
+           [:div.pull-right
+            [:a.deleteRule {:value value} "×"]]
+           [:p
+            [:i.icon-arrow-right]
+            " "
+            (let [slave-field-names (->> slave-fields
+                                         (map :name)
+                                         (clojure.string/join ", "))]
+              [:em slave-field-names])]])))))

 ;; Conditions grouped by a common master field
 (defcomponent condition-group [{:keys [master-field conditions]} owner]
   (render-state [_ state]
-    (html [:li.rule {:data-id (:id master-field)}
-             [:div.ruleTitle
-              [:i.icon-arrow-right]
-              [:a.field
-               {:on-click (fn [_]
-                            (let [{:keys [selector-channel]} (om/get-shared owner)]
-                              (put! selector-channel
-                                    {:selection-to-update :master-field
-                                     :new-value           master-field})))}
-               (:name master-field)]]
-             [:ul.unstyled
-              (om/build-all condition-detail conditions)]])))
+    (html
+      [:li.rule {:data-id (:id master-field)}
+       [:div.ruleTitle
+        [:i.icon-arrow-right]
+        [:a.field
+         {:on-click (fn [_]
+                      (let [{:keys [selector-channel]} (om/get-shared owner)]
+                        (put! selector-channel
+                              {:selection-to-update :master-field
+                               :new-value           master-field})))}
+         (:name master-field)]]
+       [:ul.unstyled
+        (om/build-all condition-detail conditions)]])))

@@ -81,7 +83,7 @@
         (let [grouped-conditions (group-by :master-field conditions)]
           (for [[master-field conditions] grouped-conditions]
             (om/build condition-group {:master-field master-field
-                                       :conditions conditions})))]])))
+                                       :conditions   conditions})))]])))

 (defn remove-condition


[n.activity] Refactor request-window-features!, enable state by default

--- src/clojure/neko/activity.clj
+++ src/clojure/neko/activity.clj
@@ -1,18 +1,12 @@
 (ns neko.activity
   "Utilities to aid in working with an activity."
-  {:author "Daniel Solano Gómez"}
   (:require neko.init
             [neko.ui :refer [make-ui]]
             [neko.debug :refer [all-activities]]
-            [neko.-utils :refer :all])
+            [neko.-utils :refer [keyword->static-field]])
   (:import android.app.Activity
-           android.view.View
+           [android.view View Window]
            android.app.Fragment))
-
-(defn activity?
-  "Determines whether the argument is an instance of Activity."
-  [x]
-  (instance? Activity x))

 (defn ^View get-decor-view
   "Returns the root view of the given activity."
@@ -26,7 +20,7 @@
   + A view object, which will be used directly
   + An integer presumed to be a valid layout ID."
   [^Activity activity, view]
-  {:pre [(activity? activity)]}
+  {:pre [(instance? Activity activity)]}
   (cond
    (instance? View view)
    (.setContentView activity ^View view)
@@ -41,24 +35,20 @@
                       ^View (neko.ui/make-ui-element activity view
                                                      {:id-holder dv})))))

-(defn request-window-features!
+(defmacro request-window-features!
   "Requests the given features for the activity. The features should be keywords
   such as :no-title or :indeterminate-progress corresponding FEATURE_NO_TITLE
   and FEATURE_INDETERMINATE_PROGRESS, respectively. Returns a sequence of
-  boolean values corresponding to each feature, where a true value indicates the
-  requested feature is supported and now enabled.
+  booleans whether for each feature that indicates if the feature is supported
+  and now enabled.

-  This function should be called before set-content-view!."
+  This macro should be called before set-content-view!."
   [^Activity activity & features]
-  {:pre  [(activity? activity)
-          (every? keyword? features)]}
-  (doseq [feat features]
-    (try (.requestWindowFeature activity
-                                (static-field-value android.view.Window feat
-                                                    #(str "FEATURE_" %)))
-         (catch NoSuchFieldException _
-           (throw (IllegalArgumentException.
-                   (format "‘%s’ is not a valid feature." feat)))))))
+  {:pre [(every? keyword? features)]}
+  `[~@(for [feat features]
+        `(.requestWindowFeature
+          ~activity ~(symbol (str (.getName Window) "/FEATURE_"
+                                  (keyword->static-field (name feat))))))])

 (defmacro *a [& args]
   `(neko.debug/*a ~@args))
@@ -71,8 +61,8 @@

   :extends, :prefix - same as for `gen-class`.

-  :def - symbol to bind the Activity object to in the onCreate
-  method. Relevant only if :create is used.
+  :features - window features to be requested for the activity.
+  Relevant only if :create is used.

   :on-create - takes a two-argument function. Generates a handler for
   activity's `onCreate` event which automatically calls the
@@ -85,11 +75,12 @@
   - same as :on-create but require a one-argument function."
   [name & {:keys [extends prefix on-create on-create-options-menu
                   on-options-item-selected on-activity-result
-                  on-new-intent def state key]
+                  on-new-intent def state key features]
            :as options}]
   (let [options (or options {}) ;; Handle no-options case
         sname (simple-name name)
-        prefix (or prefix (str sname "-"))]
+        prefix (or prefix (str sname "-"))
+        state (or state `(atom {}))]
     (when def
       (println "WARNING: :def attribute in defactivity is deprecated.
 Use (*a) to get the current activity."))
@@ -129,6 +120,8 @@
              ~(when key
                 `(.put all-activities ~key ~'this))
              (neko.init/init (.getApplicationContext ~'this))
+             ~(when features
+                `(request-window-features! ~'this ~@features))
              (~on-create ~'this ~'savedInstanceState)))
        ~(when on-create-options-menu
           `(defn ~(symbol (str prefix "onCreateOptionsMenu"))


Add raw to import-all

Add raw to import-all

--- src/clojure/neko/resource.clj
+++ src/clojure/neko/resource.clj
@@ -15,7 +15,7 @@
                                     symbol))
                       (catch ClassNotFoundException _# nil)))
               '[anim drawable color layout menu string array plurals style id
-                dimen])))
+                dimen raw])))

 (import-all)
 ;; ## Runtime resource resolution


[#756] Sanitize url in link data source

[#756] Sanitize url in link data source

--- backend/src/akvo/lumen/import/csv.clj
+++ backend/src/akvo/lumen/import/csv.clj
@@ -86,7 +86,10 @@
                "/resumed/"
                (last (string/split url #"\/"))
                "/file")
-          url))))
+          (let [url (io/as-url url)]
+            (when-not (#{"http" "https"} (.getProtocol url))
+              (throw (ex-info (str "Invalid url: " url) {:url url})))
+            url)))))

 (defmethod import/dataset-importer "CSV"
   [spec {:keys [file-upload-path]}]


Added many-constructor-params op to interactive mode

--- src/app/interactive.clj
+++ src/app/interactive.clj
@@ -13,16 +13,17 @@
 (def command-parser
   (insta/parser
    (str
-    "<COMMAND> = HELP | EXIT | LOAD | LIST | MC | F        \n"
-    "HELP = 'help' | 'h'                                   \n"
-    "EXIT = 'exit' | 'quit' | 'q'                          \n"
-    "LOAD = 'load' <WS> STR                                \n"
-    "LIST = 'list'                                         \n"
-    "MC  = ('mc'|'many-constructors') <WS> 'th' <WS> NUM   \n"
-    "F = ('f'|'finalizers')                                \n"
-    "WS  = #'[\t ]+'                                       \n"
-    "NUM = #'[0-9]+'                                       \n"
-    "STR = #'\"[^\"]*\"'                                   \n")))
+    "<COMMAND> = HELP | EXIT | LOAD | LIST | MC | MCP | F        \n"
+    "HELP = 'help' | 'h'                                         \n"
+    "EXIT = 'exit' | 'quit' | 'q'                                \n"
+    "LOAD = 'load' <WS> STR                                      \n"
+    "LIST = 'list'                                               \n"
+    "MC  = ('mc'|'many-constructors') <WS> 'th' <WS> NUM         \n"
+    "MCP = ('mcp'|'many-costructor-params') <WS> 'th' <WS> NUM   \n"
+    "F = ('f'|'finalizers')                                      \n"
+    "WS  = #'[\t ]+'                                             \n"
+    "NUM = #'[0-9]+'                                             \n"
+    "STR = #'\"[^\"]*\"'                                         \n")))

 (declare interactive)

@@ -41,12 +42,13 @@
     (interactive state)))

 (defn- help [state]
-  (println "h/help                      : print this help message")
-  (println "q/quit/exit                 : close the shell")
-  (println "list                        : list classes loaded")
-  (println "load DIR                    : load classes from DIR")
-  (println "mc/many-constructors th NUM : list classes with NUM or more constructors")
-  (println "f/finalizers                : list classes that use finalizers")
+  (println "h/help                             : print this help message")
+  (println "q/quit/exit                        : close the shell")
+  (println "list                               : list classes loaded")
+  (println "load DIR                           : load classes from DIR")
+  (println "mc/many-constructors th NUM        : list classes with NUM or more constructors")
+  (println "mcp/many-constructor-params th NUM : list constructors with NUM or more parameters")
+  (println "f/finalizers                       : list classes that use finalizers")
   (interactive state))

 (defn- load-classes [ast]
@@ -59,6 +61,10 @@

 (defn- mc-operation [state threshold]
   (printOperation classesWithManyConstructorsOp (:cus state) threshold)
+  (interactive state))
+
+(defn- mcp-operation [state threshold]
+  (printOperation constructorsWithManyParametersOp (:cus state) threshold)
   (interactive state))

 (defn- f-operation [state]
@@ -81,6 +87,8 @@
           :LOAD (load-classes ast)
           :MC (let [threshold (read-string (last (last (first ast))))]
                 (mc-operation state threshold))
+          :MCP (let [threshold (read-string (last (last (first ast))))]
+                 (mcp-operation state threshold))
           :F (f-operation state)
           (println "Command not implemented: " command))))))


remove old code

remove old code

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -123,11 +123,6 @@
        truncate-children
        max-total-depth))
     bolts))
-
-(defn find-comp-paths-in [bolt path]
-  (if (not (= (get-in bolt path :none) :none))
-    (cons (vec (concat (butlast path) [:comp]))
-          (find-comp-paths-in bolt (concat path [:head])))))

 (defn bolt-depth [bolt]
   (if-let [head (get-in bolt [:head] nil)]


add comments to function definitions

add comments to function definitions

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -42,12 +42,60 @@
 (defn generate
   "Return one expression matching spec _spec_ given the model _model_."
   [spec language-model]
+  ;;
+  ;; Return the tree of an expression, generated by the given model,
+  ;; that satisfies given spec:
+  ;;
+  ;; The tree will look like:
+  ;;
+  ;; Where H is the head of a certain node in the tree, and C
+  ;; is the complement. Terminal nodes are lexemes given by the model.
+  ;;
+  ;;       H
+  ;;      / \
+  ;;     H   C
+  ;;        / \
+  ;;       H   C
+  ;;
+  ;; A convenient wrapper around (defn gen) (below).
+
   (log/debug (str "(generate) with model named: " (:name language-model)))
   (first (gen spec language-model 0)))

 (defn gen
-  "Return a lazy sequence of every possible tree given a specification and a model."
+  "Return a lazy sequence of every possible expression given the spec and model,
+  each of whose depth is no greater than the given depth. Trees are returned in
+  ascending depth."
   [spec model depth & [from-bolts]]
+  ;;
+  ;; Given a spec and a model, return the (potentially infinite) set
+  ;; of all trees, in ascending depth, that satisfy the given spec.
+  ;;
+  ;;
+  ;; These trees look like:
+  ;;
+  ;;  First all the depth=0 trees (simply lexemes) that satisfy the spec:
+  ;;
+  ;;         H .. H ..
+
+  ;;   Then we have the trees of depth=1 that satisfy the spec:
+  ;;
+  ;;       H         H
+  ;;  ..  / \  ..   / \ ..
+  ;;     H   C     C   H
+  ;;
+  ;;   And then all trees of depth=2 that satisfy the spec:
+  ;;
+  ;;
+  ;;       H            H
+  ;;      / \          / \
+  ;;  .. H   C  ..    C   H ..
+  ;;    /            / \
+  ;;   H            C   H
+  ;;
+  ;; And so on.
+  ;;
+  ;;
   (log/trace (str "gen@" depth "; spec=" (show-spec spec)))
   (when (< depth max-depth)
     (let [bolts (or from-bolts
@@ -72,7 +120,11 @@
         (if (not (= false (get-in spec [:phrasal] true)))
           (gen spec model (+ 1 depth)))))))

-(defn get-bolts-for [model spec depth]
+(defn get-bolts-for
+  "Return every possible bolt for the given model and spec."
+  [model spec depth]
+  ;; Wrapper around (defn lightning-bolts) to provide a way to
+  ;; test indexing and memoization strategies.
   (let [result
         ;; TODO: this is an example of obtaining pre-computed bolts
         ;; from a model given a spec and a depth.
@@ -93,8 +145,10 @@
       true (lightning-bolts model spec 0 depth))))

 (defn lightning-bolts
+  "Return every possible bolt for the given model and spec. Start at the given depth and
+   keep generating until the given max-depth is reached."
   [model spec depth max-depth & [use-candidate-parents]]
-  ;; Generate 'lightning bolts':
+  ;; 'lightning bolts' look like:
   ;;
   ;;
   ;;   H        H    H


in (defn add-complement-to-bolt), (log/warn) rather than (exception) if you can’t generate a complement

It’s valid that expressions with a given specification can’t be
satisfied by any expression if the bolt is also supplying constraints
based on the parent phrase in the bolt. For example, we are generating
with spec1, and the complement parent phrase chosen randomly causes the
addition of spec s2 to the generation. unify(spec1,spec2) cannot be
generated, but there is another complement parent phrase  adding spec3,
where unify(spec1,spec2) can be generated.

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -164,19 +164,19 @@
                     (cond (and lexemes-before-phrases
                                (empty? filtered-lexical-complements)
                                (= false (get-in spec [:phrasal] true)))
-                          (exception (str "failed to generate any lexical complements with spec: "
-                                          (strip-refs spec)))
+                          (log/warn (str "failed to generate any lexical complements with spec: "
+                                         (strip-refs spec)))

                           (and lexemes-before-phrases
                                (= true (get-in spec [:phrasal] false))
                                (empty? phrasal-complements))
-                          (exception (str "failed to generate any phrasal complements with spec: "
-                                          (strip-refs spec)))
+                          (log/warn (str "failed to generate any phrasal complements with spec: "
+                                         (strip-refs spec)))

                           (and (empty? filtered-lexical-complements)
                                (empty? phrasal-complements))
-                          (exception (str "failed to generate either phrasal or lexical complements with spec: "
-                                          (strip-refs spec)))
+                          (log/warn (str "failed to generate both phrasal or lexical complements with spec: "
+                                         (strip-refs spec)))

                           lexemes-before-phrases
                           (lazy-cat (lazy-shuffle filtered-lexical-complements) phrasal-complements)


logging improvements

logging improvements

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -71,6 +71,8 @@
                 morph))))

 (defn generate-all [spec grammar lexicon index morph & [total-depth]]
+  (log/debug (str "generate-all: generating from spec: "
+                 (strip-refs spec)))
   (let [total-depth (if total-depth total-depth 0)
         add-complements-to-bolts
         (fn [bolts path]
@@ -97,7 +99,7 @@
             (add-complements-to-bolts [:comp]))]

     (if (not (empty? expressions))
-      (log/info (str "generate-all: first expression generated for spec:" (strip-refs spec) " ):"
+      (log/debug (str "generate-all: first expression generated for spec:" (strip-refs spec) " ):"
                      "'" (morph (first expressions)) "'"))
       (log/debug (str "generate-all: no expressions could be generated for spec:" (strip-refs expressions))))
     expressions))


+infinitives, nominative-pronouns

+infinitives, nominative-pronouns

--- src/babel/italiano.cljc
+++ src/babel/italiano.cljc
@@ -11,6 +11,24 @@
    [dag_unify.core :refer (get-in strip-refs)]))

 (def lexicon (:lexicon medium))
+(def infinitives
+  (filter (fn [k]
+            (let [vals (get lexicon k)]
+              (some (fn [val]
+                      (and (= (get-in val [:synsem :cat]) :verb)
+                           (= (get-in val [:synsem :infl]) :top)))
+                    vals)))
+          (keys lexicon)))
+
+(def nominative-pronouns
+  (filter (fn [k]
+            (let [vals (get lexicon k)]
+              (some (fn [val]
+                      (and (= (get-in val [:synsem :cat]) :noun)
+                           (= (get-in val [:synsem :pronoun]) true)
+                           (= (get-in val [:synsem :case]) :nom)))
+                    vals)))
+          (keys lexicon)))

 (defn analyze
   ([surface-form]


Remove dead code.

Remove dead code.

--- src/onyx/scheduling/common_task_scheduler.clj
+++ src/onyx/scheduling/common_task_scheduler.clj
@@ -45,13 +45,3 @@
 (defmethod assign-capacity-constraint? :default
   [replica job-id]
   true)
-
-(defmethod choose-downstream-peers :default
-  [replica job-id peer-config this-peer downstream-peers]
-  (fn [hash-group]
-    (rand-nth downstream-peers)))
-
-(defmethod choose-acker :default
-  [replica job-id peer-config this-peer candidates]
-  (fn []
-    (rand-nth candidates)))


Remove lens namespace.

Remove lens namespace.

--- src/cats/labs/lens.cljc
+++ src/cats/labs/lens.cljc
@@ -1,242 +0,0 @@
-(ns cats.labs.lens
-  (:require
-   [cats.util :as util]
-   [cats.protocols :as p])
-  (:refer-clojure :exclude [nth key keys vals filter select-keys cat]))
-
-;; constructors
-
-(defn lens
-  "Given a function for getting the focused value from a state (getter)
-  and a function that takes the state and and update function (setter),
-  constructs a lens."
-  [getter setter]
-  (fn [next]
-    (fn
-      ([s]
-        (next (getter s)))
-      ([s f]
-        (setter s #(next % f))))))
-
-;; base lenses
-
-(defn id-setter
-  "The identity setter, applies the function to the state."
-  [s f]
-  (f s))
-
-(defn const-setter
-  "The constant setter, returns the state unaltered."
-  [s _]
-  s)
-
-(def id
-  "Identity lens."
-  (lens identity id-setter))
-
-;; API
-
-(defn focus
-  "Given a lens and a state, return the value focused by the lens."
-  [lens s]
-  (let [getter (lens identity)]
-    (getter s)))
-
-(defn over
-  "Given a setter, a function and a state, apply the function over
-  the value focused by the setter."
-  [st f s]
-  (let [setter (st id-setter)]
-    (setter s f)))
-
-(defn put
-  "Given a setter, a new value and a state, replace the value focused by
-  the lens with the new one."
-  [st v s]
-  (over st (constantly v) s))
-
-;; combinators
-
-(defn units
-  "Given a function from unit A to unit B and another in the
-  opposite direction, construct a lens that focuses and updates
-  a converted value."
-  [one->other other->one]
-  (lens
-   one->other
-   (fn [s f]
-     (other->one (f (one->other s))))))
-
-;; lenses
-
-(defn passes
-  "Given a predicate, return a lens that focuses in an element only
-  if passes the predicate.
-
-  The lens is not well-behaved, depens on the outcome of the predicate."
-  [applies?]
-  (lens
-   (fn [s]
-     (when (applies? s)
-       s))
-   (fn [s f]
-     (if (applies? s)
-       (f s)
-       s))))
-
-(defn nth
-  "Given a number, returns a lens that focuses on the given index of
-  a collection."
-  [n]
-  (lens
-    (fn [s]
-      (clojure.core/nth s n))
-    (fn [s f]
-      (update s n f))))
-
-(def fst (nth 0))
-(def snd (nth 1))
-
-(defn sequential-empty
-  {:internal true
-   :no-doc true}
-  [coll]
-  (cond
-    (map? coll) {}
-    (set? coll) #{}
-    :else []))
-
-(def tail
-  "A lens into the tail of a collection."
-  (lens
-   rest
-   (fn [s f]
-     (into (sequential-empty s)
-           (cons (first s)
-                 (f (rest s)))))))
-
-(defn key
-  "Given a key, returns a lens that focuses on the given key of
-  an associative data structure."
-  [k]
-  (lens
-   (fn [s]
-     (get s k))
-   (fn [s f]
-     (update s k f))))
-
-(defn select-keys
-  "Return a lens focused on the given keys in an associative data
-  structure."
-  [ks]
-  (lens
-   (fn [s]
-     (clojure.core/select-keys s ks))
-   (fn [s f]
-     (merge (apply dissoc s ks)
-            (-> (clojure.core/select-keys s ks)
-                f
-                (clojure.core/select-keys ks))))))
-
-(defn in
-  "Given a path and optionally a default value, return a lens that
-  focuses the given path in an associative data structure."
-  ([path]
-   (in path nil))
-  ([path default]
-   (lens
-    (fn [s]
-      (get-in s path default))
-    (fn [s f]
-      (update-in s path f)))))
-
-;; interop
-
-(defn prefix-key
-  {:internal true
-   :no-doc true}
-  [key id]
-  (keyword (str id "-" (name key))))
-
-(deftype Focus [id lens a]
-  p/Printable
-  (-repr [m]
-    (str "#<Focus [" (pr-str lens) "," (pr-str a) "]>"))
-
-  #?@(:clj
-      [clojure.lang.IDeref
-       (deref [_] (focus lens @a))
-
-       clojure.lang.IAtom
-       (reset [self newval]
-         (swap! a #(put lens newval %))
-         (deref self))
-       (swap [self f]
-         (swap! a (fn [s] (over lens f s)))
-         (deref self))
-       (swap [self f x]
-         (swap! a (fn [s] (over lens #(f % x) s)))
-         (deref self))
-       (swap [self f x y]
-         (swap! a (fn [s] (over lens #(f % x y) s)))
-         (deref self))
-       (swap [self f x y more]
-         (swap! a (fn [s] (over lens #(apply f % x y more) s)))
-         (deref self))
-
-       clojure.lang.IRef
-       (addWatch [self key cb]
-         (let [key (prefix-key key id)]
-           (add-watch a key (fn [key _ oldval newval]
-                              (let [old' (focus lens oldval)
-                                    new' (focus lens newval)]
-                                (if (not= old' new')
-                                  (cb key self old' new')))))))
-       (removeWatch [_ key]
-         (let [key (prefix-key key id)]
-           (remove-watch a key)))]
-
-      :cljs
-      [IDeref
-       (-deref [_] (focus lens @a))
-
-       IWatchable
-       (-add-watch [self key cb]
-         (let [key (prefix-key key id)]
-           (add-watch a key (fn [key _ oldval newval]
-                              (let [old' (focus lens oldval)
-                                    new' (focus lens newval)]
-                                (if (not= old' new')
-                                  (cb key self old' new')))))))
-       (-remove-watch [_ key]
-         (let [key (prefix-key key id)]
-           (remove-watch a key)))
-
-       IReset
-       (-reset! [self newval]
-         (swap! a #(put lens newval %))
-         (deref self))
-
-       ISwap
-       (-swap! [self f]
-        (swap! a (fn [s] (over lens f s)))
-        (deref self))
-
-       (-swap! [self f x]
-         (swap! a (fn [s] (over lens #(f % x) s)))
-         (deref self))
-
-       (-swap! [self f x y]
-         (swap! a (fn [s] (over lens #(f % x y) s)))
-         (deref self))
-
-       (-swap! [self f x y more]
-         (swap! a (fn [s] (over lens #(apply f % x y more) s)))
-         (deref self))]))
-
-(defn focus-atom
-  [lens a]
-  (let [id (str (gensym "cats-lens"))]
-    (Focus. id lens a)))
-
-(util/make-printable Focus)


(SERVER-1187) Update results map elements in execute-autosign-command!

When the autosign code was updated to use shell-utils, the results map
in execute-autosign-command! was not updated to the execution results
map. This commit updates the keys for exit-code, stderr and stdout so
that they will be non-nil.

--- src/clj/puppetlabs/puppetserver/certificate_authority.clj
+++ src/clj/puppetlabs/puppetserver/certificate_authority.clj
@@ -804,9 +804,9 @@
                   :in csr-stream
                   :env (merge env {"RUBYLIB" rubylib})})]
     (log/debugf "Autosign command '%s %s' exit status: %d"
-                executable subject (:exit results))
+                executable subject (:exit-code results))
     (log/debugf "Autosign command '%s %s' output: %s"
-                executable subject (str (:err results) (:out results)))
+                executable subject (str (:stderr results) (:stdout results)))
     results))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


Solving 3.7, 3.8 and 3.9

Solving 3.7, 3.8 and 3.9

--- src/fpinscala/datastructures.clj
+++ src/fpinscala/datastructures.clj
@@ -61,7 +61,44 @@
   (loop [[h & t] xs]
     (if (not t)
       nil
-      (cons h (init t)))))
+      (cons h (init-fpins t)))))
 ;note that in answers - it is mentioned that there is another common
-;convention to do reversing - just like I did :)ooo
+;convention to do reversing - just like I did :)
+;-----------------------------------------------------------------------
+
+; fold-right as it is in fpins book (page 39)
+;it could be altered to use clojure's loop-recur but let it be like this
+(defn fold-right [as z f]
+  (let [[x & xs :as orig] as]
+    (if (nil? orig)
+      z
+      (f x (fold-right xs z f)))))
+
+;couple of more from fpins (page 39)
+(defn sum2 [xs]
+  (fold-right xs 0 #(+ % %2)))
+
+(defn product2 [xs]
+  (fold-right xs 1 #(* % %2)))
+
+;3.7 - I think not because of stack... how to skip over stack entries before
+;we spot 0.0?
+;-----------------------------------------------------------------------
+
+;3.8 - it yields equivalent list as input
+;check out for thorough explanation in exercises answers of fpins
+;-----------------------------------------------------------------------
+
+;3.9
+;mine
+(defn length [xs]
+  (fold-right xs 0 (fn [_ x] (+ x 1))))
+;fpins
+;conceptually - same :)
+;-----------------------------------------------------------------------
+
+;3.10
+;mine
+
+;
 ;-----------------------------------------------------------------------


start work on rhs deletion

start work on rhs deletion

--- dada2-core/src/test/clojure/org/dada2/test_join_model.clj
+++ dada2-core/src/test/clojure/org/dada2/test_join_model.clj
@@ -92,14 +92,16 @@

 (defn- rhs-dissoc [indeces i rhs-pk-key fk rhs]
   "dissociate an rhs from existing index"
-  (update-in indeces [i fk (rhs-pk-key rhs)] (fn [_] nil)))
+  (let [rhs-pk (rhs-pk-key rhs)]
+    (assoc-in indeces [i fk] (dissoc ((indeces i) fk) rhs-pk)))
+  )

 (deftest test-rhs-access
   (let [before [[] {}]
 	after  [[] {String {3 "xxx"}}]]
     (is (= after (rhs-assoc before 1 count String "xxx")))
     (is (= '(("xxx")) (rhses-get (rest after) [first] [String])))
-    (is (= [[] {String {3 nil}}] (rhs-dissoc after 1 count String "xxx")))))
+    (is (= [[] {String {}}] (rhs-dissoc after 1 count String "xxx")))))

 ;;--------------------------------------------------------------------------------
 ;; this layer encapsulates access to both lhs and rhs at the same time...
@@ -377,7 +379,7 @@
     ;; join - delete rhs - b2
     (on-delete bs b2)
     (is (= [[{:b {:a1 a1v1}}{:c {:a1 a1v1}}]
-	    {:b {:b1 b1v1 :b2 nil}} {:c {:c1 c1v1 :c2 c2}}] (data join)))
+	    {:b {:b1 b1v1}} {:c {:c1 c1v1 :c2 c2}}] (data join)))
     (is (= {
 	   [:a1 :b1 :c1] (->ABC [:a1 :b1 :c1] [1 1 1] "b1v1-data" "c1v1-data")
 	   [:a1 :b1 :c2] (->ABC [:a1 :b1 :c2] [1 1 0] "b1v1-data" "c2-data")
@@ -387,7 +389,7 @@
     ;; join - delete rhs - c2
     (on-delete cs c2)
     (is (= [[{:b {:a1 a1v1}}{:c {:a1 a1v1}}]
-	    {:b {:b1 b1v1 :b2 nil}} {:c {:c1 c1v1 :c2 nil}}] (data join)))
+	    {:b {:b1 b1v1}} {:c {:c1 c1v1}}] (data join)))
     (is (= {
 	   [:a1 :b1 :c1] (->ABC [:a1 :b1 :c1] [1 1 1] "b1v1-data" "c1v1-data")
 	   }


figwheel.main: add open-url to strict keys def of config

also add a load time verification that we are covering the know keys

--- figwheel-main/src/figwheel/main/schema/config.clj
+++ figwheel-main/src/figwheel/main/schema/config.clj
@@ -3,43 +3,11 @@
    [clojure.java.io :as io]
    [clojure.string :as string]
    [clojure.spec.alpha :as s]
+   [clojure.set]
    [figwheel.main.schema.core :refer [def-spec-meta non-blank-string? directory-exists?]]
    [expound.alpha :as exp]
    [spell-spec.alpha :as spell]
    [spell-spec.expound]))
-
-(s/def ::edn (spell/strict-keys :opt-un
-                     [::watch-dirs
-                      ::css-dirs
-                      ::ring-handler
-                      ::ring-server-options
-                      ::rebel-readline
-                      ::pprint-config
-                      ::open-file-command
-                      ::figwheel-core
-                      ::hot-reload-cljs
-                      ::connect-url
-                      ::reload-clj-files
-                      ::log-file
-                      ::log-level
-                      ::log-syntax-error-style
-                      ::load-warninged-code
-                      ::ansi-color-output
-                      ::validate-config
-                      ::target-dir
-
-                      ::launch-node
-                      ::inspect-node
-                      ::node-command
-
-                      ::client-print-to
-                      ::ring-stack
-                      ::ring-stack-options
-                      ::watch-time-ms
-                      ::mode
-                      ::ring-server
-                      ::broadcast
-                      ::broadcast-reload]))

 (s/def ::watch-dirs (s/coll-of (s/and non-blank-string?
                                       directory-exists?)))
@@ -297,6 +265,15 @@
     :validate-config false"
   :group :common)

+(s/def ::validate-cli boolean?)
+(def-spec-meta ::validate-cli
+  :doc
+ "Whether to validate the figwheel-main command line options
+Default: true
+
+    :validate-cli false"
+  :group :common)
+
 (s/def ::target-dir non-blank-string?)
 (def-spec-meta ::target-dir
   :doc
@@ -444,3 +421,50 @@

     :broadcast true"
   :group :un-common)
+
+;; helper to validate that all keys are registered
+(defmacro all-keys-registered [key-spec]
+  (let [spec-keys (set (cons ::edn (mapcat second (partition 2 (rest key-spec)))))
+        reg-keys  (set (filter #(= "figwheel.main.schema.config" (namespace %))
+                               (keys (s/registry))))
+        missing-keys (clojure.set/difference reg-keys spec-keys)]
+    (assert (empty? missing-keys) (str "missing keys " (pr-str missing-keys))))
+  key-spec)
+
+(s/def ::edn
+  (all-keys-registered
+   (spell/strict-keys
+    :opt-un
+    [::watch-dirs
+     ::css-dirs
+     ::ring-handler
+     ::ring-server-options
+     ::rebel-readline
+     ::pprint-config
+     ::open-file-command
+     ::figwheel-core
+     ::hot-reload-cljs
+     ::connect-url
+     ::open-url
+     ::reload-clj-files
+     ::log-file
+     ::log-level
+     ::log-syntax-error-style
+     ::load-warninged-code
+     ::ansi-color-output
+     ::validate-config
+     ::validate-cli
+     ::target-dir
+
+     ::launch-node
+     ::inspect-node
+     ::node-command
+
+     ::client-print-to
+     ::ring-stack
+     ::ring-stack-options
+     ::wait-time-ms
+     ::mode
+     ::ring-server
+     ::broadcast
+     ::broadcast-reload])))


C.t.n refresh fix

C.t.n refresh fix

--- src/clj/saapas/main.clj
+++ src/clj/saapas/main.clj
@@ -1,9 +1,20 @@
 (ns saapas.main
   (:require
-    [clojure.tools.namespace.repl :as ns-tools])
+    [clojure.tools.namespace.repl :as ns-tools]
+    [clojure.java.io :as io])
   (:gen-class))

 (ns-tools/disable-reload!)
+
+(let [reload-dirs (->> (or (try
+                             (require 'boot.core)
+                             ((resolve 'boot.core/get-env) :directories)
+                             (catch Exception _
+                               nil))
+                           (do (require 'clojure.tools.namespace.dir)
+                               ((resolve 'clojure.tools.namespace.dir/dirs-on-classpath))))
+                       (remove #(.exists (io/file % ".no-reload"))))]
+  (apply ns-tools/set-refresh-dirs reload-dirs))

 (defonce system (atom nil))


Removed an unnecessary writer

Removed an unnecessary writer

--- src/cljam/tools/cli.clj
+++ src/cljam/tools/cli.clj
@@ -220,8 +220,7 @@

 (defn- depth
   [f region n-threads]
-  (with-open [r (sam/reader f)
-              w (cio/writer *out*)]
+  (with-open [r (sam/reader f)]
     (when-not (sam/indexed? r)
       (exit 1 "Random alignment retrieval only works for indexed BAM."))
     (when-not (sorter/sorted? r)


Fixed some typos

Fixed some typos

--- src/cljc/quil/core.cljc
+++ src/cljc/quil/core.cljc
@@ -1763,7 +1763,7 @@
      frustum
      "Sets a perspective matrix defined through the parameters. Works
   like glFrustum, except it wipes out the current perspective matrix
-  rather than muliplying itself with it.
+  rather than multiplying itself with it.
   https://en.wikipedia.org/wiki/Frustum"
      [left right bottom top near far]
      (.frustum (current-graphics) (float left) (float right) (float bottom) (float top)
@@ -2188,7 +2188,7 @@
      light-specular
      "Sets the specular color for lights. Like fill, it affects only the
   elements which are created after it in the code. Specular refers to
-  light which bounces off a surface in a perferred direction (rather
+  light which bounces off a surface in a preferred direction (rather
   than bouncing in all directions like a diffuse light) and is used
   for creating highlights. The specular quality of a light interacts
   with the specular material qualities set through the specular and
@@ -2840,7 +2840,7 @@
   stack. Understanding pushing and popping requires understanding the
   concept of a matrix stack. The push-matrix fn saves the current
   coordinate system to the stack and pop-matrix restores the prior
-  coordinate system. push-matrix and pop-matrix are used in conjuction
+  coordinate system. push-matrix and pop-matrix are used in conjunction
   with the other transformation methods and may be embedded to control
   the scope of the transformations."
   []
@@ -2929,7 +2929,7 @@
   understanding the concept of a matrix stack. The push-matrix
   function saves the current coordinate system to the stack and
   pop-matrix restores the prior coordinate system. push-matrix and
-  pop-matrix are used in conjuction with the other transformation
+  pop-matrix are used in conjunction with the other transformation
   methods and may be embedded to control the scope of the
   transformations."
   []
@@ -3442,8 +3442,8 @@
     :added "1.0"}
   save-frame
   "Saves an image identical to the current display window as a
-  file. May be called multple times - each file saved will have a
-  unique name. Name and image formate may be modified by passing a
+  file. May be called multiple times - each file saved will have a
+  unique name. Name and image format may be modified by passing a
   string parameter of the form \"foo-####.ext\" where foo- can be any
   arbitrary string, #### will be replaced with the current frame id
   and .ext is one of .tiff, .targa, .png, .jpeg or .jpg
@@ -3470,7 +3470,7 @@
   multiply the effect. For example, calling (scale 2) and then
   (scale 1.5) is the same as (scale 3). If scale is called within
   draw, the transformation is reset when the loop begins again. Using
-  this fuction with the z parameter requires specfying :p3d or :opengl
+  this function with the z parameter requires specifying :p3d or :opengl
   as the renderer. This function can be further controlled by
   push-matrix and pop-matrix."
   ([s] (.scale (current-graphics) (float s)))
@@ -3567,7 +3567,7 @@
        :added "2.0"}
      shader
      "Applies the shader specified by the parameters. It's compatible with the :p2d
-  and :p3drenderers, but not with the default :java2d renderer. Optional 'kind'
+  and :p3d renderers, but not with the default :java2d renderer. Optional 'kind'
   parameter - type of shader, either :points, :lines, or :triangles"
      ([shader] (.shader (current-graphics) shader))
      ([shader kind]
@@ -3777,7 +3777,7 @@
   called again with a new parameter and so should not be called prior
   to every sphere statement, unless you wish to render spheres with
   different settings, e.g. using less detail for smaller spheres or
-  ones further away from the camera. To controla the detail of the
+  ones further away from the camera. To control the detail of the
   horizontal and vertical resolution independently, use the version of
   the functions with two parameters."
   ([res] (.sphereDetail (current-graphics) (int res)))


Add support of Environment section.

Add support of Environment section.

--- src/cljx/quil/core.cljx
+++ src/cljx/quil/core.cljx
@@ -1725,7 +1725,6 @@
   #+clj (PApplet/floor (float n))
   #+cljs (.floor (current-applet) n))

-#+clj
 (defn
   ^{:requires-bindings true
     :processing-name "focused"
@@ -1747,7 +1746,8 @@
   displayed since the program started. Inside setup() the value is 0
   and and after the first iteration of draw it is 1, etc."
   []
-  (.frameCount (current-applet)))
+  #+clj (.frameCount (current-applet))
+  #+cljs (.-frameCount (current-applet)))

 (defn
   ^{:requires-bindings true
@@ -1758,7 +1758,8 @@
   current-frame-rate
   "Returns the current framerate"
   []
-  (.frameRate (current-applet)))
+  #+clj (.frameRate (current-applet))
+  #+cljs (.-frameRate (current-applet)))

 (defn
   ^{:requires-bindings true
@@ -1857,7 +1858,7 @@
   size is called."
   []
   #+clj (.getHeight (current-applet))
-  #+cljs (.-height (current-graphics)))
+  #+cljs (.-height (current-applet)))

 #+clj
 (defn
@@ -4396,7 +4397,7 @@
   called."
   []
   #+clj (.getWidth (current-applet))
-  #+cljs (.-width (current-graphics)))
+  #+cljs (.-width (current-applet)))

 #+clj
 (defmacro


Add an :arg-resolvers option to fns involved in producing namespace handlers

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -221,56 +221,59 @@
   middleware-spec is the literal form specifying the middleware in the
   dispatch table; a route-spec* is a route-spec with keywords replaced
   by symbols in the pathvec."
-  [dispatch-table]
-  (loop [routes     {}
-         handlers   {}
-         middleware {}
-         entries    (seq (unnest-dispatch-table dispatch-table))]
-    (if-let [[method pathvec verb-fn-sym mw-spec] (first entries)]
-      (let [handler-sym (gensym "handler_sym__")
-            routes      (assoc routes
-                          [method (keywords->symbols pathvec)] handler-sym)
-            [middleware mw-sym]
-            (if (contains? middleware mw-spec)
-              [middleware (get middleware mw-spec)]
-              (let [mw-sym (gensym "mw_sym__")]
-                [(assoc middleware mw-spec mw-sym) mw-sym]))
-            ns               (-> verb-fn-sym namespace symbol the-ns)
-            ns-metadata      (meta ns)
-            metadata         (merge (reduce-kv (fn [out k v]
-                                                 (assoc out
-                                                   k (if (symbol? v)
-                                                       @(ns-resolve ns v)
-                                                       v)))
-                                      {}
-                                      (dissoc ns-metadata :doc))
-                               (meta (resolve verb-fn-sym)))
-            sync?            (:sync metadata)
-            route-params     (mapv (comp symbol name)
-                               (filter keyword? pathvec))
-            context          (:context (meta pathvec))
-            arglist          (first (:arglists metadata))
-            non-route-params (remove (set route-params) arglist)
-            arg-resolvers    (binding [*ns* ns]
-                               (eval (:arg-resolvers metadata)))
-            schema           (:schema metadata)
-            handler (cond->
-                      {:middleware-sym   mw-sym
-                       :route-params     route-params
-                       :non-route-params non-route-params
-                       :verb-fn-sym      verb-fn-sym
-                       :arglist          arglist
-                       :arg-resolvers    arg-resolvers
-                       :schema           schema
-                       :sync?            sync?
-                       :metadata         metadata}
-                      context
-                      (assoc :context (string/join "/" (cons "" context))))
-            handlers (assoc handlers handler-sym handler)]
-        (recur routes handlers middleware (next entries)))
-      {:routes     (sorted-routes routes)
-       :handlers   handlers
-       :middleware (set/map-invert middleware)})))
+  [dispatch-table options]
+  (let [extra-arg-resolvers (:arg-resolvers options)]
+    (loop [routes     {}
+           handlers   {}
+           middleware {}
+           entries    (seq (unnest-dispatch-table dispatch-table))]
+      (if-let [[method pathvec verb-fn-sym mw-spec] (first entries)]
+        (let [handler-sym (gensym "handler_sym__")
+              routes      (assoc routes
+                            [method (keywords->symbols pathvec)] handler-sym)
+              [middleware mw-sym]
+              (if (contains? middleware mw-spec)
+                [middleware (get middleware mw-spec)]
+                (let [mw-sym (gensym "mw_sym__")]
+                  [(assoc middleware mw-spec mw-sym) mw-sym]))
+              ns               (-> verb-fn-sym namespace symbol the-ns)
+              ns-metadata      (meta ns)
+              metadata         (merge (reduce-kv (fn [out k v]
+                                                   (assoc out
+                                                     k (if (symbol? v)
+                                                         @(ns-resolve ns v)
+                                                         v)))
+                                        {}
+                                        (dissoc ns-metadata :doc))
+                                 (meta (resolve verb-fn-sym)))
+              sync?            (:sync metadata)
+              route-params     (mapv (comp symbol name)
+                                 (filter keyword? pathvec))
+              context          (:context (meta pathvec))
+              arglist          (first (:arglists metadata))
+              non-route-params (remove (set route-params) arglist)
+              arg-resolvers    (merge
+                                 extra-arg-resolvers
+                                 (binding [*ns* ns]
+                                   (eval (:arg-resolvers metadata))))
+              schema           (:schema metadata)
+              handler (cond->
+                        {:middleware-sym   mw-sym
+                         :route-params     route-params
+                         :non-route-params non-route-params
+                         :verb-fn-sym      verb-fn-sym
+                         :arglist          arglist
+                         :arg-resolvers    arg-resolvers
+                         :schema           schema
+                         :sync?            sync?
+                         :metadata         metadata}
+                        context
+                        (assoc :context (string/join "/" (cons "" context))))
+              handlers (assoc handlers handler-sym handler)]
+          (recur routes handlers middleware (next entries)))
+        {:routes     (sorted-routes routes)
+         :handlers   handlers
+         :middleware (set/map-invert middleware)}))))

 (defn- map-traversal-dispatcher
   "Returns a Ring handler using the given dispatch-map to guide
@@ -508,9 +511,9 @@
   ([options dispatch-table]
      (let [options       (merge dispatch-table-compilation-defaults options)
            build-handler (:build-handler-fn options)
-           analysed-dispatch-table (analyse-dispatch-table dispatch-table)]
-       (build-handler analysed-dispatch-table
-         (select-keys options [:async?])))))
+           analysed-dispatch-table (analyse-dispatch-table
+                                     dispatch-table options)]
+       (build-handler analysed-dispatch-table options))))

 (defn- simple-namespace-dispatch-table
   "Examines the given namespace and produces a dispatch table in a


cleanup copy/paste mess in layout

cleanup copy/paste mess in layout

--- src/foosball/views/layout.clj
+++ src/foosball/views/layout.clj
@@ -28,12 +28,6 @@
                                                                      (when playername (str " " playername)))))])
     [:p.navbar-text "Version " (:version project)]]])

-
-(def ^:private default-cljs-ns "foosball.browser.")
-
-(defn auto-refresh-page []
-  )
-
 (defn footer [auto-refresh?]
   (list
    [:script {:type "text/javascript"} "goog.require(\"foosball.browser\");"]


fix test wording

fix test wording

--- test/cljs/love_letter_cljs/handlers_test.cljs
+++ test/cljs/love_letter_cljs/handlers_test.cljs
@@ -134,11 +134,12 @@
     (is (= [1 3 4] (sut/player-list test-game-a)))))

 (deftest next-in-list-test
-  (testing "retrieves the next id in the list"
+  (testing "retrieves the next item in the list"
     (is (= 3 (sut/next-in-list [1 2 3 4] 2))))
-  (testing "retrieves the first item if current id is the last element"
+  (testing "retrieves the first item if current item is the last element"
     (is (= 1 (sut/next-in-list [1 2 3 4] 4))))
-  (testing "gets next greatest element if current element is missing"
+  (testing "gets next greatest item if current item is missing"
     (is (= 4 (sut/next-in-list [1 2 4] 3))))
   (testing "gets first element if current element is greatest and missing"
     (is (= 1 (sut/next-in-list [1 2 3] 4)))))
+


regex improvement for autosuggestions

regex improvement for autosuggestions

--- iwaswhere-web/src/cljs/iwaswhere_web/ui/edit.cljs
+++ iwaswhere-web/src/cljs/iwaswhere_web/ui/edit.cljs
@@ -42,7 +42,7 @@
 (defn autocomplete-tags
   "Render autocomplete option for the partial tag (or mention) before the cursor."
   [before-cursor regex-prefix tags]
-  (let [current-tag (re-find (js/RegExp. (str regex-prefix h/tag-char-class "+$") "m") before-cursor)
+  (let [current-tag (re-find (js/RegExp. (str regex-prefix h/tag-char-class "+$") "") before-cursor)
         current-tag-regex (js/RegExp. current-tag "i")
         tag-substr-filter (fn [tag] (when current-tag (re-find current-tag-regex tag)))
         f-tags (filter tag-substr-filter tags)]


break in case of error

break in case of error

--- uberjar/src/dda/pallet/dda_managed_vm/main.clj
+++ uberjar/src/dda/pallet/dda_managed_vm/main.clj
@@ -20,6 +20,7 @@
   (:require
     [clojure.string :as str]
     [clojure.tools.cli :as cli]
+    [dda.config.commons.styled-output :as styled]
     [dda.pallet.core.app :as core-app]
     [dda.pallet.dda-managed-vm.app :as app]))

@@ -53,21 +54,33 @@
   (println msg)
   (System/exit status))

+(defn success []
+  (exit 0 "Successfull executed"))
+
+(defn error []
+  (exit 2 "ERROR"))
+
 (defn -main [& args]
   (let [{:keys [options arguments errors summary help]} (cli/parse-opts args cli-options)]
     (cond
       help (exit 0 (usage summary))
       errors (exit 1 (error-msg errors))
       (not= (count arguments) 1) (exit 1 (usage summary))
-      (:serverspec options) (core-app/existing-serverspec
-                              app/crate-app
-                              {:domain (first arguments)
-                               :targets (:targets options)})
-      (:configure options) (core-app/existing-configure
-                             app/crate-app
-                             {:domain (first arguments)
-                              :targets (:targets options)})
-      :default (core-app/existing-install
-                 app/crate-app
-                 {:domain (first arguments)
-                  :targets (:targets options)}))))
+      (:serverspec options) (if (core-app/existing-serverspec
+                                  app/crate-app
+                                  {:domain (first arguments)
+                                   :targets (:targets options)})
+                              (exit 0 (styled/styled "ALL TESTS PASSED" :green))
+                              (exit 2 (styled/styled "SOME TESTS FAILED" :red)))
+      (:configure options) (if (core-app/existing-configure
+                                 app/crate-app
+                                 {:domain (first arguments)
+                                  :targets (:targets options)})
+                               (success)
+                               (error))
+      :default (if (core-app/existing-install
+                     app/crate-app
+                     {:domain (first arguments)
+                      :targets (:targets options)})
+                 (success)
+                 (error)))))


Upgrade karma to 4.3.0

Upgrade karma to 4.3.0


Upgrade shadow-cljs to 2.8.110

Upgrade shadow-cljs to 2.8.110

--- src/deps.cljs
+++ src/deps.cljs
@@ -1,4 +1,4 @@
-{:npm-dev-deps {"shadow-cljs"           "2.8.109"
+{:npm-dev-deps {"shadow-cljs"           "2.8.110"
                 "karma"                 "4.4.1"
                 "karma-chrome-launcher" "3.1.0"
                 "karma-cljs-test"       "0.1.0"


allow for printing entire stack

allow for printing entire stack

--- util/clojure-cli/src/commcare_cli/app_host.clj
+++ util/clojure-cli/src/commcare_cli/app_host.clj
@@ -28,7 +28,8 @@
     ":home - Navigate to the home menu of the app"
     ":lang <lang> - change the language to <lang> (e.g. :lang en)"
     ":today <date> - change the date returned by today()/now() (e.g. :today 2015-07-25). ':today' resets to today's date"
-    ":stack - Show the current session frame stack"
+    ":stack - Show the stack of session frames"
+    ":frame - Show the current session frame"
     ":help - Show this message"))

 (defn build-restore-user-sandbox [prototype-factory restore-file]
@@ -81,19 +82,34 @@
         (recur session))
       :else (throw (RuntimeException. "Unexpected frame request")))))

-(defn print-stack [session]
+(defn print-frame-inner [steps]
+  (doall
+    (map
+      (fn [step] (if (= (.getType step) SessionFrame/STATE_COMMAND_ID)
+                   (println "COMMAND: " (.getId step))
+                   (println "DATUM: " (.getId step) " - " (.getValue step))))
+      steps)))
+
+(defn print-frame [session]
   (let
     [frame (.getFrame session)
      steps (.getSteps frame)]
+    (print-frame-inner steps)))
+
+(defn print-stack [session]
+  (let
+    [frame-stack (.getFrameStack session)]
+    (println "------- current frame -------")
+    (print-frame session)
+    (println "-----------------------------")
     (doall
-      (map
-        (fn [step] (if (= (.getType step) SessionFrame/STATE_COMMAND_ID)
-                     (println "COMMAND: " (.getId step))
-                     (println "DATUM: " (.getId step) " - " (.getValue step))))
-        steps))))
+      (map (fn [frame] (println "-------")
+             (print-frame-inner (.getSteps frame))
+             (println "-------")))
+      frame-stack)))

 ;; String -> BuildType
-;; where BuildType is one of
+;; where BuildType is one of
 ;; - :save, latest saved version of app
 ;; - :build, latest built version of app
 ;; - :release, latests starred version of app
@@ -138,6 +154,9 @@
         (= command ":stack")
         (do (print-stack session)
             :stay)
+        (= command ":frame")
+        (do (print-frame session)
+            :stay)
         (= command ":lang")
         (do (set-locale arg)
             :stay)
@@ -177,7 +196,7 @@
   (try
     (let [stream (ByteArrayInputStream. form-instance)]
       (.parse (DataModelPullParser. stream (CommCareTransactionParserFactory. sandbox) true true)))
-    (catch Exception e (doall
+    (catch Exception e (doall
                          (println "Error processing the form result: " (.getMessage e))
                          (st/print-stack-trace e)))))

@@ -187,7 +206,7 @@
         form-xmlns (.getForm session)
         locale nil] ; TODO: pass in locale
     (println "Starting form entry with the following stack frame")
-    (print-stack session)
+    (print-frame session)
     (if (nil? form-xmlns)
       (do (finish-session session) true)
       (let [form-result (form-player/play


Refactor code

Refactor code

--- src/hatti/views/dataview.cljs
+++ src/hatti/views/dataview.cljs
@@ -185,18 +185,19 @@
           [:div.tab-bar
            (map dv->link dataviews)
            (om/build dataview-infobar
-                     {:dataset-info (-> app-state :dataset-info)
-                      :status (-> app-state :status)})]
+                     {:dataset-info (:dataset-info app-state)
+                      :status (:status app-state)})]
           (for [{:keys [component view]} dataviews
                 :let [view-name (name view)]]
             [:div {:class (str "tab-page " view-name "-page")
                    :style {:height
-                           (:table-view-height (-> app-state :table-page))
+                           (-> app-state :table-page :table-view-height)
                            :display
                            (view->display view)
                            :overflow-x
-                           (if (:prevent-scrolling-in-table-view?
-                                (-> app-state :table-page))
+                           (if (-> app-state
+                                   :table-page
+                                   :prevent-scrolling-in-table-view?)
                              "hidden"
                              "scroll")}}
              (when (= selected view)


Added the required url field to the tuple output

--- memex-datawake-stream/topologies/datawake-mockcrawler.clj
+++ memex-datawake-stream/topologies/datawake-mockcrawler.clj
@@ -49,28 +49,28 @@
             options
             {"datawake-visited-spout" :shuffle }
             "datawakestreams.extractors.email_bolt.EmailBolt"
-            ["attribute", "value", "extracted_raw", "extracted_metadata","context"]
+            ["attribute", "value", "extracted_raw", "extracted_metadata","url","context"]
         )

         "phone-bolt" (python-bolt-spec
             options
             {"datawake-visited-spout" :shuffle }
             "datawakestreams.extractors.phone_bolt.PhoneBolt"
-            ["attribute", "value", "extracted_raw", "extracted_metadata","context"]
+            ["attribute", "value", "extracted_raw", "extracted_metadata","url","context"]
         )

         "website-bolt" (python-bolt-spec
             options
             {"datawake-visited-spout" :shuffle }
             "datawakestreams.extractors.website_bolt.WebsiteBolt"
-            ["attribute", "value", "extracted_raw", "extracted_metadata","context"]
+            ["attribute", "value", "extracted_raw", "extracted_metadata","url","context"]
         )

         "mitie-bolt" (python-bolt-spec
             options
             {"datawake-visited-spout" :shuffle }
             "datawakestreams.extractors.mitie_bolt.MitieBolt"
-            ["attribute", "value", "extracted_raw", "extracted_metadata","context"]
+            ["attribute", "value", "extracted_raw", "extracted_metadata","url","context"]
          )

         ;; write extracted links to the crawler-in


Update test namespaces

Update test namespaces

--- src/main/clojure/conexp/base.clj
+++ src/main/clojure/conexp/base.clj
@@ -125,9 +125,7 @@
                conexp.contrib.tests.algorithms
                conexp.contrib.tests.algorithms.concepts
                conexp.contrib.tests.algorithms.generators
-               conexp.contrib.tests.algorithms.titanic
-               conexp.contrib.tests.factor-analysis
-               conexp.contrib.tests.fuzzy.sets]]
+               conexp.contrib.tests.algorithms.titanic]]
      (apply require nss)
      (apply clojure.test/run-tests nss))))


make into an elipse

make into an elipse

--- src/mccarthy_animation/core.cljc
+++ src/mccarthy_animation/core.cljc
@@ -88,10 +88,12 @@
            (:x sprite-size)
            (:y sprite-size))

-  ;; calculate x and y coordinates of the circle.
-  (let [angle (:angle state)
-        x (* 50 (quil/cos angle)) ; distance from center
-        y (* 50 (quil/sin angle))]
+  ;; parametric equation of an elipse
+  (let [x-radius 50
+        y-radius 20
+        angle (:angle state)
+        x (* x-radius (quil/cos angle))
+        y (* y-radius (quil/sin angle))]

     ;; Move origin point to the center of the hero
     (quil/with-translation [(get-in state [:hero :position :x]) (get-in state [:hero :position :y])]


Minor style tweaks for metabase.driver.redshift :yum:

--- src/metabase/driver/redshift.clj
+++ src/metabase/driver/redshift.clj
@@ -10,24 +10,24 @@
             [metabase.util :as u]
             [metabase.util.korma-extensions :as kx]))

-(defn- connection-details->spec [_ details]
+(defn- connection-details->spec [details]
   (kdb/postgres (merge details postgres/ssl-params))) ; always connect to redshift over SSL

-(defn- date-interval [_ unit amount]
+(defn- date-interval [unit amount]
   (k/raw (format "(GETDATE() + INTERVAL '%d %s')" (int amount) (name unit))))

-(defn- unix-timestamp->timestamp [_ expr seconds-or-milliseconds]
+(defn- unix-timestamp->timestamp [expr seconds-or-milliseconds]
   (case seconds-or-milliseconds
     :seconds      (kx/+ (k/raw "TIMESTAMP '1970-01-01T00:00:00Z'")
                         (kx/* expr
                               (k/raw "INTERVAL '1 second'")))
-    :milliseconds (recur nil (kx// expr 1000) :seconds)))
+    :milliseconds (recur (kx// expr 1000) :seconds)))

 ;; The Postgres JDBC .getImportedKeys method doesn't work for Redshift, and we're not allowed to access information_schema.constraint_column_usage,
 ;; so we'll have to use this custom query instead
 ;; See also: [Related Postgres JDBC driver issue on GitHub](https://github.com/pgjdbc/pgjdbc/issues/79)
 ;;           [How to access the equivalent of information_schema.constraint_column_usage in Redshift](https://forums.aws.amazon.com/thread.jspa?threadID=133514)
-(defn- describe-table-fks [_ database table]
+(defn- describe-table-fks [database table]
   (set (for [fk (jdbc/query (sql/db->jdbc-connection-spec database)
                             ["SELECT source_column.attname AS \"fk-column-name\",
                                      dest_table.relname    AS \"dest-table-name\",
@@ -47,9 +47,9 @@
                                      AND dest_column.attnum   = ANY(c.confkey)"
                              (:name table)
                              (:schema table)])]
-         {:fk-column-name (:fk-column-name fk)
-          :dest-table {:name   (:dest-table-name fk)
-                       :schema (:dest-table-schema fk)}
+         {:fk-column-name   (:fk-column-name fk)
+          :dest-table       {:name   (:dest-table-name fk)
+                             :schema (:dest-table-schema fk)}
           :dest-column-name (:dest-column-name fk)})))

 (defrecord RedshiftDriver []
@@ -59,8 +59,8 @@
 (u/strict-extend RedshiftDriver
   driver/IDriver
   (merge (sql/IDriverSQLDefaultsMixin)
-         {:date-interval       date-interval
-          :describe-table-fks  describe-table-fks
+         {:date-interval       (u/drop-first-arg date-interval)
+          :describe-table-fks  (u/drop-first-arg describe-table-fks)
           :details-fields      (constantly [{:name         "host"
                                              :display-name "Host"
                                              :placeholder  "my-cluster-name.abcd1234.us-east-1.redshift.amazonaws.com"
@@ -85,10 +85,10 @@

   sql/ISQLDriver
   (merge postgres/PostgresISQLDriverMixin
-         {:connection-details->spec  connection-details->spec
+         {:connection-details->spec  (u/drop-first-arg connection-details->spec)
           :current-datetime-fn       (constantly (k/sqlfn* :GETDATE))
           :set-timezone-sql          (constantly nil)
-          :unix-timestamp->timestamp unix-timestamp->timestamp}
+          :unix-timestamp->timestamp (u/drop-first-arg unix-timestamp->timestamp)}
          ;; HACK ! When we test against Redshift we use a session-unique schema so we can run simultaneous tests against a single remote host;
          ;; when running tests tell the sync process to ignore all the other schemas
          (when config/is-test?


added some duplication in favor of being a lot shorter while still pretty direct and clear

--- src/midje/util/file_position.clj
+++ src/midje/util/file_position.clj
@@ -13,14 +13,9 @@

 (defn- raw-arrow-line-number [arrow-loc]
   (try
-    (let [directional (fn [direction-fn]
-                        (fn [loc]
-                          (-> loc direction-fn zip/node meta :line)))
-          left-lineno (directional zip/left)
-          right-lineno (directional zip/right)]
-      (or (left-lineno arrow-loc)
-          (right-lineno arrow-loc)
-          (inc (left-lineno (zip/prev arrow-loc)))))
+      (or (-> arrow-loc zip/left zip/node meta :line)
+          (-> arrow-loc zip/right zip/node meta :line)
+          (inc (-> arrow-loc zip/prev zip/left zip/node meta :line)))
     (catch Throwable ex nil)))

 (defn arrow-line-number [arrow-loc]


Remain backward-compatible with older projects

--- src/leiningen/droid/utils.clj
+++ src/leiningen/droid/utils.clj
@@ -243,8 +243,10 @@
   "Get the list of dependency libraries that has `:use-resources true`
   in their definition."
   [{:keys [dependencies] :as project}]
-  (let [res-deps (for [[_ _ & options :as dep] (:dependencies project)
-                       :when (:use-resources (apply hash-map options))]
+  (let [res-deps (for [[lib _ & options :as dep] (:dependencies project)
+                       :when (or (:use-resources (apply hash-map options))
+                                 ;; Should be removed in final release
+                                 (= lib 'org.clojure-android/clojure))]
                    dep)
         mod-proj (assoc project :dependencies res-deps)]
     (resolve-dependencies :dependencies mod-proj)))


Update reagent.clj

Update reagent.clj

--- src/leiningen/new/reagent.clj
+++ src/leiningen/new/reagent.clj
@@ -46,7 +46,7 @@
   "Plugins for development or as part of an app."
   '[[lein-cljsbuild "1.0.4"]
     [lein-environ "1.0.0"]
-    [lein-ring "0.9.0"]
+    [lein-ring "0.9.1"]
     [lein-asset-minifier "0.2.2"]])

 (defn app-dependencies [opts]


Used leinjacker.deps/add-if-missing

Used leinjacker.deps/add-if-missing

--- src/leiningen/ring/server.clj
+++ src/leiningen/ring/server.clj
@@ -1,4 +1,5 @@
 (ns leiningen.ring.server
+  (:require [leinjacker.deps :as deps])
   (:use [leinjacker.eval :only (eval-in-project)]
         leiningen.ring.util))

@@ -18,7 +19,7 @@
   (ensure-handler-set! project)
   (let [project (update-in project [:ring] merge options)]
     (eval-in-project
-     (update-in project [:dependencies] conj ['ring-server "0.2.4"])
+     (deps/add-if-missing project '[ring-server "0.2.4"])
      `(ring.server.leiningen/serve
        '~(select-keys project [:ring]))
      (load-namespaces


(MAINT) Update tk-jetty9 to 1.1.0 for FOSS puppetserver

Without this patch FOSS puppet server builds 0.9.0 of tk-jetty9 in the
uberjar.  This is a problem because FOSS puppet server should be using
1.1.0 of tk-jetty9

--- configs/puppetserver/puppetserver.clj
+++ configs/puppetserver/puppetserver.clj
@@ -2,7 +2,7 @@
   :description "Release artifacts for puppet-server"
   :pedantic? :abort
   :dependencies [[puppetlabs/puppet-server "{{{puppet-server-version}}}"]
-                 [puppetlabs/trapperkeeper-webserver-jetty9 "0.9.0"]
+                 [puppetlabs/trapperkeeper-webserver-jetty9 "1.1.0"]
                  ;; There is a bug in leiningen that forces us to
                  ;; explicitly reference nrepl if we want it to be
                  ;; included in the uberjar.


Fixing oracle search namespace for access groups.

--- metadata-db-app/src/cmr/metadata_db/data/oracle/search.clj
+++ metadata-db-app/src/cmr/metadata_db/data/oracle/search.clj
@@ -29,31 +29,25 @@
          vals
          first))))

-(defmulti columns-for-find-concept
+(def common-columns
+  "A set of common columns for all concept types."
+  #{:native_id :concept_id :revision_date :metadata :deleted :revision_id :format})
+
+(def concept-type->columns
+  "A map of concept type to the columns for that type in the database."
+  {:granule (into common-columns
+                  [:provider_id :parent_collection_id :delete_time :granule_ur])
+   :collection (into common-columns
+                     [:provider_id :entry_title :entry_id :short_name :version_id :delete_time
+                      :user_id])
+   :tag (into common-columns [:user_id])
+   :access-group (into common-columns [:provider_id :user_id])})
+
+(defn columns-for-find-concept
   "Returns the table columns that should be included in a find-concept sql query"
-  (fn [concept-type params]
-    concept-type))
-
-(defmethod columns-for-find-concept :granule
   [concept-type params]
   (let [exclude-metadata? (= "true" (:exclude-metadata params))
-        all-fields #{:provider_id :native_id :concept_id :revision_date :metadata :deleted
-                     :revision_id :format :parent_collection_id :delete_time :granule_ur}]
-    (disj all-fields (when exclude-metadata? :metadata))))
-
-(defmethod columns-for-find-concept :collection
-  [concpet-type params]
-  (let [exclude-metadata? (= "true" (:exclude-metadata params))
-        all-fields #{:native_id :provider_id :concept_id :revision_date :revision_id :metadata
-                     :deleted :format :entry_title :entry_id :short_name :version_id :delete_time
-                     :user-id}]
-    (disj all-fields (when exclude-metadata? :metadata))))
-
-(defmethod columns-for-find-concept :tag
-  [concpet-type params]
-  (let [exclude-metadata? (= "true" (:exclude-metadata params))
-        all-fields #{:native_id :concept_id :revision_date :revision_id :metadata
-                     :deleted :format :user-id}]
+        all-fields (concept-type->columns concept-type)]
     (disj all-fields (when exclude-metadata? :metadata))))

 (defn- params->sql-params


Don't use transaction when clearing dataset.

--- src/cavm/h2.clj
+++ src/cavm/h2.clj
@@ -734,12 +734,11 @@
        (with-load-status dataset-id
          (when (or force
                    (not (= (set files) (set (related-sources dataset-id)))))
-           (jdbcd/transaction
-             (p :dataset-clear
-                (clear-by-exp dataset-id))
-             (p :dataset-sources
-                (load-related-sources
-                  :dataset_source :dataset_id dataset-id files)))
+           (p :dataset-clear
+              (clear-by-exp dataset-id))
+           (p :dataset-sources
+              (load-related-sources
+                :dataset_source :dataset_id dataset-id files))
            (p :dataset-table
               (let [{:keys [rows warnings]} (table-writer *tmp-dir* dataset-id matrix-fn)]
                 (jdbcd/transaction


Added text endpoints for domains.

Added text endpoints for domains.

--- src/member_domains/server.clj
+++ src/member_domains/server.clj
@@ -32,20 +32,43 @@
                            :num-members (db/num-members)}]
                  (render-file "templates/home.html" info))))

-(defresource data-full-domain-names
+(defresource data-full-domain-names-json
   []
   :available-media-types ["application/json"]
   :handle-ok (fn [ctx]
                (let [domains (db/unique-member-domains)]
                  domains)))

-(defresource data-domain-names
+(defresource data-domain-names-json
+  []
+  :available-media-types ["text/plain"]
+  :handle-ok (fn [ctx]
+               (let [full-domains (db/unique-member-domains)
+                     domain-names (set (map #(->> % etld/get-main-domain (drop 1)) full-domains))]
+                 (map #(clojure.string/join "." %) domain-names))))
+
+(defresource data-full-domain-names-text
+  []
+  :available-media-types ["text/plain"]
+  :handle-ok (fn [ctx]
+               (let [domains (db/unique-member-domains)]
+                 (clojure.string/join "\n" domains))))
+
+(defresource data-domain-names-json
   []
   :available-media-types ["application/json"]
   :handle-ok (fn [ctx]
                (let [full-domains (db/unique-member-domains)
                      domain-names (set (map #(->> % etld/get-main-domain (drop 1)) full-domains))]
                  (map #(clojure.string/join "." %) domain-names))))
+
+(defresource data-domain-names-text
+  []
+  :available-media-types ["text/plain"]
+  :handle-ok (fn [ctx]
+               (let [full-domains (db/unique-member-domains)
+                     domain-names (set (map #(->> % etld/get-main-domain (drop 1)) full-domains))]
+                 (clojure.string/join "\n" (map #(clojure.string/join "." %) domain-names)))))

 ; GNIP text format rules for member domains.
 (defresource data-domain-names-gnip-txt
@@ -106,8 +129,10 @@

 (defroutes app-routes
   (GET "/" [] (home))
-  (GET "/data/full-domain-names.json" [] (data-full-domain-names))
-  (GET "/data/domain-names.json" [] (data-domain-names))
+  (GET "/data/full-domain-names.json" [] (data-full-domain-names-json))
+  (GET "/data/domain-names.json" [] (data-domain-names-json))
+  (GET "/data/full-domain-names.txt" [] (data-full-domain-names-text))
+  (GET "/data/domain-names.txt" [] (data-domain-names-text))
   (GET "/data/full-domain-names.gnip.txt" [] (data-domain-names-gnip-txt))
   (GET "/data/full-domain-names.gnip.json" [] (data-domain-names-gnip-json))
   (GET "/data/member-prefixes.json" [] (member-prefixes))


rename language

rename language

--- src/databinder/core.clj
+++ src/databinder/core.clj
@@ -51,7 +51,7 @@

 (defn uuid [] (str "urn:uuid:" (java.util.UUID/randomUUID)))

-(def db (uris "http://logangilmour.com/data-binder#" :rank :root :binds :bindo  :haschild :container :relator :contains :projects :path))
+(def bind (uris "http://logangilmour.com/data-binder#" :rank :root :subject :object  :child :container :relator :contains :projection :path))

 (def funcs
   {:projector
@@ -129,7 +129,7 @@
 (defn relator [statement model resource]

   (let [binder (.getURI (.getPredicate statement))]
-    (if (= binder (db :binds))
+    (if (= binder (bind :object))
       (iterator-seq (.listResourcesWithProperty model (prop (.getURI (.asResource (.getObject statement)))) resource ))
       (iterator-seq
        (.listObjectsOfProperty model resource
@@ -154,8 +154,8 @@
                                 (keys dc)))))

 (defn get-bound [binding model]
-  (or  (.getProperty model binding (prop (:binds db)))
-       (.getProperty model binding (prop (:bindo db)))))
+  (or  (.getProperty model binding (prop (bind :object)))
+       (.getProperty model binding (prop (bind :subject)))))

 (defn relate-right [model predicate resource]
   (iterator-seq (.listObjectsOfProperty model resource predicate)))
@@ -174,16 +174,16 @@
 (defn s-rec [binding model url-parts]

   (let [children (sort-by (fn [resource]
-                            (let [p (.getProperty model resource (prop (:rank db)))]
+                            (let [p (.getProperty model resource (prop (bind :rank)))]
                               (if p
                                 (.getString (.asLiteral (.getObject p)))
                                 "")))
                           (concat
-                           (relate-right model (prop (:contains db)) binding)
-                           (relate-right model (prop (:haschild db)) binding)))
-
-        projector (first (relate-left model (prop (:projects db)) binding)) ;;TODO only works for container pointed at by projector for now.
-        path (if projector (first (relate-right model (prop (:path db)) projector)))
+                           (relate-right model (prop (bind :contains)) binding)
+                           (relate-right model (prop (bind :child)) binding)))
+
+        projector (first (relate-left model (prop (bind :projection)) binding)) ;;TODO only works for container pointed at by projector for now.
+        path (if projector (first (relate-right model (prop (bind :path)) projector)))

         bindable (first (relate-right model (prop "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") binding))

@@ -197,11 +197,42 @@

         sub-calls (map (fn [child] (s-rec child model url-parts)) children) ;; make the next part of the tree
         meta-data (get-meta-data binding model)
-        myp (first (relate-right model (prop (:path db)) binding))
+        myp (first (relate-right model (prop (bind :path)) binding))
         mypath (if myp (.getString (.asLiteral myp)))]

     (cond
-     (contains? types (db :relator))
+     (contains? types (bind :container))
+     (fn [data child resource url built-url]
+            (let [ppath (if path (.getString (.asLiteral path)))
+                  p (get (parse-uri url) ppath)
+                  projected (if (and p (res p))
+                              (if (.containsResource data (res p))
+                                (res p)))
+
+                  current (if mypath (get (parse-uri url) mypath))
+
+                  active (if mypath (= current (.getURI resource)))
+                  built-url (or (if mypath (str built-url mypath "/" (.getURI resource) "/")) built-url)]
+
+              (if ppath
+                (if projected
+                  (func
+                   (.getURI resource)
+                   (.getURI binding)
+                   active
+                   built-url
+                   meta-data
+                   (map (fn [sub-call] (sub-call data nil projected url (str built-url ppath "/" (.getURI resource) "/"))) sub-calls))
+                  "")
+                (func
+                 (.getURI resource)
+                 (.getURI binding)
+                 active
+                 built-url
+                 meta-data
+                 (map (fn [sub-call] (sub-call data nil resource url built-url)) sub-calls))
+                )))
+     (contains? types (bind :relator))

      (let [statement (get-bound binding model) ;; fuckery for binding
            relation-getter (fn [data resource] (relator statement data resource))]
@@ -228,37 +259,8 @@
                    built-url
                    meta-data
                    vals)))))
-     (contains? types (db :container)) ;;TODO make it so we can project from a container.
-          (fn [data child resource url built-url]
-            (let [ppath (if path (.getString (.asLiteral path)))
-                  p (get (parse-uri url) ppath)
-                  projected (if (and p (res p))
-                              (if (.containsResource data (res p))
-                                (res p)))
-
-                  current (if mypath (get (parse-uri url) mypath))
-
-                  active (if mypath (= current (.getURI resource)))
-                  built-url (or (if mypath (str built-url mypath "/" (.getURI resource) "/")) built-url)]
-
-              (if ppath
-                (if projected
-                  (func
-                   (.getURI resource)
-                   (.getURI binding)
-                   active
-                   built-url
-                   meta-data
-                   (map (fn [sub-call] (sub-call data nil projected url (str built-url ppath "/" (.getURI resource) "/"))) sub-calls))
-                  "")
-                (func
-                 (.getURI resource)
-                 (.getURI binding)
-                 active
-                 built-url
-                 meta-data
-                 (map (fn [sub-call] (sub-call data nil resource url built-url)) sub-calls))
-                ))))))
+
+          )))

 (defn select [model subject predicate object]
   (iterator-seq (.listStatements (new SimpleSelector subject predicate object))))
@@ -285,15 +287,15 @@

 (defn qb [binding model uri] ;; TODO come up with a nice URI aliasing thing
   (let [children (concat
-                  (relate-right model (prop (:haschild db)) binding)
-                  (relate-right model (prop (:projects db)) binding))
-
-        projector (first (relate-left model (prop (:projects db)) binding))
-        ppath (if projector (first (relate-left model (prop (:path db)) projector)))
+                  (relate-right model (prop (bind :child)) binding)
+                  (relate-right model (prop (bind :projection)) binding))
+
+        projector (first (relate-left model (prop (bind :projection)) binding))
+        ppath (if projector (first (relate-left model (prop (bind :path)) projector)))

         types (set (map #(.toString %) (relate-right model (prop "http://www.w3.org/1999/02/22-rdf-syntax-ns#type") binding)))

-        path (first (relate-right model (prop (:path db)) binding))
+        path (first (relate-right model (prop (bind :path)) binding))
         onpath (if path (get uri (.getString (.asLiteral path))))

         subs
@@ -303,15 +305,15 @@
            '())
          (map (fn [child] (qb child model uri)) children))]

-    (cond (contains? types (db :relator))
+    (cond (contains? types (bind :relator))
           (let [statement (get-bound binding model)
                 binder (.getURI (.getPredicate statement))
                 predicate (.asResource (.getObject statement)) ;;TODO handle type thing with path thing
-                reverse (= binder (db :binds))]
+                reverse (= binder (bind :object))]

             [{:pred (.getURI predicate) :rev reverse :path onpath} subs])

-          (contains? types (db :container))
+          (contains? types (bind :container))

           subs
           )))
@@ -322,8 +324,8 @@

 (defn qbuild [inf uri]
   (let [root (.asResource (.getObject (.getProperty inf
-                                                        (res (:root db))
-                                                        (prop (:haschild db)))))
+                                                        (res (bind :root))
+                                                        (prop (bind :child)))))
         init (qb root inf uri)

         numbered (loop [loc (z/vector-zip (flatten-seq init))
@@ -465,8 +467,8 @@
                    ))

 (defn get-all-bindings [inf predicate]
-  (concat (iterator-seq (.listStatements inf nil (prop (:binds db)) predicate))
-          (iterator-seq (.listStatements inf nil (prop (:bindo db)) predicate))))
+  (concat (iterator-seq (.listStatements inf nil (prop (bind :object)) predicate))
+          (iterator-seq (.listStatements inf nil (prop (bind :subject)) predicate))))

 (defn serializer ;;TODO make this build sub-serializers that work for sub-projections
@@ -474,8 +476,8 @@

      (let [inf (. ModelFactory createRDFSModel (.union view-data widget-data))
             root (.asResource (.getObject (.getProperty inf
-                                                        (res (:root db))
-                                                        (prop (:haschild db)))))]
+                                                        (res (bind :root))
+                                                        (prop (bind :child)))))]

         (fn [data resource uri]
@@ -498,7 +500,7 @@
       (map (fn [binder]

              (let [binding (.getSubject binder)
-                   reverse (= (.getURI (.getPredicate binder)) (db :binds))]
+                   reverse (= (.getURI (.getPredicate binder)) (bind :object))]

               (dissoc
                (cond
@@ -545,7 +547,7 @@
           predicate (.asResource (.getObject statement))
           pred (.getURI predicate)
           resource (res uri)
-          reverse (= binder (db :binds))
+          reverse (= binder (bind :object))
           command (commander uri pred data type)
           update (query-builder command reverse)]
       (doall (map (fn [up]
@@ -557,42 +559,42 @@
 (def example-view
   "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix data: <http://logangilmour.com/data-binder#> .
+@prefix bind: <http://logangilmour.com/data-binder#> .
 @prefix ex: <http://logangilmour.com/example-view#> .
 @prefix ont: <http://logangilmour.com/example-ontology#> .
 @prefix dc: <http://purl.org/dc/elements/1.1/> .
 @prefix w: <http://logangilmour.com/bootstrap-widgets#> .

-data:root data:haschild ex:person-manager .
+bind:root bind:child ex:person-manager .

 ex:person-manager
   rdf:type w:row ;
   dc:title \"The Application\" ;
   dc:description \"Here we are\" ;
-  data:haschild ex:person-list-container ;
-  data:contains ex:person-container .
+  bind:child ex:person-list-container ;
+  bind:contains ex:person-container .

 ex:person-list-container
-  data:haschild ex:person-list ;
+  bind:child ex:person-list ;
   rdf:type w:column4 ;
-  data:rank 1 .
+  bind:rank 1 .

 ex:person-list
   rdf:type w:list ;
-  data:binds rdf:type ;
+  bind:object rdf:type ;
   dc:title \"List of People\" ;
   dc:description \"A list of people contained within the application\" ;
-  data:haschild ex:person-item .
+  bind:child ex:person-item .

 ex:person-item
   rdf:type w:list-item ;
-  data:path \"test\" ;
-  data:haschild ex:person-projector ;
-  data:projects ex:person-container .
+  bind:path \"test\" ;
+  bind:child ex:person-projector ;
+  bind:projection ex:person-container .

 ex:person-projector
   rdf:type w:projector ;
-  data:bindo ont:name ;
+  bind:subject ont:name ;
   dc:title \"select\" ;
   dc:description \"choose a person\" .

@@ -600,31 +602,31 @@
   rdf:type w:column8 ;
   dc:title \"Person\" ;
   dc:description \"A person\" ;
-  data:rank 2 .
-
-ex:person-container data:haschild ex:person-name-container , ex:person-age ,  ex:person-deleter .
+  bind:rank 2 .
+
+ex:person-container bind:child ex:person-name-container , ex:person-age ,  ex:person-deleter .

 ex:person-deleter rdf:type w:deleter ;
-                  data:bindo rdf:type ;
+                  bind:subject rdf:type ;
                   dc:title \"Remove\" ;
-                  data:rank 3 ;
+                  bind:rank 3 ;
                   dc:description \"Permanently delete a person from the database\" .

 ex:person-name-container
-  data:haschild ex:person-name ;
+  bind:child ex:person-name ;
   dc:title \"thing\" ;
   dc:description \"stuff\" ;
   rdf:type w:h1 .

 ex:person-name rdf:type w:text-field ;
-               data:rank 1 ;
-               data:bindo ont:name ;
+               bind:rank 1 ;
+               bind:subject ont:name ;
                dc:title \"Name\" ;
                dc:description \"The name of a person\" .

 ex:person-age rdf:type w:text-field ;
-              data:rank 2 ;
-              data:bindo ont:age ;
+              bind:rank 2 ;
+              bind:subject ont:age ;
               dc:title \"Age\" ;
               dc:description \"The age of a person\".

@@ -633,28 +635,28 @@
 (def widgets
   "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
 @prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
-@prefix data: <http://logangilmour.com/data-binder#> .
+@prefix bind: <http://logangilmour.com/data-binder#> .
 @prefix w: <http://logangilmour.com/bootstrap-widgets#> .

-w:projector rdfs:subClassOf data:relator .
-
-w:column8 rdfs:subClassOf data:container .
-
-w:column4 rdfs:subClassOf data:container .
-
-w:row rdfs:subClassOf data:container .
-
-w:list rdfs:subClassOf data:relator .
-
-w:list-item rdfs:subClassOf data:container .
-
-w:deleter rdfs:subClassOf data:relator .
-
-w:paragraph rdfs:subClassOf data:relator .
-
-w:text-field rdfs:subClassOf data:relator .
-
-w:h1 rdfs:subClassOf data:container .
+w:projector rdfs:subClassOf bind:relator .
+
+w:column8 rdfs:subClassOf bind:container .
+
+w:column4 rdfs:subClassOf bind:container .
+
+w:row rdfs:subClassOf bind:container .
+
+w:list rdfs:subClassOf bind:relator .
+
+w:list-item rdfs:subClassOf bind:container .
+
+w:deleter rdfs:subClassOf bind:relator .
+
+w:paragraph rdfs:subClassOf bind:relator .
+
+w:text-field rdfs:subClassOf bind:relator .
+
+w:h1 rdfs:subClassOf bind:container .
 ")


A small refactor in preparation to add

A small refactor in preparation to add

--- src/dependable/core.clj
+++ src/dependable/core.clj
@@ -7,6 +7,17 @@

 (def safe-spec-call
   (fnil spec-call (fn [v] true)))
+
+
+(defn choose-candidate
+  [pname
+   pspec
+   query]
+  (let [response (query pname)]
+    (first
+      (filter
+        #(safe-spec-call pspec (:version %))
+        response))))

 (defn resolve-dependencies
   [names
@@ -33,11 +44,7 @@
                    (nil? (conflict pname)))
               [:unsatisfiable pname]
               :else
-              (let [response (query pname)
-                    chosen (first
-                             (filter
-                               #(safe-spec-call pspec (:version %))
-                               response))
+              (let [chosen (choose-candidate pname pspec query)
                     chosen-conflicts (:conflicts chosen)]
                 (if (or (nil? chosen)
                         (and (contains? conflict pname)


fixing compatibility tests

fixing compatibility tests

--- src/midje/checkers/simple.clj
+++ src/midje/checkers/simple.clj
@@ -11,7 +11,7 @@
     [midje.util.ecosystem :only [clojure-1-3? +M -M *M]]
     [midje.util.form-utils :only [defalias def-many-methods pred-cond regex?]]
     [midje.util.backwards-compatible-utils :only [every-pred-m some-fn-m]])
-  (:import [midje.error_handling.exceptions CapturedThrowable]))
+  (:import [midje.error_handling.exceptions ICapturedThrowable]))

 (defchecker truthy
   "Returns precisely true if actual is not nil and not false."
@@ -82,18 +82,18 @@
                       class?                     :throwable )))))

 (defmethod throws #{:message } [& expected-msgs]
-  (checker [^CapturedThrowable wrapped-throwable]
+  (checker [^ICapturedThrowable wrapped-throwable]
     (let [actual-msg (.getMessage ^Throwable (.throwable wrapped-throwable))]
       (every? (partial extended-= actual-msg) expected-msgs))))

 (defmethod throws #{:predicate} [& preds]
-  (checker [^CapturedThrowable wrapped-throwable]
+  (checker [^ICapturedThrowable wrapped-throwable]
     ((apply every-pred-m preds) (.throwable wrapped-throwable))))

 (defmethod throws #{:throwable} [clazz]
-  (checker [^CapturedThrowable wrapped-throwable]
+  (checker [^ICapturedThrowable wrapped-throwable]
     (= clazz (class (.throwable wrapped-throwable)))))

 (def-many-methods throws [#{:throwable :predicate}, #{:message :predicate },
                           #{:throwable :message}, #{:throwable :message :predicate}] [& args]
-  (as-checker (apply every-pred-m (map throws args))))
+  (as-checker (apply every-pred-m (map throws args))))


Try to delete the draft board on an entry save or publish to a new board only if the old board actually exists, can be that the post is brand new and we are not moving the post from another board.

--- src/oc/storage/api/boards.clj
+++ src/oc/storage/api/boards.clj
@@ -195,9 +195,10 @@
             (let [entry-result (entry-res/upsert-entry! conn new-entry user)]
               (timbre/info "Upserted entry for new board:" board-uuid "as" (:uuid entry-result))
               ;; If we are updating an existing draft check if we need to remove the old board
-              (let [old-board (board-res/get-board conn (:board-uuid entry))
-                    remaining-entries (entry-res/list-all-entries-by-board conn (:uuid old-board))]
-                (board-res/maybe-delete-draft-board conn org old-board remaining-entries user))
+              (when (not= (:board-uuid entry) entry-res/temp-uuid)
+                (let [old-board (board-res/get-board conn (:board-uuid entry))
+                      remaining-entries (entry-res/list-all-entries-by-board conn (:uuid old-board))]
+                  (board-res/maybe-delete-draft-board conn org old-board remaining-entries user)))
               (when (= (:status entry-result) "published")
                 (when (= :add entry-action)
                   (entries-api/auto-share-on-publish conn (assoc ctx :existing-board board-result) entry-result))