follow mapquest redirects

follow mapquest redirects

--- src/cljs/montheway/mmodern.cljs
+++ src/cljs/montheway/mmodern.cljs
@@ -175,23 +175,31 @@
                       "routeType" "fastest"
                       "narrativeType" "none"
                       "shapeFormat" "raw"
-                      "generalize" "0"}
+                      "generalize" "0"
+                      "outFormat" "json"}
         uri "http://www.mapquestapi.com/directions/v2/route"]
     (mk-uri uri query-params)))

 (defn fetch-mapquest-lat-lngs [to from]
   (go
    (let [url (mapquest-uri to from)
-         response (<! (http/get url))
-         steps (-> response
-                   :body :route :shape :shapePoints)
-         lat-lngs (map
-                   (fn [[start-lat start-lng end-lat end-lng]]
-                     {:start-lat start-lat
-                      :start-lng start-lng
-                      :end-lat end-lat
-                      :end-lng end-lng})
-                   (partition 4 2 steps))]
+         response (<! (http/get url))]
+     (if (contains? response :trace-redirects)
+       (do
+         (let [redirect-url (-> response :trace-redirects first)
+               r-response (<! (http/get (-> response :trace-redirects first)))]
+           (dommy/append! (sel1 :body) [:p (str  "Mapquest redirect-url:"
+                                                 redirect-url)])
+           (dommy/append! (sel1 :body) [:p (str  "Mapquest query:" r-response)]))))
+     steps (-> response
+                    :body :route :shape :shapePoints)
+     lat-lngs (map
+                    (fn [[start-lat start-lng end-lat end-lng]]
+                      {:start-lat start-lat
+                       :start-lng start-lng
+                       :end-lat end-lat
+                       :end-lng end-lng})
+                    (partition 4 2 steps))
      (dommy/append! (sel1 :body) [:p (str  "Mapquest data:" response)])
      lat-lngs)))


remove IWithMeta impl for reactive entities

--- src/clojure/freactive/core.cljs
+++ src/clojure/freactive/core.cljs
@@ -50,10 +50,6 @@

   IMeta
   (-meta [_] meta)
-
-  IWithMeta
-  (-with-meta [_ new-meta]
-    (ReactiveAtom. state new-meta validator watches))

   IPrintWithWriter
   (-pr-writer [a writer opts]
@@ -201,11 +197,6 @@
   IMeta
   (-meta [_] meta)

-  IWithMeta
-  (-with-meta [_ new-meta]
-    (ReactiveExpression. state dirty f deps new-meta watches
-                         invalidation-watches sully lazy trace-captures))
-
   IPrintWithWriter
   (-pr-writer [a writer opts]
     (-write writer "#<ReactiveComputation: ")
@@ -307,11 +298,6 @@

   IMeta
   (-meta [_] meta)
-
-  IWithMeta
-  (-with-meta [_ new-meta]
-    (ReactiveCursor. ref getter setter dirty state new-meta watches
-                     invalidation-watches lazy sully add-watch-fn))

   IPrintWithWriter
   (-pr-writer [a writer opts]


[n.u.mapping] Add GridView

[n.u.mapping] Add GridView

--- src/clojure/neko/ui/mapping.clj
+++ src/clojure/neko/ui/mapping.clj
@@ -6,7 +6,7 @@
   (:use [neko.-utils :only [keyword->static-field reflect-field]])
   (:import [android.widget LinearLayout Button EditText ListView SearchView
             ImageView ImageView$ScaleType RelativeLayout ScrollView FrameLayout
-            Gallery]
+            Gallery GridView]
            android.app.ProgressDialog
            android.view.inputmethod.EditorInfo
            [android.view View ViewGroup$LayoutParams Gravity]))
@@ -76,7 +76,10 @@
     :gallery {:classname android.widget.Gallery
               :inherits :view-group
               :traits [:on-item-click]}
-
+    :grid-view {:classname android.widget.GridView
+                :inherits :view-group
+                :traits [:on-item-click]}
+
     ;; Other
     :layout-params {:classname ViewGroup$LayoutParams
                     :values {:fill ViewGroup$LayoutParams/FILL_PARENT
@@ -106,6 +109,7 @@
     android.webkit.WebView :web-view
     android.widget.ScrollView :scroll-view
     android.widget.Gallery :gallery
+    android.widget.GridView :grid-view
     android.app.ProgressDialog :progress-dialog}))

 (defn set-classname!


Hide tooltips before removing them

Hide tooltips before removing them

--- src/net/sekao/nightcode/builders.clj
+++ src/net/sekao/nightcode/builders.clj
@@ -132,6 +132,7 @@
     (.addListener (-> (.lookup pane "#build_tabs") .getSelectionModel .selectedItemProperty)
       (reify ChangeListener
         (changed [this observable old-value new-value]
+          (some-> old-value .getContent shortcuts/hide-tooltips!)
           (some-> old-value .getContent (shortcuts/remove-tooltips! ids))
           (some-> new-value .getContent (shortcuts/add-tooltips! ids)))))
     ; select/disable build tabs


Use isValidElement and createElement to avoid deprecation messages

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -198,7 +198,7 @@
       (let [cached-class (util/cached-react-class tag)]
         (if-not (nil? cached-class)
           cached-class
-          (if (.' js/React isValidClass tag)
+          (if (.' js/React isValidElement tag)
             (util/cache-react-class tag (wrap-component tag nil nil))
             (fn-to-class tag)))))))

@@ -218,7 +218,7 @@
                k)]
       (when-not (nil? k')
         (.! jsprops :key k')))
-    (c jsprops)))
+    (.' js/React createElement c jsprops)))

 (def seq-ctx #js{})


Add styling, begin on pie charts

Add styling, begin on pie charts

--- src/com/hypirion/clj_xchart.clj
+++ src/com/hypirion/clj_xchart.clj
@@ -1,22 +1,113 @@
 (ns com.hypirion.clj-xchart
   (:import (org.knowm.xchart XYChart
+                             PieChart
+                             XYSeries$XYSeriesRenderStyle
                              XChartPanel)
+           (org.knowm.xchart.style.markers Circle
+                                           Diamond
+                                           None
+                                           Square
+                                           TriangleDown
+                                           TriangleUp)
            (javax.swing JPanel
                         JFrame
                         SwingUtilities)
-           java.awt.GridLayout))
+           (java.awt Color
+                     GridLayout)))
+
+(defn add-series
+  ([^XYChart chart s-name x-data y-data]
+   (.addSeries chart s-name x-data y-data))
+  ([^XYChart chart s-name x-data y-data error-bars]
+   (.addSeries chart s-name x-data y-data error-bars)))
+
+(def colors
+  {:blue Color/BLUE
+   :black Color/BLACK
+   :cyan Color/CYAN
+   :dark-gray Color/DARK_GRAY
+   :gray Color/GRAY
+   :green Color/GREEN
+   :light-gray Color/LIGHT_GRAY
+   :magenta Color/MAGENTA
+   :orange Color/ORANGE
+   :pink Color/PINK
+   :red Color/RED
+   :white Color/WHITE
+   :yellow Color/YELLOW})
+
+(def markers
+  {:circle (Circle.)
+   :diamond (Diamond.)
+   :none (None.)
+   :square (Square.)
+   :triangle-up (TriangleUp.)
+   :triangle-down (TriangleDown.)})
+
+(def xy-render-styles
+  {:area XYSeries$XYSeriesRenderStyle/Area
+   :scatter XYSeries$XYSeriesRenderStyle/Scatter
+   :line XYSeries$XYSeriesRenderStyle/Line})
+
+(defmacro ^:private doto-cond
+  "Example:
+  (doto-cond expr
+    cond1 (my call)
+    cond2 (my2 call2))
+  =>
+  (let [e# expr]
+    (when cond1 (my #e call))
+    (when cond2 (my2 #2 call2)))"
+  [expr & clauses]
+  (let [pairs (partition 2 clauses)
+        expr-sym (gensym "expr")]
+    `(let [~expr-sym ~expr]
+       ~@(map (fn [[cond clause]]
+                `(when ~cond
+                   (~(first clause) ~expr-sym ~@(rest clause))))
+              pairs)
+       ~expr-sym)))

 (defn xy-chart
   "Returns an xy-chart"
-  [{:keys [width height series]
-    :or {width 540 height 500}}]
+  [{:keys [width height title series]
+    :or {width 640 height 500}}]
   {:pre [series]}
   (let [chart (XYChart. width height)]
-    (doseq [[s-name [x-data y-data error-bars]] series]
-      (if error-bars
-        (.addSeries chart s-name x-data y-data error-bars)
-        (.addSeries chart s-name x-data y-data)))
-    chart))
+    (doseq [[s-name data] series]
+      (if (sequential? data)
+        (apply add-series chart s-name data)
+        (let [{:keys [x y error-bars style]} data
+              {:keys [marker-color marker-type
+                      line-color line-style line-width
+                      fill-color show-in-legend render-style]} style]
+          (doto-cond
+           (if error-bars
+             (add-series chart s-name x y error-bars)
+             (add-series chart s-name x y))
+           marker-color (.setMarkerColor (colors marker-color marker-color))
+           marker-type (.setMarker (markers marker-type marker-type))
+           line-color (.setLineColor (colors line-color line-color))
+           line-style (.setLineStyle line-style)
+           line-width (.setLineWidth (float line-width))
+           fill-color (.setFillColor (colors fill-color fill-color))
+           (not (nil? show-in-legend)) (.setShowInLegend (boolean show-in-legend))
+           render-style (.setXYSeriesRenderStyle (xy-render-styles render-style))))))
+    (doto-cond
+     chart
+     title (.setTitle title))))
+
+(defn pie-chart
+  "Returns a pie chart"
+  [{:keys [width height title series]
+    :or {width 640 height 500}}]
+  {:pre [series]}
+  (let [chart (PieChart. width height)]
+    (doseq [[s-name num] series]
+      (.addSeries chart s-name num))
+    (doto-cond
+     chart
+     title (.setTitle title))))

 (defn view
   "Utility function to render one or more charts in a swing frame."


Error messages in Swing are now scrollable!

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

--- src/conexp/contrib/gui/util.clj
+++ src/conexp/contrib/gui/util.clj
@@ -95,8 +95,9 @@
      (catch Exception e#
        (javax.swing.JOptionPane/showMessageDialog
         ~frame
-        (scrollable (apply str (get-root-cause e#) "\n"
-                           (interpose "\n" (.getStackTrace e#))))
+        (scrollable (text :text (apply str (get-root-cause e#) "\n"
+                                       (interpose "\n" (.getStackTrace e#)))
+                          :multi-line? true))
         ~title
         javax.swing.JOptionPane/ERROR_MESSAGE))))


introduce cardinal-delta, ie only a cardinal direction

--- src/tile_game/coordinates.cljc
+++ src/tile_game/coordinates.cljc
@@ -17,10 +17,11 @@

 (s/def ::coord-delta #{-1 0 1})
 (s/def ::delta (s/tuple ::coord-delta ::coord-delta))
+(s/def ::cardinal-delta (s/and ::delta (fn [[x y]] (= 1 (abs (+ x y))))))
 (s/def ::coordinate (s/and int? pos?))
 (s/def ::point (s/tuple ::coordinate ::coordinate))
 (comment (gen/sample (s/gen ::point))
-         (gen/sample (s/gen ::delta)))
+         (gen/sample (s/gen ::cardinal-delta)))
 (defn adjacent-to
   "Lists adjacent coordinates in clockwise order"
   [p]


Added documentation

Added documentation

--- src/wishlistd/models/redis.clj
+++ src/wishlistd/models/redis.clj
@@ -42,6 +42,7 @@
 ;; Advanced

 (defn update-merge [{:keys [code] :as wishlist}]
+  "Allows incremental updates by merging old and new wishlist maps."
   (r/with-server db
     (when-let [old (read-wishlist code)]
       (update-wishlist (merge old wishlist)))))


HTML 표현 프로토콜로 추상화

HTML 표현 프로토콜로 추상화

--- src/인스타파스/변환.clj
+++ src/인스타파스/변환.clj
@@ -2,8 +2,8 @@
   (:require [인스타파스.블럭 :as 블럭]
             [인스타파스.문장 :as 문장]
             [instaparse.core :as insta]
-            [clojure.test :refer :all]))
-
+            [clojure.test :refer :all])
+  (:import [clojure.lang IPersistentVector ISeq]))

 (defn 마크다운 [텍스트]
   (->> 텍스트
@@ -13,27 +13,41 @@

 (마크다운 "*강조*큰제목\n====\n일반문장.\n")

-(defn ->HTML [트리]
-  (let [태그 (fn [키워드] (case 키워드
-                         :문서   ["" ""]
-                         :큰제목 ["
"   "
"]
-                         :문단   ["
"  "
"]
-                         :문장   [""       ""]
-                         :기울임 [""    ""]
-                         [(name 키워드)]))]
-    (if (seq 트리)
-      (cond
-        (vector? 트리)
-        (let [[열기 닫기] (태그 (first 트리))]
-          (str 열기
-               (apply str (map ->HTML (rest 트리)))
-               닫기))
+;;; the code below is heavily influenced by hiccup

-        (string? 트리)
-        트리
+(defprotocol HtmlRenderer
+  (render-html [element]))

-        :else
-        (throw (IllegalStateException.))))))
+(defn render-element [트리]
+  (if-let [태그 ({:큰제목   "h2"
+                  :작은제목 "h3"
+                  :문단     "div"
+                  :기울임   "i"
+                  :굵게     "em"
+                  } (first 트리))]
+    (str "<" 태그 ">"
+         (render-html (rest 트리))
+         "</" 태그 ">")
+    (render-html (rest 트리))))

-(->HTML (마크다운 ""))
-(->HTML (마크다운 "중간*강조*큰제목\n====\n일반문장.\n"))
+(extend-protocol HtmlRenderer
+  IPersistentVector
+  (render-html [this]
+    (render-element this))
+
+  ISeq
+  (render-html [this]
+    (apply str (map render-html this)))
+
+  String
+  (render-html [this] this)
+
+  Object
+  (render-html [this]
+    (str this))
+
+  nil
+  (render-html [this] ""))
+
+(render-html (마크다운 ""))
+(render-html (마크다운 "중간*강조*큰제목\n====\n일반문장.\n"))


[#3036] Include multiple-column-txs but derive, merge-datasets and reverse-geocode

--- backend/src/akvo/lumen/lib/transformation/engine.clj
+++ backend/src/akvo/lumen/lib/transformation/engine.clj
@@ -222,7 +222,10 @@
   [{:keys [tenant-conn] :as deps} dataset-id job-execution-id transformation]
   (if (and (get (env/all tenant-conn) "data-groups")
            (or (contains? s.transformation/single-column-transformations (get transformation "op"))
-               (= "core/combine" (get transformation "op"))))
+               (contains? (set/difference
+                           s.transformation/multiple-column-transformations
+                           #{"core/derive" "core/merge-datasets" "core/reverse-geocode"})
+                          (get transformation "op"))))
     (execute-transformation-2 deps dataset-id job-execution-id transformation)
     (execute-transformation-1 deps dataset-id job-execution-id transformation)))


[#3083]Fix:Not use/expose previous-columns but (:columns data-group)

previous transformation log after deleting one column

[
     {
       "op": "core/delete-column",
       "args": {
         "columnName": "submitter"
       },
       "created": "2020-12-29T11:23:50.999Z",
       "onError": "fail",
       "dataset-id": "5feb11ae-b555-49d8-844e-47e219969c27",
       "changedColumns": {
         "submitter": {
           "after": null,
           "before": {
             "key": false,
             "sort": null,
             "type": "text",
             "title": "Submitter",
             "hidden": false,
             "groupId": "metadata",
             "direction": null,
             "groupName": "metadata",
             "columnName": "submitter",
             "multipleId": null,
             "multipleType": null
           }
         },
         "c626839131": {
           "after": null,
           "before": {
             "key": false,
             "sort": null,
             "type": "text",
             "title": "video",
             "hidden": false,
             "groupId": "655359129",
             "direction": null,
             "groupName": "group2",
             "columnName": "c626839131",
             "multipleId": null,
             "multipleType": null
           }
         },
         "c628419134": {
           "after": null,
           "before": {
             "key": false,
             "sort": null,
             "type": "text",
             "title": "photo",
             "hidden": false,
             "groupId": "655359129",
             "direction": null,
             "groupName": "group2",
             "columnName": "c628419134",
             "multipleId": null,
             "multipleType": null
           }
         },
         "c635099115": {
           "after": null,
           "before": {
             "key": false,
             "sort": null,
             "type": "number",
             "title": "age",
             "hidden": false,
             "groupId": "653389137",
             "direction": null,
             "groupName": "group1",
             "columnName": "c635099115",
             "multipleId": null,
             "multipleType": null
           }
         },
         "c655369136": {
           "after": null,
           "before": {
             "key": false,
             "sort": null,
             "type": "text",
             "title": "name",
             "hidden": false,
             "groupId": "653389137",
             "direction": null,
             "groupName": "group1",
             "columnName": "c655369136",
             "multipleId": null,
             "multipleType": null
           }
         },
         "instance_id": {
           "after": {
             "key": true,
             "sort": null,
             "type": "text",
             "title": "Instance id",
             "hidden": false,
             "groupId": "metadata",
             "direction": null,
             "groupName": "metadata",
             "columnName": "instance_id",
             "multipleId": null,
             "multipleType": null
           },
           "before": {
             "key": false,
             "sort": null,
             "type": "text",
             "title": "Instance id",
             "hidden": true,
             "groupId": "655359129",
             "direction": null,
             "groupName": "group2",
             "columnName": "instance_id",
             "multipleId": null,
             "multipleType": null
           }
         }
       }
     }
   ]

--- backend/src/akvo/lumen/lib/transformation/engine.clj
+++ backend/src/akvo/lumen/lib/transformation/engine.clj
@@ -194,7 +194,6 @@
       (throw (ex-info (or message "") {:transformation-result (select-keys res [:success? :message :columns :execution-log])})))
     {:data-groups-to-be-created (or data-groups-to-be-created [])
      :columns columns
-     :previous-columns previous-columns
      :data-group data-group}))

 (defn adapt [data-groups-to-be-created data-groups]
@@ -220,7 +219,7 @@
   "
   [{:keys [tenant-conn claims] :as deps}
    {:keys [job-execution-id transformation data-groups]}
-   {:keys [previous-columns columns data-groups-to-be-created data-group dataset-version]}]
+   {:keys [columns data-groups-to-be-created data-group dataset-version]}]
   (let [new-dataset-version-id (str (util/squuid))]
     (db.dataset-version/new-dataset-version-2 tenant-conn {:id               new-dataset-version-id
                                                            :dataset-id       (:dataset-id transformation)
@@ -231,7 +230,7 @@
                                                                               (conj (vec (:transformations dataset-version))
                                                                                (assoc transformation
                                                                                "created" (Instant/ofEpochMilli (System/currentTimeMillis))
-                                                                                "changedColumns" (diff-columns previous-columns
+                                                                                "changedColumns" (diff-columns (:columns data-group)
                                                                                columns))))})
     (when (seq data-groups-to-be-created)
       (doseq [dg (adapt data-groups-to-be-created data-groups)]
@@ -263,12 +262,11 @@
         tx-data {:data-groups data-groups
                  :job-execution-id job-execution-id
                  :transformation transformation}
-        {:keys [columns previous-columns data-groups-to-be-created data-group]}
+        {:keys [columns data-groups-to-be-created data-group]}
         (try-apply-operation-2 deps tx-data)]
     (post-try-apply-operation-2 deps tx-data
                                 {:columns columns
                                  :dataset-version dataset-version
-                                 :previous-columns previous-columns
                                  :data-group data-group
                                  :data-groups-to-be-created data-groups-to-be-created})))

@@ -496,7 +494,7 @@
                                      (set (map #(get % "columnName") columns)))))]
         (if avoid-tranformation?
           (recur (rest transformations) data-groups applied-txs)
-          (let [{:keys [data-groups-to-be-created columns previous-columns data-group] :as op}
+          (let [{:keys [data-groups-to-be-created columns data-group] :as op}
                 (try
                   (try-apply-operation-2 {:tenant-conn conn :caddisfly caddisfly}
                                          {:data-group data-group
@@ -511,7 +509,7 @@
                 data-groups-to-be-created (adapt data-groups-to-be-created data-groups)]
             (let [applied-txs (conj applied-txs
                                     (assoc transformation "changedColumns"
-                                           (diff-columns previous-columns columns)))]
+                                           (diff-columns (:columns data-group)  columns)))]
               (db.job-execution/vacuum-table conn {:table-name (:table-name data-group)})
               (recur (rest transformations)
                      (reduce (fn [c dg]


Clean ns

Clean ns

--- src/aero/core.cljc
+++ src/aero/core.cljc
@@ -1,22 +1,17 @@
 ;; Copyright © 2015-2017, JUXT LTD.

 (ns aero.core
-  #?(:clj (:require
-           [clojure.edn :as edn]
-           [clojure.string :refer [trim]]
-           [clojure.walk :refer [walk postwalk]]
-           [clojure.java.io :as io]
-           [clojure.java.shell :as sh]
-           [aero.vendor.dependency.v0v2v0.com.stuartsierra.dependency :as dep]))
-  #?(:clj (:import (java.io StringReader)))
-  #?(:cljs (:require [cljs.tools.reader :as edn]
-                     [goog.string :as gstring]
-                     goog.string.format
-                     [clojure.walk :refer [walk postwalk]]
-                     [aero.vendor.dependency.v0v2v0.com.stuartsierra.dependency :as dep]
-                     ["os" :as os]
-                     ["fs" :as fs]
-                     ["path" :as path])))
+  (:require
+    [aero.vendor.dependency.v0v2v0.com.stuartsierra.dependency :as dep]
+    [clojure.walk :refer [walk postwalk]]
+    #?(:clj [clojure.edn :as edn]
+       :cljs [cljs.tools.reader :as edn])
+    #?@(:clj [[clojure.java.io :as io]]
+        :cljs [[goog.string :as gstring]
+               goog.string.format
+               ["fs" :as fs]
+               ["path" :as path] ["os" :as os]]))
+  #?(:clj (:import (java.io StringReader))))

 (declare read-config)


Minor impl change.

Minor impl change.

--- src/bide/core.cljs
+++ src/bide/core.cljs
@@ -100,7 +100,7 @@
     (e/listen history History.EventType.NAVIGATE -on-navigate)
     (.replaceToken history initial-token)
     (on-navigate initial-loc)
-    (reify IRouter
+    (specify! router
       (-navigare [_ location params]
         (.setToken history (resolve location params)))
       (-replace-location [_ location params]


Prevent delayed exceptions in lazy sequences

--- src/rdf_path_examples/evaluation.clj
+++ src/rdf_path_examples/evaluation.clj
@@ -56,7 +56,7 @@
                                                   clj->rdf-model
                                                   (partial generate-fn path))))
         avg-ild-fn (fn [[path-name path] index]
-                     (let [avg-ild (try (repeatedly-generate-fn path index)
+                     (let [avg-ild (try (doall (average (repeatedly-generate-fn path index)))
                                         (catch Exception ex
                                           (log/error (.getMessage ex))
                                           :failed))]


Log when we cleanup files

Log when we cleanup files

--- src/vip/data_processor/cleanup.clj
+++ src/vip/data_processor/cleanup.clj
@@ -7,5 +7,6 @@
                  (.toFile file)
                  file)]
       (when (.exists file)
+        (log/info "Removing" (.toString file))
         (.delete file))))
   ctx)


split up the work to improve fps

split up the work to improve fps

--- spinning/src/app/core.cljs
+++ spinning/src/app/core.cljs
@@ -252,13 +252,15 @@

 (defn step-chan [cells]
   "Returns a channel containing a single map of the next generation of cells."
-  (let [cell-freq  (->> (keys cells) (mapcat neighbors) (frequencies))
-        generation (chan 1 (keep (partial cell-fate cells)))]
+  (let [generation   (chan 1 (keep (partial cell-fate cells)))
+        neighborhood (mapcat neighbors (keys cells))]
     (go
       (<! (timeout 0))
-      (onto-chan generation cell-freq)
-      (<! (timeout 0))
-      (<! (async/into {} generation)))))
+      (let [cell-neighbor-freq (frequencies neighborhood)]
+        (<! (timeout 0))
+        (onto-chan generation cell-neighbor-freq)
+        (<! (timeout 0))
+        (<! (async/into {} generation))))))

 (defn setup-gol! []
   (swap! state assoc-in [:gol :cells] (create-cells acorn)))


fix test-rmq-settings-from-config to also use :api-endpoint

--- test/brainbot/nozzle/core_test.clj
+++ test/brainbot/nozzle/core_test.clj
@@ -17,7 +17,7 @@
 (deftest test-rmq-settings-from-config
   (testing "no amqp-url"
     (is (= (inihelper/rmq-settings-from-config {inihelper/main-section-name {}})
-           {:username "guest", :password "guest", :vhost "/", :host "localhost", :port 5672})))
+           {:api-endpoint "http://localhost:15672" :username "guest", :password "guest", :vhost "/", :host "localhost", :port 5672})))
   (testing "with amqp-url"
     (is (= (inihelper/rmq-settings-from-config {inihelper/main-section-name {"amqp-url" "amqp://foo.com/host"}})
-           {:host "foo.com", :port 5672, :vhost "host", :username "guest", :password "guest"}))))
+           {:api-endpoint "http://foo.com:15672" :host "foo.com", :port 5672, :vhost "host", :username "guest", :password "guest"}))))


Improve test coverage for CLJS by including some tests that require eval

--- test/cljc/spectrace/core_test.cljc
+++ test/cljc/spectrace/core_test.cljc
@@ -28,20 +28,18 @@
     [[{:spec `integer? :path [] :val :a :in [] :trail []
        :spec-name ::x}]]

-    ;; eval is necessary to test the three cases below, but I don't
+    (s/and integer? even?)
+    :a
+    [[{:spec `(s/and integer? even?) :path [] :val :a :in [] :trail []}
+      {:spec `integer? :path [] :val :a :in [] :trail [0] :snapshots [:a]}]]
+
+    (s/and integer? even?)
+    3
+    [[{:spec `(s/and integer? even?) :path [] :val 3 :in [] :trail []}
+      {:spec `even? :path [] :val 3 :in [] :trail [1] :snapshots [3 3]}]]
+
+    ;; eval is necessary to test the following case, but I don't
     ;; know how we can prepare it for CLJS at the moment.
-    #?@(:clj
-        ((s/and integer? even?)
-         :a
-         [[{:spec `(s/and integer? even?) :path [] :val :a :in [] :trail []}
-           {:spec `integer? :path [] :val :a :in [] :trail [0] :snapshots [:a]}]]))
-
-    #?@(:clj
-        ((s/and integer? even?)
-         3
-         [[{:spec `(s/and integer? even?) :path [] :val 3 :in [] :trail []}
-           {:spec `even? :path [] :val 3 :in [] :trail [1] :snapshots [3 3]}]]))
-
     #?@(:clj
         ((s/and integer? (s/conformer (fn [x] (mod x 2))) zero?)
          3
@@ -246,45 +244,41 @@
        :trail []}
       {:spec `keyword? :path [] :val 42 :in [] :trail [::z] :spec-name ::z}]]

-    ;; eval is necessary to test the two cases below, but I don't
-    ;; know how we can prepare it for CLJS at the moment.
-    #?@(:clj
-        ((s/merge (s/keys :req-un [::x]) (s/keys :req-un [::y]))
-         {:x :a}
-         [[{:spec `(s/merge (s/keys :req-un [::x]) (s/keys :req-un [::y]))
-            :path [:x]
-            :val {:x :a}
-            :in [:x]
-            :trail []}
-           {:spec `(s/keys :req-un [::x]) :path [:x] :val {:x :a} :in [:x]
-            :trail [0]}
-           {:spec `integer? :path [] :val :a :in [] :spec-name ::x
-            :trail [0 :x]}]
-          [{:spec `(s/merge (s/keys :req-un [::x]) (s/keys :req-un [::y]))
-            :path []
-            :val {:x :a}
-            :in []
-            :trail []}
-           {:spec `(s/keys :req-un [::y]) :path [] :val {:x :a} :in []
-            :trail [1]}
-           {:spec `(fn [~'%] (contains? ~'% :y)) :path [] :val {:x :a} :in []
-            :trail [1]}]]))
-
-    #?@(:clj
-        ((s/merge (s/keys :req-un [::x]) (s/keys :req-un [::y]))
-         {:x 1 :y 'foo}
-         [[{:spec `(s/merge (s/keys :req-un [::x]) (s/keys :req-un [::y]))
-            :path [:y]
-            :val {:x 1 :y 'foo}
-            :in [:y]
-            :trail []}
-           {:spec `(s/keys :req-un [::y])
-            :path [:y]
-            :val {:x 1 :y 'foo}
-            :in [:y]
-            :trail [1]}
-           {:spec `string? :path [] :val 'foo :in [] :trail [1 :y]
-            :spec-name ::y}]]))
+    (s/merge (s/keys :req-un [::x]) (s/keys :req-un [::y]))
+    {:x :a}
+    [[{:spec `(s/merge (s/keys :req-un [::x]) (s/keys :req-un [::y]))
+       :path [:x]
+       :val {:x :a}
+       :in [:x]
+       :trail []}
+      {:spec `(s/keys :req-un [::x]) :path [:x] :val {:x :a} :in [:x]
+       :trail [0]}
+      {:spec `integer? :path [] :val :a :in [] :spec-name ::x
+       :trail [0 :x]}]
+     [{:spec `(s/merge (s/keys :req-un [::x]) (s/keys :req-un [::y]))
+       :path []
+       :val {:x :a}
+       :in []
+       :trail []}
+      {:spec `(s/keys :req-un [::y]) :path [] :val {:x :a} :in []
+       :trail [1]}
+      {:spec `(fn [~'%] (contains? ~'% :y)) :path [] :val {:x :a} :in []
+       :trail [1]}]]
+
+    (s/merge (s/keys :req-un [::x]) (s/keys :req-un [::y]))
+    {:x 1 :y 'foo}
+    [[{:spec `(s/merge (s/keys :req-un [::x]) (s/keys :req-un [::y]))
+       :path [:y]
+       :val {:x 1 :y 'foo}
+       :in [:y]
+       :trail []}
+      {:spec `(s/keys :req-un [::y])
+       :path [:y]
+       :val {:x 1 :y 'foo}
+       :in [:y]
+       :trail [1]}
+      {:spec `string? :path [] :val 'foo :in [] :trail [1 :y]
+       :spec-name ::y}]]

     (s/cat :int integer? :str string?)
     [1]
@@ -334,26 +328,25 @@
     #_[2 4]
     #_[[{:spec `(s/& integer? even?) :path [] :val [2 4] :in [1] :trail []}]]

-    ;; eval is necessary to test the two cases below, but I don't
+    (s/& (s/cat :x integer? :y integer?)
+         (fn [{:keys [x y]}] (< x y)))
+    [4 :a]
+    [[{:spec `(s/& (s/cat :x integer? :y integer?)
+                   (fn [{:keys [~'x ~'y]}] (< ~'x ~'y)))
+       :path [:y]
+       :val [4 :a]
+       :in [1]
+       :trail []}
+      {:spec `(s/cat :x integer? :y integer?)
+       :path [:y]
+       :val [4 :a]
+       :in [1]
+       :trail [0]
+       :snapshots [[4 :a]]}
+      {:spec `integer? :path [] :val :a :in [] :trail [0 :y]}]]
+
+    ;; eval is necessary to test the following case, but I don't
     ;; know how we can prepare it for CLJS at the moment.
-    #?@(:clj
-        ((s/& (s/cat :x integer? :y integer?)
-              (fn [{:keys [x y]}] (< x y)))
-         [4 :a]
-         [[{:spec `(s/& (s/cat :x integer? :y integer?)
-                        (fn [{:keys [~'x ~'y]}] (< ~'x ~'y)))
-            :path [:y]
-            :val [4 :a]
-            :in [1]
-            :trail []}
-           {:spec `(s/cat :x integer? :y integer?)
-            :path [:y]
-            :val [4 :a]
-            :in [1]
-            :trail [0]
-            :snapshots [[4 :a]]}
-           {:spec `integer? :path [] :val :a :in [] :trail [0 :y]}]]))
-
     #?@(:clj
         ((s/& (s/cat :x integer? :y integer?)
               (fn [{:keys [x y]}] (< x y)))


Add test for date->pretty-string

Add test for date->pretty-string

--- test/cljs/my_money/utils_test.cljs
+++ test/cljs/my_money/utils_test.cljs
@@ -12,3 +12,8 @@
   (testing "Convert 2000 to 20,00€"
     (is (= "20,00€"
            (utils/amount->pretty-string 2000)))))
+
+(deftest test-converting-date-to-pretty-string
+  (testing "Date object for May 29th 1990 is formatted as 29.5.1990"
+    (is (= "29.5.1990"
+           (utils/date->pretty-string (js/Date. 1990 4 29))))))


Disabling display test for Travis

Disabling display test for Travis

--- test/funimage/test/imp/display.clj
+++ test/funimage/test/imp/display.clj
@@ -2,8 +2,9 @@
   (:use [funimage imp]
         [clojure.test]))

-(deftest test-show-imp
-  (let [imp1 (open-imp "http://mirror.imagej.net/images/blobs.gif")]
-    (show-imp imp1)
-    (is imp1)))
+; Disabling for Travis
+#_(deftest test-show-imp
+   (let [imp1 (open-imp "http://mirror.imagej.net/images/blobs.gif")]
+     (show-imp imp1)
+     (is imp1)))


initial test skeleton

initial test skeleton


Fix failing backend tests

Fix failing backend tests

--- test/metabase/api/dataset_test.clj
+++ test/metabase/api/dataset_test.clj
@@ -19,6 +19,7 @@
                :last_name $
                :last_login $
                :is_superuser $
+               :is_qbnewb $
                :common_name $}))

 (defn remove-ids-and-boolean-timestamps [m]


Update lifecycles in fault tolerance code.

--- test/onyx/peer/fault_tolerance.clj
+++ test/onyx/peer/fault_tolerance.clj
@@ -2,7 +2,6 @@
   (:require [onyx.helper-env :as helper-env :refer [->TestEnv map->TestEnv]]
             [clojure.core.async :refer [chan >!! <!! close! go-loop timeout thread alts!! sliding-buffer]]
             [midje.sweet :refer :all]
-            [onyx.peer.task-lifecycle-extensions :as l-ext]
             [onyx.extensions :as extensions]
             [com.stuartsierra.component :as component]
             [onyx.plugin.core-async :refer [take-segments!]]
@@ -62,11 +61,27 @@

 (def out-chan (chan (inc chan-size)))

-(defmethod l-ext/inject-lifecycle-resources :in
-  [_ _] {:core.async/chan in-chan})
+(defn inject-in-ch [event lifecycle]
+  {:core.async/chan in-chan})

-(defmethod l-ext/inject-lifecycle-resources :out
-  [_ _] {:core.async/chan out-chan})
+(defn inject-out-ch [event lifecycle]
+  {:core.async/chan out-chan})
+
+(def in-calls
+  {:lifecycle/before-task :onyx.peer.fault-tolerance/inject-in-ch})
+
+(def out-calls
+  {:lifecycle/before-task :onyx.peer.fault-tolerance/inject-out-ch})
+
+(def lifecycles
+  [{:lifecycle/task :in
+    :lifecycle/calls :onyx.peer.fault-tolerance/in-calls}
+   {:lifecycle/task :in
+    :lifecycle/calls :onyx.plugin.core-async/reader-calls}
+   {:lifecycle/task :out
+    :lifecycle/calls :onyx.peer.fault-tolerance/out-calls}
+   {:lifecycle/task :out
+    :lifecycle/calls :onyx.plugin.core-async/writer-calls}])

 (def incomplete
   (atom #{}))
@@ -76,76 +91,79 @@

 (def n-messages-total 100000)

-(try
-  (helper-env/add-peers test-env 9)
-  (let [load-data-ch (thread
-                       (loop [ls (repeatedly n-messages-total (fn [] {:id (java.util.UUID/randomUUID)}))]
-                         (when-let [segment (first ls)]
-                           (swap! incomplete conj (int-2 (int-1 segment)))
-                           (>!! in-chan segment)
-                           (recur (rest ls))))
-                       (>!! in-chan :done)
-                       (close! in-chan))
+(when false
+  (try
+    (helper-env/add-peers test-env 9)
+    (let [load-data-ch (thread
+                         (loop [ls (repeatedly n-messages-total (fn [] {:id (java.util.UUID/randomUUID)}))]
+                           (when-let [segment (first ls)]
+                             (swap! incomplete conj (int-2 (int-1 segment)))
+                             (>!! in-chan segment)
+                             (recur (rest ls))))
+                         (>!! in-chan :done)
+                         (close! in-chan))

-        job-id (:job-id (helper-env/run-job test-env
-                                            {:catalog catalog
-                                             :workflow workflow
-                                             :task-scheduler :onyx.task-scheduler/balanced}))
-        _ (Thread/sleep 4000)
-        task-peers (-> test-env
-                       :replica
-                       deref
-                       :allocations
-                       (get job-id))
+          job-id (:job-id (helper-env/run-job test-env
+                                              {:catalog catalog
+                                               :workflow workflow
+                                               :lifecycles lifecycles
+                                               :task-scheduler :onyx.task-scheduler/balanced}))
+          _ (Thread/sleep 4000)
+          task-peers (-> test-env
+                         :replica
+                         deref
+                         :allocations
+                         (get job-id))

-        task-ids (->> task-peers
-                      keys
-                      (map (partial extensions/read-chunk (:log (:env test-env)) :task))
-                      (map (juxt :name :id))
-                      (into {}))
+          task-ids (->> task-peers
+                        keys
+                        (map (partial extensions/read-chunk (:log (:env test-env)) :task))
+                        (map (juxt :name :id))
+                        (into {}))

-        non-input-task-ids (set (vals (dissoc task-ids :in)))
+          non-input-task-ids (set (vals (dissoc task-ids :in)))

-        remove-completed-ch (go-loop []
-                                     (let [v (<!! out-chan)]
-                                       (when (and v (not= v :done))
-                                         (swap! incomplete disj v)
-                                         (when (or (nil? (:a v))
-                                                   (nil? (:b v)))
-                                           (swap! bad-values conj v))
-                                         (recur))))
-        kill-ch (chan 1)
-        mess-with-peers-ch (go-loop []
-                                    (let [; average the the full circuit worth of timeouts
-                                          chaos-kill-ms (rand-int (* 3 batch-timeout 2))
-                                          [v ch] (alts!! [(timeout chaos-kill-ms) kill-ch])]
-                                      (when-not (= ch kill-ch)
-                                        (try
-                                          (when-let [non-input-peers (->> (get (:allocations @(:replica test-env)) job-id)
-                                                                          (filter (fn [[task-id peers]]
-                                                                                (and (> (count peers) 1)
-                                                                                (non-input-task-ids task-id))))
-                                                                          vals
-                                                                          flatten
-                                                                          seq)]
-                                            (when-let [peer-val (helper-env/lookup-peer test-env (rand-nth non-input-peers))]
-                                              (println "Killing a peer")
-                                              (helper-env/remove-peer test-env peer-val)
-                                              (helper-env/add-peers test-env 1)))
-                                          (catch Exception e
-                                            (println "FAILURE MANAGING: " e)))
-                                        (recur))))]
-
-    (<!! remove-completed-ch)
-    (fact @incomplete => #{})
-    (let [after-done (loop [after-done #{}]
-                       (let [[v ch] (alts!! [out-chan (timeout 10000)])]
-                         (if v
-                           (recur (conj after-done v))
-                           after-done)))]
-      (fact after-done => #{}))
+          remove-completed-ch (go-loop []
+                                       (let [v (<!! out-chan)]
+                                         (println "got " v)
+                                         (when (and v (not= v :done))
+                                           (swap! incomplete disj v)
+                                           (when (or (nil? (:a v))
+                                                     (nil? (:b v)))
+                                             (swap! bad-values conj v))
+                                           (recur))))
+          kill-ch (chan 1)
+          chaos-ch (go-loop []
+                            (let [; average the the full circuit worth of timeouts
+                                  chaos-kill-ms (rand-int (* 3 batch-timeout 2))
+                                  [v ch] (alts!! [(timeout chaos-kill-ms) kill-ch])]
+                              (when-not (and (= ch kill-ch) v)
+                                (try
+                                  (when-let [non-input-peers (->> (get (:allocations @(:replica test-env)) job-id)
+                                                                  (filter (fn [[task-id peers]]
+                                                                            (and (> (count peers) 1)
+                                                                                (non-input-task-ids task-id))))
+                                                                  vals
+                                                                  flatten
+                                                                  seq)]
+                                    (when-let [peer-val (helper-env/lookup-peer test-env (rand-nth non-input-peers))]
+                                      (println "Killing a peer")
+                                      (helper-env/remove-peer test-env peer-val)
+                                      (helper-env/add-peers test-env 1)))
+                                  (catch Exception e
+                                    (println "FAILURE MANAGING: " e)))
+                                (recur))))]
+      (<!! remove-completed-ch)
+      (println "All done")
+      (fact @incomplete => #{})
+      (let [after-done (loop [after-done #{}]
+                         (let [[v ch] (alts!! [out-chan (timeout 10000)])]
+                           (if v
+                             (recur (conj after-done v))
+                             after-done)))]
+        (fact after-done => #{}))
       (fact @bad-values => #{})
-    (close! kill-ch)
-    #_(<!! mess-with-peers-ch))
-  (finally
-    (component/stop test-env)))
+      (close! kill-ch)
+      #_(<!! mess-with-peers-ch))
+    (finally
+      (component/stop test-env))))


Fix broken tests.

Fix broken tests.

--- test/tranjlator/chat_room_test.clj
+++ test/tranjlator/chat_room_test.clj
@@ -129,7 +129,7 @@
            (a/<!! (:chan user2))
            (a/<!! (:chan user3)))

-      (are [x] (= (:content x) (clojure-response result))
+      (are [x] (= (:content x) (clojure-response {:result result} ))
            (a/<!! (:chan user1))
            (a/<!! (:chan user2))
            (a/<!! (:chan user3)))
@@ -141,7 +141,7 @@
            (a/<!! (:chan user2))
            (a/<!! (:chan user3)))

-      (are [x] (= (:content x) (clojure-response result))
+      (are [x] (= (:content x) (clojure-response {:result result}))
            (a/<!! (:chan user1))
            (a/<!! (:chan user2))
            (a/<!! (:chan user3)))))
@@ -164,7 +164,7 @@
       (a/<!! (:chan user)) ;; drop result of form1

       (a/<!! (:chan user)) ;; drop broadcast of form2
-      (is (= (:content (a/<!! (:chan user))) (clojure-response value))))))
+      (is (= (:content (a/<!! (:chan user))) (clojure-response {:result value}))))))

 (deftest test-ping
   (testing "When a user sends a clojure form all users see the form and the result as chat."


CMR-1419: Added granule iso tests

CMR-1419: Added granule iso tests

--- system-int-test/test/cmr/system_int_test/search/concept_metadata_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/concept_metadata_search_test.clj
@@ -15,8 +15,12 @@
             [cmr.mock-echo.client.echo-util :as e]
             [cmr.system-int-test.system :as s]
             [cmr.umm.iso-mends.collection :as umm-c]
+            [cmr.umm.iso-smap.collection :as umm-iso-c]
+            [cmr.umm.iso-smap.granule :as umm-iso-g]
             [clojure.string :as str]
-            [clj-time.format :as f]))
+            [clj-time.format :as f])
+  (:import cmr.umm.collection.UmmCollection
+           cmr.umm.granule.UmmGranule))

 (use-fixtures
   :each
@@ -45,14 +49,14 @@

 (defmethod result-matches? :default
   [format-key umm response]
-  (let [expected (:metadata (d/item->metadata-result false format-key umm))
-        metadata (:body response)]
-    (is (= expected metadata))))
+  (let [expected (umm/umm->xml umm format-key);(:metadata (d/item->metadata-result false format-key umm))
+        metadata-xml (:body response)]
+    (is (= expected metadata-xml))))

 (deftest retrieve-metadata-from-search-by-concept-id-concept-revision
-  ;; Grant permissions before creating data
-  ;; all collections in prov1 granted to guests
+  ;; Grant permissions before creating data.
+  ;; All collections in PROV1 granted to registered users.
   (e/grant-registered-users (s/context) (e/coll-catalog-item-id "provguid1"))
   (e/grant-registered-users (s/context) (e/gran-catalog-item-id "provguid1"))

@@ -149,7 +153,13 @@
               umm-gran1-1 :echo10 "application/echo10+xml" "G1200000003-PROV1" 1

               " echo10 granule revision 2"
-              umm-gran1-2 :echo10 "application/echo10+xml" "G1200000003-PROV1" 2))
+              umm-gran1-2 :echo10 "application/echo10+xml" "G1200000003-PROV1" 2
+
+               "iso-smap granule revision 1"
+              umm-gran1-1 :iso-smap "application/iso:smap+xml" "G1200000003-PROV1" 1
+
+              "iso-smap granule revision 2"
+              umm-gran1-2 :iso-smap "application/iso:smap+xml" "G1200000003-PROV1" 2))

       (testing "Requests for tombstone revision returns a 400 error"
         (let [{:keys [status errors] :as response} (search/get-search-failure-xml-data


A little refactoring

A little refactoring

--- src/cljam/util.clj
+++ src/cljam/util.clj
@@ -5,7 +5,7 @@
 (defn ubyte
   "Casts to byte avoiding an error about out of range for byte."
   [n]
-  {:pre [(>= n 0) (<= n 255)]}
+  {:pre [(<= 0 n 255)]}
   (byte (if (< n 0x80) n (- n 0x100))))

 (defn string->bytes [s]
@@ -98,8 +98,7 @@
 (defn char->compressed-base-low
   "Convert from a char to BAM nybble representation of a base in low-order nybble."
   [base]
-  (condp (fn [case-vec ch]
-           (some #(= ch %) case-vec)) base
+  (condp #(some #{%2} %1) base
     [\=]       (:eq compressed-bases-low)
     [\a \A]    (:a  compressed-bases-low)
     [\c \C]    (:c  compressed-bases-low)
@@ -121,8 +120,7 @@
 (defn char->compressed-base-high
   "Convert from a char to BAM nybble representation of a base in high-order nybble."
   [base]
-  (condp (fn [case-vec ch]
-           (some #(= ch %) case-vec)) base
+  (condp #(some #{%2} %1) base
     [\=]       (:eq compressed-bases-high)
     [\a \A]    (:a  compressed-bases-high)
     [\c \C]    (:c  compressed-bases-high)


remove {:human true} from many nominal pronouns so that generation doesn't get stuck as much looking for lexical complements

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1243,8 +1243,7 @@
                  :agr {:gender :fem
                        :person :1st
                        :number :sing}
-                 :sem {:human true
-                       :pred :I}
+                 :sem {:pred :I}
                  :subcat '()}}

        {:synsem {:cat :noun
@@ -1253,8 +1252,7 @@
                  :agr {:gender :masc
                        :person :1st
                        :number :sing}
-                 :sem {:human true
-                       :pred :I}
+                 :sem {:pred :I}
                  :subcat '()}}]
       "la"
       ;; TODO: refactor commonalities
@@ -1585,8 +1583,7 @@
              :agr {:gender :fem
                    :person :1st
                    :number :plur}
-             :sem {:human true
-                   :pred :noi}
+             :sem {:pred :noi}
              :subcat '()}}
     {:synsem {:cat :noun
               :pronoun true
@@ -1594,8 +1591,7 @@
              :agr {:gender :masc
                    :person :1st
                    :number :plur}
-              :sem {:human true
-                    :pred :noi}
+              :sem {:pred :noi}
               :subcat '()}}]

    "osservare" {:synsem {:cat :verb
@@ -1942,8 +1938,7 @@
               :agr {:person :2nd
                     :gender :fem
                     :number :sing}
-              :sem {:human true
-                    :pred :tu}
+              :sem {:pred :tu}
               :subcat '()}}
     {:synsem {:cat :noun
               :pronoun true
@@ -1951,10 +1946,8 @@
               :agr {:person :2nd
                     :gender :masc
                     :number :sing}
-              :sem {:human true
-                    :pred :tu}
+              :sem {:pred :tu}
               :subcat '()}}]
-
    "un"
        {:synsem {:cat :det
                  :def :indef
@@ -1967,7 +1960,6 @@
               :mass false
               :agr {:gender :fem
                     :number :sing}}}
-
    "uomo"
    (unify agreement-noun
           common-noun
@@ -1988,7 +1980,6 @@
                                                :boot-stem2 "usc"}}}]
              [(merge common {:synsem {:sem {:pred :go-out}}})
               (merge common {:synsem {:sem {:pred :exit}}})])
-
    "vedere"
    {:synsem {:cat :verb
              :sem {:pred :see}}
@@ -2024,8 +2015,6 @@
                                       :pronoun true
                                        :reflexive true
                                        :sem subject-semantics}}}})
-
-
    "vi"
    {:synsem {:cat :noun
              :pronoun true
@@ -2043,7 +2032,6 @@
                         :sem {:pred :win
                               :subj {:human true}
                               :obj {:human false}}}}
-
    "vino"
    (unify drinkable-noun
           agreement-noun
@@ -2072,8 +2060,7 @@
               :agr {:person :2nd
                     :gender :fem
                     :number :plur}
-              :sem {:human true
-                    :pred :voi}
+              :sem {:pred :voi}
               :subcat '()}}

     {:synsem {:cat cat-of-pronoun
@@ -2082,8 +2069,7 @@
               :agr {:person :2nd
                     :gender :masc
                     :number :plur}
-              :sem {:human true
-                    :pred :voi}
+              :sem {:pred :voi}
               :subcat '()}}]

     "volere" {:synsem {:cat :verb


Remove useless space

Remove useless space

--- src/whisper2cyanite/metric_store.clj
+++ src/whisper2cyanite/metric_store.clj
@@ -30,7 +30,7 @@

 (def fetch-cql
   (str "SELECT data, time FROM metric WHERE "
-       "tenant = '%s' AND rollup = %s  AND period = %s AND "
+       "tenant = '%s' AND rollup = %s AND period = %s AND "
        "path = '%s' AND time >= %s AND time <= %s;"))

 (defn- get-cassandra-insert


cljs-nusmods.main - Port over remaining Exhibit 3 code

Now the Module Finder page has pretty much all the functionality as
before its port, except for the `Select Modules for Timetable` input box
powered by the Select2 library. That is our next goal.

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

--- src/cljs/cljs_nusmods/main.cljs
+++ src/cljs/cljs_nusmods/main.cljs
@@ -164,7 +164,15 @@
               database     (aset js/window "database"
                                  (.create (.-Database Exhibit)))
               myExhibit    (aset js/window "exhibit" (.create Exhibit))]
-          (.loadData database (js-obj "items" modulesArray))
+          (.loadData
+            database
+            (js-obj "types"      (js-obj
+                                   "Module" (js-obj "pluralLabel" "Modules"))
+                    "properties" (js-obj
+                                   "mc"         (js-obj "valueType" "number")
+                                   "level"      (js-obj "valueType" "number")
+                                   "moduleType" (js-obj "valueType" "item"))
+                    "items"      itemsArray))
           (.configureFromDOM myExhibit))))

     ; Retrieve Exhibit 3.0 Library


review changes

review changes

--- src/cljs/cljs_repl_web/app.cljs
+++ src/cljs/cljs_repl_web/app.cljs
@@ -4,7 +4,8 @@
             [re-frame.core :refer [dispatch subscribe]]
             [re-complete.app :as complete-app]
             [replumb.ast :as ast]
-            [clojure.string :as str]))
+            [clojure.string :as str]
+            [replumb.ast :as ast]))

 (defn gist-showing?
   "Given a db, indicates if the gist login dialog is shown.
@@ -96,14 +97,16 @@
 ;;;;;;;;;;;;;;;;;;;;;

 (defn opening-excluded-chars [word excluded-chars]
-  (if ((set (map #(= (first word) %) excluded-chars)) true)
-    (opening-excluded-chars (apply str (rest word)) excluded-chars)
-    word))
+  (let [starts-with-excluded-char? ((set excluded-chars) (first word))]
+    (if starts-with-excluded-char?
+      (opening-excluded-chars (apply str (rest word)) excluded-chars)
+      word)))

 (defn closing-excluded-chars [word excluded-chars]
-  (if ((set (map #(= (last word) %) excluded-chars)) true)
-    (closing-excluded-chars (apply str (butlast word)) excluded-chars)
-    word))
+  (let [ends-with-excluded-char? ((set excluded-chars) (last word))]
+    (if ends-with-excluded-char?
+      (closing-excluded-chars (apply str (butlast word)) excluded-chars)
+      word)))

 (defn current-word [previous-input input]
   (->> input
@@ -122,6 +125,11 @@
         other-items (sort (vec (clojure.set/difference (set items-to-sort) (set lower-case-items))))]
     (apply conj other-items (reverse lower-case-items))))

+(defn sort-dictionary [dictionary]
+  (->> dictionary
+       sort-case-insensitive-way
+       lower-case-first))
+
 (defn create-dictionary [event console-key]
   (let [previous-input (subscribe [:get-previous-input console-key])
         options (subscribe [:get-options console-key])
@@ -131,17 +139,14 @@
                      (opening-excluded-chars trim-chars)
                      (closing-excluded-chars trim-chars))
         user-ns (keys (replumb.ast/ns-publics @replumb.repl.st 'cljs.user))
-        requires (get-in @replumb.repl.st [:cljs.analyzer/namespaces 'cljs.user :requires])
+        requires (ast/requires @replumb.repl.st 'cljs.user)
         cljs-user (get-functions-from-ns 'cljs.user)
         cljs-core (get-functions-from-ns 'cljs.core)
-        base-libs (concat cljs-user cljs-core)]
+        base-libs (concat cljs-user cljs-core)
+        list-of-requires-vars (apply concat (map (fn [[k v]]
+                                                   (map #(str k "/" %) (keys (ast/ns-publics @replumb.repl.st v))))
+                                                 requires))
+        created-dictionary (concat base-libs list-of-requires-vars)]
     (if (= new-text "")
       ""
-      (dispatch [:dictionary console-key (->> (map (fn [[k v]]
-                                                     (map #(str k "/" %) (keys (ast/ns-publics @replumb.repl.st v))))
-                                                   requires)
-                                              (map str)
-                                              (apply concat)
-                                              sort-case-insensitive-way
-                                              (concat base-libs)
-                                              lower-case-first)]))))
+      (dispatch [:dictionary console-key (sort-dictionary created-dictionary)]))))


Removes pluralization rule for "brother"

"Brethren" is an archaic plural form of "brother" and is only used in
religious contexts or fraternal orders. That would be a special case
where a library user could add the exception if needed.

--- src/clojure/contrib/inflect.clj
+++ src/clojure/contrib/inflect.clj
@@ -61,7 +61,6 @@
                                {
                                 "ox" "oxen",
                                 "child" "children",
-                                "brother" "brethen",
                                 "man" "men",
                                 "woman" "women",
                                 "foot" "feet",


[#212] fix supports-logs? (#213)

[#212] fix supports-logs? (#213)

* [#212] fix supports-logs?
* fix misplaced docstrings (found with clj-kondo)

--- src/etaoin/api.clj
+++ src/etaoin/api.clj
@@ -137,8 +137,9 @@
     (or (:sessionId result)               ;; default
         (:sessionId (:value result)))))   ;; firefox

-(defn delete-session [driver]
+(defn delete-session
   "Deletes a session. Closes a browser window."
+  [driver]
   (execute {:driver driver
             :method :delete
             :path [:session (:session @driver)]}))
@@ -813,8 +814,9 @@
                 :path [:session (:session @driver) :element el :rect]})
       (select-keys [:x :y])))

-(defn get-element-location [driver q]
+(defn get-element-location
   "Returns an element location on a page as a map with :x and :x keys."
+  [driver q]
   (get-element-location-el driver (query driver q)))

 ;;
@@ -1514,7 +1516,7 @@
 (defn supports-logs?
   "Checks whether a driver supports getting console logs."
   [driver]
-  (implemented? driver get-logs))
+  (implemented? driver get-logs*))

 (defn- dump-logs


Pick up episodes when video is added

Pick up episodes when video is added

--- src/video_server/watcher.clj
+++ src/video_server/watcher.clj
@@ -142,7 +142,9 @@
         (add-images folder title)))
     (when (:video added)
       (let [video (video-for-file folder file)]
-        (add-subtitles folder video)))))
+        (add-subtitles folder video)))
+    (when (:season added)
+      (process-title folder file))))

 (defn add-file
   "Adds a newly discovered file to the library and queues it for


refactor import test in prep for other formats

--- test/clj_money/import_test.clj
+++ test/clj_money/import_test.clj
@@ -8,6 +8,8 @@
             [clj-time.core :as t]
             [environ.core :refer [env]]
             [clj-factory.core :refer [factory]]
+            [clj-money.util :refer [file-ext
+                                    file-name]]
             [clj-money.io :refer [read-bytes]]
             [clj-money.serialization :as serialization]
             [clj-money.factories.user-factory]
@@ -29,14 +31,23 @@

 (use-fixtures :each (partial reset-db storage-spec))

-(def gnucash-sample
-  (io/input-stream "resources/fixtures/sample.gnucash"))
-
-(def import-context
+(defn- path->image
+  [path]
+  (let [ext (file-ext path)
+        filename (file-name path)]
+    {:body (-> path
+               io/input-stream
+               read-bytes)
+     :content-type (format "application/%s" ext)
+     :original-filename filename}))
+
+(def images
+  {:gnucash (map path->image ["resources/fixtures/sample.gnucash"])})
+
+(defn- import-context
+  [source-type]
   {:users [(factory :user, {:email "john@doe.com"})]
-   :images [{:body (read-bytes gnucash-sample)
-             :content-type "application/gnucash"
-             :original-filename "sample.gnucash"}]
+   :images (source-type images)
    :imports [{:entity-name "Personal"
               :image-id "sample.gnucash"}]})

@@ -137,7 +148,9 @@
     :balance 2000M}])

 (deftest import-a-simple-file
-  (let [context (serialization/realize storage-spec import-context)
+  (let [context (serialization/realize
+                  storage-spec
+                  (import-context :gnucash))
         user (-> context :users first)
         image (-> context :images first)
         imp (-> context :imports first)
@@ -191,7 +204,9 @@
               :image-id "budget_sample.gnucash"}]})

 (deftest receive-updates-asynchronously
-  (let [context (serialization/realize storage-spec import-context)
+  (let [context (serialization/realize
+                  storage-spec
+                  (import-context :gnucash))
         user (-> context :users first)
         image (-> context :images first)
         imp (-> context :imports first)


delete comment block

delete comment block

--- bigquery/src/gclouj/bigquery.clj
+++ bigquery/src/gclouj/bigquery.clj
@@ -318,18 +318,6 @@

 (defn query-job
   [service query {:keys [create-disposition write-disposition large-results? dry-run? destination-table use-cache? flatten-results? priority udfs]}]
-  (comment (let [{:keys [project-id dataset-id table-id]} destination-table
-                 builder                                  (QueryJobInfo/builder query)]
-             (.createDisposition builder (create-dispositions (or create-disposition :never)))
-             (.writeDisposition builder (write-dispositions (or write-disposition :append)))
-             (.allowLargeResults builder large-results?)
-             (.useQueryCache builder use-cache?)
-             (.flattenResults builder flatten-results?)
-             (when destination-table
-               (.destinationTable builder (TableId/of project-id dataset-id table-id)))
-             (.priority builder (priorities (or priority :batch)))
-             (to-clojure (.create service (.build builder) (into-array BigQuery$JobOption [])))))
-
   (let [{:keys [project-id dataset-id table-id]} destination-table
         priorities {:batch       (QueryJobConfiguration$Priority/BATCH)
                     :interactive (QueryJobConfiguration$Priority/INTERACTIVE)}


Changing wait detection to not 200

Changing wait detection to not 200

Up to now it's been retry on 404, but there might be some 400 responses
happening which is stopping the waits activating correctly.

--- test/kixi/integration/base.clj
+++ test/kixi/integration/base.clj
@@ -137,7 +137,7 @@
                            :throw-exceptions false
                            :transit-opts {:encode t/write-handlers
                                           :decode t/read-handlers}})]
-       (if (= 404 (:status md))
+       (if-not (= 200 (:status md))
          (do
            (when (zero? (mod cnt every-count-tries-emit))
              (prn (str "Waited " cnt " times for " url)))


Run tests against a non-ratelimited endpoint

--- test/day8/re_frame/http_fx_test.cljs
+++ test/day8/re_frame/http_fx_test.cljs
@@ -6,9 +6,16 @@
     [re-frame.core :as re-frame]
     [day8.re-frame.http-fx]))

-;;
-(s/def ::api-result
-  (s/keys :req-un [::type ::issues_url ::url ::public_repos])) ;; loose spec
+;; Spec from https://developer.github.com/v3/rate_limit/
+(s/def ::limit int?)
+(s/def ::remaining int?)
+(s/def ::reset int?)
+(s/def ::resource (s/keys :req-un [::limit ::remaining ::reset]))
+(s/def ::core ::resource)
+(s/def ::search ::resource)
+(s/def ::resources (s/keys :req-un [::core ::search]))
+(s/def ::api-result (s/keys :req-un [::resources]))
+

 ;; ---- FIXTURES ---------------------------------------------------------------
 ;; This fixture uses the re-frame.core/make-restore-fn to checkpoint and reset
@@ -79,7 +86,7 @@
   ;; to fail unless there is something wrong with your internet or github.
   (async done
     (re-frame/dispatch [::http-test {:method          :get
-                                     :uri             "https://api.github.com/orgs/day8"
+                                     :uri             "https://api.github.com/rate_limit"
                                      :timeout         5000
                                      :response-format (ajax/json-response-format {:keywords? true})
                                      :on-success      [::good-http-result done "test-token1"]
@@ -119,12 +126,13 @@
   ;; to fail unless there is something wrong with your internet or github.
   (async done
     (re-frame/dispatch [::http-test [{:method          :get
-                                      :uri             "https://api.github.com/orgs/day8"
+                                      :uri             "https://api.github.com/rate_limit"
                                       :timeout         5000
                                       :response-format (ajax/json-response-format {:keywords? true})
                                       :on-success      [::good-http-result done "test-token1"]
                                       :on-failure      [::bad-http-result done "test-token1"]}]])))

+; Commented out until we re-enable spec
 ;(deftest invalid-fx-test
 ;  (is (= ::s/invalid
 ;         (s/conform ::http-fx/request-map {})))


remove dead code (missing on last commit)

--- src-cljc/tourney_nerd/games.cljc
+++ src-cljc/tourney_nerd/games.cljc
@@ -59,38 +59,3 @@
    :field-id "field-34343"
    :schedule-id "time-2823232"
    :game-group-id "group-23238873"})
-
-;; -----------------------------------------------------------------------------
-;; Create Games from Round Robin Pools
-
-;; TODO: move to util namespace
-(defn str->int
-  "convert s to an Integer"
-  [s]
-  #?(:clj  (java.lang.Integer/parseInt s)
-     :cljs (js/parseInt s 10)))
-
-
-
-
-
-
-;; FIXME: this needs tests
-(defn create-games-from-pool
-  [division-id teams fields rounds rr-pool]
-  (let [games (atom [])
-        round-idx (atom 0)]
-    (doseq [row rr-pool]
-      (let [field-idx (atom 0)]
-        (doseq [matchup-str row]
-          (let [[teamA-num teamB-num] (str/split matchup-str #"v")
-                new-game (games/create-game {:division-id division-id
-                                             :game-group-id "FIXME"
-                                             :teamA-id (nth teams (dec (str->int teamA-num)))
-                                             :teamB-id (nth teams (dec (str->int teamB-num)))
-                                             :field-id (nth fields @field-idx)
-                                             :timeslot-id (nth rounds @round-idx)})]
-            (swap! games conj new-game))
-          (swap! field-idx inc)))
-      (swap! round-idx inc))
-    @games))


orbifoldInvariant3d.clj: completed the quotient-graph function

--- clojure/org/gavrog/clojure/orbifoldInvariant3d.clj
+++ clojure/org/gavrog/clojure/orbifoldInvariant3d.clj
@@ -36,7 +36,6 @@
     (into {} (for [idcs index-combinations
                    D (orbit-reps ds idcs)]
                [[idcs D] {:type (orbifold-type ds idcs D)
-                          :elms (orbit-elements ds idcs D) ;; for debugging
                           :adjs (sub-orbits idcs D)}]))))

 (defn- filter-graph [p g]
@@ -49,12 +48,20 @@
         b (:adjs v)]
     [a b]))

-(defn- classes [equiv pairs s]
+(defn- equivalence-classes [equiv pairs s]
   (let [join (fn [p [a b]] (if (equiv a b) (punion p a b) p))
         p (reduce join pempty pairs)
         seen (set (apply concat p))]
-    (concat p (map set (filter (comp not seen) s)))))
+    (concat p (map #(set [%]) (filter (comp not seen) s)))))

 (defn- quotient-graph [equiv g]
-  (let [cl (classes #(equiv (g %1) (g %2)) (edges g) (keys g))]
-    cl))
+  (let [classes (equivalence-classes #(equiv (g %1) (g %2)) (edges g) (keys g))
+        to-rep (into {} (for [cl classes, :let [a (first cl)], b cl]
+                          [b a]))]
+    (into {} (for [cl classes
+                   :let [key (to-rep (first cl))
+                         adjs (set (for [a cl
+                                         b (map to-rep (:adjs (g a)))
+                                         :when (not= b key)]
+                                     b))]]
+               [key (assoc (g key) :adjs adjs)]))))


Removed useless test helper.

Removed useless test helper.

--- app/test/weather/test_utils.clj
+++ app/test/weather/test_utils.clj
@@ -18,8 +18,3 @@
   (let [response @(http/get url)
         body (json/read-json (:body response))]
     (assoc response :body body)))
-
-(defn http-post
-  [url body]
-  @(http/post url {:body (json/write-str body)
-                   :headers {"Content-Type" "application/json"}}))


Minor changes

Minor changes

--- server/src/clinicico/server/handler.clj
+++ server/src/clinicico/server/handler.clj
@@ -179,12 +179,12 @@
              ["-p" "--port" "Port to listen to" :default 3000 :parse-fn #(Integer. %)]
              ["-r" "--repl" "nREPL port to listen to" :default 7888 :parse-fn #(Integer. %)]
              ["-d" "--development" "Run server in development mode" :default false :flag true])]
-    (def in-dev? (:development options))
+    (defonce in-dev? (:development options))
     (when (:help options)
       (println banner)
       (System/exit 0))
     (let [handler (if in-dev? (reload/wrap-reload app) app)]
-      (log/info "Running server on port" (:port options) "nREPL running on" (:repl options))
+      (log/info "Running server on port" (:port options) ";nREPL running on" (:repl options))
       (defonce repl-server (repl/start-server :port (:repl options)))
       (tasks/initialize)
       (run-server handler {:port (:port options)}))))


Fix OS X plan link

Fix OS X plan link

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -180,7 +180,7 @@
                                        "Note: this option only works if the project builds under an OS X plan. "
                                        "Configure that option "
                                        [:a {:href (routes/v1-org-settings-path {:org (:org_name plan)
-                                                                                :vcs_type (:vcs_type plan)
+                                                                                :vcs_type (-> plan :org :vcs_type)
                                                                                :_fragment "osx-pricing"})} "here"]
                                        "."]]
                                      [:p


Act on otfrom's comments.

Act on otfrom's comments.

--- src/kixi/hecuba/api/devices.clj
+++ src/kixi/hecuba/api/devices.clj
@@ -201,34 +201,72 @@
                        [:difference_series :co2 :kwh]))
         (merge {:upper_ts end-date :lower_ts start-date}))))

-(defn recreate-sensor [device_id user_id old-sensor new-sensor range session]
-  (let [updated-keys          (keys new-sensor)
-        old-synthetic-sensors (create-default-sensors {:readings [old-sensor]})
+(defn delete-old-synthetic-sensors
+  "Takes a sequence of sensors and deletes old synthetic sensors."
+  [session device_id user_id sensors]
+  (doseq [s sensors]
+    (when (:synthetic s)
+      (log/infof "Deleting synthetic sensor: %s : %s" device_id (:type s))
+      (sensors/delete s session))))
+
+(defn insert-new-synthetic-sensors
+  "Takes a sequence of sensors and inserts new synthetic sensors"
+  [session device_id user_id sensors]
+  (doseq [s sensors]
+    (when (:synthetic s)
+      (log/infof "Inserting sensor: %s : %s" device_id (:type s))
+      (let [metadata {:type (:type s) :device_id device_id}]
+        (sensors/insert session (assoc s :device_id device_id :user_id user_id) metadata)))))
+
+(defn update-original-sensor
+  "Updates original sensor and resets its dirty dates to lower_ts and upper_ts
+   so that calculations for new synthetic sensors can calculate over all data."
+  [session device_id user_id new-sensor range]
+  (let [refreshed-metadata (sensor-metadata (:type new-sensor) device_id range)]
+    (log/infof "Updating original sensor: %s" new-sensor)
+    (sensors/update session device_id (assoc new-sensor :device_id device_id :user_id user_id) refreshed-metadata)))
+
+(defn tidy-up-sensors
+  "Takes session, old sensor data, new sensor data. Updates original sensor and
+   recreates synthetic sensors. "
+  [session device_id user_id old-sensor new-sensor range]
+  (let [old-synthetic-sensors (create-default-sensors {:readings [old-sensor]})
         new-synthetic-sensors (create-default-sensors {:readings [(dissoc (m/deep-merge old-sensor new-sensor)
                                                                           :lower_ts :upper_ts :median :status)]})]
+    (delete-old-synthetic-sensors session device_id user_id (:readings old-synthetic-sensors))
+    (insert-new-synthetic-sensors session device_id user_id (:readings new-synthetic-sensors))
+    (update-original-sensor session device_id user_id new-sensor range)))
+
+(defn update-existing-sensors
+  "Updates original and synthetic sensors (used when unit or period remain the same."
+  [session device_id user_id old-sensor new-sensor]
+  (let [new-synthetic-sensors (create-default-sensors {:readings [(dissoc (m/deep-merge old-sensor new-sensor)
+                                                                          :lower_ts :upper_ts :median :status)]})]
+    (doseq [s (:readings new-synthetic-sensors)]
+      (log/infof "Updating sensor: %s : %s" device_id (:type s))
+      (sensors/update session device_id (assoc s :device_id device_id)))))
+
+(defn recreate-sensor
+  "Depending on edited fields, either deletes/iserts new synthetic sensors or updates
+  the existing onews."
+  [session device_id user_id old-sensor new-sensor range]
+  (let [updated-keys          (keys new-sensor)]
     (if (some (into #{} updated-keys) #{:unit :period})
       ;; Recreate because unit or period has changed
-      (do
-        ;; Deleting old synthetic sensor
-        (doseq [s (:readings old-synthetic-sensors)]
-          (when (:synthetic s)
-            (log/infof "Deleting synthetic sensor: %s : %s" device_id (:type s))
-            (sensors/delete s session)))
-        ;; Inserting new synthetic sensors
-        (doseq [s (:readings new-synthetic-sensors)]
-          (when (:synthetic s)
-            (log/infof "Inserting sensor: %s : %s" device_id (:type s))
-            (let [metadata {:type (:type s) :device_id device_id}]
-              (sensors/insert session (assoc s :device_id device_id :user_id user_id) metadata))))
-        ;; Updating original sensor and resetting its dirty dates to lower_ts and upper_ts
-        ;; so that calculations for new synthetic sensors can kick in
-        (let [refreshed-metadata (sensor-metadata (:type new-sensor) device_id range)]
-          (log/infof "Updating original sensor: %s" new-sensor)
-          (sensors/update session device_id (assoc new-sensor :device_id device_id) refreshed-metadata)))
+      (tidy-up-sensors session device_id user_id old-sensor new-sensor range)
       ;; Update existing one since nothing crucial has changed
-      (doseq [s (:readings new-synthetic-sensors)]
-        (log/infof "Updating sensor: %s : %s" device_id (:type s))
-        (sensors/update session device_id (assoc s :device_id device_id))))))
+      (update-existing-sensors session device_id user_id old-sensor new-sensor))))
+
+(defn add-new-sensor
+  "Creates new sensors and respective synthetic sensors."
+  [session device_id user_id new-sensor]
+  (let [new-sensors (create-default-sensors
+                     {:readings [(-> new-sensor
+                                     (dissoc :lower_ts :upper_ts
+                                             :median :status))]})]
+    (doseq [s (:readings new-sensors)]
+      (log/infof "Inserting new sensor: %s : %s" device_id (:type s))
+      (sensors/insert session (assoc s :device_id device_id :user_id user_id)))))

 (defn resource-put! [store ctx]
   (db/with-session [session (:hecuba-session store)]
@@ -247,15 +285,9 @@
                   {:keys [lower_ts upper_ts]} (m/all-sensor-information store device_id (:type new-sensor))]
               (if old-sensor
                 ;; sensor already exists - need to update/recreate synthetic sensors
-                (recreate-sensor device_id user_id old-sensor new-sensor {:start-date lower_ts :end-date upper_ts} session)
+                (recreate-sensor session device_id user_id old-sensor new-sensor {:start-date lower_ts :end-date upper_ts})
                 ;; sensor doesn't exist - adding new sensor
-                (let [new-sensors (create-default-sensors
-                                   {:readings [(-> new-sensor
-                                                   (dissoc :lower_ts :upper_ts
-                                                           :median :status))]})]
-                  (doseq [s (:readings new-sensors)]
-                    (log/infof "Inserting new sensor: %s : %s" device_id (:type s))
-                    (sensors/insert session (assoc s :device_id device_id :user_id user_id)))))))
+                (add-new-sensor session device_id user_id new-sensor))))
           (-> (search/searchable-entity-by-id entity_id session)
               (search/->elasticsearch (:search-session store)))
           (ring-response {:status 404 :body "Please provide valid entity_id and device_id"}))))))


удаление пользователя

удаление пользователя

--- src/ixinfestor/core_handler.clj
+++ src/ixinfestor/core_handler.clj
@@ -156,7 +156,15 @@

                     (ring.util.response/response row))))

-           )
+           (POST "/delete" request
+                 (-> request
+                     :params
+                     :id
+                     ((partial ix/com-delete-for-id ix/webuser))
+                     ring.util.response/response
+                     cw/error-response-json))
+
+           )
   )
 ;; END Users reference book
 ;;..................................................................................................
@@ -212,6 +220,7 @@
                  (ix/tag-tree-as-flat-groups)))

            ;; TAGS WORK ------------------------------------------------------
+
            (POST "/save" request
                  (-> request
                      :params
@@ -259,7 +268,7 @@
                         {:id (if (= tag-id "root") nil tag-id)})

                        (as-> query
-                           (let [f
+                           (let [fts-query (clojure.string/trim fts-query)]
                              (if (empty? fts-query) query
                                  (ix/webdoc-pred-search* query fts-query))))


missing quoting on deftype -prototype case

--- src/main/clojure/cljs/core.cljc
+++ src/main/clojure/cljs/core.cljc
@@ -1279,7 +1279,7 @@
   [tsym sym] `(.. ~tsym ~(to-property sym)))

 (core/defmethod extend-prefix :default
-  [tsym sym] `(.. ~tsym -prototype ~(to-property sym)))
+  [tsym sym] `(.. ~tsym ~'-prototype ~(to-property sym)))

 (core/defn- adapt-obj-params [type [[this & args :as sig] & body]]
   (core/list (vec args)


Use alias to refer to binding namespace

Use alias to refer to binding namespace

--- src/caesium/crypto/secretbox.clj
+++ src/caesium/crypto/secretbox.clj
@@ -1,11 +1,11 @@
 (ns caesium.crypto.secretbox
   "Bindings to the secretbox secret-key authenticated encryption scheme."
-  (:require [caesium.binding :refer [sodium defconsts]]
+  (:require [caesium.binding :as b]
             [caesium.util :as u]
             [caesium.byte-bufs :refer [buflen]])
   (:import [java.nio ByteBuffer]))

-(defconsts [keybytes noncebytes macbytes primitive])
+(b/defconsts [keybytes noncebytes macbytes primitive])

 (defn secretbox-easy-to-buf!
   "Encrypt with `crypto_secretbox_easy` into the given byte array.
@@ -14,7 +14,7 @@
   you want [[secretbox-easy]]."
   [^bytes out ^bytes msg ^bytes nonce ^bytes key]
   (let [mlen (buflen msg)]
-    (.crypto_secretbox_easy sodium out msg mlen nonce key)))
+    (.crypto_secretbox_easy b/sodium out msg mlen nonce key)))

 (defn secretbox-easy-to-byte-buf!
   "Like [[secretbox-easy-to-buf!]], but with a ByteBuffer output.
@@ -23,7 +23,7 @@
   the output byte buffer yourself. Otherwise, you want [[secretbox-easy]]."
   [^java.nio.ByteBuffer out ^bytes msg ^bytes nonce ^bytes key]
   (let [mlen (buflen msg)]
-    (.crypto_secretbox_easy sodium out msg mlen nonce key)))
+    (.crypto_secretbox_easy b/sodium out msg mlen nonce key)))

 (defn secretbox-easy
   "Encrypt with `crypto_secretbox_easy`.
@@ -48,7 +48,7 @@
   you want [[secretbox-open-easy]]."
   [^bytes out ^bytes ctext ^bytes nonce ^bytes key]
   (let [clen (long (buflen ctext))
-        res (.crypto_secretbox_open_easy sodium out ctext clen nonce key)]
+        res (.crypto_secretbox_open_easy b/sodium out ctext clen nonce key)]
     (if (= res 0)
       out
       (throw (RuntimeException. "Ciphertext verification failed")))))
@@ -63,7 +63,7 @@
   [out ctext ctextlen nonce key]
   ;; This takes an ctextlen argument because you can't tell the appropriate
   ;; length from the ctext ByteBuffer and the caller knows anyway.
-  (let [res (.crypto_secretbox_open_easy sodium
+  (let [res (.crypto_secretbox_open_easy b/sodium
                                          ^bytes out
                                          ^java.nio.ByteBuffer ctext
                                          ^long ctextlen


Fix spelling.

Fix spelling.

--- src/circleci/web/views/index.clj
+++ src/circleci/web/views/index.clj
@@ -54,7 +54,7 @@
           [:div.box_medium.feature.separator_r
             [:img {:src "img/icon_feature_02.png" :width 60 :height 55}]
             [:h3 "Lightning fast tests"]
-            [:p "Find out as soon as something breaks, using automatic paralleization, "
+            [:p "Find out as soon as something breaks, using automatic parallelization, "
                 "dependency analysis and test prioritization."]]

           [:div.box_medium.feature


remove another bad namespace convention for CLJS data structure

--- src/clj/cljs/tagged_literals.clj
+++ src/clj/cljs/tagged_literals.clj
@@ -4,7 +4,7 @@
 (defn read-queue
   [form]
   (assert (vector? form) "Queue literal expects a vector for its elements.")
-  (list 'cljs.core/into 'cljs.core.PersistentQueue/EMPTY form))
+  (list 'cljs.core/into 'cljs.core.PersistentQueue.EMPTY form))

 (defn read-uuid
   [form]


end-turn fixed

end-turn fixed

--- src/clj/funstructor/commands.clj
+++ src/clj/funstructor/commands.clj
@@ -115,6 +115,7 @@
     (u/log "Processing end-turn for game: " game-id)

     (gs/update-global-state gs/update-game game-id f/end-turn-for-player)
+    (send-game-updates game-id)
     (let [updated-game (gs/get-game (gs/current-global-state) game-id)]
       (when (f/turn-finished? updated-game)
         (gs/update-global-state gs/update-game game-id f/end-turn)


Return a 404 or a 500 if the production cannot be deleted

--- src/clj/mdr2/routes/services.clj
+++ src/clj/mdr2/routes/services.clj
@@ -118,10 +118,12 @@
                ;;:swagger {:security [{:apiAuth []}]}
                :parameters {:path {:id int?}}
                :handler (fn [{{{:keys [id]} :path} :parameters}]
-                          (let [deleted (db/delete-production {:id id})]
-                            (if (>= deleted 1)
-                              (no-content)
-                              (not-found))))}
+                          (if-let [p (prod/get-production id)]
+                            (let [res (prod/delete! p)]
+                              (if-not (fail/failed? res)
+                                (no-content)
+                                (internal-server-error)))
+                            (not-found)))}

       :patch {:summary "Patch a production, e.g. update the library_signature"
               ;;:middleware [wrap-restricted wrap-authorized]


Remove non-functioning code

Remove non-functioning code

--- src/clj/nightcode/controller.clj
+++ src/clj/nightcode/controller.clj
@@ -194,13 +194,7 @@
   (when-let [path (:selection @*pref-state)]
     (when-let [pane (get-in @*runtime-state [:editor-panes path])]
       (when-let [engine (some-> pane (.lookup "#webview") .getEngine)]
-        (e/save-file! path engine)))
-    ; if saving a build.boot file, refresh the build buttons
-    (let [file (io/file path)
-          parent-path (-> file .getParentFile .getCanonicalPath)]
-      (when (-> file .getName (= "build.boot"))
-        (when-let [pane (.lookup scene "#content")]
-          (b/show-boot-buttons! pane parent-path @*pref-state *runtime-state))))))
+        (e/save-file! path engine)))))

 (defn -onSave [this ^ActionEvent event]
   (-> event .getSource .getScene save!))


Add bind-exec helper to the main stream ns.

Because the ratpack internal api for manage execution
process has changed.

--- src/clojure/catacumba/stream.clj
+++ src/clojure/catacumba/stream.clj
@@ -27,6 +27,7 @@
             [catacumba.impl.stream.common :as stream.common])
   (:import org.reactivestreams.Publisher
            org.reactivestreams.Subscriber
+           ratpack.stream.Streams
            catacumba.impl.stream.pushstream.IPushStream
            catacumba.impl.stream.common.IPullStream
            clojure.lang.Seqable))
@@ -35,6 +36,10 @@
   "A polymorphic publisher constructor."
   [source]
   (stream/publisher source))
+
+(defn bind-exec
+  [source]
+  (Streams/bindExec source))

 (defn transform
   "A polymorphic publisher transformer."


Add `set-checked!` function for ListViews

--- src/clojure/neko/ui/listview.clj
+++ src/clojure/neko/ui/listview.clj
@@ -26,3 +26,10 @@
              (recur (inc i) rest (conj result curr))
              (recur (inc i) rest result)))))))

+(defn set-checked!
+  "Given a sequence of numbers checks the respective ListView
+  elements."
+  [lv checked-ids]
+  (doseq [i checked-ids]
+    (.setItemChecked lv i true)))
+


Drop non-idiomatic arity of `ffilter`.

Drop non-idiomatic arity of `ffilter`.

--- src/clojure/parkour/reducers.clj
+++ src/clojure/parkour/reducers.clj
@@ -131,8 +131,7 @@

 (defn ffilter
   "Returns the first item in `coll` for which `(pred item)` is true."
-  ([coll] (ffilter identity coll))
-  ([pred coll] (reduce (fn [_ x] (if (pred x) (reduced x))) nil coll)))
+  [pred coll] (reduce (fn [_ x] (if (pred x) (reduced x))) nil coll))

 (def keep
   "Like `keep`, but implemented in terms of `reduce`"


Fix grimoire munging

Fix grimoire munging

--- src/lt/plugins/inc_clojure.cljs
+++ src/lt/plugins/inc_clojure.cljs
@@ -41,11 +41,11 @@
 ;; from https://github.com/clojure-grimoire/grimoire/blob/cf69630e38f4f9c2c94351d1e8ef1547b61d9567/resources/API.md
 (defn munge-grimoire-var [s]
   (-> s
-      (replace "?" "_QMARK_")
-      (replace "." "_DOT_")
-      (replace "/" "_SLASH_")
-      (replace #"^_*" "")
-      (replace #"_*$" "")))
+      (s/replace "?" "_QMARK_")
+      (s/replace "." "_DOT_")
+      (s/replace "/" "_SLASH_")
+      (s/replace #"^_*" "")
+      (s/replace #"_*$" "")))

 (defn ->grimoire-url [ns var]
   ;; Hardcode latest version - not worth calculating version and


Add back in basic deduping to allow main execution path to work

In earlier code, I removed the functions that computed a resource deduping hash
from the catalog parsing/transformation code. My rationale was that as that
code doesn't really have any "domain" value, and exists purely as a storage
optimization, it really belongs with the rest of the persistence code.

But because I'm dumb, I forgot that taking that code out would break the
current (crappy/prototype) main execution path. I've put some basic dedupe code
back in, though this is purely a stop-gap to get things working again. Better
dedupe is coming.

--- src/com/puppetlabs/cmdb/core.clj
+++ src/com/puppetlabs/cmdb/core.clj
@@ -4,7 +4,8 @@
             [clojure.contrib.logging :as log]
             [clj-json.core :as json]
             [clojure.java.jdbc :as sql]
-            [clojure.contrib.duck-streams :as ds])
+            [clojure.contrib.duck-streams :as ds]
+            [digest])
   (:use [clojure.contrib.command-line :only (with-command-line print-help)]))

 ;; TODO: externalize this into a configuration file
@@ -46,14 +47,25 @@
     (let [row (first result-set)]
       (row :present))))

+(defn compute-hash
+  "Compute a hash for a given resource that will uniquely identify it
+  within a population."
+  [resource]
+  {:pre  [resource]
+   :post [(string? %)]}
+  (-> resource
+      (str)
+      (digest/sha-1)))
+
 (defn persist-resource!
   "Given a certname and a single resource, persist that resource and its parameters"
-  [certname {:keys [type title hash exported parameters] :as resource}]
+  [certname {:keys [type title exported parameters] :as resource}]
   ;; Have to do this to avoid deadlock on updating "resources" and
   ;; "resource_params" tables in the same xaction
   (sql/do-commands "LOCK TABLE resources IN EXCLUSIVE MODE")

-  (let [persisted? (resource-already-persisted? hash)]
+  (let [hash       (compute-hash resource)
+        persisted? (resource-already-persisted? hash)]

     (when-not persisted?
       ; Add to resources table
@@ -88,8 +100,8 @@
 then we'll lookup a resource with that key and use its hash."
   [certname edges resources]
   (let [rows  (for [{:keys [source target relationship]} edges
-                    :let [source-hash (get-in resources [source :hash])
-                          target-hash (get-in resources [target :hash])
+                    :let [source-hash (compute-hash (resources source))
+                          target-hash (compute-hash (resources target))
                           type        (name relationship)]]
                 {:certname certname :source source-hash :target target-hash :type type})]
     (apply sql/insert-records :edges rows)))


ok - I can't write macros :-(  - check in and xfer to faster machine to try again

--- dada-core/src/main/clojure/org/dada/core/utils.clj
+++ dada-core/src/main/clojure/org/dada/core/utils.clj
@@ -1,7 +1,9 @@
 (ns
  org.dada.core.utils
  (:import
-  [clojure.lang Atom])
+  [java.util Collection]
+  [clojure.lang Atom]
+  [org.dada.core Creator Getter Metadata])
  )

 ;; simplifies syntax for the destructuring of a record
@@ -32,3 +34,73 @@
      (str "#<" (.getSimpleName ^Class (.getClass object)) "@" (Integer/toHexString (System/identityHashCode object)) " " internals ">"))
   ([object]
      (print-object object "")))
+
+;;--------------------------------------------------------------------------------
+
+(defn make-pk-fn [^Metadata metadata]
+  (let [keys (.getPrimaryKeys metadata)
+	^Getter key-getter (.getPrimaryGetter metadata)]
+    (if (= (count keys) 1)
+      (fn [value] (.get key-getter value))
+      (let [^Creator key-creator (.getKeyCreator metadata)]
+	(println (str "KEY CREATOR=" (type key-creator) " : " key-creator))
+	(fn [value]
+	    (let [k (.get key-getter value)]
+	      (println (str "K=" k))
+	      (.create key-creator (into-array Object k))))))))
+
+;;--------------------------------------------------------------------------------
+
+(defmacro make-singleton-key-fn [datum-class key]
+  "return a fn that given a datum of class datum-class returns the value of .key applied to that datum."
+  ;; (let [datum 'datum#
+  ;; 	datum-with-meta (with-meta datum {:tag datum-class})]
+  ;;   `(fn [~datum-with-meta] (. ~datum ~key))
+  ;;   )
+  ;;(list 'fn [(with-meta 'datum {:tag datum-class})] (list '. 'datum key)))
+  `(fn [~(with-meta `datum# {:tag datum-class})] (. `datum# ~key))
+  )
+
+(defmacro make-compound-key-fn [datum-class keys]
+  "return a fn that given a datum of class datum-class and a set of
+keys, creates a key class that references an instance of datum-class
+and implements its hash code and equality in terms of the values
+associated with said keys on referenced instance and returns a fn that
+will manufacture and instance of this class that refers to an instance
+of datum-class. - i,e, creates a minimal footprint compound key."
+  (let [key-class (symbol (str datum-class "Key"))
+	datum (with-meta 'datum {:tag datum-class})
+	that-datum (with-meta 'that-datum {:tag datum-class})
+	that 'that
+	that-with-type (with-meta that {:tag key-class})
+	]
+    (eval
+     `(deftype ~key-class
+	[~datum]
+	Object
+	(^int hashCode [this]
+	      (+ ~@(map (fn [key] `(. ~datum ~key)) keys)))
+	(^boolean equals [this ~that]
+		  (and (not (nil? ~that))
+		       (instance? ~key-class ~that)
+		       ~@(map
+			  (fn [key]
+			      `(= (. ~datum ~key)
+				  (let [~that-datum (.datum ~that-with-type)]
+				    (. ~that-datum ~key))))
+			  keys)))
+;;	(^String toString [this]
+;;		 (str ~keys))
+	))
+    `(fn [datum#]
+     	 (new ~key-class datum#))
+    ))
+
+(defn xxx [x y] x)
+
+;; (defn make-ref-key-fn [data-class keys]
+;;   (if (instance? Collection keys)
+;; ;;    (make-compound-key-fn data-class keys)
+;;     (xxx data-class keys)
+;;     (make-singleton-key-fn data-class keys)
+;;     ))


Add search form.

Add search form.

--- src/beebster_clj/views.clj
+++ src/beebster_clj/views.clj
@@ -1,5 +1,5 @@
 (ns beebster-clj.views
-  (:use hiccup.core hiccup.util hiccup.page))
+  (:use hiccup.core hiccup.util hiccup.page hiccup.form))

 (def categories
   '("search" "popular" "highlights" "films" "nature"
@@ -17,7 +17,8 @@
         (for [[url description] links]
           [:li.active [:a {:href url} description]])
         (for [link categories]
-          [:li.active [:a {:href (apply str "/categories?category=" link)} link]])]]]]]))
+          [:li.active
+           [:a {:href (apply str "/categories?category=" link)} link]])]]]]]))

 (defn base-template
   "base html template for all beebster sites."
@@ -25,10 +26,8 @@
   (html
    [:head
     [:title title]
-    (include-css "/css/bootstrap.min.css")]))
-
-
-
+    (include-css "/css/bootstrap.min.css")
+    (include-css "/css/beebster.css")]))

 (defmacro category-template
@@ -47,7 +46,13 @@
   []
   (html
    (base-template "Index")
-   (header '(("/about" "About")))))
+   (header '(("/about" "About")))
+   [:div.sform
+    [:form {:method "post" :role "form" :action "/results"}
+     [:div.form-group
+      [:input.form-control {:type "text" :name "searchvalue"}]]
+     [:div.form-group
+      [:input.form-control {:type "submit" :value "Search"}]]]]))

 (defn about-page
   []


replace build labels server side so go and snap projects get filtered correctly

--- src/nevergreen/api/projects.clj
+++ src/nevergreen/api/projects.clj
@@ -2,18 +2,22 @@
   (:require [clj-cctray.core :as parser]
             [clj-cctray.filtering :as filtering]
             [clj-cctray.util :refer [in?]]
-            [clojure.string :refer [blank?]]
+            [clojure.string :refer [blank? replace]]
             [nevergreen.http :refer [http-get]]
             [nevergreen.servers :as servers]
             [nevergreen.security :as security]
-            [nevergreen.crypto :as crypt]))
+            [nevergreen.crypto :as crypt])
+  (:refer-clojure :exclude [replace]))
+
+(defn- replace-build-labels [webUrl]
+  (replace webUrl #"\/\d+(?:\/|$)" "/0/"))

 (defn invalid-scheme? [url]
   (or (blank? url)
       (not (re-find #"https?://" url))))

 (defn filter-by-urls [urls projects]
-  (filter #(in? urls (:web-url %)) projects))
+  (filter #(in? urls (replace-build-labels (:web-url %))) projects))

 (defn- invalid-url-error-message [url]
   (if (blank? url)


Show the braille genres in the braille subtoc

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -91,7 +91,7 @@

 (defn sub-toc [items fmt]
   [:fo:block
-   (keep #(sub-toc-entry items fmt %) layout/genres)])
+   (keep #(sub-toc-entry items fmt %) (if (= fmt :braille) layout/braille-genres layout/genres))])

 (def wrap (layout/wrapper ""))


Use '_' where the value isn't used later

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -730,7 +730,7 @@
    (impressum)])

 (defmethod document-sexp :hörfilm
-  [items fmt year issue _ _ {:keys [description]}]
+  [items fmt year _ _ _ {:keys [description]}]
   (let [title (layout/translations :catalog-hörfilm)]
     [:fo:root (style :font (root-attrs))
      (layout-master-set)
@@ -748,7 +748,7 @@
          (mapcat #(genre-sexp (get subitems %) fmt % 1 {:show-genre? false}) (keys subitems))])]]))

 (defmethod document-sexp :ludo
-  [items fmt year issue _ _ {:keys [description]}]
+  [items fmt year _ _ _ {:keys [description]}]
   (let [title (layout/translations :catalog-ludo)]
     [:fo:root (style :font (root-attrs))
      (layout-master-set)


making sure user has a valid pass

making sure user has a valid pass

--- src/celestial/security.clj
+++ src/celestial/security.clj
@@ -44,11 +44,15 @@
          param (<< "&login_failed=Y&user=~{user}")]
    (ring.util.response/redirect (<< "/login?~{param}"))))

+(defn user-with-pass [id]
+  {:post [(not-empty (% :password ))]}
+  (p/get-user! id))
+
 (defn secured-app [routes]
   (friend/authenticate
     (friend/wrap-authorize (user-tracking routes) roles/user)
     {:allow-anon? true
-     :credential-fn #(if (p/user-exists? (:username %)) (creds/bcrypt-credential-fn p/get-user! %) nil)
+     :credential-fn #(if (p/user-exists? (:username %)) (creds/bcrypt-credential-fn user-with-pass %) nil)
      :unauthenticated-handler #(assoc (workflows/http-basic-deny "basic-celestial" %) :body {:message "login failed" } )
      :workflows [(workflows/interactive-form :login-failure-handler login-redirect) (workflows/http-basic :realm "basic-celestial")]}))