add comment

add comment

--- src/bzzz/core.clj
+++ src/bzzz/core.clj
@@ -52,6 +52,7 @@
         resolved (if-let [all-possible ((keyword identifier) @peers*)]
                    (if-let [host (possible-hosts all-possible)]
                      host
+                     ;; there is something in the @peers* table, but it is empty/not-rescenn
                      (throw (Throwable. (str "cannot find possible hosts for:" (as-str identifier)))))
                    ;; nothing matches the identifier, in the @peers* table
                    ;; just return it


Sparkles now kick backwards.

Sparkles now kick backwards.

--- Clojure/clojuroids.clj
+++ Clojure/clojuroids.clj
@@ -15,7 +15,8 @@
 (def bullet-efficiency 0.5)
 (def bullet-acceleration 200)
 (def sparkle-efficiency 0.3)
-(def sparkle-velocity 0.25)
+(def sparkle-spread-velocity 0.25)
+(def sparkle-kick-velocity 1.0)
 (def sparkle-amount 0.3)

 (def width 640)
@@ -227,12 +228,19 @@
         (fn [o]
             (let [
                 a (rand (* 2.0 Math/PI))
-                v (rand sparkle-velocity)]
+                sv (* (rand sparkle-spread-velocity) (:acc o))
+                v (* (rand sparkle-kick-velocity) (:acc o))]
                 (assoc o
                     :acc 0.0
                     :eff sparkle-efficiency
-                    :xv (+ (:xv o) (* v (:acc o) (Math/cos a)))
-                    :yv (+ (:yv o) (* v (:acc o) (Math/sin a))))))
+                    :xv (+
+                        (:xv o)
+                        (* sv (Math/cos a))
+                        (* v (- (Math/cos (:a o)))))
+                    :yv (+
+                        (:yv o)
+                        (* sv (Math/sin a))
+                        (* v (- (Math/sin (:a o))))))))
         (filter
             (fn [o] (> (* (:acc o) time-step sparkle-amount) (rand)))
             objects)))


Renamed result-key to res-key.

Renamed result-key to res-key.

--- src/cbfg/kvs.cljs
+++ src/cbfg/kvs.cljs
@@ -58,7 +58,7 @@
   (act kvs-snapshot-do actx
        (aput kvs-snapshot-do res-ch (cb kvs-snapshot))))

-(defn make-scan-fn [kc-kind scan-kind result-key get-entry]
+(defn make-scan-fn [kc-kind scan-kind res-key get-entry]
   (fn [actx state-ch m]
      (let [{:keys [kvs-ident kvs-snapshot from to include-deleted res-ch]} m
            cb (fn [state kvs]
@@ -70,7 +70,7 @@
                          (when-let [entry (get-entry kc k v)]
                            (when (or include-deleted (not (:deleted entry)))
                              (aput scan-work res-ch
-                                   (merge m {:partial :ok result-key key :entry entry})))))
+                                   (merge m {:partial :ok res-key key :entry entry})))))
                        (aput-close scan-work res-ch (merge m {:status :ok}))))
                 nil)]
        (if kvs-snapshot


Added el-event/html/svg helper vars.

Added el-event/html/svg helper vars.

--- src/cbfg/vis.cljs
+++ src/cbfg/vis.cljs
@@ -305,42 +305,45 @@
         (when (> @event-delay 0) (<! (timeout @event-delay)))
         (when (< @event-delay 0) (<! step-ch)))
         (recur (inc num-events)))
-    (ago world w
-         (go-loop [vis-last nil ; Process render-ch, updating U/I.
-                   vis-last-positions nil
-                   vis-last-html nil
-                   vis-last-svg nil
-                   prev-deltas nil]
-           (let [[vis-next deltas after event-str] (<! render-ch)
-                 next-deltas (take 20 (conj prev-deltas [after deltas]))]
-             (set-el-innerHTML (str el-prefix "-event") event-str)
-             (if after
-               (let [vis-next-positions (atom {})
-                     actx-ch-ch-infos (group-by #(:first-taker-actx (second %)) (:chs vis-next))]
-                 (assign-positions vis-next world vis-next-positions actx-ch-ch-infos
-                                   (when (get-in vis-next [:actxs world :closed]) 0))
-                 (let [vis-next-html (apply str (flatten (vis-html-actx vis-next world
-                                                                        actx-ch-ch-infos)))
-                       vis-next-svg (apply str (flatten (vis-svg-actxs vis-next @vis-next-positions
-                                                                       deltas true prev-deltas)))]
-                   (when (not= vis-next-html vis-last-html)
-                     (set-el-innerHTML (str el-prefix "-html") vis-next-html))
+    (let [el-event (str el-prefix "-event")
+          el-html (str el-prefix "-html")
+          el-svg (str el-prefix "-svg")]
+      (ago world w
+           (go-loop [vis-last nil ; Process render-ch, updating U/I.
+                     vis-last-positions nil
+                     vis-last-html nil
+                     vis-last-svg nil
+                     prev-deltas nil]
+             (let [[vis-next deltas after event-str] (<! render-ch)
+                   next-deltas (take 20 (conj prev-deltas [after deltas]))]
+               (set-el-innerHTML el-event event-str)
+               (if after
+                 (let [vis-next-positions (atom {})
+                       actx-ch-ch-infos (group-by #(:first-taker-actx (second %)) (:chs vis-next))]
+                   (assign-positions vis-next world vis-next-positions actx-ch-ch-infos
+                                     (when (get-in vis-next [:actxs world :closed]) 0))
+                   (let [vis-next-html (apply str (flatten (vis-html-actx vis-next world
+                                                                          actx-ch-ch-infos)))
+                         vis-next-svg (apply str (flatten (vis-svg-actxs vis-next @vis-next-positions
+                                                                         deltas true prev-deltas)))]
+                     (when (not= vis-next-html vis-last-html)
+                       (set-el-innerHTML el-html vis-next-html))
+                     (when (not= vis-next-svg vis-last-svg)
+                       (set-el-innerHTML el-svg vis-next-svg))
+                     (recur vis-next @vis-next-positions vis-next-html vis-next-svg next-deltas)))
+                 (let [vis-next-svg (apply str (flatten (vis-svg-actxs vis-last vis-last-positions
+                                                                       deltas false prev-deltas)))]
                    (when (not= vis-next-svg vis-last-svg)
-                     (set-el-innerHTML (str el-prefix "-svg") vis-next-svg))
-                   (recur vis-next @vis-next-positions vis-next-html vis-next-svg next-deltas)))
-               (let [vis-next-svg (apply str (flatten (vis-svg-actxs vis-last vis-last-positions
-                                                                     deltas false prev-deltas)))]
-                 (when (not= vis-next-svg vis-last-svg)
-                   (set-el-innerHTML (str el-prefix "-svg") vis-next-svg))
-                 (recur vis-last vis-last-positions vis-last-html vis-next-svg next-deltas)))))
-         (world-init-cb world))
-    (let [toggle-ch (listen-el (gdom/getElement (str el-prefix "-html")) "click")]
-      (go-loop []
-        (let [actx-id (no-prefix (.-id (.-target (<! toggle-ch))))]
-          (doseq [[actx actx-info] (:actxs @vis)]
-            (when (= actx-id (last actx))
-              (swap! vis #(assoc-in % [:actxs actx :closed] (not (:closed actx-info))))
-              (>! render-ch [@vis nil true nil])))
-          (recur))))
+                     (set-el-innerHTML el-svg vis-next-svg))
+                   (recur vis-last vis-last-positions vis-last-html vis-next-svg next-deltas)))))
+           (world-init-cb world))
+      (let [toggle-ch (listen-el (gdom/getElement el-html) "click")]
+        (go-loop []
+          (let [actx-id (no-prefix (.-id (.-target (<! toggle-ch))))]
+            (doseq [[actx actx-info] (:actxs @vis)]
+              (when (= actx-id (last actx))
+                (swap! vis #(assoc-in % [:actxs actx :closed] (not (:closed actx-info))))
+                (>! render-ch [@vis nil true nil])))
+            (recur)))))
     (vis-run-controls event-delay step-ch el-prefix)))


Remove println.

Remove println.

--- frontend/uxbox/ui/dashboard/icons.cljs
+++ frontend/uxbox/ui/dashboard/icons.cljs
@@ -148,8 +148,7 @@
        [:section.dashboard-grid.library
         (page-title coll)
         [:div.dashboard-grid-content
-         (for [icon (:icons coll)
-               :let [_ (println icon)]]
+         (for [icon (:icons coll)]
            [:div.grid-item.small-item.project-th {:key (str (:id icon))}
             [:span.grid-item-image #_i/toggle (shapes/render icon)]
             [:h3 "Custom icon"]


change version file to be JSON

change version file to be JSON

--- src-cljs/cuttle/main_page.cljs
+++ src-cljs/cuttle/main_page.cljs
@@ -63,7 +63,7 @@
 ;;------------------------------------------------------------------------------

 (def latest-version-url (str
-  "http://cljs.info/latest-cuttle-version.txt?_="
+  "http://cljs.info/cuttle-latest.json?_="
   (uuid)))

 ;; NOTE: I was sick while writing this function; please don't judge ;)
@@ -89,7 +89,11 @@
     (let [data (atom "")]
       (.setEncoding js-res "utf8")
       (.on js-res "data" #(swap! data str %))
-      (.on js-res "end" #(check-version2 @data))))))
+      (.on js-res "end" (fn []
+        (when-let [result (try (.parse js/JSON @data)
+                               (catch js/Error _error nil))]
+          (js-log result)
+          (check-version2 (aget result "version")))))))))

 ;;------------------------------------------------------------------------------
 ;; Project State


disable editing for READ_ONLY

disable editing for READ_ONLY

it's UGLY but it works

--- pedestal-app/app/src/semtag_web/tasks.clj
+++ pedestal-app/app/src/semtag_web/tasks.clj
@@ -2,6 +2,7 @@
   "Tasks to run from the commandline"
   (:require [io.pedestal.app-tools.build :as build]
             [clojure.string :as string]
+            [clojure.java.shell :as sh]
             [io.pedestal.app-tools.dev :as dev]))

 ;; Useful for debugging in ghostdriver
@@ -55,6 +56,22 @@
     (if (System/getenv "READ_ONLY")
       (comp add-read-only-css transform-js-fn) transform-js-fn)))

+(def disable-write-js
+  "(defn enable-editable-table [dom-id input-queue])")
+
+;; I tried different ways to modify the production js file but found none that worked:
+;; - using window.onload was too late to get recognized
+;; - redefining semtag_web.start.main to add a callback was too late for advanced compilation
+;; - removing event listeners wouldn't have worked (since they could get added in another screen)
+(defn- around-build [build-fn]
+  (when (System/getenv "READ_ONLY")
+    (-> "app/src/semtag_web/rendering.cljs" slurp (str "\n" disable-write-js)
+        (as-> new-body
+          (spit "app/src/semtag_web/rendering.cljs" new-body))))
+  (build-fn)
+  (when (System/getenv "READ_ONLY")
+    (sh/sh "git" "checkout" "app/src/semtag_web/rendering.cljs")))
+
 (defn build-app
   "Builds an aspect, :test if no argument is given. It also prepares it to be standalone html and
   adds debugging for the test aspect. Additional behavior can be toggled on with these env
@@ -62,14 +79,15 @@

   * $API_URI: sets a new services/base-uri.
   * $TEST: acts as if the current aspect were a test aspect by forcing simulated services.
-  * $READ_ONLY: hides any write-related UI e.g. the create_thing form."
+  * $READ_ONLY: disables any write-related UI/functionality e.g. the create_thing form."
   [& args]
   (let [aspect (keyword (or (first args) "test"))
         {html-file :uri js-file :out-file} (-> dev/config vals first :aspects aspect)]
     (when-not html-file (throw (ex-info "This aspect does not exist!" {:aspect aspect})))

     (println (format "Building %s app..." aspect))
-    (time (build/build! (-> dev/config vals first (modify-config aspect)) aspect))
+    (around-build (fn []
+                    (time (build/build! (-> dev/config vals first (modify-config aspect)) aspect))))

     (println "Writing" (str "out/public" html-file))
     (modify-file (str "out/public" html-file) (build-transform-fn aspect))


Day 15 part 1 solved

Day 15 part 1 solved

--- src/adventofcode/solutions.clj
+++ src/adventofcode/solutions.clj
@@ -441,9 +441,8 @@
             (conj % (first endpoints) (last endpoints))) #{} deltas))

 (defn day13
-  [input]
-  "Solves day 13 part 1"
-  (let [deltas (into {} (map d13-single-line-extractor input))
+  []
+  (let [deltas (into {} (map d13-single-line-extractor (day-input-line-seq 13)))
         persons (d13-persons deltas)
         arrangements (permutations persons)
         happiness (fn [members]
@@ -457,11 +456,14 @@
              #(+ (happiness %) (happiness (reverse %)))
              arrangements))))

+;factored it out down there in day 15 as similar pattern is used
+(declare name-and-numbers)
+
 ;day 14
 ;part 1
 (defn- d14-single-line-extractor
   [line]
-  (let [[n s d r] (map first (re-seq #"(^\w+)|\d+" line))]
+  (let [[n s d r] (name-and-numbers line)]
     {:name               n
      :moment-in-time     1
      :speed              (s->int s)
@@ -537,9 +539,9 @@
                          (rest raindeers))))

 (defn day14
-  "Expects sequence of lines from file - easily achieved by using day-input-line-seq like (day-input-line-seq 14)"
-  [input]
-  (let [collector (agent (into {} (map #(identity [% []]) (range 2 2504))))
+  []
+  (let [input (day-input-line-seq 14)
+        collector (agent (into {} (map #(identity [% []]) (range 2 2504))))
         watcher (fn [_ _ _ new]
                   (send collector d14-part2-reporter new))
         raindeers (map #(let [a (agent (d14-single-line-extractor %))]
@@ -555,6 +557,48 @@
       {:part1 (find-longest-distance-travelled values)
        :part2 (find-max-points @collector)})))

+(defn- d15-single-line-extractor
+  [line]
+  (let [[name cap dur fla tex cal] (name-and-numbers line)]
+    {:name name
+     :cap  (s->int cap)
+     :dur  (s->int dur)
+     :fla  (s->int fla)
+     :tex  (s->int tex)
+     :cal  (s->int cal)}))
+
+(defn- name-and-numbers
+  [line]
+  (map first (re-seq #"(^\w+)|-?\d+" line)))
+
 ;day 15
 ;preparation
-(filter #(= 100 (apply + %)) (iterate (odometer-generator 4 1 97) [1 1 1 97]))+(defn day15
+  "Similarly to previous: expects sequence of lines from file.
+  Easily achieved by using day-input-line-seq like (day-input-line-seq 15)"
+  []
+  (let [ingredients (into [] (map d15-single-line-extractor (day-input-line-seq 15)))
+        prop-val (fn [a i prop]
+                   (* a (prop (nth ingredients i))))]
+    (apply
+      max
+      (map
+        (fn [amounts]
+          (reduce
+            #(* % (if (pos? %2) %2 0))
+            1
+            (reduce
+              #(map
+                (fn [a b] (+ a b)) % %2) [0 0 0 0]
+              (map-indexed
+                (fn [i a]
+                  [(prop-val a i :cap)
+                   (prop-val a i :dur)
+                   (prop-val a i :fla)
+                   (prop-val a i :tex)])
+                amounts))))
+        (filter
+          #(= 100 (apply + %))
+          (take-while
+            #(< (first %) 98)
+            (iterate (odometer-generator 4 1 98) [1 1 1 97])))))))


minor

minor

--- src-cljs/cuttle/core.cljs
+++ src-cljs/cuttle/core.cljs
@@ -6,14 +6,12 @@
     [cljs.core.async :refer [<!]]
     [cuttle.config :refer [app-data-path]]
     [cuttle.dom :refer [by-id hide-el! set-html! show-el!]]
-    [cuttle.exec :refer [add-lein-profile!
-                         kill-all-leiningen-instances!
-                         correct-java-installed?
-                         lein]]
+    [cuttle.exec :refer [add-lein-profile! correct-java-installed?
+                         kill-all-leiningen-instances! lein]]
+    [cuttle.log :refer [log-info]]
     [cuttle.main-page :as main-page]
     [cuttle.projects :refer [load-workspace!]]
-    [cuttle.util :refer [file-exists? on-windows? path-join windows-bin-dir]]
-    [cuttle.log :refer [log-info]]
+    [cuttle.util :refer [on-windows? path-join windows-bin-dir]]
     hiccups.runtime))

 (enable-console-print!)


fix checkboxes on project settings page

fix checkboxes on project settings page

This edge case makes me think we should rethink the whole inputs
in a side branch of app-state thing.

--- frontend/components/project_settings.cljs
+++ frontend/components/project_settings.cljs
@@ -460,13 +460,15 @@
     (render [_]
       (html
        (let [controls-ch (om/get-shared owner [:comms :controls])
-             inputs (inputs/get-inputs-from-app-state owner)
              notify_pref (get settings field)
              id (string/replace (name field) "_" "-")]
          [:label {:for id}
           [:input {:id id
                    :checked (= "smart" notify_pref)
-                   :on-change #(utils/edit-input controls-ch (conj state/inputs-path field) % :value (if (= "smart" notify_pref) nil "smart"))
+                   ;; note: can't use inputs-state here because react won't let us
+                   ;;       change checked state without rerendering
+                   :on-change #(utils/edit-input controls-ch (conj state/project-path field) %
+                                                 :value (if (= "smart" notify_pref) nil "smart"))
                    :value "smart"
                    :type "checkbox"}]
           [:span "Fixed/Failed Only"]
@@ -514,7 +516,9 @@
                                          [:input#hipchat-notify
                                           {:type "checkbox"
                                            :checked (:hipchat_notify settings)
-                                           :on-change #(utils/edit-input controls-ch (conj state/inputs-path :hipchat_notify) % :value (not (:hipchat_notify settings)))}]
+                                           ;; n.b. can't use inputs-state b/c react won't changed
+                                           ;;      checked state without a rerender
+                                           :on-change #(utils/edit-input controls-ch (conj state/project-path :hipchat_notify) % :value (not (:hipchat_notify settings)))}]
                                          [:span "Show popups"]])
                              :inputs [{:field :hipchat_room :placeholder "Room"}
                                       {:field :hipchat_api_token :placeholder "API"}]


Remove println.

Remove println.

--- src/uxbox/ui/workspace/colorpalette.cljs
+++ src/uxbox/ui/workspace/colorpalette.cljs
@@ -55,8 +55,7 @@
        [:div.color-palette
         [:div.color-palette-actions
          [:select.input-select {:on-change select-collection}
-          (for [collection (vals collections-by-id)
-                :let [_ (println collection)]]
+          (for [collection (vals collections-by-id)]
             [:option {:key (str (:id collection))
                       :value (pr-str (:id collection))}
              (:name collection)])]


Search for atom over all commits

Search for atom over all commits

--- src/atom_finder/atom_patch.clj
+++ src/atom_finder/atom_patch.clj
@@ -121,5 +121,6 @@
   (->> conditional-atom?
        (atom-removed-all-commits gcc-repo)
        (take 10)
-       (doall (map println))
+       (map println)
+       dorun
        time))


"at" + location should not take a pronoun

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -103,6 +103,7 @@
                          :reflexive false})]
           {:synsem {:cat :prep
                     :subcat {:1 {:cat :noun
+                                 :pronoun false
                                  :subcat '()
                                  :sem obj}}
                     :sem {:obj obj


Refactor wpml/word-xmlns

Refactor wpml/word-xmlns

--- src/bakyeono/litedocx/wpml.clj
+++ src/bakyeono/litedocx/wpml.clj
@@ -73,31 +73,31 @@
    :xmlns:dc "http://purl.org/dc/elements/1.1/"})

 (def ^:const ^{:private true} word-xmlns
-  {:xmlns:a "http://schemas.openxmlformats.org/drawingml/2006/main"
-   :xmlns:c "http://schemas.openxmlformats.org/drawingml/2006/chart"
-   :xmlns:dgm "http://schemas.openxmlformats.org/drawingml/2006/diagram"
-   :xmlns:dsp "http://schemas.microsoft.com/office/drawing/2008/diagram"
-   :xmlns:m "http://schemas.openxmlformats.org/officeDocument/2006/math"
-   :xmlns:ns11 "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
-   :xmlns:ns13 "urn:schemas-microsoft-com:office:excel"
-   :xmlns:ns17 "urn:schemas-microsoft-com:office:powerpoint"
-   :xmlns:ns24 "http://schemas.openxmlformats.org/officeDocument/2006/bibliography"
-   :xmlns:ns25 "http://schemas.openxmlformats.org/drawingml/2006/compatibility"
-   :xmlns:ns26 "http://schemas.openxmlformats.org/drawingml/2006/lockedCanvas"
-   :xmlns:ns6 "http://schemas.openxmlformats.org/schemaLibrary/2006/main"
-   :xmlns:ns8 "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing"
-   :xmlns:o "urn:schemas-microsoft-com:office:office"
-   :xmlns:odc "http://opendope.org/conditions"
-   :xmlns:odgm "http://opendope.org/SmartArt/DataHierarchy"
-   :xmlns:odi "http://opendope.org/components"
-   :xmlns:odq "http://opendope.org/questions"
-   :xmlns:odx "http://opendope.org/xpaths"
-   :xmlns:pic "http://schemas.openxmlformats.org/drawingml/2006/picture"
-   :xmlns:r "http://schemas.openxmlformats.org/officeDocument/2006/relationships"
-   :xmlns:v "urn:schemas-microsoft-com:vml"
-   :xmlns:w "http://schemas.openxmlformats.org/wordprocessingml/2006/main"
-   :xmlns:w10 "urn:schemas-microsoft-com:office:word"
-   :xmlns:wp "http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing"})
+  {:xmlns:a xmlns-a
+   :xmlns:c xmlns-c
+   :xmlns:dgm xmlns-dgm
+   :xmlns:dsp xmlns-dsp
+   :xmlns:m xmlns-m
+   :xmlns:ns11 xmlns-ns11
+   :xmlns:ns13 xmlns-ns13
+   :xmlns:ns17 xmlns-ns17
+   :xmlns:ns24 xmlns-ns24
+   :xmlns:ns25 xmlns-ns25
+   :xmlns:ns26 xmlns-ns26
+   :xmlns:ns6 xmlns-ns6
+   :xmlns:ns8 xmlns-ns8
+   :xmlns:o xmlns-o
+   :xmlns:odc xmlns-odc
+   :xmlns:odgm xmlns-odgm
+   :xmlns:odi xmlns-odi
+   :xmlns:odq xmlns-odq
+   :xmlns:odx xmlns-odx
+   :xmlns:pic xmlns-pic
+   :xmlns:r xmlns-r
+   :xmlns:v xmlns-v
+   :xmlns:w xmlns-w
+   :xmlns:w10 xmlns-w10
+   :xmlns:wp xmlns-wp})

 (def ^:const ^{:private true} default-content-types
   [(node :Default {:Extension "rels"


remove unsightly period

remove unsightly period

--- src-cljs/frontend/components/connection.cljs
+++ src-cljs/frontend/components/connection.cljs
@@ -79,7 +79,7 @@
                                                           (disj s conn-id)
                                                           (conj (or s #{}) conn-id))))}
                "Connection from " (client-id->user app (:producer conn-stats))
-               " to " (client-id->user app (:consumer conn-stats)) "."]
+               " to " (client-id->user app (:consumer conn-stats))]
               (when-not (contains? (om/get-state owner :hidden-stats) conn-id)
                 [:div
                  [:table.connection-items.make {:key "conn"}


Fix docstring for shrink-polygon

Fix docstring for shrink-polygon

--- src/clj/genartlib/geometry.clj
+++ src/clj/genartlib/geometry.clj
@@ -39,8 +39,8 @@

 (defn shrink-polygon
   "Pulls all points in a polygon towards the centroid. The provided
-   ratio controls how far the points are pulled, with 0 producing no
-   change and 1.0 pulling all the way to the centroid."
+   ratio controls how far the points are pulled, with 1.0 producing no
+   change and 0.0 pulling all the way to the centroid."
   [points ratio]
   (let [x-points (map first points)
         y-points (map second points)


a little more info

a little more info

--- src/clj/runbld/tests/junit.clj
+++ src/clj/runbld/tests/junit.clj
@@ -104,16 +104,22 @@
                                     nil))]
                       :when xml]
                   (do
-                    (debug/log "Looking for testsuite node")
+                    (rio/log "Looking for testsuite node in"
+                             (.getName (io/file failure)))
                     (if-let [testsuite (x/select xml [[(x/tag= :testsuite)]])]
                       (merge-default (make-failure-report testsuite))
-                      (debug/log "none found"))))]
+                      (rio/log "No testsuite node found."))))]
     (debug/log "Made" (count reports) "reports")
     (debug/log "Combining reports")
-    (reduce combine-failure-reports
-            {:errors 0
-             :failures 0
-             :tests 0
-             :skipped 0
-             :failed-testcases []}
-            reports)))
+    (let [summary (reduce combine-failure-reports
+                          {:errors 0
+                           :failures 0
+                           :tests 0
+                           :skipped 0
+                           :failed-testcases []}
+                          reports)]
+      (rio/log "Errors:" (:errors summary)
+               "Failures:" (:failures summary)
+               "Tests:" (:tests summary)
+               "Skipped:" (:skipped summary))
+      summary)))


Finish integration with latest version of Timber

--- src/clj/traveler/templates.clj
+++ src/clj/traveler/templates.clj
@@ -31,26 +31,40 @@
 ;; base template

 (defn base-page
-  [{:keys [page-name request user-name main-menu user-menu page-content]}]
+  [{:keys [page-name brand request user-name main-menu
+           user-menu page-content extra-styles extra-scripts
+           ng-app]}]
   (timber/base-page
    {:page-name page-name
+    :brand brand
     :asset-uri-path (h-uri/relative-uri request (h-nav/id->uri-path request :timber/assets))
-    :user-name user-name
-    :main-menu main-menu
-    :user-menu user-menu
-    :page-content page-content
+    :user-name      user-name
+    :main-menu      main-menu
+    :user-menu      user-menu
+    :page-content   page-content
+    :extra-styles   extra-styles
+    :extra-scripts  extra-scripts
+    :ng-app         ng-app
     }))

 ;;snippets

+(def extra-styles
+  (timber/extra-styles
+   ["/static/css/traveler.css"]))
+
+(def extra-scripts
+  (timber/extra-scripts
+   ["/static/js/traveler.js"]))
+
 (def nav-side
   (timber/main-menu
    [{:menu-name "Dashboard"
-     :menu-url "/dashboard"}
+     :menu-url  "/dashboard"}
     {:menu-name "Users"
-     :menu-url "/users"}
+     :menu-url  "/users"}
     {:menu-name "System"
-     :menu-url "/system"}]))
+     :menu-url  "/system"}]))

 ;;pages

@@ -77,9 +91,13 @@
   "Main page layout type"
   [{:keys [title content ng-app ctx]}]
   (base-page {:page-name title
+              :brand "VLACS Traveler"
               :request (:request ctx)
               :main-menu nav-side
-              :page-content content}))
+              :page-content content
+              :extra-styles extra-styles
+              :extra-scripts extra-scripts
+              :ng-app ng-app}))

 ;;views


refine logic for deciding how to render an account

--- src/clj_money/web/accounts.clj
+++ src/clj_money/web/accounts.clj
@@ -173,7 +173,10 @@
 (defmulti ^:private show-account
   (fn [account params]
     (cond
-      (-> account :commodity :default)
+      (contains? (:tags account) :trading)
+      :trading-account
+
+      (contains? (:tags account) :tradable)
       :trading-detail

       :else
@@ -326,10 +329,6 @@
     (select-field account :type (map #(vector :option {:value %} (humanize %))
                                      accounts/account-types))
     (select-field account
-                  :content-type
-                  (map #(vector :option {:value %} (humanize %))
-                       [:currency :commodities]))
-    (select-field account
                   :parent-id
                   (grouped-options-for-accounts (:entity-id account)
                                                 {:include-none? true
@@ -368,7 +367,7 @@
   "Creates the account and redirects to the index page on success, or
   re-renders the new form on failure"
   [{params :params}]
-  (let [account (select-keys params [:entity-id :name :type :content-type :parent-id])
+  (let [account (select-keys params [:entity-id :name :type :parent-id])
         saved (accounts/create (env :db) account)]
     (if (validation/has-error? saved)
       (new-account {:params (select-keys saved [:entity-id])} saved)
@@ -394,9 +393,7 @@
   (let [account (select-keys params [:id
                                      :name
                                      :type
-                                     :content-type
                                      :entity-id
-                                     :content-type
                                      :parent-id])
         updated (accounts/update (env :db) account)]
     (if (validation/has-error? updated)


Force focus on edit

Force focus on edit

--- src/cljs/retrobard/client.cljs
+++ src/cljs/retrobard/client.cljs
@@ -192,6 +192,15 @@
     om/IInitState
     (init-state [_]
       {:editing false})
+    om/IDidUpdate
+    (did-update [this prev-props prev-state]
+      (let [input (om/get-node owner "input")
+            val (.-value input)]
+        (when (and (om/get-state owner :editing)
+                   (not (:editing prev-state)))
+          (.focus input)
+          (set! (.-value input) "")
+          (set! (.-value input) val))))
     om/IRenderState
     (render-state [_ {:keys [editing]}]
       (let [text (get data edit-key)]
@@ -203,10 +212,11 @@
                  #js {:className "note-input"
                       :style (display editing)
                       :value text
+                      :ref "input"
                       :onChange #(handle-change % data edit-key owner)
-                      :onKeyUp #(case (.-keyCode %)
-                                     13 (end-edit text owner on-edit)
-                                     nil)
+                      :onKeyDown #(case (.-keyCode %)
+                                    13 (end-edit text owner on-edit)
+                                    nil)
                       :onBlur (fn [e]
                                 (when (om/get-state owner :editing)
                                   (end-edit text owner on-edit)))})


Fix for disposing a ReactiveElement when it is detached from the tree (or moved) by some other method (say diffing).

--- src/clojure/freactive/dom.cljs
+++ src/clojure/freactive/dom.cljs
@@ -719,30 +719,29 @@

           ref-meta (meta child-ref)

-          get-new-elem (fn []
+          get-new-elem (fn get-new-elem-fn []
                          (set! (.-dirty state) false)
                          (add-watch* child-ref state (.-invalidate state))
                          (or (non-reactively @child-ref) ""))

-          show-new-elem (fn [new-elem cur]
+          show-new-elem (fn show-new-elem-fn [new-elem cur]
                           (let [cur
                                 (if (instance? ReactiveElement cur)
                                   (let [cur-elem (.-cur-element cur)]
                                     (set! (.-disposed cur) true)
                                     (set! (.-cur-element cur) nil)
                                     cur-elem)
-                                  cur)
-
-                                new-node
-                                (if cur
-                                  (replace-child* parent new-elem cur true)
-                                  (insert-child* parent new-elem before))]
-
-                            (set! (.-cur-element state) new-node)
-                            (set! (.-updating state) false)
-                            (when (.-dirty state)
-                              (queue-animation (.-animate state)))
-                            (show-node new-node)))
+                                  cur)]
+                            (if-let [parent parent]
+                              (let [new-node (if cur
+                                               (replace-child* parent new-elem cur true)
+                                               (insert-child* parent new-elem before))]
+                                (set! (.-cur-element state) new-node)
+                                (set! (.-updating state) false)
+                                (when (.-dirty state)
+                                  (queue-animation (.-animate state)))
+                                (show-node new-node))
+                              (set! (.-disposed state) true))))

           animate
           (fn animate [x]


Fix/implement send-chaincode-proposal, etc

--- src/clojure_fabric/channel.clj
+++ src/clojure_fabric/channel.clj
@@ -292,14 +292,8 @@
                                             {:args [name transaction-id]})))

 (defn- send-chaincode-proposal
-  ([{:keys [user-key name] :as channel}
-    target-peers
-    endorsement                         ; FIXME: Not being used
-    ;; FIXME: transient map
-    command-key                         ; :instantiate or :upgrade
-    ;;;
-    & {:as chaincode-deployment-spec-args}
-    ]
+  ([{:keys [user-key name] :as channel} target-peers signature-policy-envelope command-key ; :instantiate or :upgrade
+    & {:as chaincode-deployment-spec-args}]
    (user/with-validating-peers [channel target-peers]
      (let [{:keys [name version type fcn args] :or {fcn "init"}} chaincode-deployment-spec-args
            chaincode-id (proto/make-chaincode-id :name name :version version)
@@ -309,7 +303,7 @@
                                                 name
                                                 target-peers
                                                 (apply core/get-user user-key)
-                                                {:args [name deployment-spec endorsement]})))))
+                                                {:args [name deployment-spec signature-policy-envelope]})))))

 ;;;create_deploy_proposal
@@ -352,26 +346,16 @@
    ))

 (defn send-instantiate-proposal
-  ([channel chaincode-id user fcn args transient-map opts]
-   (send-instantiate-proposal channel chaincode-id (core/get-nodes channel :peers) user fcn args
-                              transient-map opts))
-  ([channel chaincode-id targets user fcn args transient-map opts]
-   (send-chaincode-proposal channel
-                            targets
-                            :ENDORSEMENT
-                            :deploy
-                            opts)))
+  ([channel signature-policy-envelope opts]
+   (send-instantiate-proposal channel (core/get-nodes channel :peers) signature-policy-envelope opts))
+  ([channel targets signature-policy-envelope opts]
+   (send-chaincode-proposal channel targets signature-policy-envelope :deploy opts)))

 (defn send-upgrade-proposal
-  ([channel chaincode-id user fcn args transient-map opts]
-   (send-upgrade-proposal channel chaincode-id (core/get-nodes channel :peers) user fcn args
-                          transient-map opts))
-  ([channel chaincode-id targets user fcn args transient-map opts]
-   (send-chaincode-proposal channel
-                            targets
-                            :ENDORSEMENT
-                            :upgrade
-                            opts)))
+  ([channel signature-policy-envelope opts]
+   (send-upgrade-proposal channel (core/get-nodes channel :peers) signature-policy-envelope opts))
+  ([channel targets signature-policy-envelope opts]
+   (send-chaincode-proposal channel targets signature-policy-envelope :upgrade opts)))

 ;;;send_transaction
 (defn send-transaction


fix def to defn

fix def to defn

--- kafka-clj/src/kafka_clj/consumer/node.clj
+++ kafka-clj/src/kafka_clj/consumer/node.clj
@@ -154,7 +154,7 @@
      :redis-conn         redis-conn
      :work-unit-event-ch work-unit-event-ch}))

-(def node-stats
+(defn node-stats
   "Returns the consumer stats, takes as argument the instance returned from create-node!"
   [{:keys [consumer]}]
   (consumer-pool-stats consumer))


Bugfix: could not connect to gate inputs

--- src/alder/node-graph.cljs
+++ src/alder/node-graph.cljs
@@ -66,7 +66,7 @@
       (case (:type input-data)
         :param (f from-audio-node [(aget to-audio-node input-name) output-index])
         :node (f from-audio-node [to-audio-node output-index input-index])
-        :gate f from-audio-node [to-audio-node output-index]
+        :gate (f from-audio-node [to-audio-node output-index])
         :null-node nil))))

 (s/defn connect-nodes :- NodeGraph


Timeline view shows most recent tweets at the top.

--- samples/twitterbuzz/src/twitterbuzz/timeline.cljs
+++ samples/twitterbuzz/src/twitterbuzz/timeline.cljs
@@ -26,7 +26,7 @@
 (defn update-timeline [tweets]
   (let [status (dom/getElement "tweet-status")]
     (do (dom/setTextContent status (str (:tweet-count @buzz/state) " tweets"))
-        (doseq [tweet tweets]
+        (doseq [tweet (reverse tweets)]
           (add-timeline-tweet tweet)))))

 (buzz/register :track-clicked #(buzz/remove-children "timeline-content"))


Clear timeline when refresh button is clicked.

--- samples/twitterbuzz/src/twitterbuzz/timeline.cljs
+++ samples/twitterbuzz/src/twitterbuzz/timeline.cljs
@@ -1,18 +1,17 @@
+;   Copyright (c) Rich Hickey. All rights reserved.
+;   The use and distribution terms for this software are covered by the
+;   Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+;   which can be found in the file epl-v10.html at the root of this distribution.
+;   By using this software in any fashion, you are agreeing to be bound by
+;   the terms of this license.
+;   You must not remove this notice, or any other, from this software.
+
 (ns twitterbuzz.timeline
   (:require [twitterbuzz.core :as core]
             [goog.dom :as dom]))

-;; This is a working example. Please improve in any way to that you
-;; can.
-
-;; TODO: Only show a certain number of tweets. Remove tweets from the
-;; end of the list when this number is exceeded.
-
-;; may want to put common dom helper functions somewhere else so they
-;; can be used by all the views.
-
 (defn dom-element [element attrs]
-  (dom/createDom element
+  (dom/createDom (name element)
                  (.strobj (reduce (fn [m [k v]]
                                     (assoc m k v))
                                   {}
@@ -20,10 +19,10 @@

 (defn add-timeline-tweet [tweet]
   (let [parent (dom/getElement "timeline-content")
-        child (dom-element "div" {:class "tweet"})
-        user (dom-element "div" {:class "user-name"})
-        text (dom-element "div" {:class "tweet-text"})
-        pic (dom-element "img" {:src (:profile_image_url tweet) :class "profile-pic"})]
+        child (dom-element :div {:class "tweet"})
+        user (dom-element :div {:class "user-name"})
+        text (dom-element :div {:class "tweet-text"})
+        pic (dom-element :img {:src (:profile_image_url tweet) :class "profile-pic"})]
     (do (dom/setTextContent text (:text tweet))
         (dom/setTextContent user (:from_user tweet))
         (dom/appendChild child pic)
@@ -37,4 +36,9 @@
         (doseq [tweet tweets]
           (add-timeline-tweet tweet)))))

+(defn refresh [_]
+  (let [parent (dom/getElement "timeline-content")]
+    (do (dom/removeChildren parent))))
+
 (core/register :new-tweets update-timeline)
+(core/register :refresh-clicked refresh)


reset did not work

reset did not work

--- dev/dev.clj
+++ dev/dev.clj
@@ -4,12 +4,7 @@
     [com.ig.swagger.search.standalone :as standalone]
     clojure.java.shell))

-(disable-reload!)
-
-(if-let [ns (find-ns 'com.ig.swagger.search.discovery.providers.consul)]
-  (disable-reload! ns))
-
-(def system (atom nil))
+(defonce system (atom nil))

 (defn start
   "Starts the current development system."


Add download-modes.

Add download-modes.

--- src/beebster_clj/core.clj
+++ src/beebster_clj/core.clj
@@ -2,6 +2,7 @@
   (:import [java.lang.ProcessBuilder])
   (:require [compojure.route :as route]
             [compojure.handler :as handler]
+
             ;; [beebster-clj.views :as views]
             )
   (:use [ring.adapter.jetty :only [run-jetty]]
@@ -27,6 +28,15 @@
   [index]
   (split-lines (:out (apply sh (flatten (conj (list index) iplayer-info))))))

+(defn get-download-modes
+  "build list of possible download-modes for a given index."
+  [lst]
+  (let [modes (first (filter #(re-find #"modes.*" %) lst))]
+    (remove nil? (list (re-find #"flashhigh" modes)
+                       (re-find #"flashvhigh" modes)
+                       (re-find #"flashhd" modes)
+                       (re-find #"flashlow" modes)))))
+
 (defn load-thumbandinfo-for-index
   "grep url for thumbnail size44, title and description
    for entered index."
@@ -35,7 +45,8 @@
     (list
      (map #(re-find #"htt.*" %) (filter #(re-find #"thumbnail4.*" %) ind))
      (map #(re-find #"[A-Z].*" %) (filter #(re-find #"desc:.*" %) ind))
-     (map #(re-find #"[A-Z0-9].*" %) (filter #(re-find #"title:.*" %) ind)))))
+     (map #(re-find #"[A-Z0-9].*" %) (filter #(re-find #"title:.*" %) ind))
+     (get-download-modes ind))))

 (defn get-thumb-from-search
   "return list of thumbnail for searchterm."
@@ -53,18 +64,6 @@
   [s]
   (remove #(= "" %) (map #(re-find #"^[0-9]*" %) s)))

-(defn get-download-modes
-  "build list of possible download-modes for a given index."
-  [lst]
-  (let [modes (first (filter #(re-find #"modes.*" %) lst))]
-    (remove nil? (list (re-find #"flashhigh" modes)
-                       (re-find #"flashvhigh" modes)
-                       (re-find #"flashhd" modes)
-                       (re-find #"flashlow" modes)))))
-
-
-
-
 (defn old-recordings?
   "Does get-iplayer complain about recorded programmes > 30 days?"
   [lst]
@@ -75,11 +74,8 @@
 (defn iplayer-download-command
   "concatenate index and mode to download command"
    [index mode]
-   (list "get-iplayer" (apply str "modes=" mode "1")
-         (apply str "output=" (System/getenv "HOME") "/Videos/") "-g" index))
-
-
-
+   (list "get-iplayer" (apply str "modes=" mode "1\"")
+         "output=\"$HOME/Videos\"" "-g" index))

 (defn get-url
   "return /info url string concatenated with index"
@@ -92,16 +88,15 @@
   (:out (apply sh (flatten
                    (conj (list search-title) iplayer-command)))))

-
-
 (defn iplayer-search
-  "run external command with given args list."
+  "If old-recording? display a list of all programmes,
+   that have to be deleted, otherwise, return a list of
+   all matching programmes for search input."
   [search-title]
   (let [result (iplayer-search-resultstring search-title)]
     (if (old-recordings? (split-lines result))
       (split-lines (subs result (.indexOf result delete-string)))
       (split-lines result))))
-

 (defn search-categories
   "search iplayer for a given category"


Extract type hint foo into fn.

Extract type hint foo into fn.

--- src/dsbdp/local_data_processing_pipeline.clj
+++ src/dsbdp/local_data_processing_pipeline.clj
@@ -61,18 +61,22 @@
     (println expr)
     expr))

+(defn add-type-hint
+  [obj]
+  (if (.contains queue-setup "Queue")
+    (with-meta
+      obj
+      {:tag (condp (fn [^String v ^String s] (.startsWith s v)) queue-setup
+              "ArrayBlockingQueue" 'java.util.concurrent.BlockingQueue
+              "LinkedBlockingQueue" 'java.util.concurrent.BlockingQueue
+              "LinkedTransferQueue" 'java.util.concurrent.TransferQueue
+              "OneToOneConcurrentArrayQueue3" 'java.util.Queue)})
+    obj))
+
 (defmacro enqueue
   [obj data enqueued-counter dropped-counter]
   (println "Enqueueing data via:")
-  (let [queue (if (.contains queue-setup "Queue")
-                (with-meta
-                  obj
-                  {:tag (condp (fn [^String v ^String s] (.startsWith s v)) queue-setup
-                          "ArrayBlockingQueue" 'java.util.concurrent.BlockingQueue
-                          "LinkedBlockingQueue" 'java.util.concurrent.BlockingQueue
-                          "LinkedTransferQueue" 'java.util.concurrent.TransferQueue
-                          "OneToOneConcurrentArrayQueue3" 'java.util.Queue)})
-                obj)
+  (let [queue (add-type-hint obj)
         expr (condp (fn [^String v ^String s] (.contains s v)) queue-setup
                "add-counted-yield" `(if (< (.size ~queue) queue-size)
                                       (do
@@ -153,15 +157,7 @@
 (defmacro take-from-queue
   [obj]
   (println "Retrieving data via:")
-  (let [queue (if (.contains queue-setup "Queue")
-                (with-meta
-                  obj
-                  {:tag (condp (fn [^String v ^String s] (.startsWith s v)) queue-setup
-                          "ArrayBlockingQueue" 'java.util.concurrent.BlockingQueue
-                          "LinkedBlockingQueue" 'java.util.concurrent.BlockingQueue
-                          "LinkedTransferQueue" 'java.util.concurrent.TransferQueue
-                          "OneToOneConcurrentArrayQueue3" 'java.util.Queue)})
-                obj)
+  (let [queue (add-type-hint obj)
         expr (condp (fn [^String v ^String s] (.endsWith s v)) queue-setup
                "remove-yield" `(if (not (.isEmpty ~queue))
                                  (.remove ~queue)


Mapping changes for TTP schema in CTIM 0.1.7

--- src/ctia/stores/es/mapping.clj
+++ src/ctia/stores/es/mapping.clj
@@ -29,14 +29,17 @@

 (def attack-pattern
   {:properties
-   {:description all_text
+   {:title string
+    :description all_text
+    :short_description string
     :capec_id string}})

 (def malware-instance
   {:properties
-   {:description all_text
-    :type string
-    :malware_type string}})
+   {:title string
+    :description all_text
+    :short_description string
+    :type string}})

 (def observable
   {:type "object"
@@ -68,7 +71,9 @@

 (def infrastructure
   {:properties
-   {:description all_text
+   {:title string
+    :description all_text
+    :short_description string
     :type string}})

 (def related-identities
@@ -96,7 +101,7 @@
   {:properties
    {:tools tool
     :infrastructure infrastructure
-    :providers tg-identity}})
+    :personas tg-identity}})

 (def activity
   {:properties


Cleanup. Floor texture.

Cleanup. Floor texture.

--- src/brevis/graphics/basic_3D.clj
+++ src/brevis/graphics/basic_3D.clj
@@ -3,7 +3,7 @@
         [penumbra.opengl core]
         [cantor]
         [brevis.physics.space]
-        [brevis.shape box sphere])
+        [brevis.shape core box sphere])
   (:require [penumbra.app :as app]
             [penumbra.text :as text]
             [penumbra.data :as data]
@@ -17,21 +17,26 @@
 (defn draw-shape
   "Draw a shape. Call this after translating, scaling, and setting color."
   [obj]
-  (let [pos (get-position obj)
-        vel (get-velocity obj)
-        col (:color obj)]
-	  (push-matrix
-	   #_(apply color (:color obj))
-	   (material :front-and-back
-	    :ambient-and-diffuse (into [] (conj col 1)); [1 1 1 1]
-	    :specular            [0.5 0.4 0.4 1]
-	    :shininess           64)
-	   (translate pos)
-	   (apply scale (:dim (:shape obj)))
-	   (rotate (.x vel) 1 0 0)
-	   (rotate (.y vel) 0 1 0)
-	   (rotate (.z vel) 0 0 1)
-	   (cond
-      (= (:type (:shape obj)) :box) (draw-textured-cube)
-      (= (:type (:shape obj)) :sphere) (draw-sphere))
-	   #_(call-display-list (cond (= (:type (:shape obj)) :box) box-graphic)))))
+  (if (:texture obj)
+    (with-enabled :texture-2d
+      (with-texture brevis.shape.core/*checkers*;(:texture obj)
+        (draw-shape (dissoc obj :texture))))
+	  (let [pos (get-position obj)
+	        vel (get-velocity obj)
+	        col (:color obj)]
+		  (push-matrix
+		   #_(apply color (:color obj))
+		   (material :front-and-back
+		    :ambient-and-diffuse (into [] (conj col 1)); [1 1 1 1]
+;		    :specular            [0.5 0.4 0.4 1]
+		    :shininess           80)
+		   (translate pos)
+		   (apply scale (:dim (:shape obj)))
+		   (rotate (.x vel) 1 0 0)
+		   (rotate (.y vel) 0 1 0)
+		   (rotate (.z vel) 0 0 1)
+		   (cond
+	      (= (:type (:shape obj)) :box) (draw-textured-cube)
+	      (= (:type (:shape obj)) :sphere) (draw-sphere))
+		   #_(call-display-list (cond (= (:type (:shape obj)) :box) box-graphic))))))
+


Fix docstring typo

Fix docstring typo

--- src/caesium/crypto/secretbox.clj
+++ src/caesium/crypto/secretbox.clj
@@ -21,7 +21,7 @@
   "Encrypt with `crypto_secretbox_easy`.

   Please note that this returns a (mutable!) byte array. This is a
-  higher level API than [[secretbox-easy-to-buf!]] because it create
+  higher level API than [[secretbox-easy-to-buf!]] because it creates
   that output byte array for you.

   This API is marginally higher level than `secretbox`: it will


Remove dead code

Remove dead code

--- src/app/view/ctl.cljs
+++ src/app/view/ctl.cljs
@@ -40,15 +40,6 @@
                      :child
                      (xform (str "<div>" (md->html help-tpl) "</div>"))])]])))

-(defn display? [visible?]
-  (if @visible?
-    "display: block;"
-    "display: none;"))
-
-(defn visibility-class [visible?]
-  (if visible?
-    ""
-    "hidden"))

 (defn ipm-slider [model]
   [slider


more options

more options

--- src/clj/just_married/labels.clj
+++ src/clj/just_married/labels.clj
@@ -5,6 +5,13 @@

 (def ^:private n-cols 3)
 (def ^:private file-name "labels.pdf")
+
+(def table-options
+  {:width-percent    100
+   :horizontal-align :right})
+
+(def cell-options
+  {:align :right})

 (def countries-mappping
   {"IT" "Italy"
@@ -17,15 +24,17 @@
   #_{:pre [(contains? (set (keys countries-mappping)) country)]}
   (format "%s\n%s\n%s"
           group_name
-          address
-          (countries-mappping country)))
+          (or address "")
+          (or (countries-mappping country) "")))

 (defn gen-table
   [addresses]
   (let [grouped-addresses (partition-all n-cols addresses)]
-    (into [:pdf-table (repeat n-cols 20)]
+    (into [:pdf-table
+           table-options
+           (repeat n-cols 20)]
           (map #(for [addr %]
-                  [:pdf-cell (format-address addr)])
+                  [:pdf-cell cell-options (format-address addr)])
                grouped-addresses))))

 (defn labels


write lock free on sync trunk

write lock free on sync trunk

--- src/clj/neb/durability/core.clj
+++ src/clj/neb/durability/core.clj
@@ -43,16 +43,15 @@

 (defn sync-trunk [^Trunk trunk]
   (try
-    (.writeLock trunk)
-    (let [dirty-ranges  (.clone (.getDirtyRanges trunk))
-          append-header (.getAppendHeaderValue trunk)
+    (let [append-header (.getAppendHeaderValue trunk)
           ^MemoryFork mf (.fork trunk)
+          dirty-ranges  (.clone (.getDirtyRanges trunk))
           timestamp (System/nanoTime)]
       (.clear (.getDirtyRanges trunk))
-      (.writeUnlock trunk)
       (loop [pos 0]
         (let [d-range (.ceilingEntry dirty-ranges pos)]
-          (if-not d-range
+          (if (or (not d-range)
+                  (>= (.getKey d-range) append-header))
             (when (> (.size dirty-ranges) 0)
               (finish-trunk-sync trunk append-header timestamp))
             (do (let [start (.getKey d-range)
@@ -61,6 +60,4 @@
                 (recur (inc (.getValue d-range)))))))
       (.release mf))
     (catch Exception ex
-      (clojure.stacktrace/print-cause-trace ex))
-    (finally
-      (.writeUnlock trunk))))+      (clojure.stacktrace/print-cause-trace ex))))


use narrative

use narrative

--- src/clj/salava/badge/routes.clj
+++ src/clj/salava/badge/routes.clj
@@ -275,14 +275,14 @@
                    :path-params [user-badge-id :- Long]
                    :body-params [id :- (s/maybe s/Int)
                                  name :- (s/maybe s/Str)
-                                 description :- (s/maybe s/Str)
+                                 narrative :- (s/maybe s/Str)
                                  url :- s/Str
                                  resource_id :- (s/maybe s/Int)
                                  resource_type :- (s/maybe s/Str)]
                    :summary "Save badge evidence"
                    :auth-rules access/authenticated
                    :current-user current-user
-                   (ok (b/save-badge-evidence ctx (:id current-user) user-badge-id id name description url resource_id resource_type)))
+                   (ok (b/save-badge-evidence ctx (:id current-user) user-badge-id id name narrative url resource_id resource_type)))

              (DELETE "/evidence/:evidenceid" [user_badge_id resource_type resource_id]
                      :return {:status (s/enum "success" "error")}


Whitespace

Whitespace

--- src/braid/core/hooks.cljc
+++ src/braid/core/hooks.cljc
@@ -25,4 +25,3 @@
   []
   (doseq [[a initial-state] @atoms]
     (reset! a initial-state)))
-


cljfmt

cljfmt

--- src/desdemona/plugins/swift.clj
+++ src/desdemona/plugins/swift.clj
@@ -45,7 +45,7 @@
                              :throw-entire-message true
                              :as :stream})]
     (-> response :body bs/to-reader (json/decode-stream
-                                      ->kebab-case-keyword))))
+                                     ->kebab-case-keyword))))

 (defn create-container
   "Create a container on Cloud Files. This requires an auth token, which is


Run report update

Run report update

--- src/clinvar_submitter/report.clj
+++ src/clinvar_submitter/report.clj
@@ -19,11 +19,11 @@
        "\n\nNOTE: The variant coordinates are based on the preferred genomic representation from the ClinGen Allele Registry.\n\n"
        "\n*******************************************************************\n\n"
        "\n\n"(format "%10s%45s%45s""|----------|""----------------- Input --------------- |""----------------- Output ---------------|")
-       "\n"(format "%s%10s%s%18s%s%4s%s%15s%s%5s%s%5s%s%10s%s%17s"
+       "\n"(format "%s%10s%s%18s%s%20s%s%8s%s%5s%s%5s%s%10s%s%17s"
                            "|""Result#"
                            "|""File Name"
+                           "|""Variant (alt desig)"
                            "|""Record"
-                           "|""Variant (alt desig)"
                            "|""Cell"
                            "|""Status"
                            "|""Code"
@@ -37,68 +37,91 @@
 	   (number? v) (str v)
      (seq? v) (apply str v) :else v))

-(defn isError [celldata]
-  (println celldata)
-  (let [errorvector ["E-202" "E-203" "E-204" "E-205" "E-206" "E-207" "E-208" "W-251" "E-301" "E-302" "E-401" "E-402" "E-403" "E-404" "E-501" "W-551"]]
-  (println (compare errorvector celldata))
-  ))
+(defn isError [errorcode]
+  ;(println "errorcode in isError " errorcode)
+  (let [errorvector ["*E-202" "*E-203" "*E-204" "*E-205" "*E-206" "*E-207" "*E-208" "*W-251" "*E-301" "*E-302" "*E-401" "*E-402" "*E-403" "E-404" "E-501" "W-551"]]
+  (some #(= errorcode %) errorvector))
+)

 (defn error-description [errorcode]
-(println errorcode)
-{
-    :E-202 "Variant identifier not provided."
-		:E-203 "No preferred variant information provided"
-		:E-204 "Preferred variant reference sequence not provided"
-		:E-205 "Preferred variant start coordinate not provided."
-		:E-206 "Preferred variant end coordinate not provided."
-		:E-207 "Preferred variant reference allele not provided."
-		:E-208 "Preferred variant alternate allele not provided."
-		:W-251 "Preferred variant alternate designation not provided."
-		:E-301 "Condition disease code or name not provided."
-		:E-302 "Mode of Inheritance display value not provided."
-		:E-401 "Interpretation id not provided."
-		:E-402 "Interpretation significance not provided."
-		:E-403 "Interpretation evaluation date not provided."
-		:E-404 "Interpretation evaluation date format not valid (<eval-date-value>)."
-		:E-501 "<x> met criteria rules and/or strength codes are invalid or missing."
-		:W-551 "No PMID citations found."
-  })
+  (println "is equale " (identical? "*E-401" errorcode))
+  (if (identical? "*E-401" errorcode)
+  {
+   :desc "Interpretation id not provided."
+  }))

-(defn get-error [errorcode]
+;{
+;    :E-202 "Variant identifier not provided."
+;		:E-203 "No preferred variant information provided"
+;		:E-204 "Preferred variant reference sequence not provided"
+;		:E-205 "Preferred variant start coordinate not provided."
+;		:E-206 "Preferred variant end coordinate not provided."
+;		:E-207 "Preferred variant reference allele not provided."
+;		:E-208 "Preferred variant alternate allele not provided."
+;		:W-251 "Preferred variant alternate designation not provided."
+;		:E-301 "Condition disease code or name not provided."
+;		:E-302 "Mode of Inheritance display value not provided."
+;		:E-401 "Interpretation id not provided."
+;		:E-402 "Interpretation significance not provided."
+;		:E-403 "Interpretation evaluation date not provided."
+;		:E-404 "Interpretation evaluation date format not valid (<eval-date-value>)."
+;		:E-501 "<x> met criteria rules and/or strength codes are invalid or missing."
+;		:W-551 "No PMID citations found."
+;})
+
+(defn get-error [errorcode n]
+  (let [desc (error-description errorcode)]
   {
-   :cell "A8"
-   :status "Error",
+   :cell n
+   :status "Error"
    :code errorcode
-   :desc ((error-description errorcode) :E-401)
-   })
+   :desc (get desc :desc)
+}))

 (defn get-variant [records]
-  (println "record size: " (count records))
-  (doseq [items records]
-    (get items 3)
-    (println "data: " (get items 3) "\n" ))
- )
-
-(defn append-to-report [reportfile in out records]
-  (let [error (get-error "E-401")]
-  ;(doseq [n (range (count records))]
-    (let [n 0]
-    (doseq [item records]
-      (println item)
-      (let [reportdata (format "%s%10s%s%18s%s%4s%s%15s%s%5s%s%5s%s%10s%s%16s%s"
-                               "|" (+ n 101)
-                               "|" in
-                               "|" (+ n 1)
-                               "|" (get item 3)
-                               "|" (get error :cell)
-                               "|" (get error :status)
-                               "|" (get error :code)
-                               "|" (get error :desc)"|\n")]
-      (spit reportfile reportdata :append true))
-      (inc n))
-      ;(recur item (inc n))
-      )))
+  (let [data (for [items records] (get items 3))]
+    data))
+
+(defn get-errorcode [items]
+  (let [errorlist
+       (for [i (range (count items))]
+       (if-not(nil? (get items i))
+         (if(isError (get items i))
+          (str (get items i)))))]
+       (let [newList (some #(when-not (empty? %) %) errorlist)]
+       newList)))
+
+(defn append-to-report [reportfile in out records]
+  (doseq [n (range (count records))]
+    ;get each row from record set
+    (let [row (nth records n)]
+      ;get errorcode from each row
+      (let [errorcode (get-errorcode row)]
+        ;if there is error in any row add error information in the report
+        (if-not(nil? errorcode)
+          (let [error (get-error errorcode n)]
+          (let [outputdata-e (format "%s%10s%s%18s%s%20s%s%8s%s%5s%s%5s%s%10s%s%16s%s"
+                                  "|" (+ n 101)
+                                  "|" in
+                                  "|" (nth (get-variant records) n)
+                                  "|" (+ n 1)
+                                  "|" (get error :cell)
+                                  "|" (get error :status)
+                                  "|" (get error :code)
+                                  "|" (get error :desc) "|\n")]
+           (spit reportfile outputdata-e  :append true)))
+           (let [outputdata-s (format "%s%10s%s%18s%s%20s%s%8s%s%5s%s%5s%s%10s%s%16s%s"
+                                   "|" (+ n 101)
+                                   "|" in
+                                   "|" (nth (get-variant records) n)
+                                   "|" (+ n 1)
+                                   "|" "--"
+                                   "|" "SUCCESS"
+                                   "|" "--"
+                                   "|" "--" "|\n")]
+             (spit reportfile outputdata-s :append true)))
+          ))))

 (defn write-report [in cx out frc reportfile]
   (with-open [report (clojure.java.io/writer reportfile :append false)]


fix concurrency and time simulation problems with timer by taking a much simpler approach

--- src/clj/backtype/storm/timer.clj
+++ src/clj/backtype/storm/timer.clj
@@ -26,19 +26,14 @@
                         (while @active
                           (try
                             (let [[time-secs _ _ :as elem] (.peek queue)]
-                              (if elem
-                                (if (>= (current-time-secs) time-secs)
-                                  ;; can't hold the lock while executing the task function, or else
-                                  ;; deadlocks are possible (if the task function locks another lock
-                                  ;; and another thread locks that other lock before trying to schedule
-                                  ;; something on the timer)
-                                  (let [exec-fn (locking lock (second (.poll queue)))]
-                                    (exec-fn))
-                                  (Time/sleepUntil (to-millis time-secs))
-                                  )
-                                (Time/sleep 10000)
+                              (if (and elem (>= (current-time-secs) time-secs))
+                                ;; imperative to not run the function inside the timer lock
+                                ;; otherwise, it's possible to deadlock if function deals with other locks
+                                ;; (like the submit lock)
+                                (let [afn (locking lock (second (.poll queue)))]
+                                  (afn))
+                                (Time/sleep 1000)
                                 ))
-
                             (catch InterruptedException e
                               )
                             (catch Throwable t
@@ -65,9 +60,6 @@
         ^PriorityQueue queue (:queue timer)]
     (locking (:lock timer)
       (.add queue [(+ (current-time-secs) delay-secs) afn id])
-      (when (and (not= (:timer-thread timer) (Thread/currentThread))
-                 (= id (nth (.peek queue) 2)))
-        (.interrupt ^Thread (:timer-thread timer)))
       )))

 (defn schedule-recurring [timer delay-secs recur-secs afn]


WIP still reworking routes

WIP still reworking routes

--- src/clj/clj_money/web/server.clj
+++ src/clj/clj_money/web/server.clj
@@ -240,10 +240,11 @@
       wrap-session))

 (defroutes app
+  wrapped-open-routes
   (friend/logout (POST "/logout" [] (redirect "/")))
   wrapped-protected-routes
-  wrapped-api-routes
-  wrapped-open-routes
+  ;wrapped-api-routes
+  ;wrapped-open-routes
   (ANY "*" req
        (do
          (log/debug "unable to match route for " (:uri req))


Fixed 'player nil disconnected'

Fixed 'player nil disconnected'

--- src/clj/funstructor/commands.clj
+++ src/clj/funstructor/commands.clj
@@ -179,18 +179,19 @@
         game (gs/get-game (gs/current-global-state) game-id)
         opponent (f/get-opponent game player)]
     (u/log "Player " player " has disconnected")
-    (gs/update-global-state
-     gs/update-game
-     game-id
-     f/player-win
-     opponent
-     "Other player has disconnected")
+    (when opponent
+      (gs/update-global-state
+       gs/update-game
+       game-id
+       f/player-win
+       opponent
+       "Other player has disconnected")

-    (u/log "Sending update to his opponent: " opponent)
-    (send-command
-     {:type :game-update
-      :data (make-update-data (gs/get-game (gs/current-global-state) game-id) opponent)}
-     (gs/channel-for-player (gs/current-global-state) opponent))))
+      (u/log "Sending update to his opponent: " opponent)
+      (send-command
+       {:type :game-update
+        :data (make-update-data (gs/get-game (gs/current-global-state) game-id) opponent)}
+       (gs/channel-for-player (gs/current-global-state) opponent)))))

 (defmethod handle-command :default [command channel]
   (u/printerr "Unrecognized command: " command))


Lookup webviews based on the editor pane rather than the whole scene

--- src/clj/nightcode/controller.clj
+++ src/clj/nightcode/controller.clj
@@ -188,8 +188,9 @@

 (defn save! [^Scene scene]
   (when-let [path (:selection @pref-state)]
-    (when-let [engine (some-> scene (.lookup "#webview") .getEngine)]
-      (e/save-file! path engine))
+    (when-let [pane (get-in @runtime-state [:editor-panes path])]
+      (when-let [engine (some-> pane (.lookup "#webview") .getEngine)]
+        (e/save-file! path engine)))
     ; if saving a build.boot file, refresh the build buttons
     (let [file (io/file path)
           parent-path (-> file .getParentFile .getCanonicalPath)]
@@ -203,11 +204,12 @@
 ; undo

 (defn undo! [^Scene scene]
-  (let [editor (.lookup scene "#editor")
-        webview (.lookup scene "#webview")
-        engine (.getEngine webview)]
-    (.executeScript engine "undo()")
-    (e/update-editor-buttons! editor engine)))
+  (when-let [path (:selection @pref-state)]
+    (when-let [pane (get-in @runtime-state [:editor-panes path])]
+      (let [webview (.lookup pane "#webview")
+            engine (.getEngine webview)]
+        (.executeScript engine "undo()")
+        (e/update-editor-buttons! pane engine)))))

 (defn -onUndo [this ^ActionEvent event]
   (-> event .getSource .getScene undo!))
@@ -215,11 +217,12 @@
 ; redo

 (defn redo! [^Scene scene]
-  (let [editor (.lookup scene "#editor")
-        webview (.lookup scene "#webview")
-        engine (.getEngine webview)]
-    (.executeScript engine "redo()")
-    (e/update-editor-buttons! editor engine)))
+  (when-let [path (:selection @pref-state)]
+    (when-let [pane (get-in @runtime-state [:editor-panes path])]
+      (let [webview (.lookup pane "#webview")
+            engine (.getEngine webview)]
+        (.executeScript engine "redo()")
+        (e/update-editor-buttons! pane engine)))))

 (defn -onRedo [this ^ActionEvent event]
   (-> event .getSource .getScene redo!))
@@ -227,11 +230,13 @@
 ; instaREPL

 (defn toggle-instarepl! [^Scene scene & [from-button?]]
-  (let [webview (.lookup scene "#webview")
-        instarepl (.lookup scene "#instarepl")]
-    (when-not from-button?
-      (.setSelected instarepl (not (.isSelected instarepl))))
-    (e/toggle-instarepl! (.getEngine webview) (.isSelected instarepl))))
+  (when-let [path (:selection @pref-state)]
+    (when-let [pane (get-in @runtime-state [:editor-panes path])]
+      (let [webview (.lookup pane "#webview")
+            instarepl (.lookup pane "#instarepl")]
+        (when-not from-button?
+          (.setSelected instarepl (not (.isSelected instarepl))))
+        (e/toggle-instarepl! (.getEngine webview) (.isSelected instarepl))))))

 (defn -onInstaRepl [this ^ActionEvent event]
   (-> event .getSource .getScene (toggle-instarepl! true)))
@@ -239,19 +244,22 @@
 ; find

 (defn focus-on-find! [^Scene scene]
-  (when-let [find (.lookup scene "#find")]
-    (doto find .requestFocus .selectAll)))
+  (when-let [path (:selection @pref-state)]
+    (when-let [pane (get-in @runtime-state [:editor-panes path])]
+      (when-let [find (.lookup pane "#find")]
+        (doto find .requestFocus .selectAll)))))

 (defn find! [^Scene scene ^KeyEvent event]
   (when (= KeyCode/ENTER (.getCode event))
     (when-let [path (:selection @pref-state)]
-      (let [webview (.lookup scene "#webview")
-            engine (.getEngine webview)
-            find (.lookup scene "#find")
-            find-text (.getText find)]
-        (-> engine
-            (.executeScript "window")
-            (.call "find" (into-array Object [find-text true (.isShiftDown event)])))))))
+      (when-let [pane (get-in @runtime-state [:editor-panes path])]
+        (let [webview (.lookup pane "#webview")
+              engine (.getEngine webview)
+              find (.lookup pane "#find")
+              find-text (.getText find)]
+          (-> engine
+              (.executeScript "window")
+              (.call "find" (into-array Object [find-text true (.isShiftDown event)]))))))))

 (defn -onFind [this ^KeyEvent event]
   (-> event .getSource .getScene (find! event)))


Support searching cities based on a country.

--- src/clj/weather_demo/handler.clj
+++ src/clj/weather_demo/handler.clj
@@ -11,11 +11,17 @@
             [clojure.java.io :as io]
             [cheshire.core :as json]
             [ring.util.response :refer [response]]
-            [ring.middleware.json :refer [wrap-json-response]]))
+            [ring.middleware.json :refer [wrap-json-response]])
+  (:import [java.util.zip GZIPInputStream]))

 (def countries
   (with-open [rdr (io/reader "https://raw.githubusercontent.com/mledoze/countries/master/countries.json")]
     (doall (json/parse-stream rdr))))
+
+(def cities
+  (with-open [input (io/input-stream "http://bulk.openweathermap.org/sample/city.list.json.gz")]
+    (let [lines (line-seq (io/reader (GZIPInputStream. input)))]
+      (group-by #(get % "country") (map json/parse-string lines)))))

 (def mount-target
   [:div#app
@@ -42,6 +48,7 @@
   (GET "/about" [] loading-page)

   (GET "/api/countries/" [] (response countries))
+  (GET "/api/cities/:country" [country] (response (or (get cities country) [])))

   (resources "/")
   (not-found "Not Found"))


Tighten the hyphenation validation

Tighten the hyphenation validation

Each '-' should be sorrounded by letters

--- src/cljc/hyphen_keeper/util.cljc
+++ src/cljc/hyphen_keeper/util.cljc
@@ -4,9 +4,13 @@
 (defn hyphenation-valid?
   "Return true if the `hyphenation` is not blank, is equal to
   `word` (modulo the hyphenation marks) and only contains letters a-z,
-  \u00DF-\u00FF and '-'"
+  \u00DF-\u00FF and '-'. Also each '-' in the hyphenation should be
+  surrounded by letters."
   [hyphenation word]
   (and (not (string/blank? hyphenation))
        (= word (string/replace hyphenation "-" ""))
-       (re-matches #"[a-z\xDF-\xFF-]+" hyphenation)))
+       (not (string/starts-with? hyphenation "-"))
+       (not (string/ends-with? hyphenation "-"))
+       (not (string/includes? hyphenation "--"))
+       (some? (re-matches #"[a-z\xDF-\xFF-]+" hyphenation))))


start working on streaming

start working on streaming

--- src/clojure/flambo/streaming.clj
+++ src/clojure/flambo/streaming.clj
@@ -44,8 +44,11 @@
 (defn socket-text-stream [context ip port]
   (.socketTextStream context ip port))

-(defn kafka-stream [& {:keys [streaming-context zk-connect group-id topic-map]}]
-  (KafkaUtils/createStream streaming-context zk-connect group-id (into {} (for [[k, v] topic-map] [k (Integer. v)]))))
+(defn kafka-stream [streaming-context zk-connect group-id topic-map]
+  (KafkaUtils/createStream streaming-context zk-connect group-id (into {} (for [[k v] topic-map] [k (Integer. v)]))))
+
+(defn kafka-direct-stream [streaming-context key-class value-class key-decoder-class value-decoder-class kafka-params topic-set]
+  (KafkaUtils/createDirectStream streaming-context key-class value-class key-decoder-class value-decoder-class kafka-params topic-set))

 (defn flume-stream [streaming-context host port]
   (FlumeUtils/createStream streaming-context host port))


No more yes & no.

No more yes & no.

--- src/cake/tasks/search.clj
+++ src/cake/tasks/search.clj
@@ -1,7 +1,6 @@
 (ns cake.tasks.search
   (:use cake
         cake.core
-        [cake.utils :only [yes-or-no]]
         [bake.core :only [log]]
         [clojure.string :only [join]]
         [clojure.java.io :only [file copy reader]])
@@ -28,14 +27,16 @@
     (sherlock/update-index url)
     (new-hash url)))

+
+(defn needs-updating? [id url]
+  (when (and (not= (slurp (hash-location url))
+                   (slurp (hash-url url))))
+    (println (format "The index for %s is out of date. Pass --update to update it." id))))
+
 (defn update-repo [id url]
-  (when (and (not= (slurp (hash-location url))
-                   (slurp (hash-url url)))
-             (yes-or-no
-              (format "The index for %s is out of date. Do you want to update it now?" id)))
-    (log (str "Updating index for " id ". This might take a bit."))
-    (sherlock/update-index url)
-    (new-hash url)))
+  (log (str "Updating index for " id ". This might take a bit."))
+  (sherlock/update-index url)
+  (new-hash url))

 (defn identifier [{:keys [group-id artifact-id]}]
   (if group-id
@@ -58,13 +59,15 @@
    lucene indexes for your maven repositories.
    Options:
      --page   -- The page number to fetch (each page is 10 results long).
-     --repos  -- ids of repositories to search delimited by commas."
-  {[page] :page repos :repos search :search}
+     --repos  -- ids of repositories to search delimited by commas.
+     --update -- Updates indices for repos you specify."
+  {[page] :page repos :repos search :search update :update}
   (let [page (if page (Integer. page) 1)]
     (binding [sherlock/*page-size* 10]
       (doseq [[id url] (select-repos repos)]
         (download-index id url)
-        (update-repo id url)
+        (when update (update-repo id url))
+        (needs-updating? id url)
         (print-results
          id page
          (sherlock/get-page page (sherlock/search url (join " " search) page)))))))
@@ -75,13 +78,14 @@
    and return the latest version. You can pass --repos which is expected to be a
    comma delimited list of repository names. If it is not passed, all repositories
    will be searched."
-  {[term] :latest-version, repos :repos}
+  {[term] :latest-version, repos :repos update :update}
   (let [repos (select-repos repos)
         [group-id artifact-id] (.split term "/")
         query (str "g:" group-id " AND a:" (or artifact-id group-id))]
     (doseq [[id url] repos]
       (download-index id url)
-      (update-repo id url))
+      (when update (update-repo id url))
+      (needs-updating? id url))
     (let [result (first (sort-by :version (comp unchecked-negate compare)
                                  (filter (comp #{term} identifier)
                                          (mapcat #(sherlock/search % query 10 Integer/MAX_VALUE)


Test intersection iterators

Test intersection iterators

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -355,6 +355,13 @@
       (Intersection. (into-array (sort-by #(.key %) compare-keys iterators)) false))
     (aget iterators 0)))

+(defn iter-seq [iterator]
+  (let [results #js []]
+    (while (false? (.-end? iterator))
+      (.push results (.key iterator))
+      (.next iterator))
+    results))
+
 ;; TESTS

 (def gen-key
@@ -499,6 +506,20 @@
                  actions (gen/vector gen-action)
                  movements (gen/vector gen-movement)]
                 (run-iterator-prop min-keys actions movements)))
+
+(defn run-intersection-prop [min-keys actionss movements]
+  (let [trees (map #(apply-to-tree (tree min-keys) %) actionss)
+        elems (apply clojure.set/intersection (map #(set (map vec %)) trees))
+        sorted-map (into (sorted-map-by compare-keys) elems)
+        iterator-results (apply-to-iterator (intersection (into-array (map iterator trees))) movements)
+        elems-results (apply-to-elems (seq sorted-map) movements)]
+    (= iterator-results elems-results)))
+
+(def intersection-prop
+  (prop/for-all [min-keys gen/s-pos-int
+                 actionss (gen/not-empty (gen/vector (gen/vector gen-action)))
+                 movements (gen/vector gen-movement)]
+                (run-intersection-prop min-keys actionss movements)))

 (comment
   (dc/quick-check 1000 least-prop)
@@ -514,6 +535,8 @@
   (dc/quick-check 500 (lookup-prop gen-action))
   (dc/quick-check 500 iterator-prop)
   ;; cljs.core.pr_str(cemerick.double_check.quick_check(1000, aurora.btree.iterator_prop)
+  (dc/quick-check 100 intersection-prop)
+  ;; cljs.core.pr_str(cemerick.double_check.quick_check(1000, aurora.btree.intersection_prop))

   (defn f []


Fix movable?

Fix movable?

--- src/chessground/data.cljs
+++ src/chessground/data.cljs
@@ -32,7 +32,9 @@

 (defn movable? [state orig]
   (when-let [piece (chess/get-piece (:chess state) orig)]
-    (or (= (-> state :movable :color) "both")
+    (or (and
+          (= (-> state :movable :color) "both")
+          (= (:turn-color state) (:color piece)))
         (= (-> state :movable :color)
            (:turn-color state)
            (:color piece)))))


1.3-ifying examples.scaled-sextic

1.3-ifying examples.scaled-sextic

--- src/examples/scaled_sextic.clj
+++ src/examples/scaled_sextic.clj
@@ -1,5 +1,6 @@
 (ns examples.scaled-sextic
-  (:use [clojush] [clojure.contrib.math]))
+  (:use [clojush]
+	[clojure.math.numeric-tower]))

 ;; scaled_sextic.clj
 ;; an example problem for clojush, a Push/PushGP system written in Clojure


Get back ensure-attrs for compatibility

Get back ensure-attrs for compatibility

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -279,6 +279,13 @@

 ; Exception

+(defn error-str [err]
+  (let [msg (.getMessage err)
+        data (ex-data err)]
+    (cond-> (class err)
+      msg (str ": " msg)
+      data (str " - " (pr-str data)))))
+
 (defn wrap-handle-exception [reader]
   (fn [{::keys [errors* path process-error fail-fast?] :as env}]
     (if fail-fast?
@@ -287,8 +294,7 @@
         (reader env)
         (catch #?(:clj Throwable :cljs :default) e
           (swap! errors* assoc path (if process-error (process-error env e)
-                                                      #?(:clj  (Throwable->map e)
-                                                         :cljs e)))
+                                                      (error-str e)))
           ::reader-error)))))

 (defn wrap-parser-exception [parser]
@@ -384,3 +390,10 @@
   [ast]
   (let [key (some-> ast :key)]
     (if (sequential? key) (second key))))
+
+(defn ensure-attrs [env attributes]
+  "DEPRECATED: use p/entity
+  Runs the parser against current element to garantee that some fields are loaded.
+  This is useful when you need to ensure some values are loaded in order to fetch some
+  more complex data."
+  (entity env attributes))


fix bug in last commit

fix bug in last commit

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -108,7 +108,7 @@
   (let [input-spec spec
         from-bolt bolt ;; so we can show what (add-complement) did to the input bolt, for logging.
         depth (if depth depth 0)
-        spec (unifyc spec bolt-spec)]
+        spec (unifyc spec (get-in bolt path))]
     (let [immediate-parent (get-in bolt (butlast path))
           start-time (current-time)
           cached (if cache


small fix

small fix

--- resources/leiningen/new/closp/project.clj
+++ resources/leiningen/new/closp/project.clj
@@ -114,7 +114,7 @@
                                       [joplin.lein "0.2.9"]]

                        :figwheel     {:http-server-root "public"
-                                      :port             3449
+                                      :server-port      3449
                                       :css-dirs         ["resources/public/css"]}

                        :dependencies [[ring-mock "0.1.5"]


print table

print table

--- src/athena_cmd/core.clj
+++ src/athena_cmd/core.clj
@@ -5,6 +5,8 @@
 (import '(java.sql DriverManager)
         'java.util.Properties
         'com.amazonaws.athena.jdbc.AthenaDriver)
+
+(use '[clojure.pprint :only [print-table]])

 (def athenaURI
   "jdbc:awsathena://athena.us-east-1.amazonaws.com:443")
@@ -58,6 +60,10 @@
   [file]
   (exec (slurp file)))

+(defn query-table
+  [file]
+  (print-table (query file)))
+
 (defn -main
   [& args]
   (let [file (nth args 0)]


Better arglists for wrap-reload

Better arglists for wrap-reload

--- ring-devel/src/ring/middleware/reload.clj
+++ ring-devel/src/ring/middleware/reload.clj
@@ -12,6 +12,7 @@

   :dirs - A list of directories that contain the source files.
           Defaults to [\"src\"]."
+  {:arglists '([handler] [handler options])}
   [handler & [options]]
   (let [source-dirs (:dirs options ["src"])
         modified-namespaces (ns-tracker source-dirs)]


fix auto macro loading

 fix auto macro loading

 If namespace information is not in the compiler environment it
 must be parsed

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -1224,15 +1224,19 @@
     {:import  import-map
      :require import-map}))

+(declare parse-ns)
+
 (defn macro-autoload-ns?
   "Given a spec form check whether the spec namespace requires a macro file
    of the same name. If so return true."
   [form]
   (let [ns (if (sequential? form) (first form) form)
         {:keys [use-macros require-macros]}
-        (get-in @env/*compiler* [::namespaces ns])]
-    (or (contains? use-macros ns)
-        (contains? require-macros ns))))
+        (or (get-in @env/*compiler* [::namespaces ns])
+            (when-let [res (io/resource (util/ns->relpath ns))]
+              (:ast (parse-ns res))))]
+    (or (some #{ns} (vals use-macros))
+        (some #{ns} (vals require-macros)))))

 (defn desugar-ns-specs
   "Given an original set of ns specs desugar :include-macros and :refer-macros
@@ -1820,7 +1824,8 @@
                                          (get-in @env/*compiler* [:opts :emit-constants])
                                          (conj 'constants-table)))
                            :file dest
-                           :source-file src}
+                           :source-file src
+                           :ast ast}
                           (when (and dest (.exists ^File dest))
                             {:lines (with-open [reader (io/reader dest)]
                                       (-> reader line-seq count))})))


CLJS-336: Hyphenated Protocols

CLJS-336: Hyphenated Protocols

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -555,7 +555,7 @@
     (when (= :expr context) (emits "})()"))))

 (defn protocol-prefix [psym]
-  (str (-> (str psym) (.replace \. \$) (.replace \/ \$)) "$"))
+  (symbol (str (-> (str psym) (.replace \. \$) (.replace \/ \$)) "$")))

 (defmethod emit :invoke
   [{:keys [f args env] :as expr}]
@@ -613,7 +613,7 @@
        (emits "!(" (first args) ")")

        proto?
-       (let [pimpl (str (protocol-prefix protocol)
+       (let [pimpl (str (munge (protocol-prefix protocol))
                         (munge (name (:name info))) "$arity$" (count args))]
          (emits (first args) "." pimpl "(" (comma-sep args) ")"))


added a way to convey jsdoc to defs from init exprs used it to convey variadic param declarations and silence spurious warnings note - the remaining warnings are bugs in our code!

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -226,6 +226,12 @@
 (defmethod emit :def
   [{:keys [name init env]}]
   (when init
+    (when (:jsdoc init)
+      (println "/**")
+      (doseq [e (:jsdoc init)]
+        (when e
+          (println "*" e)))
+      (println "*/"))
     (print name)
     (print (str " = " (emits init)))
     (when-not (= :expr (:context env)) (print ";\n"))))
@@ -233,7 +239,10 @@
 (defn emit-fn-method
   [{:keys [gthis name variadic params statements ret env recurs]}]
   (emit-wrap env
-             (print (str "(function " name "(" (comma-sep params) "){\n"))
+             (print (str "(function " name "(" (comma-sep
+                                                (if variadic
+                                                  (concat (butlast params) ['var_args])
+                                                  params)) "){\n"))
              (when gthis
                (println (str "var " gthis " = this;")))
              (when variadic
@@ -258,7 +267,11 @@
         (println (str "var " name " = null;"))
         (doseq [[n meth] ms]
           (println (str "var " n " = " (with-out-str (emit-fn-method meth)) ";")))
-        (println (str name " = function(" (comma-sep maxparams) "){"))
+        (println (str name " = function(" (comma-sep (if variadic
+                                                       (concat (butlast maxparams) ['var_args])
+                                                       maxparams)) "){"))
+        (when variadic
+          (println (str "var " (last maxparams) " = var_args;")))
         (println "switch(arguments.length){")
         (doseq [[n meth] ms]
           (if (:variadic meth)
@@ -506,10 +519,13 @@
         locals (if name (assoc locals name {:name mname}) locals)
         menv (if (> (count meths) 1) (assoc env :context :expr) env)
         methods (map #(analyze-fn-method menv locals %) meths)
-        max-fixed-arity (apply max (map :fixed-arity methods))]
+        max-fixed-arity (apply max (map :fixed-arity methods))
+        variadic (some :variadic methods)]
     ;;(assert (= 1 (count methods)) "Arity overloading not yet supported")
     ;;todo - validate unique arities, at most one variadic, variadic takes max required args
-    {:env env :op :fn :name mname :methods methods :variadic (some :variadic methods) :max-fixed-arity max-fixed-arity}))
+    {:env env :op :fn :name mname :methods methods :variadic variadic
+     :jsdoc [(when variadic "@param {...*} var_args")]
+     :max-fixed-arity max-fixed-arity}))

 (defmethod parse 'do
   [op env [_ & exprs] _]


Add ability to modify economic model utility function parameters.

--- src/cljs/beatha/core.cljs
+++ src/cljs/beatha/core.cljs
@@ -16,8 +16,15 @@
 (defn handle-int-config-change
   [e owner state key]
   (let [value (.. e -target -value)]
-    (if (re-matches #"[0-9]+" value)
+    (if (re-matches #"-?[0-9]+" value)
       (om/set-state! owner key (js/parseInt value))
+      (om/set-state! owner key (get state key)))))
+
+(defn handle-float-config-change
+  [e owner state key]
+  (let [value (.. e -target -value)]
+    (if (re-matches #"-?[0-9]+(\\.[0-9]+)?" value)
+      (om/set-state! owner key (js/parseFloat value))
       (om/set-state! owner key (get state key)))))

 (defn navigation-button
@@ -39,6 +46,8 @@
    (< n min) min
    (> n max) max
    :else n))
+
+(defn is-number? [v] (not (js/isNaN v)))

 (defn grid-config-view
@@ -399,7 +408,7 @@
   [data owner]
   (reify
     om/IRenderState
-    (render-state [_ {:keys [tax-rate depreciation command-info-channel]
+    (render-state [_ {:keys [tax-rate depreciation a p q command-info-channel]
                       :as state}]
       (dom/div
        #js {:role "form" :className "economic-model-control"}
@@ -415,6 +424,21 @@
         #js {:type "text" :className "form-control" :value depreciation
              :onChange
              #(handle-int-config-change % owner state :depreciation)})
+
+       (dom/label nil "Utilty param a")
+       (dom/input
+        #js {:type "text" :className "form-control" :value a
+             :onChange #(handle-float-config-change % owner state :a)})
+
+       (dom/label nil "Utilty param p")
+       (dom/input
+        #js {:type "text" :className "form-control" :value p
+             :onChange #(handle-float-config-change % owner state :p)})
+
+       (dom/label nil "Utilty param q")
+       (dom/input
+        #js {:type "text" :className "form-control" :value q
+             :onChange #(handle-float-config-change % owner state :q)})

        (dom/button
         #js {:type "button"
@@ -424,8 +448,14 @@
                     (normalize (/ (js/parseFloat tax-rate) 100) 0 1.0)
                     :depreciation
                     (normalize (/ (js/parseFloat depreciation) 100) 0 1.0)}
-                   (filter (fn [[k v]] (not (js/isNaN v))))
+                   (filter (comp is-number? second))
                    (into {})
+                   (merge
+                    {:utility-params (->> {:a (js/parseFloat a)
+                                           :p (js/parseFloat p)
+                                           :q (js/parseFloat q)}
+                                          (filter (comp is-number? second))
+                                          (into {}))})
                    (put! command-info-channel))}
         "Send command")


Added alert util-fn that returns the argument

--- src/cljs/drawer/util.cljs
+++ src/cljs/drawer/util.cljs
@@ -40,6 +40,12 @@
   (when (not (contains? @alert-map id))
     (js/alert val)
     (swap! alert-map assoc id)))
+
+(defn alert-return
+  "Alerts given value and returns it unchanged."
+  [x]
+  (js/alert x)
+  x)

 (defn construct-htag
   "Constructs an html tag with given params"


Change parameter names in haversine fn so they don't conflict with "c2" namespace under cljs.

This is a problem only under some cljs compiler versions, but might as well play it safe here.

--- src/cljx/c2/geo/core.cljx
+++ src/cljx/c2/geo/core.cljx
@@ -69,10 +69,10 @@

 (defn haversine
   "Calculate the great-circle distance between two lat/lon coordinates on a sphere with radius `r` (defaults to Earth radius)."
-  ([c1 c2] (haversine c1 c2 radius-of-earth))
-  ([c1 c2 r]
-     (let [[lat1 lon1] (->latlon c1)
-           [lat2 lon2] (->latlon c2)
+  ([co1 co2] (haversine co1 co2 radius-of-earth))
+  ([co1 co2 r]
+     (let [[lat1 lon1] (->latlon co1)
+           [lat2 lon2] (->latlon co2)
            square-half-chord (+ (sq (sin (/ (rad (- lat2 lat1)) 2)))
                                 (* (cos (rad lat1))
                                    (cos (rad lat2))


Expand dev setup to include scm info in test jars

--- src/clojars/dev/setup.clj
+++ src/clojars/dev/setup.clj
@@ -91,7 +91,11 @@
                             :version version
                             :description (format "Description for %s/%s" group-id artifact-id)
                             :homepage (format "http://example.com/%s/%s" group-id artifact-id)
-                            :authors ["Foo" "Bar" "Basil"]})
+                            :authors ["Foo" "Bar" "Basil"]
+                            :scm {:tag "abcde1"
+                                  :url (format "https://%s/%s/%s"
+                                               (rand-nth ["github.com" "gitlab.com" "other.org"])
+                                               group-id artifact-id)}})
           (update-metadata parent group-id artifact-id version)
           [group-id artifact-id version (rand-int 1000)]))
       (remove nil?)


fixed 'log symbol implementation and evaluating config

--- src/co/nclk/flax/core.clj
+++ src/co/nclk/flax/core.clj
@@ -418,7 +418,7 @@

           'log
           (let [args (-> fun-entry val)]
-            (log (-> args first keyword)
+            (log (evaluate (-> args first keyword) config)
                  (apply str
                    (map #(evaluate % config) (drop 1 args)))))

@@ -511,7 +511,8 @@
     ;; Dynamically require the namespace containing the data-connector
     ;; and call its constructor; if no data-connector is specified, then
     ;; use the built-in FileDataConnector.
-    (let [data-connector (if (:data-connector config)
+    (let [config (evaluate config config)
+          data-connector (if (:data-connector config)
                            (let [dc-ctor (do (-> config :data-connector symbol require)
                                              (-> config :data-connector (str "/connector") symbol resolve))]
                              (if-not dc-ctor


comments

comments

--- src/babel/generate.cljc
+++ src/babel/generate.cljc
@@ -81,7 +81,7 @@
      ;; P1 => C1_1,C1_2,C1_3,..
      ;; P2 => C2_1,C2_2,C2_3,..
      ;; ..
-     ;; from paths P to complements C at that path in the bolt.
+     ;; from paths P to possible complements C at that path in the bolt.
      (map (fn [bolt]
             (let [paths (find-comp-paths bolt)]
               {:bolt bolt
@@ -89,7 +89,7 @@
                :comps (map #(comp-path-to-complements bolt % model depth max-depth) paths)})))

-     ;; 4. Create all the possibilities of all complements at all paths within each bolt.
+     ;; 4. Create the cartesian product of all the possibile complements at all paths within each bolt.
      (mapcat (fn [{bolt :bolt comps :comps paths :paths}]
                ;; TODO: further flatten this into the overall ->> pipeline
                (map (fn [each-path-through-trellis]


Whitespace

Whitespace

--- src/beehive/metrics.clj
+++ src/beehive/metrics.clj
@@ -14,9 +14,7 @@

 (ns beehive.metrics
   (:require [beehive.utils :as utils])
-  (:import (net.uncontended.precipice.metrics ActionMetrics
-                                              DefaultActionMetrics
-                                              Metric)))
+  (:import (net.uncontended.precipice.metrics ActionMetrics DefaultActionMetrics)))

 (set! *warn-on-reflection* true)


Remove debug output

Remove debug output

--- src/layzee/adapters/twitter/nice_twitter.clj
+++ src/layzee/adapters/twitter/nice_twitter.clj
@@ -16,10 +16,9 @@

 (defn get-tweet [amazon-credential database-name oauth-credential]
      #(or
-       (when-let [cached (db/get amazon-credential database-name %)] (println "HIT") cached)
+       (when-let [cached (db/get amazon-credential database-name %)] cached)
        (do
          (let [fresh-value (simplify (api/get-tweet oauth-credential %))]
            (swap! api-hit-count inc)
-           (println "MISS")
            (db/set amazon-credential database-name % fresh-value) ;; [!] Can only store 1024 bytes
            fresh-value))))