Bishop rehosting restrictions

Bishop rehosting restrictions

--- src/clj/game/cards-programs.clj
+++ src/clj/game/cards-programs.clj
@@ -15,24 +15,32 @@
                                                          (handle-end-run state side)) ; remove the replace-access prompt
                                             :msg "shuffle a card into R&D"}} card))}]}

-
-
    "Au Revoir"
    {:events {:jack-out {:effect (effect (gain :credit 1)) :msg "gain 1 [Credits]"}}}

-
    "Bishop"
-   {:abilities [{:label "Host Bishop on a piece of ICE" :cost [:click 1]
-                 :choices {:req #(and (= (:type %) "ICE")
-                                      (= (last (:zone %)) :ices)
-                                      (not (some (fn [c] (has? c :subtype "Caïssa")) (:hosted %))))}
-                 :msg (msg "host it on " (if (:rezzed target) (:title target) "a piece of ICE"))
-                 :effect (effect (host target card))}]
+   {:abilities [{:cost [:click 1]
+                 :effect (req (let [b (get-card state card)
+                                    hosted? (:host b)
+                                    remote? (some #{:remote} (rest (butlast (:zone (:host b)))))]
+                                (resolve-ability state side
+                                 {:prompt (msg "Host Bishop on a piece of ICE protecting "
+                                            (if hosted? (if remote? "a central" "a remote") "any") " server")
+                                  :choices {:req #(if hosted?
+                                                    (and (if (some #{:remote} (rest (butlast (:zone (:host b)))))
+                                                           (some #{:hq :rd :archives} (rest (butlast (:zone %))))
+                                                           (some #{:remote} (rest (butlast (:zone %)))))
+                                                         (= (:type %) "ICE")
+                                                         (= (last (:zone %)) :ices)
+                                                         (not (some (fn [c] (has? c :subtype "Caïssa")) (:hosted %))))
+                                                    (and (= (:type %) "ICE")
+                                                         (= (last (:zone %)) :ices)
+                                                         (not (some (fn [c] (has? c :subtype "Caïssa")) (:hosted %)))))}
+                                  :msg (msg "host it on " (if (:rezzed target) (:title target) "a piece of ICE"))
+                                  :effect (effect (host target card))} card nil)))}]
     :events {:pre-ice-strength
              {:req (req (and (= (:cid target) (:cid (:host card))) (:rezzed target)))
               :effect (effect (ice-strength-bonus -2))}}}
-
-

    "Bug"
    {:req (req (some #{:hq} (:successful-run runner-reg)))}


add reagent

add reagent

--- src/cljs/bracketology/core.cljs
+++ src/cljs/bracketology/core.cljs
@@ -1,7 +1,22 @@
 (ns bracketology.core
   (:require [reagent.core :as r :refer [atom]]))

-(defonce app-state (atom {:text "Hello Chestnut!"}))
+(defonce app-state* (atom {:text "Hello Chestnut!"}))
+
+
+(comment
+
+  (reset! app-state* {:text "FooBar"})
+
+
+  )
+
+(defn app-view
+  [app]
+  [:div.container
+   [:p (:text @app)]])
+

 (defn main []
-  (r))
+  (r/render-component [app-view app-state*]
+                      (.getElementById js/document "app")))


cljs-nusmods.main - Update docs for add-module-types-to-exhibit-items

So it becomes more of an "action" style of phrasing

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

--- src/cljs/cljs_nusmods/main.cljs
+++ src/cljs/cljs_nusmods/main.cljs
@@ -85,8 +85,8 @@
     modulesArray))

 (defn- add-module-types-to-exhibit-items
-  "Given a JavaScript Array used as the `items` value for an Exhibit database,
-   adds all the `ModuleType` to the Array and returns it"
+  "Adds `ModuleType` information to a JavaScript Array used as the `items`
+   value for an Exhibit database, and returns the Array."
   [itemsArray]
   (.push itemsArray (js-obj "type" "ModuleType", "label" "Faculty"))
   (.push itemsArray (js-obj "type" "ModuleType", "label" "Breadth / UE"))


Try to make the card a pure component

Try to make the card a pure component

--- src/cljs/clojure_rest/core.cljs
+++ src/cljs/clojure_rest/core.cljs
@@ -38,7 +38,7 @@
 (defn filter-by-status
   "Filter card by status"
   [status cards]
-  (filter #(= status (-> % deref :status)) cards))
+  (filter #(= status (:status %)) (map second cards)))

  (defn filter-by-title
    "Keep only cards that contains the searched string inside their title"
@@ -112,38 +112,40 @@
 (defn render-card
   ; TODO - Use a message to with the card-id + path of the action
   "[NOT Pure] Render a card"
-  [card-ref]
-  (let [show-details (::show-details @card-ref)
-        toggle-details #(swap! card-ref update-in [::show-details] not)
-        title-style (if show-details :div.card__title--is-open :div.card__title)
-        details-style (when-not show-details {:style {:display "none"}})
-        on-remove-task #(swap! card-ref api/remove-task-at %)
-        on-check-task #(swap! card-ref update-in [:tasks % :done] not)
-        on-add-task #(swap! card-ref api/add-task %)
+  [cards-ref card]
+  (let [card-id (:card-id card)
+        details-style (when-not (::show-details card) {:style {:display "none"}})
+        title-style (if (::show-details card) :div.card__title--is-open :div.card__title)
+
+        on-toggle-card #(swap! cards-ref update-in [card-id ::show-details] not)
+        on-remove-task #(swap! cards-ref update-in [card-id] api/remove-task-at %)
+        on-check-task #(swap! cards-ref update-in [card-id :tasks % :done] not)
+        on-add-task #(swap! cards-ref update-in [card-id] api/add-task %)
         ]
+
     [:div.card
-     [:div {:style (card-side-color @card-ref)}]
-     [title-style {:on-click toggle-details} (:title @card-ref)]
+     [:div {:style (card-side-color card)}]
+     [title-style {:on-click on-toggle-card} (:title card)]
      [:div.card__details details-style
-      (:description @card-ref)
-      [render-tasks (:tasks @card-ref) on-remove-task on-check-task]
+      (:description card)
+      [render-tasks (:tasks card) on-remove-task on-check-task]
       [render-add-task on-add-task]
     ]]
   ))

 (defn render-column
-  [status card-refs]
+  [status cards-ref]
   [:div.list
    [:h1 (status->str status)]
-   (for [c (filter-by-status status card-refs)]
-     ^{:key (:card-id @c)} [render-card c])
+   (for [c (filter-by-status status @cards-ref)]
+     ^{:key (:card-id c)} [render-card cards-ref c])
   ])

 (defn render-board
-  [card-refs]
+  [cards-ref]
   [:div.app
    (for [status [:backlog :under-dev :done]]
-     ^{:key status} [render-column status card-refs])
+     ^{:key status} [render-column status cards-ref])
   ])

 (defn render-filter
@@ -176,15 +178,16 @@
   ; - And then you can assemble them (group-by or filter)
   (let [filter (r/cursor app-state [:filter])
         cards (r/cursor app-state [:cards])
-        on-toggle-all #(swap! cards api/toggle-all-cards)]
+        on-toggle-all #(swap! cards api/toggle-all-cards)
+        filtered-cards (reaction (filter-by-title @filter @cards))
+        ]
     (fn []
-      (let [filtered-cards (reaction (filter-by-title @filter @cards))
-            card-refs (reaction (map #(r/cursor cards [(first %)]) @filtered-cards))]
+      (let []
         [:div
          (render-filter filter)
          [render-add-card cards]
          [render-toggle-all on-toggle-all]
-         [render-board @card-refs]
+         [render-board filtered-cards] ;filtered-cards
         ]))
   ))


Correct google history integration

Correct google history integration

--- src/cljs/comic_reader/main.cljs
+++ src/cljs/comic_reader/main.cljs
@@ -11,7 +11,8 @@
             [secretary.core :as secretary
              :refer-macros [defroute]]
             [goog.events :as events]
-            [goog.history.EventType :as EventType]))
+            [goog.history.EventType :as EventType])
+  (:import goog.History))

 (enable-console-print!)

@@ -64,3 +65,4 @@
                             (.-body js/document)))

 (init!)
+(hook-browser-navigation!)


google and waze driving directions

google and waze driving directions

--- src/cljs/montheway/mmodern.cljs
+++ src/cljs/montheway/mmodern.cljs
@@ -29,20 +29,33 @@
     (.-formatted_address node)
     (str my-lat "," my-lng)))

+(defn from-query-current-location? []
+  (empty? (.-value (dom/getElement "directions-from"))))
+
 (defn to-query []
   (-> autocompleteTo .getPlace .-formatted_address))

 (defn section-id [num]
   (str "biz-" num))

-(defn google-maps-url [start way-point destination]
+(defn google-maps-url [start destination]
   (let [[start-lat start-lng] start
-        [way-lat way-lng] way-point
         [dest-lat dest-lng] destination]
-    (str "https://www.google.com/maps/dir/"
-         start-lat "," start-lng "/"
-         way-lat "," way-lng "/"
-         dest-lat "," dest-lng "/")))
+    (str "comgooglemaps://?saddr="
+         start-lat "," start-lng "&daddr="
+         dest-lat "," dest-lng)))
+
+(defn waze-maps-url [dest]
+  (let [[dest-lat dest-lng] dest]
+    (str "waze://?navigate=yes&ll=" dest-lat "," dest-lng )))
+
+(defn waze-maps-url-template [dest-text dest]
+  (if (from-query-current-location?)
+    [:p
+     [:small
+      [:a
+       {:href (waze-maps-url dest )}
+       (str "Waze directions to " dest-text)]]]))

 (deftemplate biz-template [start-point end-point businesses]
   (for [biz businesses]
@@ -76,20 +89,33 @@
           [:tr
            [:td {:class "text-right"}
             "Reviews"]
-           [:td (:review_count biz)]]
-          [:tr
-           [:td {:class "text-right"}]
-           [:td
-            [:small
-             [:a
-              {:href (google-maps-url start-point
-                                      (-> biz
-                                          :location
-                                          :coordinate
-                                          (select-keys [:latitude :longitude])
-                                          vals)
-                                      end-point)}
-              "Directions"]]]]]]]]]]))
+           [:td (:review_count biz)]]]]
+         [:p
+          [:small
+           [:a
+            {:href (google-maps-url start-point
+                                    (-> biz
+                                        :location
+                                        :coordinate
+                                        (select-keys [:latitude :longitude])
+                                        vals))}
+            "Google directions to way-point"]]]
+        [:p
+          [:small
+           [:a
+            {:href (google-maps-url (-> biz
+                                        :location
+                                        :coordinate
+                                        (select-keys [:latitude :longitude])
+                                        vals)
+                                    end-point)}
+            "Google directions to destination"]]]
+        (waze-maps-url-template "way-point" (-> biz
+                                                 :location
+                                                 :coordinate
+                                                 (select-keys [:latitude :longitude])
+                                                 vals))
+        (waze-maps-url-template "destination" end-point)]]]]))

 ;; Allows handling Nodelist like a seq
 (extend-type js/NodeList


Define some functions for cleaing up the trace

--- src/cljx/revue/interpreter.cljx
+++ src/cljx/revue/interpreter.cljx
@@ -92,7 +92,7 @@
     (assoc state
       :form (:code this)
       :env (extend-env (:env this) (:params this) args)
-      :cont `((::reset-env ~(:env state)) ~@(:cont state))))
+      :cont `((::return-from-call ~(:env state)) ~@(:cont state))))
   mem/StoredData
   (-->clojure [this store]
     this))
@@ -270,7 +270,7 @@
      (let [proc value
            [_ args] form]
        (apply-proc proc args state))
-     ::reset-env
+     ::return-from-call
      (assoc state
        :form nil
        :env (nth form 1))
@@ -299,12 +299,66 @@
                         (take-while
                          (fn [{:keys [form cont value]}] (or form cont value))
                          (iterate step (apply initial-state forms))))]
-       result
-       #_(dissoc (last result) :env))))
+       result)))
+
+
+;;; Functions for cleaning up the interpreter trace
+;;; ===============================================
+
+(defn recursively-remove-global-vars-in [d]
+  (cond
+   (map? d)
+   (into {}
+         (map (fn [[k v]]
+                (if (= k :env)
+                  (let [genv (global-env)]
+                    [k (into {} (keep (fn [[k1 v1]]
+                                        (if (contains? genv k1)
+                                          nil
+                                          [k1 (recursively-remove-global-vars-in v1)]))
+                                      v))])
+                  [k (recursively-remove-global-vars-in v)]))
+              d))
+   (or (sequential? d))
+   (if (= (first d) ::return-from-call)
+     ::return-from-call
+     (map recursively-remove-global-vars-in d))
+   :else
+   d))
+
+(defn remove-global-vars
+  "Removes all values from environments in a seq of states that are
+  defined in the global environment.  Does not take into account redefinitions!"
+  [states]
+  (map recursively-remove-global-vars-in states))
+
+(def *internal-ops* #{::eval-args ::collect-arg ::eval-proc})
+
+(defn remove-internal-forms
+  "Removes all forms that don't evaluate user code."
+  [states]
+  (keep (fn [{:keys [form] :as state}]
+          (if (or (nil? form)
+                  (and (sequential? form) (contains? *internal-ops* (first form))))
+            nil
+            state))
+        states))
+
+(defn remove-continuations
+  "Removes all continuations from states."
+  [states]
+  (map #(dissoc %1 :cont) states))
+
+(def cleanup-trace (comp remove-global-vars remove-internal-forms remove-continuations))
+

 ;;; Try the following examples:
 (comment
   (:value (last (interp '(+ 1 2))))
+  (clojure.pprint/pprint
+   (cleanup-trace
+    (interp '((lambda (f n) (if (<= n 1) n (* n (f f (- n 1)))))
+              (lambda (f n) (if (<= n 1) n (* n (f f (- n 1))))) 3))))
   (:value (last (interp '((lambda (f n) (if (<= n 1) n (* n (f f (- n 1)))))
                           (lambda (f n) (if (<= n 1) n (* n (f f (- n 1))))) 10))))
   (:value (last (interp '((lambda (f n) (if (<= n 1) n (* n (f f (- n 1)))))
@@ -318,6 +372,10 @@
                         '(f 1))))
   (:value (last (interp '(define f (lambda (n) (if (>= n 1) f 1)))
                         '(f 1))))
+  (clojure.pprint/pprint
+   (cleanup-trace
+    (interp '(define fact (lambda (n) (if (<= n 1) 1 (* (fact (- n 1)) n))))
+            '(fact 4))))
   (:value (last (interp '(define fact (lambda (n) (if (<= n 1) 1 (* (fact (- n 1)) n))))
                         '(fact 4))))
   (:value (last (interp '(define fact (lambda (n) (if (<= n 1) 1 (* (fact (- n 1)) n))))


minor

minor

--- src/clojure/migae/datastore.clj
+++ src/clojure/migae/datastore.clj
@@ -145,7 +145,7 @@

   java.util.Map$Entry
   (getKey [this]
-    (log/trace "java.util.Map$Entry getKey ")
+    ;; (log/trace "java.util.Map$Entry getKey ")
     (let [k (.getKey entity)]
       (ekey/to-keychain k)))
   ;; FIXME: just do (ekey/to-keychain entity)??


I think xy-charts are done now as well

I think xy-charts are done now as well

--- src/com/hypirion/clj_xchart.clj
+++ src/com/hypirion/clj_xchart.clj
@@ -5,7 +5,9 @@
                              XYSeries$XYSeriesRenderStyle
                              XChartPanel)
            (org.knowm.xchart.style Styler
+                                   AxesChartStyler
                                    Styler$LegendPosition
+                                   Styler$TextAlignment
                                    PieStyler$AnnotationType
                                    GGPlot2Theme
                                    MatlabTheme
@@ -64,6 +66,11 @@
   {:label PieStyler$AnnotationType/Label
    :label-and-percentage PieStyler$AnnotationType/LabelAndPercentage
    :percentage PieStyler$AnnotationType/Percentage})
+
+(def text-alignments
+  {:centre Styler$TextAlignment/Centre
+   :left Styler$TextAlignment/Left
+   :right Styler$TextAlignment/Right})

 (def legend-positions
   {:inside-n Styler$LegendPosition/InsideN
@@ -177,7 +184,114 @@
    plot (set-plot-style! plot)
    series (set-series-style! series)))

-
+(defn- set-axis-ticks!
+  [^AxesChartStyler styler
+   {:keys [labels marks padding visible line-visible]}]
+  (let [{:keys [color font]} labels]
+    (doto-cond
+     styler
+     color (.setAxisTickLabelsColor (colors color color))
+     font (.setAxisTickLabelsFont font)))
+  (let [{:keys [length color stroke visible]} marks]
+    (doto-cond
+     styler
+     length (.setAxisTickMarkLength (int length))
+     color (.setAxisTickMarksColor (colors color color))
+     stroke (.setAxisTickMarksStroke stroke)
+     (not (nil? visible)) (.setAxisTicksMarksVisible (boolean visible))))
+  (doto-cond
+   styler
+   padding (.setAxisTickPadding (int padding))
+   (not (nil? line-visible)) (.setAxisTicksLineVisible (boolean line-visible))
+   (not (nil? visible)) (.setAxisTicksVisible (boolean visible))))
+
+(defn- set-axis-title!
+  [^AxesChartStyler styler
+   {:keys [font visible padding]}]
+  (doto-cond
+   styler
+   font (.setAxisTitleFont font)
+   padding (.setAxisTitlePadding (int padding))
+   (not (nil? visible)) (.setAxisTitleVisible (boolean visible))))
+
+(defn- set-axis-plot!
+  [^AxesChartStyler styler
+   {:keys [grid-lines margin tick-marks]}]
+  (let [{:keys [horizontal? vertical? visible? color stroke]} grid-lines]
+    (doto-cond
+     styler
+     (not (nil? visible?)) (.setPlotGridLinesVisible (boolean visible?))
+     color (.setPlotGridLinesColor (colors color color))
+     stroke (.setPlotGridLinesStroke stroke)
+     (not (nil? horizontal?)) (.setPlotGridHorizontalLinesVisible (boolean horizontal?))
+     (not (nil? vertical?)) (.setPlotGridVerticalLinesVisible (boolean vertical?))))
+  (doto-cond
+   styler
+   margin (.setPlotMargin (int margin))
+   (not (nil? tick-marks)) (.setPlotTicksMarksVisible (boolean tick-marks))))
+
+(defn- set-x-axis-style!
+  [^AxesChartStyler styler
+   {:keys [label logarithmic? max min decimal-pattern
+           tick-mark-spacing-hint ticks-visible? title-visible?]}]
+  (let [{:keys [alignment rotation]} label]
+    (doto-cond
+     styler
+     alignment (.setXAxisLabelAlignment (text-alignments alignment alignment))
+     rotation (.setXAxisLabelRotation (int rotation))))
+  (doto-cond
+   styler
+   decimal-pattern (.setXAxisDecimalPattern decimal-pattern)
+   (not (nil? logarithmic?)) (.setXAxisLogarithmic (boolean logarithmic?))
+   max (.setXAxisMax (double max))
+   min (.setXAxisMin (double min))
+   tick-mark-spacing-hint (.setXAxisTickMarkSpacingHint (int tick-mark-spacing-hint))
+   (not (nil? ticks-visible?)) (.setXAxisTicksVisible (boolean ticks-visible?))
+   (not (nil? title-visible?)) (.setXAxisTitleVisible (boolean title-visible?))))
+
+(defn- set-y-axis-style!
+  [^AxesChartStyler styler
+   {:keys [label logarithmic? max min decimal-pattern
+           tick-mark-spacing-hint ticks-visible? title-visible?]}]
+  (let [{:keys [alignment rotation]} label]
+    (doto-cond
+     styler
+     alignment (.setYAxisLabelAlignment (text-alignments alignment alignment))))
+  (doto-cond
+   styler
+   decimal-pattern (.setYAxisDecimalPattern decimal-pattern)
+   (not (nil? logarithmic?)) (.setYAxisLogarithmic (boolean logarithmic?))
+   max (.setYAxisMax (double max))
+   min (.setYAxisMin (double min))
+   tick-mark-spacing-hint (.setYAxisTickMarkSpacingHint (int tick-mark-spacing-hint))
+   (not (nil? ticks-visible?)) (.setYAxisTicksVisible (boolean ticks-visible?))
+   (not (nil? title-visible?)) (.setYAxisTitleVisible (boolean title-visible?))))
+
+(defn- set-axes-style!
+  [^AxesChartStyler styler
+   {:keys [axis error-bars-color plot x-axis y-axis
+           date-pattern decimal-pattern locale marker timezone]}]
+  (let [ebc error-bars-color ;; error-bars-color is too long to be readable in these expressions
+        {axis-ticks :ticks axis-title :title} axis
+        {marker-size :size} marker]
+    (doto-cond
+     styler
+     axis-ticks (set-axis-ticks! axis-ticks)
+     axis-title (set-axis-title! axis-title)
+     date-pattern (.setDatePattern date-pattern)
+     decimal-pattern (.setDecimalPattern decimal-pattern)
+     ;; The logic here is as follows: You can specify a colour for the error
+     ;; bars. If the colour is :match-series, then the colour matches the series
+     ;; colour, but if you specify something else, you cannot match the series!
+     (and ebc (not= ebc :match-series)) (.setErrorBarsColor (colors ebc ebc))
+     (and ebc (not= ebc :match-series)) (.setErrorBarsColorSeriesColor false)
+     (= ebc :match-series) (.setErrorBarsColorSeriesColor true)
+     locale (.setLocale locale)
+     marker-size (.setMarkerSize marker-size)
+     plot (set-axis-plot! plot)
+     timezone (.setTimezone timezone)
+     x-axis (set-x-axis-style! x-axis)
+     y-axis (set-y-axis-style! y-axis))))

 ;; TODO: Add in font as a shortcut to set all fonts not yet set.

@@ -214,7 +328,9 @@
       (.getStyler chart)
       theme (.setTheme (themes theme theme))
       render-style (.setDefaultSeriesRenderStyle (xy-render-styles render-style)))
-     (set-default-style! (.getStyler chart) styling)
+     (doto (.getStyler chart)
+       (set-default-style! styling)
+       (set-axes-style! styling))
      (doto-cond
       chart
       title (.setTitle title)))))


added listing of posts of a month

added listing of posts of a month

--- src/blog/core.clj
+++ src/blog/core.clj
@@ -142,10 +142,18 @@
   (let [resp (local-redirect req "/")]
     (assoc-in resp [:session :logged-in] true)))

-(defn list-articles [page session]
+(defn list-articles-page [page session]
   (println "list")
   (let [files (article-files)
         data {:body (string/join (map article-partial (article-page-data page files)))
+              :recent-articles (recent-article-data files)
+              :archive-months (archive-article-data files)}]
+    {:body (list-template data)}))
+
+(defn list-articles-month [month session]
+  (println "list")
+  (let [files (article-files)
+        data {:body (string/join (map article-partial (article-month-data month files)))
               :recent-articles (recent-article-data files)
               :archive-months (archive-article-data files)}]
     {:body (list-template data)}))
@@ -173,17 +181,23 @@
 ; routes

 (defroutes blog-routes
-  (GET  "/login" {:as req}
+  (GET  "/login"
+        {:as req}
     (login req))
-  (POST "/login" {:as req}
+  (POST "/login"
+        {:as req}
     (process-login req))
-  (GET  "/" {session :session :as req}
-    (authenticated req (list-articles 0 session)))
-  (GET  "/articles/page/:page" {{page :page} :params session :session :as req}
-    (authenticated req (list-articles (Integer/parseInt page) session)))
-  (GET  "/articles/month/:month" {{month :month} :params session :session :as req}
-    (println "TODO"))
-  (GET  "/articles/:code" {{code :code} :params session :session :as req}
+  (GET  "/"
+        {session :session :as req}
+    (authenticated req (list-articles-page 0 session)))
+  (GET  "/articles/page/:page"
+        {{page :page} :params session :session :as req}
+    (authenticated req (list-articles-page (Integer/parseInt page) session)))
+  (GET  "/articles/month/:month"
+        {{month :month} :params session :session :as req}
+    (authenticated req (list-articles-month month session)))
+  (GET  "/articles/:code"
+        {{code :code} :params session :session :as req}
     (authenticated req (show-article code session)))
   (route/resources "/" {:root STATIC_RESOURCE_PATH})
   (route/not-found


Sketch of kvs scan-changes by refacotring scan-keys.

--- src/cbfg/kvs.cljs
+++ src/cbfg/kvs.cljs
@@ -58,6 +58,31 @@
                (merge m (or (atake state-work done-ch)
                             {:status :error :status-info :closed-ch})))))

+(defn make-scan-fn [scan-kind result-key get-entry]
+  (fn [actx state-ch m]
+     (let [from (:from m)
+           to (:to m)
+           res-m (dissoc m :status :status-info :partial)
+           res-ch (:res-ch m)
+           work-fn (fn [state kvs]
+                     (act scan-work actx
+                          (let [kc-clean (:clean kvs)]
+                            (doseq [[k v]
+                                    (subseq (into (sorted-map) (scan-kind kc-clean))
+                                            >= from < to)]
+                              (when-let [entry (get-entry kc-clean k v)]
+                                (when (not (:deleted entry))
+                                  (aput scan-work res-ch
+                                        (merge res-m {:partial :ok
+                                                      result-key key
+                                                      :entry entry})))))
+                            (aput scan-work res-ch
+                                  (merge res-m {:status :ok}))))
+                     nil)]
+       (act scan-start actx
+         (aput scan-start state-ch
+               [(kvs-ident-check (:kvs-ident m) work-fn) nil])))))
+
 (def op-handlers
   {:kvs-open
    (fn [actx state-ch m]
@@ -97,7 +122,7 @@
                                       (merge res-m {:partial :not-found :key key}))))
                             (aput multi-get res-ch
                                   (merge res-m {:status :ok}))))
-                     [state nil])]
+                     nil)]
        (act multi-get-start actx
          (aput multi-get-start state-ch
                [(kvs-ident-check (:kvs-ident m) work-fn) nil]))))
@@ -123,10 +148,10 @@
                [(kvs-ident-check (:kvs-ident m) work-fn) nil]))))

    :scan-keys
-   (fn [actx state-ch [res-ch name from-key to-key]])
+   (make-scan-fn :keys :key kc-entry-by-key-sq)

    :scan-changes
-   (fn [actx state-ch [res-ch name from-sq to-sq]])
+   (make-scan-fn :changes :sq (fn [kc sq-key entry] entry))

    :sync
    (fn [actx state-ch m]
@@ -139,12 +164,12 @@
                                                    (assoc :dirty (make-kc))))
                                      {:status :ok :status-info :synced}]))))})

-(defn make-kvs-mgr [actx]
+(defn make-kvs-mgr [actx & op-handlers-in]
   (let [cmd-ch (achan actx)
         state-ch (achan actx)]
     (act-loop kvs-mgr-in actx [tot-ops 0]
               (if-let [m (atake kvs-mgr-in cmd-ch)]
-                (if-let [op-handler (get op-handlers (:op m))]
+                (if-let [op-handler (get (or op-handlers-in op-handlers) (:op m))]
                   (do (op-handler kvs-mgr-in state-ch m)
                       (recur (inc tot-ops)))
                   (println :kvs-mgr-in-unknown-op-exit m))
@@ -153,10 +178,9 @@
     ; Using kvs-mgr-state to avoid atoms, which prevent time-travel.
     (act-loop kvs-mgr-state actx [state { :next-uuid 0 :kvss {} }]
               (if-let [[state-fn done-ch] (atake kvs-mgr-state state-ch)]
-                (if-let [[next-state done-res] (state-fn state)]
-                  (do (when (and done-ch done-res)
-                        (aput-close kvs-mgr-state done-ch done-res))
-                      (recur next-state))
-                  (println :kvs-mgr-state-fn-exit))
+                (let [[next-state done-res] (state-fn state)]
+                  (when (and done-ch done-res)
+                    (aput-close kvs-mgr-state done-ch done-res))
+                  (recur (or next-state state)))
                 (println :kvs-mgr-state-ch-exit)))
     cmd-ch))


Added :include-deleted option for kvs scan'ing.

--- src/cbfg/kvs.cljs
+++ src/cbfg/kvs.cljs
@@ -60,17 +60,17 @@

 (defn make-scan-fn [kc-kind scan-kind result-key get-entry]
   (fn [actx state-ch m]
-     (let [{:keys [kvs-ident kvs-snapshot from to res-ch]} m
+     (let [{:keys [kvs-ident kvs-snapshot from to include-deleted res-ch]} m
            cb (fn [state kvs]
                 (act scan-work actx
-                     (let [kc (kc-kind kvs)]
-                       (doseq [[k v] (subseq (into (sorted-map) (scan-kind kc))
-                                             >= from < to)]
+                     (let [kc (kc-kind kvs)] ; Either :clean or :dirty.
+                       (doseq [[k v](subseq (into (sorted-map)
+                                                  (scan-kind kc)) ; :keys or :changes.
+                                            >= from < to)]
                          (when-let [entry (get-entry kc k v)]
-                           (when (not (:deleted entry))
-                             (aput scan-work res-ch (merge m {:partial :ok
-                                                              result-key key
-                                                              :entry entry})))))
+                           (when (or include-deleted (not (:deleted entry)))
+                             (aput scan-work res-ch
+                                   (merge m {:partial :ok result-key key :entry entry})))))
                        (aput-close scan-work res-ch (merge m {:status :ok}))))
                 nil)]
        (if kvs-snapshot


Fix some Sablono warnings

Fix some Sablono warnings

--- test-cljs/frontend/devcards/test_morphs.cljs
+++ test-cljs/frontend/devcards/test_morphs.cljs
@@ -5,11 +5,11 @@
             [clojure.test.check.generators :as gen]
             [frontend.devcards.morphs :as morphs]
             [om.core :as om]
-            [om.next :as om-next :refer-macros [defui]])
+            [om.next :as om-next :refer-macros [defui]]
+            [sablono.core :as html :refer-macros [html]])
   (:require-macros
    [cljs.core.async.macros :refer [go]]
-   [devcards.core :as dc :refer [defcard deftest]]
-   [sablono.core :refer [html]]))
+   [devcards.core :as dc :refer [defcard deftest]]))

 (deftest signature-test
   (is (= {:type "div"


Law of interchange for applicative functors

This concludes part 2

--- test/clojureplayground/monads_learn_test.clj
+++ test/clojureplayground/monads_learn_test.clj
@@ -73,4 +73,15 @@
         ;Original example favors thread first macro -> but I think that
         ;in this case this explicit version makes more clear what is going on
         (is (= (<*> (pure List f) (pure List x))
-               (pure List (f x))))))))
+               (pure List (f x))))))
+
+    ;Iterchange
+    ;The result of applying an Applicative Functor u to the pure value of y
+    ; should be the same as taking the Applicative obtained by calling pure
+    ; with a function that applies its argument to y and then applying that to u
+
+    ;Haskell way: u <*> pure y = pure ($ y) <*> u
+    (testing "Interchange"
+      (let [u (pure List #(+ 10 %)) y 50]
+        (is (= (<*> u (pure List y))
+               (<*> (pure List #(% y)) u)))))))


Ditto

Ditto

--- test/clojurewerkz/cassaforte/test_helper.clj
+++ test/clojurewerkz/cassaforte/test_helper.clj
@@ -1,8 +1,8 @@
 (ns clojurewerkz.cassaforte.test-helper
   (:require [clojurewerkz.cassaforte.embedded :as e]
-            [clojurewerkz.cassaforte.client :as client])
-  (:use clojurewerkz.cassaforte.cql
-        clojurewerkz.cassaforte.query))
+            [clojurewerkz.cassaforte.client :as client]
+            [clojurewerkz.cassaforte.cql :refer :all]
+            [clojurewerkz.cassaforte.query :refer :all]))

 (declare session)


Fix Wrong number of args passed to: ex-info

clojure.lang.ArityException  Wrong number of args (1) passed to: clojure.core/ex-info

--- provider/pact-jvm-provider-lein/src/main/clojure/au/com/dius/pact/provider/lein/verify_provider.clj
+++ provider/pact-jvm-provider-lein/src/main/clojure/au/com/dius/pact/provider/lein/verify_provider.clj
@@ -72,7 +72,7 @@
     (if (not-empty failures)
       (do
         (.displayFailures verifier (into {} failures))
-        (throw (ex-info (str "There were " (count failures) " pact failures")))))))
+        (throw (ex-info (str "There were " (count failures) " pact failures")) {})))))

 (defn verify [verifier pact-info]
   (verify-providers verifier (:service-providers pact-info)))


Add online documentation to help menu

Add online documentation to help menu

and some other points, which are not implemented yet

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

--- src/conexp/contrib/gui/base.clj
+++ src/conexp/contrib/gui/base.clj
@@ -7,8 +7,8 @@
 ;; You must not remove this notice, or any other, from this software.

 (ns conexp.contrib.gui.base
-  (:import [java.awt.event WindowEvent])
-  (:use [conexp.base :only (defvar-, defvar, defnk, illegal-state, ns-doc)]
+  (:import [java.awt event.WindowEvent])
+  (:use [conexp.base :only (defvar-, defvar, defnk, illegal-state, ns-doc, unsupported-operation)]
         conexp.contrib.gui.util
         conexp.contrib.gui.repl
         conexp.contrib.gui.plugins
@@ -59,7 +59,23 @@
       )

     ;; Add Help menu at right position
-    (add-menus main-frame [:separator (menu :text "Help")])
+    (add-menus main-frame [:separator (menu :text "Help"
+                                            :items
+                                            [(menu-item :text "Online Documentation"
+                                                        :listen [:action (fn [_]
+                                                                           (with-swing-error-msg main-frame "Error"
+                                                                             (let [desktop (java.awt.Desktop/getDesktop)]
+                                                                               (when-not (.isSupported desktop java.awt.Desktop$Action/BROWSE)
+                                                                                (unsupported-operation "Not supported"))
+                                                                               (.browse (java.awt.Desktop/getDesktop)
+                                                                                (java.net.URI. "http://github.com/exot/conexp-clj/wiki")))))])
+                                             (menu-item :text "Report Bug"
+                                                        :enabled? false)
+                                             :separator
+                                             (menu-item :text "License"
+                                                        :enabled? false)
+                                             (menu-item :text "About"
+                                                        :enabled? false)])])

     main-frame))


fix summary test to account for new functions added to v5-summary-branch

--- test/vip/data_processor/db/postgres_test.clj
+++ test/vip/data_processor/db/postgres_test.clj
@@ -58,4 +58,4 @@
         v3-out-ctx (v5-summary-branch v3-ctx)
         v5-out-ctx (v5-summary-branch v5-ctx)]
     (is (= (count (v3-out-ctx :pipeline)) 0))
-    (is (= (count (v5-out-ctx :pipeline)) 2))))
+    (is (= (count (v5-out-ctx :pipeline)) 4))))


Fixed multiple bugs in init.clj

Fixed multiple bugs in init.clj

--- src/ctia/init.clj
+++ src/ctia/init.clj
@@ -2,30 +2,21 @@
   (:require [ctia.auth :as auth]
             [ctia.auth.allow-all :as allow-all]
             [ctia.auth.threatgrid :as threatgrid]
-            [ctia.properties :refer [properties]]
+            [ctia.properties :as p]
             [ctia.store :as store]
             [ctia.stores.es.store :as es]
             [ctia.lib.es.index :as es-index]
             [ctia.stores.atom.store :as as]))

 (defn init-auth-service! []
-  (let [auth-service-type (get-in @properties [:auth :service :type])]
-    {case auth-service-type
+  (let [auth-service-type (get-in @p/properties [:auth :service :type])]
+    (case auth-service-type
       :allow-all (reset! auth/auth-service (allow-all/->AuthService))
       :threatgrid (reset! auth/auth-service (threatgrid/make-auth-service
                                               (threatgrid/make-whoami-service)))
       (throw (ex-info "Auth service not configured"
                       {:message "Unknown service"
-                       :requested-service auth-service-name}))}))
-
-(defn init-store-service! []
-  (let [store-service-default (or (get-in @properties [:store :service :default]) :memory)]
-    {case store-service-default
-     :es (init-es-store!)
-     :memory (init-mem-store!)
-     (throw (ex-info "Store service not configured"
-                     {:message "Unknown service"
-                      :requested-service store-service-default}))}))
+                       :requested-service auth-service-type})))))

 (defn init-mem-store! []
   (let [store-impls {store/actor-store     as/->ActorStore
@@ -63,7 +54,16 @@
     (doseq [[store impl-fn] store-impls]
       (reset! store (impl-fn store-state)))))

+(defn init-store-service! []
+  (let [store-service-default (or (get-in @p/properties [:store :service :default]) :memory)]
+    (case store-service-default
+      :es (init-es-store!)
+      :memory (init-mem-store!)
+      (throw (ex-info "Store service not configured"
+                      {:message "Unknown service"
+                       :requested-service store-service-default})))))
+
 (defn init! []
-  (properties/init!)
+  (p/init!)
   (init-auth-service!)
   (init-mem-store!))


(maint) Remove unneeded catalog inputs relationship

The relationships map is used to provide implicit subqueries to other
query entities. The default is to allow implicit subqueries by certname,
which is provided by the `certname-relations` map. The only reason to
add anything to the map is if you'd like it to support an implicit
subquery to an entity that doesn't return certname, like the environment
entity, or has duplicate entries for a certname, such as an implicit
subquery between fact_paths and fact_contents.

--- src/puppetlabs/puppetdb/query_eng/engine.clj
+++ src/puppetlabs/puppetdb/query_eng/engine.clj
@@ -743,9 +743,7 @@
      :selection {:from [:catalog_inputs]
                  :left-join [:certnames
                              [:= :certnames.id :catalog_inputs.certname_id]]}
-     :relationships (merge certname-relations
-                           {"certnames" {:local-columns ["certname" "catalog_uuid"]
-                                         :foreign-columns ["certname" "catalog_inputs_uuid"]}})
+     :relationships certname-relations
      :entity :catalog-input-contents
      :alias "catalog_input_contents"
      :subquery? false


make the possible-hosts function more readable

--- src/bzzz/core.clj
+++ src/bzzz/core.clj
@@ -34,15 +34,16 @@
 (defn not-doing-gc? [than]
   (let [diff (- (get (second than) :next-gc-at (+ @timer* 100000)) @timer*)]
     (not (< (abs diff) 2)))) ;; regardless if we are 2 seconds before gc
-;; or 2 seconds after, try to skip this host
+                             ;; or 2 seconds after, try to skip this host

 (defn possible-hosts [list]
-  (let [p (filter #(and (rescent? %1) (not-doing-gc? %1)) list)]
-    (if (= 0 (count p))
-      (let [more (filter rescent? list)]
-        (log/debug "found host after ignoring the gcing ones, dump:" list @timer* @discover-hosts* @peers*)
-        (first (rand-nth more)))
-      (first (rand-nth p)))))
+  (let [rescent (filter rescent? list)]
+    (let [not-doing-gc (filter not-doing-gc? rescent)]
+      (if (= 0 (count not-doing-gc))
+        (do
+          (log/debug "found host after ignoring the gcing ones, dump:" list @timer* @discover-hosts* @peers*)
+          (first (rand-nth rescent)))
+        (first rand-nth not-doing-gc)))))

 (defn peer-resolve [identifier]
   (let [t0 (time-ms)


fix bug in arguments to featureCounts

fix bug in arguments to featureCounts

--- services/gen-feature-counts.clj
+++ services/gen-feature-counts.clj
@@ -7,7 +7,7 @@
                 :args ["#1", "#2", "#3" ]} ; eid, comparison-file, rep?
          :fcnt {:type "func"
                 :name "featureCounts"
-                :args ["#3", "#4"]} ; feature-type, gtf
+                :args ["#4", "#5"]} ; feature-type, gtf

          :edges {:dir [:fcnt]}}


clarify transaction test

clarify transaction test

--- test/clj_money/models/transactions_test.clj
+++ test/clj_money/models/transactions_test.clj
@@ -957,7 +957,7 @@
                                                      (= (:account-id item)
                                                         (:id pets)))
                                                    %)))
-        _ (transactions/update to-update)
+        result (transactions/update to-update)
         expected-items [{:index 2
                          :quantity 101M
                          :balance 306M}
@@ -969,10 +969,10 @@
                          :balance 103M}]
         actual-items (map #(select-keys % [:index :quantity :balance])
                           (items-by-account (:id groceries)))]
-    (testing "item values are correct"
-      (is (= expected-items actual-items)
-          "The Pets account should have the correct items"))
-    (assert-account-quantities pets 0M groceries 306M checking 694M)))
+    (is (valid? result))
+    (assert-account-quantities pets 0M groceries 306M checking 694M)
+    (is (= expected-items actual-items)
+          "The account for the changed item should have the correct items")))

 (deftest update-a-transaction-add-item
   (let [context (realize add-remove-item-context)


add unit test for changing actions

add unit test for changing actions

--- test/clj_money/models/transactions_test.clj
+++ test/clj_money/models/transactions_test.clj
@@ -682,11 +682,80 @@
              (:balance (accounts/reload storage-spec rent)))
           "The rend account has the correct balance after update"))))

+(def change-action-context
+  {:users [(factory :user, {:email "john@doe.com"})]
+   :entities [{:name "Personal"}]
+   :accounts [{:name "Checking"
+               :type :asset}
+              {:name "Salary"
+               :type :income}
+              {:name "Groceries"
+               :type :expense}]
+   :transactions [{:transaction-date (t/local-date 2016 3 2)
+                   :entity-id "Personal"
+                   :items [{:action :debit
+                            :account-id "Checking"
+                            :amount 1000}
+                           {:action :credit
+                            :account-id "Salary"
+                            :amount 1000}]}
+                  {:transaction-date (t/local-date 2016 3 9)
+                   :entity-id "Personal"
+                   :items [{:action :debit
+                            :account-id "Groceries"
+                            :amount 103}
+                           {:action :credit
+                            :account-id "Checking"
+                            :amount 103}]}
+                  {:transaction-date (t/local-date 2016 3 16)
+                   :entity-id "Personal"
+                   :items [{:action :debit
+                            :account-id "Groceries"
+                            :amount 12}
+                           {:action :credit
+                            :account-id "Checking"
+                            :amount 12}]}
+                  {:transaction-date (t/local-date 2016 3 23)
+                   :entity-id "Personal"
+                   :items [{:action :debit
+                            :account-id "Groceries"
+                            :amount 101}
+                           {:action :credit
+                            :account-id "Checking"
+                            :amount 101}]}]})
+
+(deftest update-a-transaction-change-action
+  (let [context (serialization/realize storage-spec change-action-context)
+        [checking
+         salary
+         groceries] (:accounts context)
+        [t1 t2 t3 t4] (:transactions context)
+        updated (transactions/update storage-spec (-> t3
+                                                      (assoc-in [:items 0 :action] :credit)
+                                                      (assoc-in [:items 1 :action] :debit)))
+        expected-items [{:index 2
+                         :amount (bigdec 101)
+                         :balance (bigdec 192)}
+                        {:index 1
+                         :amount (bigdec 12)
+                         :balance (bigdec 91)}
+                        {:index 0
+                         :amount (bigdec 103)
+                         :balance (bigdec 103)}]
+        actual-items (map #(select-keys % [:index :amount :balance])
+                          (transactions/items-by-account storage-spec (:id groceries)))]
+    (testing "items are updated correctly"
+      (is (= expected-items actual-items)
+          "Groceries should have the correct items after update"))
+    (testing "account balances are updated correctly"
+      (is (= (bigdec 192)
+             (:balance (accounts/reload storage-spec groceries)))
+          "Groceries should have the correct balance after update")
+      (is (= (bigdec 808)
+             (:balance (accounts/reload storage-spec checking)))
+          "Checking should have the correct balance after update"))))
+
 ; update a transaction

-; change account
-;  old account balance and items are recalculated
-;  new account balance and items are recalculated
-; change action
 ; add a transaction item
 ; remove a transaction item


DRY up overlay tests

DRY up overlay tests

--- test/cljs/comic_reader/ui/overlay_test.cljs
+++ test/cljs/comic_reader/ui/overlay_test.cljs
@@ -4,6 +4,13 @@
             [comic-reader.ui.overlay :as sut]
             [comic-reader.ui.base :as base])
   (:require-macros [comic-reader.macro-util :refer [reactively]]))
+
+(def dummy-content
+  [:div
+   [:h2 "Content Title"]
+   [:p "Body paragraph"]
+   [:p "Body paragraph"]
+   [:p "Body paragraph"]])

 (defcard-rg overlay-on
   (fn [data _]
@@ -16,12 +23,7 @@
          :footer [:h2 "Bottom"]
          :display? (:overlay @data)
          :toggle-overlay toggle-overlay
-         :content
-         [:div
-          [:h2 "Content Title"]
-          [:p "Body paragraph"]
-          [:p "Body paragraph"]
-          [:p "Body paragraph"]]}])))
+         :content dummy-content}])))
   (reagent/atom {:overlay true})
   {:inspect-data true})

@@ -36,11 +38,6 @@
          :footer [:h2 "Bottom"]
          :display? (:overlay @data)
          :toggle-overlay toggle-overlay
-         :content
-         [:div
-          [:h2 "Content Title"]
-          [:p "Body paragraph"]
-          [:p "Body paragraph"]
-          [:p "Body paragraph"]]}])))
+         :content dummy-content}])))
   (reagent/atom {:overlay false})
   {:inspect-data true})


fix test with what appears to be an out-of-date path string

--- test/implementation/util/fim_exceptions.clj
+++ test/implementation/util/fim_exceptions.clj
@@ -48,7 +48,7 @@
   (let [lines (friendly-exception-lines (Error. "message") ">>>")]
     (first lines) => #"Error.*message"
     (re-find #"^>>>" (first lines)) => falsey
-    (count (map #(re-find #">>>implementation.util.t_exceptions" %) (rest lines))) => (count (rest lines))))
+    (count (remove nil? (map #(re-find #">>>implementation.util.fim_exceptions" %) (rest lines)))) => (count (rest lines))))

 (def nested-exception
   (ex-info "Found a NPE" {:info "wrapped throw of an NPE"} (NullPointerException.)))


[LEARNING] conversations differ from replies

--- test/layzee/integration/finding_replies.clj
+++ test/layzee/integration/finding_replies.clj
@@ -24,7 +24,7 @@
  (fact "It returns all of the expected replies" ;; https://twitter.com/iamkey/status/636840679272873984
        (let [expected-count 4 result (replies/to {:id "636840679272873984" :screen-name "iamkey"})]
          (count result) => expected-count
-         (count (distinct result)) => (count result) "Expected them to all be distinct"))
+         (count (distinct result)) => (count result) :notes ["Expected them to all be distinct"]))

  (fact "it returns empty when there *are* no replies" ;; https://twitter.com/benbiddington/status/638277898596540416
        (let [result (replies/to {:id "638277898596540416" :screen-name "iamkey"})]
@@ -34,8 +34,13 @@
        (let [result (replies/to {:id "xxx-this-is-bung-xxx" :screen-name "iamkey"})]
          (count result) => 0)))

- (facts
-  (fact "And you can find the actual tweets like this"
-    (let [result (replies/to {:id "636840679272873984" :screen-name "iamkey"})]
-        (let [tweets (pmap #(api/get-tweet settings/oauth-credential %) result)]
-          (map #(:text %) tweets) => (contains #{"@iamkey Got latest?" "@benbiddington have just now. Still failing." "@iamkey Config file format has changed <https://t.co/66dquz6N78> (soz)" "@benbiddington chur"})))))
+(facts "Find full replies"
+       (let [result (replies/to {:id "636840679272873984" :screen-name "iamkey"})]
+         (fact "for example"
+               (let [tweets (pmap #(api/get-tweet settings/oauth-credential %) result)]
+                 (map #(:text %) tweets) => (contains #{"@iamkey Got latest?" "@benbiddington have just now. Still failing." "@iamkey Config file format has changed <https://t.co/66dquz6N78> (soz)" "@benbiddington chur"})))
+
+         (future-fact "and each one has the same `in_reply_to_status_id`. Interestingly it FAILS because this is a CONVERSATION -- not replies to the same tweet. So they all have different `in_reply_to_status_id` values."
+             (doseq [tweet tweets]
+                  (:in_reply_to_status_id tweet) => 636840679272873984 :notes ["Expected all of the replies to be tagged as replies to the original"]))))
+


Correct test

Correct test

--- test/reply/reader/jline/completion_test.clj
+++ test/reply/reader/jline/completion_test.clj
@@ -4,6 +4,5 @@

 (fact "correct quoting in completions form request"
   (construct-possible-completions-form "clojure.core/map-") =>
-    '(do (require '[complete.core :as ninjudd.complete])
-         (sort (ninjudd.complete/completions (str "clojure.core/map-") *ns*)))
-)
+    '(complete.core/completions (str "clojure.core/map-") *ns*))
+


[#48] Backend using latest dependencies

[#48] Backend using latest dependencies

--- backend/project.clj
+++ backend/project.clj
@@ -6,11 +6,11 @@
   :min-lein-version "2.0.0"
   :dependencies [[camel-snake-kebab "0.3.2"]
                  [cheshire "5.5.0"]
-                 [clj-http "2.0.1"]
+                 [clj-http "2.1.0"]
                  [clj-time "0.11.0"]
-                 [com.layerware/hugsql "0.3.1"]
+                 [com.layerware/hugsql "0.4.3"]
                  [com.novemberain/pantomime "2.8.0"]
-                 [com.stuartsierra/component "0.3.0"]
+                 [com.stuartsierra/component "0.3.1"]
                  [compojure "1.4.0"]
                  [duct "0.5.8"]
                  [duct/hikaricp-component "0.1.0"]
@@ -21,8 +21,8 @@
                  [org.clojure/data.csv "0.1.3"]
                  [org.immutant/scheduling "2.1.2"]
                  [org.immutant/web "2.1.2"]
-                 [org.postgresql/postgresql "9.4-1206-jdbc41"]
-                 [org.slf4j/slf4j-nop "1.7.14"]
+                 [org.postgresql/postgresql "9.4.1208"]
+                 [org.slf4j/slf4j-nop "1.7.18"]
                  [pandect "0.5.4"]
                  [ring "1.4.0"]
                  [ring-jetty-component "0.3.0"]


Fix comment in `ss-900-minutiae-100-ns-unmap`

--- test/com/nomistech/clojure_the_language/c_800_libraries/s_100_midje/ss_900_minutiae_100_ns_unmap.clj
+++ test/com/nomistech/clojure_the_language/c_800_libraries/s_100_midje/ss_900_minutiae_100_ns_unmap.clj
@@ -6,8 +6,10 @@
 ;;;; to the old var.

-;;;; Huh? What's this all about? And isn't this at least partly about symbol
-;;;; resolution happening before evaluation (of the whole top-level form)?
+;;;; You were trying to test `ns-unmap`, and ran into this.
+;;;; But this is to do with symbol resolution happening before evaluation (of
+;;;; the whole top-level form) -- it's not particularly an interaction between
+;;;; Midge and `ns-unmap`.

 (do ; This is OK:
   (ns-unmap *ns* 'x1)


Revert "Fix bug in `forbidden` feature"

Revert "Fix bug in `forbidden` feature"

This reverts commit 90df38f178cd34c656f7f670c239a72b8f0bdc58.

--- src/dependable/core_resolve.clj
+++ src/dependable/core_resolve.clj
@@ -87,7 +87,7 @@
                                     #(or %1 %2)
                                     false
                                     (map
-                                     #(safe-spec-call % candidate)
+                                     #(% candidate)
                                      absent-term-specs))))
                             candidates)]
                        (if (empty? allowed-candidates)


azulenoids.clj: (traversal) produces more useful output.

--- clojure/org/gavrog/clojure/azulenoids.clj
+++ clojure/org/gavrog/clojure/azulenoids.clj
@@ -61,7 +61,7 @@
         as-root #(vector % :root)
         unseen (fn [i seen bag] (pop-while #(seen [% i]) bag))
         pop-seen #(for [[i ys] %1] (vector i (unseen i %2 ys)))
-        push-neighbors #(for [[i ys] %1] (vector i (conj ys (walk ds %2 i))))]
+        push-neighbors #(for [[i ys] %1] (vector i (conj ys %2)))]
     ((fn collect [seeds-left todo seen]
        (let [seeds-left (drop-while (comp seen as-root) seeds-left)
              todo (pop-seen todo seen)
@@ -69,9 +69,10 @@
          (cond
            (seq todo-for-i)
            (let [D (first todo-for-i)
-                 todo (doall (push-neighbors todo D))
-                 seen (conj seen (as-root D) [D i] [(walk ds D i) i])]
-             (lazy-seq (conj (collect seeds-left todo seen) [D i])))
+                 Di (walk ds D i)
+                 todo (if Di (doall (push-neighbors todo Di)) todo)
+                 seen (conj seen (as-root Di) [D i] [Di i])]
+             (lazy-seq (conj (collect seeds-left todo seen) [D i Di])))
            (seq seeds-left)
            (let [D (first seeds-left)
                  todo (doall (push-neighbors todo D))


Document new metaphor behavior

Document new metaphor behavior

--- src/midje/doc.clj
+++ src/midje/doc.clj
@@ -60,11 +60,15 @@
   (load-facts <ns> <ns>...)
   (load-facts 'midje.util.*)      ; Load all namespaces below midje.util.
   (load-facts <ns> :integration)  ; Filter to just integration tests.
+  (load-facts)                    ; Repeat most recent load-facts.

   ----- Checking facts, once loaded
   (check-facts <ns> <ns>...)        ; in given namespaces
   (check-facts :all)                ; all defined facts
   (check-facts :all :integration)   ; all integration tests
+
+  Note: `check-facts` with no argument will check the same facts
+  as the most recent `check-facts` or `load-facts`.

   ----- Rerunning facts
   (recheck-fact)                ; Check just-checked fact again.


fix update-competency

fix update-competency

--- src/navigator.clj
+++ src/navigator.clj
@@ -85,9 +85,11 @@
   (tx conn [(merge {:db/id eid} (select-keys entity (:comp valid-fields)))]))

 (defn update-competency
+  ;; TODO: refactor me?
   "Consider using :comp/id-sk instead of the entity ID here, IF every :comp has a :comp/id-sk."
-  [conn & {:keys [eid] :as entity}]
-  (apply transact-competency conn eid (select-keys entity (:comp updatable-fields))))
+  [conn entity]
+  ;;[(:db/id entity) (select-keys entity (:comp updatable-fields))]
+  (apply transact-competency conn (:db/id entity) (flatten (seq (select-keys entity (:comp updatable-fields))))))

 (defn create-competency
   "Create a new competency"


minor

minor

--- frontend/src-cljs/pp_client/html.cljs
+++ frontend/src-cljs/pp_client/html.cljs
@@ -8,6 +8,7 @@
 ;; HTML is super cool
 ;;------------------------------------------------------------------------------

+;; TODO create a reference datastructure that can then be used to create this.
 (hiccups/defhtml input-options []
   [:optgroup {:label "Clojure"}
     [:option {:value "clj"} "Clojure Code"]
@@ -36,10 +37,10 @@
   [:div.left-body-ca07e
     [:textarea#mainTextarea.text-f3988]])

-(hiccups/defhtml body []
+(hiccups/defhtml body [hash]
   [:div.body-outer-7cb5e
     [:div.body-inner-40af1
-      [:h2.instructions-b15d3 "Paste EDN below:"]
+      [:h2.instructions-b15d3 (str "Paste " hash " below:")]
       (left-body)
       (right-body)
       [:div.clr-217e3]]])
@@ -51,5 +52,5 @@

 (hiccups/defhtml page [hash]
   (header)
-  (body)
+  (body hash)
   (footer))


Disable button on false input

Disable button on false input

--- frontend/src/cruncher/selections.cljs
+++ frontend/src/cruncher/selections.cljs
@@ -49,7 +49,7 @@
                                         :placeholder "42"})
                         (dom/span #js {:className "input-group-addon"} "%")
                         (dom/span #js {:className "input-group-btn"}
-                                  (vlib/button-default #(select-below-iv-perfect percentage) "Select")))))))
+                                  (vlib/button-default #(select-below-iv-perfect percentage) (not (js/isNaN (js/parseFloat percentage))) "Select")))))))
 (def iv-percentage (om/factory IVPercentage))

 (defui SelectionButtons


more merge skew fix

more merge skew fix

Signed-off-by: Eric Baur <a1c9c5f8609c68027db0779b39e5f932d4cb0053@robeybaur.org>

--- src/obcc/core.clj
+++ src/obcc/core.clj
@@ -45,36 +45,36 @@
 (defn -app [& args]
   (let [ {:keys [options arguments errors summary]} (parse-opts args cli-options) ]
     (cond
-          (:help options)
-          (exit 0 (usage summary))
+      (:help options)
+      (exit 0 (usage summary))

-          (not= errors nil)
-          (exit -1 "Error: " (string/join errors))
+      (not= errors nil)
+      (exit -1 "Error: " (string/join errors))

-          (:version options)
-          (exit 0 (version))
+      (:version options)
+      (exit 0 (version))

-          (= (count arguments) 0)
-          (exit 0 (usage summary))
+      (= (count arguments) 0)
+      (exit 0 (usage summary))

-          (not= (count arguments) 1)
-          (exit -1 "Error: bad argument count")
+      (not= (count arguments) 1)
+      (exit -1 "Error: bad argument count")

-          :else
-          (let [path (:path options)
-                file (io/file path util/configname)]
-            (do
-              (cond (not (.isFile file))
-                    (exit -1 "Configuration not found at " path)
-                    :else
-                    (let [config (config/parser file)]
-                      (if-let [[_ func] (subcommands (first arguments))]
-                        (do
-                          (try
-                            (func path config)
-                            (catch Exception e (println "error:" (:stderr (ex-data e)))))
-                          (exit 0 ""))
-                        (exit 1 (usage summary))))))))))
+      :else
+      (let [path (:path options)
+            file (io/file path util/configname)]
+        (do
+          (cond (not (.isFile file))
+                (exit -1 "Configuration not found at " path)
+                :else
+                (let [config (config/parser file)]
+                  (if-let [[_ func] (subcommands (first arguments))]
+                    (do
+                      (try
+                        (func path config)
+                        (catch Exception e (println "error:" (:stderr (ex-data e)))))
+                      (exit 0 ""))
+                    (exit 1 (usage summary))))))))))

 (defn -main [& args]
   (System/exit (apply -app args)))


caveat

caveat

--- src/puny/core.clj
+++ src/puny/core.clj
@@ -1,5 +1,6 @@
 (ns puny.core
-  "A tiny redis based ORM, note that index operations are not atomic"
+  "A tiny redis based ORM,
+   Caveat: crud+index operations are not atomic, introducing lua procedures will fix that."
   (:use
     [slingshot.slingshot :only  [throw+ try+]]
     [celestial.redis :only (wcar hsetall*)]
@@ -21,8 +22,7 @@
    :add-fn (<<< "add-~{name*}") :update-fn (<<< "update-~{name*}")
    :validate-fn (<<< "validate-~{name*}") :gen-fn (<<< "gen-~{name*}-id")
    :delete-fn (<<< "delete-~{name*}") :get-fn (<<< "get-~{name*}")
-   :partial-fn (<<< "partial-~{name*}")
-   })
+   :partial-fn (<<< "partial-~{name*}")})

 (defn id-modifiers [name* opts]
   (if-let [id-prop (opts :id)]


get fn names from qmon.core, not *ns*

get fn names from qmon.core, not *ns*

--- src/qmon/core.clj
+++ src/qmon/core.clj
@@ -9,6 +9,7 @@
   (:use [clojure.xml :only [parse]]))

 (def headkeys [:jobid :owner :rtime :utime :procs :nodes :state :queue :part :name])
+
 (def headvals ["Job ID" "Owner" "Requested" "Used" "Procs" "Nodes" "S" "Queue" "Partition" "Job Name"])

 (declare split tree xprocs xres xtime)
@@ -21,7 +22,7 @@
         (map max headwidth datawidth)))))

 (defn jobinfo [job]
-  (let [fns (map #(ns-resolve *ns* (symbol (str "x" (name %)))) headkeys)
+  (let [fns (map #(ns-resolve 'qmon.core (symbol (str "x" (name %)))) headkeys)
         raw (fn [job] (zipmap (map #(:tag %) job) (map #(:content %) job)))]
     (zipmap headkeys (map #(% (raw job)) fns))))

@@ -110,8 +111,6 @@
 (defn xutime [j]
   (let [t (xtime j :resources_used)] (if (nil? t) "-" t)))

-;; Entry point from command line.
-
 (defn -main [& args]
   (let [user         (myname)
         panel        (JPanel. (BorderLayout.))


explicit decoration for dispatch-event

explicit decoration for dispatch-event

--- src/rex/core.cljs
+++ src/rex/core.cljs
@@ -12,7 +12,7 @@
 (defn reset-store! []
   (reset! store *store-init-value*))

-(defn- dispatch-event [cursor event]
+(defn- dispatch-event-internal [cursor event]
   (let [event-type (get event :type :unknown)]
     (doseq [r @reducers]
       (let [{name :name
@@ -22,21 +22,26 @@
         (swap! store reduce-rn event-type event cursor))))
   @store)

-(defn- dispatch-event-with-middlewares []
-  (let [store-value-getter (fn [] @store)]
-    (reduce (fn [accumulated-dispatch-event-fn middleware]
-              (let [{name :name
-                     middleware-fn :fn} middleware]
-                (fn [cursor action]
-                  (middleware-fn store-value-getter
-                                 accumulated-dispatch-event-fn
-                                 cursor
-                                 action))))
-            dispatch-event
-            @middlewares)))
+(defn- dispatch-event-with-middlewares [store-value-getter
+                                        middlewares-getter]
+  (reduce (fn [accumulated-dispatch-event-fn middleware]
+            (let [{name :name
+                   middleware-fn :fn} middleware]
+              (fn [cursor action]
+                (middleware-fn store-value-getter
+                               accumulated-dispatch-event-fn
+                               cursor
+                               action))))
+          dispatch-event-internal
+          (middlewares-getter)))
+
+(defn dispatch-event [cursor event]
+  (let [decorator (dispatch-event-with-middlewares (fn [] @store)
+                                                   (fn [] @middlewares))]
+    (decorator cursor event)))

 (defn dispatch [cursor action-creator]
-  (let [dispatch-event-fn (dispatch-event-with-middlewares)]
+  (let [dispatch-event-fn dispatch-event]
     (let [event (action-creator (partial dispatch-event-fn cursor)
                                 @store
                                 cursor)]


Changes the use of the function in the main code.

Removed the printing of the function.

--- src/rmfu/core.clj
+++ src/rmfu/core.clj
@@ -30,9 +30,9 @@
   (do
     (println (format "_______ ENV DEV: %s   " (env :dev?)))
     (println (format "_______ CLIENT URL: %s" (env :client-url)))
-    (println (check-env "RMFU_SECRET"))
-    (println (check-env "RMFU_FROM_EMAIL"))
-    (println (check-env "MANDRILL_API_KEY"))))
+    (check-env "RMFU_SECRET")
+    (check-env "RMFU_FROM_EMAIL")
+    (check-env "MANDRILL_API_KEY")))

 (def secret (System/getenv "RMFU_SECRET"))


able to add custom methods and data to a react component

--- src/rum/core.cljs
+++ src/rum/core.cljs
@@ -43,80 +43,83 @@
         child-context-types (collect :child-context-types classes) ;; chilid-context-types
         child-context       (collect :child-context classes)       ;; state -> child-context
         context-types       (collect :context-types classes)       ;; context-types
-    ]
-
-    (js/React.createClass #js {
-      :displayName display-name
-      :getInitialState
-      (fn []
-        (this-as this
-          (let [props (.-props this)
-                state (-> { :rum/react-component this
-                            :rum/id (next-id) }            ;; assign id on mount?
-                        (merge (props->state props)))]
-            #js { ":rum/state" (volatile! state) })))
-      :componentWillMount
-      (when-not (empty? will-mount)
-        (fn []
-          (this-as this
-            (vswap! (state this) call-all will-mount))))
-      :componentDidMount
-      (when-not (empty? did-mount)
-        (fn []
-          (this-as this
-            (vswap! (state this) call-all did-mount))))
-      :componentWillReceiveProps
-      (fn [next-props]
-        (this-as this
-          (let [old-state @(state this)
-                next-state (-> { :rum/react-component this
-                                 :rum/id (:rum/id old-state) }
-                             (merge (props->state next-props)))
-                next-state (reduce #(%2 old-state %1) next-state transfer-state)]
-            (.setState this #js {":rum/state" (volatile! next-state)}))))
-      :shouldComponentUpdate
-      (if (empty? should-update)
-        (constantly true)
-        (fn [next-props next-state]
-          (this-as this
-            (let [old-state @(state this)
-                  new-state @(aget next-state ":rum/state")]
-              (or (some #(% old-state new-state) should-update) false)))))
-      :componentWillUpdate
-      (when-not (empty? will-update)
-        (fn [_ next-state]
-          (this-as this
-            (let [new-state (aget next-state ":rum/state")]
-              (vswap! new-state call-all will-update)))))
-      :render
-      (fn []
-        (this-as this
-          (let [state (state this)
-                [dom next-state] (wrapped-render @state)]
-            (vreset! state next-state)
-            dom)))
-      :componentDidUpdate
-      (when-not (empty? did-update)
-        (fn [_ _]
-          (this-as this
-            (vswap! (state this) call-all did-update))))
-      :componentWillUnmount
-      (when-not (empty? will-unmount)
-        (fn []
-          (this-as this
-            (vswap! (state this) call-all will-unmount))))
-      :childContextTypes
-      (when-not (empty? child-context-types)
-        (clj->js (apply merge child-context-types)))
-      :contextTypes
-      (when-not (empty? context-types)
-        (clj->js (apply merge context-types)))
-      :getChildContext
-      (when-not (empty? child-context)
-        (fn []
-          (this-as this
-            (let [state @(state this)]
-              (clj->js (transduce (map #(% state)) merge {} child-context))))))})))
+
+        methods             (reduce #(merge %1 %2) (collect :methods classes)) ;; custom methods
+        data                (reduce #(merge %1 %2) (collect :data classes)) ;; custom data
+
+        default-attrs       {:displayName display-name
+                             :getInitialState
+                             (fn []
+                               (this-as this
+                                        (let [props (.-props this)
+                                              state (-> { :rum/react-component this
+                                                         :rum/id (next-id) }            ;; assign id on mount?
+                                                        (merge (props->state props)))]
+                                          #js { ":rum/state" (volatile! state) })))
+                             :componentWillMount
+                             (when-not (empty? will-mount)
+                               (fn []
+                                 (this-as this
+                                          (vswap! (state this) call-all will-mount))))
+                             :componentDidMount
+                             (when-not (empty? did-mount)
+                               (fn []
+                                 (this-as this
+                                          (vswap! (state this) call-all did-mount))))
+                             :componentWillReceiveProps
+                             (fn [next-props]
+                               (this-as this
+                                        (let [old-state @(state this)
+                                              next-state (-> { :rum/react-component this
+                                                              :rum/id (:rum/id old-state) }
+                                                             (merge (props->state next-props)))
+                                              next-state (reduce #(%2 old-state %1) next-state transfer-state)]
+                                          (.setState this #js {":rum/state" (volatile! next-state)}))))
+                             :shouldComponentUpdate
+                             (if (empty? should-update)
+                               (constantly true)
+                               (fn [next-props next-state]
+                                 (this-as this
+                                          (let [old-state @(state this)
+                                                new-state @(aget next-state ":rum/state")]
+                                            (or (some #(% old-state new-state) should-update) false)))))
+                             :componentWillUpdate
+                             (when-not (empty? will-update)
+                               (fn [_ next-state]
+                                 (this-as this
+                                          (let [new-state (aget next-state ":rum/state")]
+                                            (vswap! new-state call-all will-update)))))
+                             :render
+                             (fn []
+                               (this-as this
+                                        (let [state (state this)
+                                              [dom next-state] (wrapped-render @state)]
+                                          (vreset! state next-state)
+                                          dom)))
+                             :componentDidUpdate
+                             (when-not (empty? did-update)
+                               (fn [_ _]
+                                 (this-as this
+                                          (vswap! (state this) call-all did-update))))
+                             :componentWillUnmount
+                             (when-not (empty? will-unmount)
+                               (fn []
+                                 (this-as this
+                                          (vswap! (state this) call-all will-unmount))))
+                             :childContextTypes
+                             (when-not (empty? child-context-types)
+                               (clj->js (apply merge child-context-types)))
+                             :contextTypes
+                             (when-not (empty? context-types)
+                               (clj->js (apply merge context-types)))
+                             :getChildContext
+                             (when-not (empty? child-context)
+                               (fn []
+                                 (this-as this
+                                          (let [state @(state this)]
+                                            (clj->js (transduce (map #(% state))
+                                                                merge {} child-context))))))}]
+    (js/React.createClass (clj->js (merge methods data default-attrs)))))

 ;; render queue


added doctype and html5 helpers

added doctype and html5 helpers

--- src/seri/html.clj
+++ src/seri/html.clj
@@ -72,6 +72,25 @@
   ([x visitor-fn]
      (apply escape-html (flatten (seri.walk/walk x visitor-fn)))))

+;;; helpers
+(def doctype
+  {:html4
+   (safe "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01//EN\" "
+        "\"http://www.w3.org/TR/html4/safeict.dtd\">\n")
+   :xhtml-safeict
+   (safe "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Safeict//EN\" "
+        "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-safeict.dtd\">\n")
+   :xhtml-transitional
+   (safe "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" "
+        "\"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\n")
+   :html5
+   (safe "<!DOCTYPE html>\n")})
+
+(defn html5 [& contents]
+  [(doctype :html5)
+   [:html ;{:lang (options# :lang)}
+    contents]])
+
 ;;; test

 #_(to-html


Remove unneeded (and broken) test

Remove unneeded (and broken) test

--- server/test/patavi/server/test/handler.clj
+++ server/test/patavi/server/test/handler.clj
@@ -1,14 +0,0 @@
-(ns patavi.server.test.handler
-  (:use clojure.test
-        ring.mock.request
-        patavi.server.handler))
-
-(deftest test-app
-  (testing "main route"
-    (let [response (app (request :get "/"))]
-      (is (= (:status response) 200))
-      (is (= (:body response) "Hello World"))))
-
-  (testing "not-found route"
-    (let [response (app (request :get "/invalid"))]
-      (is (= (:status response) 404)))))


Add report and suggest to dropdown

Add report and suggest to dropdown

--- src-cljs/frontend/components/pieces/topbar.cljs
+++ src-cljs/frontend/components/pieces/topbar.cljs
@@ -74,7 +74,13 @@
                 [:li
                  ;; FIXME: NEED TO ADD THIS AGAIN IN THE DEFN
                  [:a.support-info
-                  "Support"]]]]
+                  "Support"]]
+                [:li
+                 [:a (html/open-ext {:href "/"})
+                  "Suggest a feature"]]
+                [:li
+                 [:a (html/open-ext {:href "/"})
+                  "Report an issue"]]]]

               [:li.dropdown.user-menu
                [:button.dropdown-toggle


Use ref to pick vexflow container

Use ref to pick vexflow container

--- src/cljs/daveconservatoire/site/ui/vexflow.cljs
+++ src/cljs/daveconservatoire/site/ui/vexflow.cljs
@@ -3,6 +3,7 @@
   (:require [om.next :as om]
             [om.dom :as dom]
             [cljs.core.async :refer [chan <!]]
+            [goog.object :as gobj]
             [goog.dom :as gdom]
             [daveconservatoire.site.ui.util :as u]
             [cljs.spec.alpha :as s]))
@@ -70,17 +71,18 @@
   (componentDidMount [this]
     (go
       (<! (require-vexflow))
-      (let [div (js/ReactDOM.findDOMNode this)]
+      (let [div (gobj/get this "el")]
         (render-score (om/props this) div))))

   (componentDidUpdate [this _ _]
-    (let [node (js/ReactDOM.findDOMNode this)]
+    (let [node (gobj/get this "el")]
       (gdom/removeChildren node)
       (render-score (om/props this) node)))

   (render [this]
     (let [{::keys [width height backend]} (om/props this)
           el (backend-element backend)]
-      (el #js {:style #js {:width width :height height}}))))
+      (el #js {:style #js {:width width :height height}
+               :ref #(gobj/set this "el" %)}))))

 (def score (om/factory Score))


adds assertions to the sediment server tests (#832)

--- waiter/integration/waiter/trailers_test.clj
+++ waiter/integration/waiter/trailers_test.clj
@@ -53,7 +53,8 @@
                               (log/error ex "unable to parse response as json")
                               (is false (str "unable to parse response as json" (:body response)))))
                 http-version (hu/backend-protocol->http-version backend-proto)]
-            (is (= http-version (get body-json "protocol")))
+            (assert-response-status response 200)
+            (is (= http-version (get body-json "protocol")) (str body-json))
             (when (= "http" backend-proto)
               (is (= "chunked" (get-in body-json ["headers" "Transfer-Encoding"]))
                   (str body-json))


Fix passing the card ref to card callbacks

--- src/kanban/components/card.cljs
+++ src/kanban/components/card.cljs
@@ -40,10 +40,10 @@
           {:keys [drag-fns activate-fn]} (om/get-computed this)]
       (let [ref (om/get-ident this)]
         (dom/div #js {:className "card"
-                      :onClick #(some-> activate-fn (apply ref))
+                      :onClick #(some-> activate-fn (apply [ref]))
                       :draggable true
-                      :onDragStart #(some-> drag-fns :start (apply ref))
-                      :onDragEnd #(some-> drag-fns :end (apply ref))}
+                      :onDragStart #(some-> drag-fns :start (apply [ref]))
+                      :onDragEnd #(some-> drag-fns :end (apply [ref]))}
           (dom/span #js {:className "card-id"} id)
           (for [a assignees]
             (assignee a))


CMR-3200: Adding defaults for topic and term when parsing ISO science keywords.

--- umm-spec-lib/src/cmr/umm_spec/iso_keywords.clj
+++ umm-spec-lib/src/cmr/umm_spec/iso_keywords.clj
@@ -10,6 +10,7 @@
             [cmr.common.xml :as cx]
             [cmr.umm-spec.models.common :as c]
             [cmr.common.xml.parse :refer :all]
+            [cmr.umm-spec.util :as su]
             [cmr.umm-spec.iso19115-2-util :as iso]))

 (def nil-science-keyword-field
@@ -95,8 +96,8 @@
                detailed-variable] (map #(if (= nil-science-keyword-field %) nil %)
                                        (str/split sk iso/keyword-separator-split))]]
     {:Category category
-     :Topic topic
-     :Term term
+     :Topic (su/with-default topic)
+     :Term (su/with-default term)
      :VariableLevel1 variable-level-1
      :VariableLevel2 variable-level-2
      :VariableLevel3 variable-level-3


Create default project for new users.

Create default project for new users.

--- web-server/src/clj/hatnik/web/server/login.clj
+++ web-server/src/clj/hatnik/web/server/login.clj
@@ -12,8 +12,12 @@

 (defn create-user [email]
   (timbre/info "Creating new user" email)
-  {:email email
-   :id (stg/create-user! @stg/storage email)})
+  (let [id (stg/create-user! @stg/storage email)]
+    (timbre/info "Create default project for user")
+    (stg/create-project! @stg/storage {:name "Default"
+                                       :user-id id})
+    {:email email
+     :id id}))

 (defn github-login [code state]
   (let [resp (client/post "https://github.com/login/oauth/access_token"


improves assertion in test for * default namespace in replicaset spec builder (#1453)

--- waiter/integration/waiter/kubernetes_scheduler_integration_test.clj
+++ waiter/integration/waiter/kubernetes_scheduler_integration_test.clj
@@ -290,7 +290,8 @@
   (testing-using-waiter-url
     (when (using-k8s? waiter-url)
       (let [current-user (retrieve-username)
-            default-namespace (-> waiter-url get-kubernetes-scheduler-settings :replicaset-spec-builder :default-namespace)
+            configured-namespace (-> waiter-url get-kubernetes-scheduler-settings :replicaset-spec-builder :default-namespace)
+            default-namespace (if (= "*" configured-namespace) current-user configured-namespace)
             star-user-header {:x-waiter-run-as-user "*"}
             current-user-header {:x-waiter-run-as-user current-user}
             not-current-user "not-current-user"]


test-pod-namespace is slow (#817)

test-pod-namespace is slow (#817)

--- waiter/integration/waiter/kubernetes_scheduler_integration_test.clj
+++ waiter/integration/waiter/kubernetes_scheduler_integration_test.clj
@@ -187,7 +187,7 @@
         (is (some? pod-spec))
         (is (= expected-namespace pod-namespace))))))

-(deftest ^:parallel ^:integration-fast test-pod-namespace
+(deftest ^:parallel ^:integration-slow test-pod-namespace
   "Expected behavior for services with namespaces:
    Run-As-User    Namespace   Validation
    Missing        Missing     OK


Removed arohner's cookie.clj - superceeded by cookies map in http lib

--- lib/compojure/http/cookie.clj
+++ lib/compojure/http/cookie.clj
@@ -1,19 +0,0 @@
-
-
-(defn- cookie-to-map [#^javax.servlet.http.Cookie cookie]
-  "returns a clojure map out of the cookie's attributes"
-  {:name (. cookie (getName))
-   :value (. cookie (getValue))
-   :path (. cookie (getPath))
-   :comment (. cookie (getComment))
-   :domain (. cookie (getDomain))
-   :max_age (. cookie (getMaxAge))})
-
-(defn get-cookies [request]
-  (reduce
-   (fn [cookie-map cookie]
-     (assoc cookie-map (cookie :name) cookie))
-   {} (map (fn [cookie]
-	     (cookie-to-map cookie))
-	   (. request (getCookies)))))
-


Modify affinity; refactor value into behaviour

--- src/main/clojure/dm/expt/reddit_recommender.clj
+++ src/main/clojure/dm/expt/reddit_recommender.clj
@@ -8,10 +8,16 @@
 (defprotocol FeatureExtractor
   (features [this subreddit-weight]))

+(defprotocol Affinity
+  (value [this]))
+
 (defrecord RedditAffinity [user subreddit value-str]
+  Affinity
+  (value [this] (Float/valueOf value-str))
+
   FeatureExtractor
-  (features [affinity subreddit-weight]
-    [(subreddit-weight subreddit) (Float/valueOf value-str)]))
+  (features [this subreddit-weight]
+    [(subreddit-weight subreddit) (value this)]))

 (defn -main
   ([]
@@ -32,7 +38,7 @@
          (map-indexed
            (fn [i a]
              [(str "Cluster" i)
-              (let [affs (map #(-> % :value-str Float/valueOf) a)]
+              (let [affs (map value a)]
                 (map #(% affs) [i/quantile i/mean i/median]))
               (select-keys subreddit->user-count (->> a (map :subreddit) set))])
            clusters))))))


constrain complement of vp-pronoun-nonphrasal to be {:case :acc}

--- src/babel/francais/grammar.cljc
+++ src/babel/francais/grammar.cljc
@@ -465,6 +465,7 @@
                                    :synsem {:infl {:not :past-p}}}
                             :comp {:phrasal false
                                    :synsem {:cat :noun
+                                            :case :acc
                                             :pronoun true}}
                             :rule "vp-pronoun-nonphrasal"
                             :synsem {:aux false


--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -218,6 +218,12 @@
        {:synsem {:cat :verb
                  :aux false}})

+      (default ;; essere must be shared within :italiano, because that is all morphology can see.
+       (let [essere (atom :top)]
+         {:synsem {:cat :verb
+                   :essere essere}
+          :italiano {:essere essere}}))
+
       (default ;; essere defaults to false.
        {:synsem {:cat :verb
                  :essere false}})


move :unify-processing closer to beginning of lexical compilation

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -98,15 +98,15 @@
       evaluate ;; evaluate all expressions within this map (e.g. grep for "(let") in the .edn file.
       listify ;; if any value of the map is not a sequence, make it a sequence with one element: the original value.

-      (default ;; all lexemes are phrasal=false by default.
-       {:phrasal false})
-
       ;; end language-independent operations.

       ;; begin language-dependent operations.
       apply-unify-key ;; turn any :unify [..] key-value pairs with (reduce unify (:unify values)).
       ;; the operation of apply-unify-key is language-independent, but
       ;; the values of :unify may be symbols that refer to language-dependent values.
+
+      (default ;; all lexemes are phrasal=false by default.
+       {:phrasal false})

       exception-generator2 ;; add new keys to the map for all exceptions found.


fix comment

fix comment

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -3,13 +3,12 @@
   (:refer-clojure :exclude [get-in])
   (:require
    [babel.lexicon :refer [universals]]
-
-   ;; TODO: use dag_unify/unifyc instead:
-   ;; deprecate lexiconfn/unify.
    [babel.encyclopedia :as encyc]
    [babel.lexiconfn :refer [compile-lex if-has if-then default
                             filter-vals listify map-function-on-map-vals
                             new-entries rewrite-keys verb-pred-defaults
+                            ;; TODO: use dag_unify/unifyc instead:
+                            ;; deprecate lexiconfn/unify.
                             unify]]

    #?(:clj [clojure.tools.logging :as log])


wip: rest api for match-report

wip: rest api for match-report

--- src/clj/foosball/routes/api.clj
+++ src/clj/foosball/routes/api.clj
@@ -134,16 +134,15 @@
      [false {:message "Unsupported Content-Type"}])
     true))

-(defresource match-report-resource [id]
+(defresource match-report-resource [db id]
   :allowed-methods [:get :put :delete]
   :available-media-types media-types
   :known-content-type? (partial check-content-type body-media-types)
   :exists? (fn [_]
-             false
-             #_ (let [e (get @entries id)]
-                    (if-not (nil? e)
-                      {::entry e})))
-  :existed? (fn [_] false #_ (nil? (get @entries id ::sentinel)))
+             (let [e (d/get-match db id)]
+               (if-not (nil? e)
+                 {::entry e})))
+  :existed? (fn [_] (nil? (or (d/get-match db id) ::sentinel)))
   :handle-ok ::entry
   :delete! (fn [_] false #_ (dosync (alter entries assoc id nil)))
   :malformed? #(parse-json % ::data)


Add docstrings

Add docstrings

--- src/clj/pva_parrot/calc/pca.clj
+++ src/clj/pva_parrot/calc/pca.clj
@@ -6,11 +6,14 @@
 (m/set-current-implementation :vectorz)

 (defn transpose
-  "Transpose a matrix."
+  "Transpose the matrix mat."
   [mat]
   (apply mapv vector mat))

-(defn vals-to-lists [hash-map]
+(defn vals-to-lists
+  ;; TODO: Add docstring
+  ""
+  [hash-map]
   (zipmap (keys hash-map) (map to-vect (vals hash-map))))

 (defn map-columns
@@ -19,16 +22,24 @@
   [f m]
   (map #(apply f %) m))

-(defn mins [m]
+(defn mins
+  "Returns a vector with the minimal values of every column in matrix m."
+  [m]
   (map-columns min m))

-(defn maxs [m]
+(defn maxs
+  "Returns a vector with the maximum values of every column in matrix m."
+  [m]
   (map-columns max m))

-(defn means [m]
+(defn means
+  "Returns a vector with the mean values of every column in matrix m."
+  [m]
   (map mean m))

-(defn sds [m]
+(defn sds
+  "Returns a vector with the standard deviations of every column in matrix m."
+  [m]
   (map sd m))

 (defn summarize [labels m]


Move to GL 3.0

Move to GL 3.0

--- src/clj/robinson/glterminal.clj
+++ src/clj/robinson/glterminal.clj
@@ -19,9 +19,10 @@
               RenderingHints)
     (org.lwjgl BufferUtils LWJGLUtil)
     (java.nio FloatBuffer ByteBuffer)
+    (java.nio.charset Charset)
     (org.lwjgl.opengl Display ContextAttribs
-                      PixelFormat DisplayMode
-                      GL11 GL12 GL13 GL15 GL20)
+                      PixelFormat DisplayMode Util
+                      GL11 GL12 GL13 GL15 GL20 GL30)
     (org.lwjgl.input Keyboard)
     (org.lwjgl.util.vector Matrix4f Vector3f)
     (java.io File)
@@ -236,13 +237,14 @@
     "NONE"
     (.getName #^Field (some
                        #(if (= enum-value (.get #^Field % nil)) % nil)
-                       (mapcat get-fields [GL11 GL12 GL13 GL15 GL20])))))
+                       (mapcat get-fields [GL11 GL12 GL13 GL15 GL20 GL30])))))

 (defn- except-gl-errors
   [msg]
   (let [error (GL11/glGetError)
         error-string (str "OpenGL Error(" error "):"
-                          (gl-enum-name error) ": " msg)]
+                          (gl-enum-name error) ": " msg " - "
+                          (Util/translateGLErrorString error))]
     (if (not (zero? error))
       (throw (Exception. error-string)))))

@@ -258,7 +260,7 @@

 (defn- init-display [title screen-width screen-height]
   (let [pixel-format       (PixelFormat.)
-        context-attributes (ContextAttribs. 2 1)
+        context-attributes (ContextAttribs. 3 0)
         icon-image         (ImageIO/read (File. "images/icon.png"))
         icon-image-16      (scale-image icon-image 16,  -1)
         icon-image-32      (scale-image icon-image 32,  -1)
@@ -790,7 +792,7 @@
   ;; render in background thread
   (let [terminal (make-terminal (format "Robinson - %s@%s" "demo" "glterminal")
                                 80 24 [255 255 255] [5 5 8] nil
-                                "Courier New" "fonts/Boxy/Boxy.ttf" 16 true)
+                                "Courier New" "fonts/Boxy/Boxy.ttf" 6 true)
         last-key (atom nil)
           input-chan (go-loop []
                        (reset! last-key (async/<!! (rat/get-key-chan terminal)))


fixed trim if nil line

fixed trim if nil line

--- src/clj/swarmpit/docker/log.clj
+++ src/clj/swarmpit/docker/log.clj
@@ -12,7 +12,9 @@
   [line]
   (-> (re-pattern "(19|20)\\d{2}[.:\\-TZ0-9]* ")
       (re-find line)
-      (first)))
+      (first)
+      (or "")
+      (trim)))

 (defn- parse-log-task
   [line]
@@ -28,4 +30,4 @@
                      :timestamp (parse-log-timestamp x)
                      :task      (parse-log-task x)}))
        (filter #(some? (:task %)))
-       (sort-by :timestamp)))
+       (sort-by :timestamp)))


Fix round-up and remember to terminate scale-range traversal

--- src/clj/xn/graph/scale/core.clj
+++ src/clj/xn/graph/scale/core.clj
@@ -62,7 +62,10 @@
   (- n (mod n (:step scale))))

 (defn- round-up [scale n]
-  (+ n (- (:step scale) (mod (+ n) (:step scale)))))
+  (let [m (mod n (:step scale))]
+    (if (zero? m)
+      (BigDecimal. (str n))
+      (+ n (- (:step scale) (mod n (:step scale)))))))

 (defn- max-value [scale point]
   (let [n (+ (value point)
@@ -149,7 +152,8 @@
      (fn [point]
        (->> (first-point scale point)
             (iterate (next-point scale (max-value scale point)))
-            (take-while some?)))))
+            (take-while some?)
+            (take (inc (Math/round (/ (double (+ above below)) (double (:step scale))))))))))
   ([min max step offset below above]
    (scale-range {:min min :max max :step step}
                 offset below above)))
@@ -241,6 +245,18 @@
     (is (= [1 1 1 1 1 10 10 10 10 10 -100 -10 -10 1 1 1]
            (traversal-steps 45 -17)))))

+(set-test round-down
+  (do
+    (is (= 0.1M (round-down {:step 0.002M} 0.1019M)))
+    (is (= 1M (round-down {:step 0.002M} 1.0001M)))
+    (is (= 1M (round-down {:step 0.002M} 1)))))
+
+(set-test round-up
+  (do
+    (is (= 0.002M (round-up {:step 0.002M} 0.0001M)))
+    (is (= 1M (round-up {:step 0.002M} 1)))
+    (is (= 0M (round-up {:step 0.002M} 0)))))
+
 (def tests)
 (set-test tests
   (testing "tests defined in scale.core itself"
@@ -249,4 +265,6 @@
     (test #'scale-index)
     (test #'next-step)
     (test #'scale-point)
-    (test #'traversal-steps)))
+    (test #'traversal-steps)
+    (test #'round-up)
+    (test #'round-down)))


remove index from permissable actions

remove index from permissable actions

--- src/clj_money/models/grants.clj
+++ src/clj_money/models/grants.clj
@@ -34,7 +34,7 @@
     :report})

 (def actions
-  #{:index :show :create :update :delete})
+  #{:show :create :update :delete})

 (def available-permissions
   (->> {:report #{:income-statement :balance-sheet :budget}}


Document helper functions

Document helper functions

--- src/cljs/load_test_om/core.cljs
+++ src/cljs/load_test_om/core.cljs
@@ -21,11 +21,14 @@
 (enable-console-print!)

 (comment
+  ;; how many load-tests
   (count (get-in @app-state [:load-tests :items]))
+  ;; how many data points in first load test
   (count (get-in @app-state [:load-tests :items 0 :data-points]))
-  (->> (get-in @app-state [:load-tests :items 2 :data-points])
-       (group-by :status)
-       (type)))
+  ;; Correct order?
+  (apply > (->> (get-in @app-state [:load-tests :items])
+                (map (fn [load-test]
+                       (get-in load-test [:data-points 0 :time]))))))

 (comment
   (identity @app-state))


Remove some debug logging :yum:

Remove some debug logging :yum:

--- src/metabase/query_processor/sql_parameters.clj
+++ src/metabase/query_processor/sql_parameters.clj
@@ -25,7 +25,6 @@
   String        (->sql [this]
                   (str \' (s/replace this #"'" "\\\\'") \'))
   FieldInstance (->sql [this]
-                  (println "FieldInstance -> SQL:" (u/pprint-to-str 'blue this))
                   ;; For SQL drivers, generate appropriate qualified & quoted identifier
                   ;; Mative param substitution is only enabled for SQL for the time being. We'll need to tweak this a bit so when we add support for other DBs in the future.
                   (first (hsql/format (apply hsql/qualify (field/qualified-name-components this))
@@ -35,8 +34,7 @@
   (let [k (keyword param)
         _ (assert (contains? params k)
             (format "Unable to substitute '%s': param not specified." param))
-        v (->sql (u/prog1 (k params)
-                   (println "->sql" <>)))]
+        v (->sql (k params))]
     (s/replace-first s match v)))

 (defn- handle-simple [s params]
@@ -81,7 +79,7 @@
   (when-let [dimension (:dimension tag)]
     (if-let [field-id (dimension->field-id dimension)]
       (db/select-one [Field :name :parent_id :table_id], :id field-id)
-      (println "TODO - Handle non-Field-ID dimension:" dimension))))
+      (throw (Exception. (str "Don't know how to handle dimension: " dimension))))))

 (defn- default-value-for-tag [{:keys [default display_name required]}]
   (or default
@@ -98,12 +96,8 @@
     :dimension value))

 (defn- value-for-tag [tag params]
-  (parse-value-for-type (:type tag) (or (u/prog1 (param-value-for-tag tag params)
-                                          (when <>
-                                            (println "param-value-for-tag" <>)))
-                                        (u/prog1 (dimension-value-for-tag tag)
-                                          (when <>
-                                            (println "dimension-value-for-tag" (u/pprint-to-str <>))))
+  (parse-value-for-type (:type tag) (or (param-value-for-tag tag params)
+                                        (dimension-value-for-tag tag)
                                         (default-value-for-tag tag))))

 (defn- query->params-map [{tags :template_tags, params :parameters}]


update status on tld transfer

update status on tld transfer

--- src/name_bazaar/ui/pages/manage_names_page.cljs
+++ src/name_bazaar/ui/pages/manage_names_page.cljs
@@ -280,11 +280,12 @@
                 {:ens.record/label name
                  :ens.record/owner owner}
                 {:result-href (path-for :route.ens-record/detail @form-data)
-                 :on-tx-receipt-n [[:ens.records/load [(sha3 name)]
+                 :on-tx-receipt-n [[:registrar.entries/load [(sha3 name)]]
+                                   [:ens.records/load [(namehash full-name)]
                                     {:load-resolver? true}]
                                    [:district0x.snackbar/show-message
                                     (gstring/format "Ownership of %s was transferred to %s"
-                                                    (:ens.record/name form-data)
+                                                    full-name
                                                     (truncate owner 10))]]}]
                [:registrar.transfer/tx-pending? name]]
               [[:ens/set-owner {:ens.record/name full-name


Added hooks for manipulating game state.

--- src/tfe/core.cljs
+++ src/tfe/core.cljs
@@ -7,10 +7,39 @@

 (enable-console-print!)

-(def app-state (atom {:board [[nil nil nil nil]
+(def app-state (atom {:state :playing
+                      :board [[nil nil nil nil]
                               [nil nil nil   2]
                               [nil nil nil   2]
                               [nil nil nil nil]]}))
+
+(defn next-board [direction board]
+  (vec (apply map vector board)))
+
+(defn next-state [board]
+  :playing)
+
+(defn next-game [direction game]
+  (let [board (:board game)
+        state (:state game)]
+    (assoc game
+           :board (next-board direction board)
+           :state (next-state (next-board direction board)))))
+
+(defn code->direction [key-code]
+  (case key-code
+    37 :left
+    38 :up
+    39 :right
+    40 :down
+    nil))
+
+(defn handle-keybindings [event]
+  (let [keyCode (.-keyCode event)
+        direction (code->direction keyCode)]
+    (swap! app-state #(next-game direction %))))
+
+(events/listen js/document "keyup" (comp println handle-keybindings))

 (defn cell [value]
   (dom/span #js {:className "cell"}  value))


Fix old/elder keyword

Fix old/elder keyword

--- src/tobias/cv.clj
+++ src/tobias/cv.clj
@@ -18,7 +18,7 @@
               (Integer/parseInt n)
               n)]
     (cond
-      (>= age 50) :old
+      (>= age 50) :elder
       (>= age 30) :mid
       :else       :young)))