(TK-18) Fix up errant comment

(TK-18) Fix up errant comment

--- src/puppetlabs/trapperkeeper/internal.clj
+++ src/puppetlabs/trapperkeeper/internal.clj
@@ -417,8 +417,8 @@
         ;; when we instantiate the graph, we pass in the context atom.
          graph-instance (instantiate compiled-graph {:tk-app-context app-context
                                                      :tk-service-refs service-refs})
-        ;; here we build up a map of all of the services by calling the
-        ;; constructor for each one
+        ;; dereference the atom of service references, since we don't need to update it
+        ;; any further
          services-by-id @service-refs
          ordered-services (map (fn [[service-id _]] [service-id (services-by-id service-id)]) graph)]
     (swap! app-context assoc :services-by-id services-by-id)


fix language == nil case

fix language == nil case

--- src-cljs/frontend/models/repo.cljs
+++ src-cljs/frontend/models/repo.cljs
@@ -26,9 +26,10 @@
   ;; GH "Swift" "Objective-C"
   ;; BB "swift" "objective-c"
   (let [osx-languages #{"swift" "objective-c"}]
-    (->> (:language repo)
-         str/lower-case
-         (contains? osx-languages))))
+    (boolean
+     (some->> (:language repo)
+              str/lower-case
+              (contains? osx-languages)))))

 (defn id [repo]
   (:vcs_url repo))


fix missing wrapping paren around some-fn

--- src-cljs/frontend/models/user.cljs
+++ src-cljs/frontend/models/user.cljs
@@ -48,8 +48,8 @@
   (-> user :github_oauth_scopes empty? not))

 (defn bitbucket-authorized? [user]
-  (-> user (some-fn :user/bitbucket-authorized? :bitbucket_authorized) boolean))
-
+  (let [check-fn (some-fn :user/bitbucket-authorized? :bitbucket_authorized)]
+    (-> user check-fn boolean)))

 (defn deauthorize-github [user]
   (-> user


More progress bar examples to match the React Toolbox page. Closes #22.

--- src/cljs/reagent_toolbox_docs/components/progress_bar.cljs
+++ src/cljs/reagent_toolbox_docs/components/progress_bar.cljs
@@ -15,14 +15,30 @@

      [ui/display-and-eval-code "
 (defn progress-bar-test []
-  (fn []
-    [:div
-     [reagent-toolbox.core/progress-bar {:type \"circular\"
-                                         :mode \"indeterminate\"}]
-     [reagent-toolbox.core/progress-bar {:type   \"linear\"
-                                         :mode   \"determinate\"
-                                         :value  83
-                                         :buffer 90}]]))
+  (let [value (reagent.ratom/atom 20)
+        buffer (reagent.ratom/atom 40)]
+    (fn []
+      (js/setInterval (fn []
+                        (reset! value (rand-int 100))
+                        (reset! buffer (+ @value (rand-int (- 100 @value)))))
+                     2000)
+      [:div
+       [:p \"Determinate\"]
+       [reagent-toolbox.core/progress-bar {:mode   \"determinate\"
+                                           :value  @value
+                                           :buffer @buffer}]
+       [:p \"Indeterminate\"]
+       [reagent-toolbox.core/progress-bar {:mode \"indeterminate\"}]
+       [:p \"Circular\"]
+       [reagent-toolbox.core/progress-bar {:type       \"circular\"
+                                           :mode       \"indeterminate\"
+                                           :multicolor true}]
+       [:p \"Disabled\"]
+       [reagent-toolbox.core/progress-bar {:type     \"linear\"
+                                           :mode     \"determinate\"
+                                           :value    83
+                                           :buffer   90
+                                           :disabled true}]])))

 [progress-bar-test]"]


implemented path expressions

implemented path expressions


Add serial take check.

Add serial take check.

--- test/com/hypirion/primes_test.clj
+++ test/com/hypirion/primes_test.clj
@@ -1,8 +1,15 @@
 (ns com.hypirion.primes-test
   (:use clojure.test
         com.hypirion.pregenerated-primes)
-  (:require [com.hypirion.primes :as p]))
+  (:require [com.hypirion.primes :as p])
+  (:import [com.hypirion.primes Primes]))

-(deftest serial-check
+(deftest serial-prime?-check
+  (Primes/clear)
   (doseq [prime hundred-thousand]
     (is (p/prime? prime))))
+
+(deftest serial-take
+  (doall
+   (map #(is (= %1 %2))
+        (p/take 100008) hundred-thousand)))


Skip tests that require browser on node

Skip tests that require browser on node

--- test/reagenttest/testreagent.cljs
+++ test/reagenttest/testreagent.cljs
@@ -909,54 +909,54 @@
     (is (thrown-with-msg?
          :default #"Invalid tag: 'p.'"
          (rstr [:p.])))
-
-    (let [comp1 (fn comp1 [x]
-                  x)
-          comp2 (fn comp2 [x]
-                  [comp1 x])
-          comp3 (fn comp3 []
-                  (r/with-let [a (r/atom "foo")]
-                    [:div (for [i (range 0 1)]
-                          ^{:key i} [:p @a])]))
-          comp4 (fn comp4 []
-                  (for [i (range 0 1)]
-                    [:p "foo"]))
-          nat ($ util/react createClass #js{:render (fn [])})
-          pkg "reagenttest.testreagent."
-          stack1 (str "in " pkg "comp1")
-          stack2 (str "in " pkg "comp2 > " pkg "comp1")
-          lstr (fn [& s] (list (apply str s)))
-          re (fn [& s]
-               (re-pattern (apply str s)))
-          rend (fn [x]
-                 (with-mounted-component x identity))]
-      (let [e (debug/track-warnings
-               #(is (thrown-with-msg?
-                     :default (re "Invalid tag: 'div.' \\(" stack2 "\\)")
-                     (rend [comp2 [:div. "foo"]]))))]
-        (is (= e
-               {:error (lstr "Error rendering component (" stack2 ")")})))
-
-      (let [e (debug/track-warnings
-               #(is (thrown-with-msg?
-                     :default (re "Invalid tag: 'div.' \\(" stack1 "\\)")
-                     (rend [comp1 [:div. "foo"]]))))]
-        (is (= e
-               {:error (lstr "Error rendering component (" stack1 ")")})))
-
-      (let [e (debug/track-warnings #(r/as-element [nat]))]
-        (is (re-find #"Using native React classes directly"
-                     (-> e :warn first))))
-
-      (let [e (debug/track-warnings
-               #(rend [comp3]))]
-        (is (re-find #"Reactive deref not supported"
-                     (-> e :warn first))))
-
-      (let [e (debug/track-warnings
-               #(r/as-element (comp4)))]
-        (is (re-find #"Every element in a seq should have a unique :key"
-                     (-> e :warn first)))))))
+    (when r/is-client
+      (let [comp1 (fn comp1 [x]
+                    x)
+            comp2 (fn comp2 [x]
+                    [comp1 x])
+            comp3 (fn comp3 []
+                    (r/with-let [a (r/atom "foo")]
+                      [:div (for [i (range 0 1)]
+                              ^{:key i} [:p @a])]))
+            comp4 (fn comp4 []
+                    (for [i (range 0 1)]
+                      [:p "foo"]))
+            nat ($ util/react createClass #js{:render (fn [])})
+            pkg "reagenttest.testreagent."
+            stack1 (str "in " pkg "comp1")
+            stack2 (str "in " pkg "comp2 > " pkg "comp1")
+            lstr (fn [& s] (list (apply str s)))
+            re (fn [& s]
+                 (re-pattern (apply str s)))
+            rend (fn [x]
+                   (with-mounted-component x identity))]
+        (let [e (debug/track-warnings
+                 #(is (thrown-with-msg?
+                       :default (re "Invalid tag: 'div.' \\(" stack2 "\\)")
+                       (rend [comp2 [:div. "foo"]]))))]
+          (is (= e
+                 {:error (lstr "Error rendering component (" stack2 ")")})))
+
+        (let [e (debug/track-warnings
+                 #(is (thrown-with-msg?
+                       :default (re "Invalid tag: 'div.' \\(" stack1 "\\)")
+                       (rend [comp1 [:div. "foo"]]))))]
+          (is (= e
+                 {:error (lstr "Error rendering component (" stack1 ")")})))
+
+        (let [e (debug/track-warnings #(r/as-element [nat]))]
+          (is (re-find #"Using native React classes directly"
+                       (-> e :warn first))))
+
+        (let [e (debug/track-warnings
+                 #(rend [comp3]))]
+          (is (re-find #"Reactive deref not supported"
+                       (-> e :warn first))))
+
+        (let [e (debug/track-warnings
+                 #(r/as-element (comp4)))]
+          (is (re-find #"Every element in a seq should have a unique :key"
+                       (-> e :warn first))))))))

 (deftest test-dom-node
   (let [node (atom nil)


Chaning readFromCache to useCallCache

Chaning readFromCache to useCallCache

--- src/cljs/main/broadfcui/page/workspace/method_configs/launch_analysis.cljs
+++ src/cljs/main/broadfcui/page/workspace/method_configs/launch_analysis.cljs
@@ -135,7 +135,7 @@
                              :methodConfigurationName (:name config-id)
                              :entityType (:type entity)
                              :entityName (:name entity)
-                             :readFromCache (react/call :checked? (@refs "callCache-check"))}
+                             :useCallCache (react/call :checked? (@refs "callCache-check"))}
                        (when-not (clojure.string/blank? expression) {:expression expression}))]
          (swap! state assoc :launching? true :launch-server-error nil)
          (endpoints/call-ajax-orch


further cleanup and simplification of (defn exception-generator)

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1404,52 +1404,50 @@

 ;; TODO: move this to babel.italiano.lexicon, since it is part of lexicon compilation
 (defn exception-generator [lexicon]
-  (flatten
-   (->>
-    (sort (keys lexicon))
-    (map (fn [k]
-           (let [lexemes (get lexicon k)
-                 lexeme-kv [k lexemes]]
-             (if lexemes
-               (->> exceptions-rules
-                    (mapcat (fn [{path :path
-                                  label :label
-                                  surface-form :surface-form
-                                  merge-fn :merge-fn}]
-                              (let [surface-form-fn (or surface-form
-                                                        (fn [lexeme]
-                                                          (get-in lexeme path :none)))]
-                                ;; a lexeme-kv is a pair of a key and value. The key is a string (the word's surface form)
-                                ;; and the value is a list of lexemes for that string.
-                                (->> lexemes
-                                     (mapcat (fn [lexeme]
-                                               (if (not (= :none (get-in lexeme path :none)))
-                                                 (do (log/debug (str (first lexeme-kv) " generating lexeme exceptional surface form: " (surface-form-fn lexeme)))
-                                                     (list {(surface-form-fn lexeme)
-                                                            [(reduce
-                                                              (fn [a b]
-                                                                (cond
-                                                                  (= a :fail)
-                                                                  (do
-                                                                    (log/warn (str ":fail in exception rule:"
-                                                                                label
-                                                                                "; lexeme's italiano:"
-                                                                                (strip-refs (get-in lexeme [:italiano]))))
-                                                                    :fail)
-                                                                  (= b :fail)
-                                                                  (do
-                                                                    (log/warn (str ":fail in exception rule:"
-                                                                                label
-                                                                                "; lexeme:"
-                                                                                (or (strip-refs (get-in lexeme [:italiano :italiano]))
-                                                                                (strip-refs (get-in lexeme [:italiano])))))
-                                                                    :fail)
-                                                                  true
-                                                                  (unify a b)))
-                                                              [(dissoc-paths lexeme [[:italiano :italiano]])
-                                                               (merge-fn lexeme)
-                                                               {:italiano {:infinitive k
-                                                                           :exception true}}])]})))))))))))))))))
+  (->>
+   (sort (keys lexicon))
+   (mapcat (fn [k]
+          (let [lexemes (get lexicon k)
+                lexeme-kv [k lexemes]]
+            (->> exceptions-rules
+                 (mapcat (fn [{path :path
+                               label :label
+                               surface-form :surface-form
+                               merge-fn :merge-fn}]
+                           (let [surface-form-fn (or surface-form
+                                                     (fn [lexeme]
+                                                       (get-in lexeme path :none)))]
+                             ;; a lexeme-kv is a pair of a key and value. The key is a string (the word's surface form)
+                             ;; and the value is a list of lexemes for that string.
+                             (->> lexemes
+                                  (mapcat (fn [lexeme]
+                                            (if (not (= :none (get-in lexeme path :none)))
+                                              (do (log/debug (str (first lexeme-kv) " generating lexeme exceptional surface form: " (surface-form-fn lexeme)))
+                                                  (list {(surface-form-fn lexeme)
+                                                         [(reduce
+                                                           (fn [a b]
+                                                             (cond
+                                                               (= a :fail)
+                                                               (do
+                                                                 (log/warn (str ":fail in exception rule:"
+                                                                                label
+                                                                                "; lexeme's italiano:"
+                                                                                (strip-refs (get-in lexeme [:italiano]))))
+                                                                 :fail)
+                                                               (= b :fail)
+                                                               (do
+                                                                 (log/warn (str ":fail in exception rule:"
+                                                                                label
+                                                                                "; lexeme:"
+                                                                                (or (strip-refs (get-in lexeme [:italiano :italiano]))
+                                                                                (strip-refs (get-in lexeme [:italiano])))))
+                                                                 :fail)
+                                                               true
+                                                               (unify a b)))
+                                                           [(dissoc-paths lexeme [[:italiano :italiano]])
+                                                            (merge-fn lexeme)
+                                                            {:italiano {:infinitive k
+                                                                        :exception true}}])]})))))))))))))))
 (defn phonize2 [lexicon]
   (into {}
         (for [[k vals] lexicon]


Correct if-not indentation.

Correct if-not indentation.

--- src/caesium/crypto/generichash.clj
+++ src/caesium/crypto/generichash.clj
@@ -69,8 +69,8 @@
                     personal (or personal (bb/alloc blake2b-personalbytes))]
                 (b/call! blake2b-salt-personal buf msg key salt personal))
               (b/call! blake2b buf msg key)))
-     (throw (RuntimeException. "Error in blake2b hashing")))
-   buf))
+     (throw (RuntimeException. "Error in blake2b hashing"))
+     buf)))

 (defn blake2b
   "Hashes a message using BLAKE2b. Optionally takes key, salt and personal.


Insulate against custom init printing changes

closes #89

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -134,7 +134,9 @@
       client
       {:value (partial reset! results)
        :session session}
-      (pr-str `(binding [*ns* (symbol ~(deref current-ns))] ~form)))
+      (binding [*print-length* nil
+                *print-level* nil]
+        (pr-str `(binding [*ns* (symbol ~(deref current-ns))] ~form))))
     (read-string @results)))

 (defn poll-for-responses [connection]
@@ -172,11 +174,13 @@
       (execute-with-client
                client
                (assoc options :value (constantly nil))
-               (pr-str (list 'do
-                         (reply.initialization/export-definition
-                           'reply.signals/set-signal-handler!)
-                         '(set-signal-handler! "INT" (fn [s]))
-                         (reply.initialization/construct-init-code options))))
+               (binding [*print-length* nil
+                         *print-level* nil]
+                 (pr-str (list 'do
+                           (reply.initialization/export-definition
+                             'reply.signals/set-signal-handler!)
+                           '(set-signal-handler! "INT" (fn [s]))
+                           (reply.initialization/construct-init-code options)))))

       (handle-client-interruption! client)
       (run-repl client options))))


refactor schemas

refactor schemas

--- src/cljc/salava/badge/schemas.cljc
+++ src/cljc/salava/badge/schemas.cljc
@@ -173,6 +173,7 @@
                             :ctime s/Int
                             (s/optional-key :first_name) s/Str
                             (s/optional-key :last_name) s/Str
+                            (s/optional-key :profile_picture) (s/maybe s/Str)

                             }])


Add offset for Ellipse submorphs, fix wrong CSS attrs.

--- src/cljs/cljs_workspace/morph.cljs
+++ src/cljs/cljs_workspace/morph.cljs
@@ -18,8 +18,8 @@
   ([*atom kws]
      (om/to-cursor @*atom *atom kws)))

-(def html5TransformProperty "-webkit-transform")
-(def html5TransformOriginProperty "-webkit-transform-origin")
+(def html5TransformProperty "WebkitTransform")
+(def html5TransformOriginProperty "WebkitTransformOrigin")

 ; Event handling

@@ -90,7 +90,7 @@

 (defn get-transform-css [{rotation :Rotation, scale :Scale, pivot :PivotPoint,
                           :or {rotation 0, scale 1, pivot {:x 0, :y 0}}}]
-  {html5TransformProperty (str "rotation(" rotation ") scale(" scale ")")
+  {html5TransformProperty (str "rotate(" (mod (/ (* rotation 180) js/Math.PI) 360) "deg) scale(" scale "," scale ")")
    html5TransformOriginProperty (str (:x pivot) "px " (:y pivot) "px")})

 (defn get-visibility-css [value]
@@ -126,7 +126,7 @@
               :BorderRadius (get-border-radius-css value)
               :BorderStyle (get-border-style-css value)
               :DropShadow (get-drop-shadow-css value)
-              ;; more to come...
+              ;; more to come... :CSS for custom modifications to that very morph
                 nil))) (get ->self :shape))))

 ; morph component + rendering functions
@@ -138,6 +138,9 @@
 (defmulti morph (fn [app owner] (get-in app [:morph :MorphClass])))

 ; utilities
+
+(defn point-from-polar [radius angle]
+  {:x (* radius (.cos js/Math angle)) :y (* radius (.sin js/Math angle))})

 (defn add-points [point & points]
   (reduce (fn [p1 p2] {:x (+ (p1 :x) (p2 :x)) :y (+ (p1 :y) (p2 :y))}) point points))
@@ -148,8 +151,16 @@
       true
       visible)))

-(defn render-submorphs [self]
-  (dom/div #js {:className "originNode"}
+(defn render-submorphs [self & [offset]]
+  (when offset (prn offset))
+  (dom/div #js {:className "originNode"
+                :style (if offset
+                         (dict->js {"position" "absolute",
+                                    "top" (str (/ (:y offset) 2) "px !important"),
+                                    "left" (str (/ (:x offset) 2) "px !important"),
+                                    "marginTop" "-2px",
+                                    "margineft" "-2px"})
+                         {})}
     (apply dom/div nil
       (om/build-all morph (get self :submorphs) {:state {:owner (om/ref-cursor self)}}))))

@@ -177,11 +188,13 @@
     (om/update! ->owner :submorphs (conj submorphs morph))))

 (defn remove-morph [->owner morph-id]
-  (let [submorphs (get @->owner :submorphs)]
-    (om/update! ->owner :submorphs (into [] (filter #(not= (% :id) morph-id) submorphs)))))
-
-(defn set-rotation [->morph origin degrees]
-  (om/update! ->morph :morph (-> (:morph @->morph) (assoc :Rotation degrees) (assoc :PivotPoint origin))))
+  (let [submorphs (get @->owner :submorphs)
+        new-submorphs (into [] (filter #(not= (% :id) morph-id) submorphs))]
+    (prn (map #(% :id) new-submorphs))
+    (om/update! ->owner :submorphs new-submorphs)))
+
+(defn set-rotation [->morph rad origin]
+  (om/update! ->morph :morph (-> (:morph @->morph) (assoc :Rotation rad) (assoc :PivotPoint origin))))

 (defn set-position [->morph pos]
   (om/update! ->morph [:morph :Position] pos))
@@ -207,26 +220,33 @@
             false
             true))))

+(defn call-step [->morph]
+  ((-> ->morph :morph :step) ->morph))
+
 ; render based on ad hoc definition of morph like frame
 ; to visualize the halo
 (defn render-halo [app owner])

 (defmethod morph :default [app owner]
   (reify
+    om/IInitState
+    (init-state [_]
+       {:owner nil})
     om/IRenderState
     (render-state [_ state]
+
                   (let [state (assoc state :>> (om/ref-cursor app))
-              style (dict->js (extract-morph-css app))]
-          (dom/div  #js {:style style
-                       :className "morphNode"
-                       :onClick #(handle-click % state)
-                       :onMouseDown #(draggable/start-dragging % state owner)
-                       :onMouseUp #(draggable/stop-dragging % state owner)
-                       :onMouseMove #(draggable/drag % state)
-                       :onMouseEnter #(handle-enter % state)
-                       :onMouseLeave #(handle-leave % state)}
-                   (when (get-in app [:morph :Halo]) (render-halo app owner))
-                   (shape app owner))))))
+                        style (dict->js (extract-morph-css app))]
+                    (dom/div  #js {:style style
+                                   :className "morphNode"
+                                   :onClick #(handle-click % state)
+                                   :onMouseDown #(draggable/start-dragging % state owner)
+                                   :onMouseUp #(draggable/stop-dragging % state owner)
+                                   :onMouseMove #(draggable/drag % state)
+                                   :onMouseEnter #(handle-enter % state)
+                                   :onMouseLeave #(handle-leave % state)}
+                      (when (get-in app [:morph :Halo]) (render-halo app owner))
+                      (shape app owner))))))

 ;; multi method for shape

@@ -242,7 +262,7 @@
     ;; we apply some customizations to the style, to make the shape elliptical
     (let [ellipse-style (assoc style
                                "borderRadius" (str (style "width") "px /" (style "height") "px"))]
-      (dom/div #js {:style (dict->js ellipse-style)} (render-submorphs app)))))
+      (dom/div #js {:style (dict->js ellipse-style)} (render-submorphs app (get-in app [:shape :Extent]))))))

 (defmethod shape :default [app owner]
   (let [style (extract-shape-css app)]
@@ -268,7 +288,7 @@
     e))

 (defn render-path-node [app owner]
-  (prn (flatten (map unpack (get-in app [:shape :PathElements]))))
+  ; (prn (flatten (map unpack (get-in app [:shape :PathElements]))))
   (let [vertices (flatten (map unpack (get-in app [:shape :PathElements])))
         minX (apply min (map #(% :x) vertices))
         minY (apply min (map #(% :y) vertices))


add hashtags to comments

add hashtags to comments

--- src/cljs/link_collective/core.cljs
+++ src/cljs/link_collective/core.cljs
@@ -116,7 +116,14 @@
                            :post post-id
                            :content text
                            :author author
-                           :ts ts}])
+                           :ts ts}]
+                         (map (fn [t]
+                                {:db/id (uuid)
+                                 :comment comment-id
+                                 :tag (keyword t)
+                                 :ts ts})
+                              hash-tags)
+                         )
                         '(fn [old params]
                            (:db-after (d/transact old params)))))
         (<! (s/commit! stage


Giphy integration

Giphy integration

--- src/cljs/openslack/views/text.cljs
+++ src/cljs/openslack/views/text.cljs
@@ -72,6 +72,15 @@
                (str "/" (str/ltrim rpath "/gallery"))
                rpath)]
     (make-image-message (str domain path ".jpg"))))
+
+(defmethod convert-http-url :giphy.com
+  [url]
+  (let [uri (Uri. url)
+        rpath (.getPath uri)
+        gif-id (last (str/split rpath "-"))
+        domain "http://media.giphy.com"
+        path (str "/media/" gif-id "/giphy.gif")]
+    (make-image-message (str domain path))))

 (defmethod convert-http-url :default


stop hardcoding http hosts

stop hardcoding http hosts

--- src/clojure_playground/app/io.cljs
+++ src/clojure_playground/app/io.cljs
@@ -9,7 +9,7 @@
 (def base-url "http://localhost:3000")

 (defn reset-recipes []
-  (go (let [url (str base-url "/recipes")
+  (go (let [url "/recipes"
             response (<! (http/get url
                                    {:with-credentials? false
                                     :query-params      {"since" 135}}))]
@@ -19,5 +19,5 @@
           (prn @recipes)))))

 (defn store-recipe [recipe]
-  (http/post (str base-url "/recipes") {:json-params recipe}))
+  (http/post "/recipes" {:json-params recipe}))


made the header navigation centered

made the header navigation centered

--- src-cljs/bitfondue/core.cljs
+++ src-cljs/bitfondue/core.cljs
@@ -21,19 +21,20 @@
 (defn header
   []
   [:nav.navbar.navbar-light.bg-faded
-   [:a.navbar-brand {:href "/"} "bitfondue"]
-   [:ul.nav.navbar-nav
-    [:li.nav-item
-     [:a.nav-link {:href "#"} "Features"]]
-    [:li.nav-item
-     [:a.nav-link {:href "#"} "Pricing"]]
-    [:li.nav-item
-     [:a.nav-link {:href "#"} "About"]]]
-   [:ul.nav.navbar-nav.pull-right
-    [:li.nav-item
-     [:a.nav-link {:href "#"} "Login"]]
-    [:li.nav-item
-     [:a.nav-link {:href "#"} "Register"]]]])
+   [:div.container
+    [:a.navbar-brand {:href "/"} "bitfondue"]
+    [:ul.nav.navbar-nav
+     [:li.nav-item
+      [:a.nav-link {:href "#"} "Features"]]
+     [:li.nav-item
+      [:a.nav-link {:href "#"} "Pricing"]]
+     [:li.nav-item
+      [:a.nav-link {:href "#"} "About"]]]
+    [:ul.nav.navbar-nav.pull-right
+     [:li.nav-item
+      [:a.nav-link {:href "#"} "Login"]]
+     [:li.nav-item
+      [:a.nav-link {:href "#"} "Register"]]]]])

 (defn layout
   []


CMR-1715: Removing ingest event aliases.

--- indexer-app/src/cmr/indexer/services/ingest_event_handler.clj
+++ indexer-app/src/cmr/indexer/services/ingest_event_handler.clj
@@ -9,22 +9,10 @@
             [cmr.message-queue.services.queue :as queue]
             [cmr.common.log :refer (debug info warn error)]))

-(def ingest-event-aliases
-  "The actions sent in the ingest events can change from time to time. This has aliases from past
-  events to the latest events. This allows multiple versions of the CMR to be deployed and running
-  at the same time."
-  {:index-concept :concept-update
-   :delete-concept :concept-delete})
-
-(defn translate-action-alias
-  "Returns the latest name for an action"
-  [action]
-  (get ingest-event-aliases action action))
-
 (defmulti handle-ingest-event
   "Handle the various actions that can be requested via the indexing queue"
   (fn [context msg]
-    (translate-action-alias (keyword (:action msg)))))
+    (keyword (:action msg))))

 (defmethod handle-ingest-event :default
   [_ _]


Get an approximation to SPEA2 running.

Get an approximation to SPEA2 running.

Uses a simplified archive thinning mechanism. Doesn't work very well!

--- src/algebolic/algorithms/spea2.clj
+++ src/algebolic/algorithms/spea2.clj
@@ -3,7 +3,16 @@

   Currently limited to two objectives, but the API is arranged so that should be easy to
   generalise if needed."
-  (:require [algebolic.evolution.pareto :as pareto]))
+  (:require [algebolic.evolution.pareto :as pareto]
+            [algebolic.evolution.selection :as selection]))
+
+;; These functions can be grouped into:
+;; - functions for calculating the fitness values
+;; - functions for constructing the archive from the population and previous archive
+;; - functions for plugging the algorithm into algebolic.evolution.core
+
+
+;; * Fitness calculation functions *

 (defn- calculate-strength
   "The strength of an individual is the count of how many individuals it dominates. This function
@@ -60,9 +69,74 @@
          population)))

 (defn calculate-fitnesses
-  "Calculates the SPEA2 fitness values with respect to the given keys. Assocs"
+  "Calculates the SPEA2 fitness values with respect to the given keys. Assocs the fitness values into
+  a :spea2-fitness key."
   [keys population]
   (map #(assoc % :spea2-fitness (+ (:spea2-raw-fitness %) (:spea2-density %)))
        (->> population
             (calculate-densities keys)
-            (calculate-raw-fitnesses keys))))+            (calculate-raw-fitnesses keys))))
+
+
+;; * Archive construction functions *
+
+(defn- simple-archive-thinner
+  [goals oversized-archive target-size]
+  (let [coords (map (partial coords-from-individual goals) oversized-archive)
+        tree (kdtree/build-tree coords)
+        measured-archive (map #(assoc % :spea2-distance
+                                        (kth-nearest-distance tree 2 (coords-from-individual goals %)))
+                              oversized-archive)]
+    (take target-size (sort-by :spea2-distance > measured-archive))))
+
+(defn- thin-out-archive
+  "SPEA2 has a fairly complicated prescription for thinning out the archive if it's oversized. We look for
+  the individual who has the least distance to its nearest neighbour. If this doesn't yield a unique
+  individual, then we rank on distance to the second nearest neighbour, recursing until the tie is broken.
+  We remove this individual from the population and repeat until we have thinned the archive to the desired
+  size."
+  [goals oversized-archive target-size]
+  )
+
+(defn make-new-archive
+  "Implements the core step of the SPEA2 algorithm which is constructing a new archive of elite
+  individuals from the old archive and a population of new individuals."
+  [goals archive-size population old-archive]
+  (let [pool (into population old-archive)
+        scored-pool (calculate-fitnesses goals pool)
+        ;; individuals that are non-dominated will have a fitness less than 1
+        new-elites (filter #(< (:spea2-fitness %) 1.0) scored-pool)
+        new-size (count new-elites)
+;;        _ (println "New archive size: " new-size)
+    ]
+    ;; there are three cases here: either the new archive is exactly the right size, too big, or too small
+    (cond
+      ;; the easy one, if we happen to have the right number, then we're done.
+      (= new-size archive-size) new-elites
+      ;; if we have too few non-dominated individuals to fill the archive then we select the dominated
+      ;; individuals with the lowest fitness scores to make up the difference. The easiest way to do this
+      ;; is to just sort and select from the pool.
+      (< new-size archive-size) (take archive-size (sort-by :spea2-fitness < scored-pool))
+      ;; and finally, if we've got too many non-dominated individuals then some of them are for the chop
+      (> new-size archive-size) (simple-archive-thinner goals new-elites archive-size))))
+
+
+;; * algebolic.evolution.core configuration *
+
+(defn spea2-config
+  "A configuration implementing SPEA2. Needs to be fed the set of goal keys (which must be of
+  length 2 currently) and the unary and binary genetic operations that will be used in reproduction.
+
+  The SPEA2 algorithm preserves an elite population from generation to generation. On each iteration
+  first the newly bred individuals will be pooled with the elite population, and all have their
+  :spea2-fitness calculated. Then, a new elite population is constructed made up of the non-dominated
+  individuals - with thinning if there are too many elite individuals, and promotion from the population
+  if there are too few. Finally, a new generation is bred from the archived individuals, using binary
+  tournament selection on the :spea2-fitness, and the cycle begins again."
+  [config]
+  (let [{:keys [unary-ops binary-ops goals archive-size]} config]
+    {:elite-selector         (fn [rabble elite] (make-new-archive goals archive-size rabble elite))
+     :mating-pool-selector   (fn [_ elite] elite)
+     :reproduction-config    {:selector   (partial selection/tournament-selector 2 :spea2-fitness)
+                              :unary-ops  unary-ops
+                              :binary-ops binary-ops}}))


oh yeah, creating an address is smooooth

--- src/bitsplit_cli/client.cljs
+++ src/bitsplit_cli/client.cljs
@@ -45,9 +45,9 @@
     (send-amounts! [this amounts]
         (println "sending" amounts))
     (new-address! [this]
-        (swap! fake-addresses conj
-            (str "newest-address" (swap! findex inc)))
-        (last @fake-addresses)))
+        (-> coin
+            .createAccount
+            .getAddress)))

 (defn new-client [name]
     (-> {:db


Remove unused function

Remove unused function

--- src/braid/server/db/user.clj
+++ src/braid/server/db/user.clj
@@ -22,16 +22,6 @@
                   db->user)]
     (activate-first-quests! conn id)
     user))
-
-(defn create-oauth-user!
-  "Create a user that logins via oauth (and hence has no password)"
-  [conn {:keys [id email avatar]}]
-  (->> {:user/id id
-        :user/email email
-        :user/avatar avatar
-        :user/nickname (-> email (string/split #"@") first)}
-       (create-entity! conn)
-       db->user))

 (defn create-bot-user!
   [conn {:keys [id]}]


Added path to navigate to atom value

Added path to navigate to atom value

--- src/clj/com/rpl/specter.cljx
+++ src/clj/com/rpl/specter.cljx
@@ -280,6 +280,17 @@
     ))

 (defpath
+  ^{:doc "Navigates to atom value."}
+  atompath
+  []
+  (select* [this structure next-fn]
+    (next-fn @structure))
+  (transform* [this structure next-fn]
+    (do
+      (reset! structure (next-fn @structure))
+      structure)))
+
+(defpath
   ^{:doc "Navigates to the key only if it exists in the map."}
   must
   [k]


Also fail in repair for ignored exceptions

Such as failing to untar the production or failing to remove the
temporary files.

--- src/clj/mdr2/repair/core.clj
+++ src/clj/mdr2/repair/core.clj
@@ -54,6 +54,12 @@
               :dist-master (:library_signature production))]
      (-> {:id id} db/production-id-to-archive-id :id))))

+(defn- log-and-fail
+  "Log an error with given `msg` and return a (Failjure) failure"
+  [msg]
+  (log/error msg)
+  (fail/fail msg))
+
 (defn repair
   "Get a production from the archive and prepare it for repairing"
   [{id :id :as production}]
@@ -63,21 +69,15 @@
         tmp-dir (fs/path (fs/parent dest-path) (str id "_repair"))]
     (cond
       (not= (:state production) "archived")
-      (let [error-msg "Production is not in state \"archived\""]
-        (log/error error-msg)
-        (fail/fail error-msg))
+      (log-and-fail "Production is not in state \"archived\"")
       ;; checking for the state is not enough: there is a race
       ;; condition as the state is only set after all the files have
       ;; been copied. This takes time. So we also check for the
       ;; existence of some important directories
       (fs/exists? dest-path)
-      (let [error-msg (format "Directory %s already exists" dest-path)]
-        (log/error error-msg)
-        (fail/fail error-msg))
+      (log-and-fail (format "Directory %s already exists" dest-path))
       (fs/exists? tmp-dir)
-      (let [error-msg (format "Directory %s already exists" tmp-dir)]
-        (log/error error-msg)
-        (fail/fail error-msg))
+      (log-and-fail (format "Directory %s already exists" tmp-dir))
       :else
       (let [production (prod/set-state! production "repairing")
             container-id (container-id production)
@@ -86,39 +86,47 @@
                                  {:as :stream
                                   :basic-auth [(env :archive-web-user) (env :archive-web-password)]})]
         (log/infof "Repairing %s" id)
-        (if (client/success? response)
+        (if-not (client/success? response)
+          (do
+            (.close (:body response)) ;; close the stream
+            (log-and-fail (format "Couldn't get %s from archive (%s)" id url)))
           (let [dam-number (prod/dam-number production)
                 tar-file (fs/path tmp-dir (str dam-number ".tar"))]
-            (fail/try*
-              ;; fail fast if any of the filesystem operations below fail
-              ;; create all dirs for this production
-              (log/info "Create dirs" id)
+
+            ;; fail fast if any of the filesystem operations fail. If
+            ;; the filesystem operations silently ignore failures we
+            ;; check the results.
+            (try
+              ;;create all dirs for this production
               (prod/create-dirs production)
               ;; copy tar to tmpdir
-              (log/infof "Copy tar to tmpdir" tmp-dir)
               (fs/create-dirs tmp-dir)
               (with-open [input (:body response)]
                 (io/copy input (fs/file tar-file)))
               ;; extract the tar
-              (log/infof "extract tar %s to %s" tar-file tmp-dir)
-              (shell/sh "tar" "--extract" (str "--file=" tar-file) :dir (fs/file tmp-dir))
-              ;; extract the relevant parts to the structured-path
-              (let [src-path (fs/file tmp-dir dam-number "produkt" dam-number)]
-                (log/infof "extract the relevant parts to the structured-path %s" src-path)
-                (doseq [f (filter #(.isFile %) (file-seq src-path))]
-                  (fs/move f (io/file dest-path (fs/file-name f)))))
-              ;; clear the temporary files
-              (log/info "clear the temporary files")
-              (fs/delete-tree tmp-dir)
-              ;; create the obi config file
-              (log/info "create the obi config file")
-              (obi/config-file production)
-              ;; set the state
-              (log/info "set the state")
-              (prod/set-state! production "structured")))
-          (let [error-msg (format "Couldn't get %s from archive (%s)" id url)]
-            ;; close the stream
-            (.close (:body response))
-            (log/error error-msg)
-            (fail/fail error-msg)))))))
+              (let [{exit :exit} (shell/sh "tar" "--extract" (format "--file=%s" tar-file) :dir (fs/file tmp-dir))]
+                (if-not (= exit 0)
+                  (do
+                    ;; re-set the state back to archived
+                    (prod/set-state! production "archived")
+                    (log-and-fail (format "Failed to extract the tar file %s inside %s" tar-file tmp-dir)))
+                  (do
+                    ;; extract the relevant parts to the structured-path
+                    (let [src-path (fs/file tmp-dir dam-number "produkt" dam-number)]
+                      (doseq [f (filter #(.isFile %) (file-seq src-path))]
+                        (fs/move f (io/file dest-path (fs/file-name f)))))
+                    ;; clear the temporary files
+                    (if-not (fs/delete-tree tmp-dir)
+                      ;; we probably do not need to roll back the state just because we couldn't
+                      ;; clean up some temporary files
+                      (log-and-fail (format "Failed to remove temporary files in %s" tmp-dir))
+                      (do
+                        ;; create the obi config file
+                        (obi/config-file production)
+                        ;; set the state
+                        (prod/set-state! production "structured"))))))
+              (catch Exception e
+                ;; re-set the state back to archived
+                (prod/set-state! production "archived")
+                e))))))))


pdf fix test

pdf fix test

--- src/clj/salava/badge/pdf.clj
+++ src/clj/salava/badge/pdf.clj
@@ -65,7 +65,8 @@
   (if (== 1 (count markdown))
     markdown
     (if-let [p (process-markdown-helper markdown id context)]
-      (markdown->clj-pdf {:image {:x 10 :y 10} :spacer {:extra-starting-value 1 :allow-extra-line-breaks? true :single-value 2} :wrap {:global-wrapper :paragraph}} markdown)
+      (markdown->clj-pdf {:image {:x 10 :y 10} ;:spacer {:extra-starting-value 1 :allow-extra-line-breaks? true :single-value 2}
+                          :wrap {:global-wrapper :paragraph}} markdown)
       ""
       )))


Fix function name

Fix function name

--- src/clj/salava/core/util.clj
+++ src/clj/salava/core/util.clj
@@ -225,5 +225,5 @@

 (defn md->html
   "convert markdown to html and sanitize output"
-  ([md] (markdown-to-html md default-md-processor))
+  ([md] (md->html md default-md-processor))
   ([md processor] (markdown-to-html processor md)))


Move css and js vectors to separate vars

--- src/clj/subman/web/views.clj
+++ src/clj/subman/web/views.clj
@@ -2,6 +2,35 @@
   (:require [hiccup.page :refer [html5 include-css include-js]]
             [environ.core :refer [env]]
             [subman.helpers :refer [as-static make-static]]))
+
+(def debug-js
+  ["components/jquery/dist/jquery.js"
+   "components/bootstrap/dist/js/bootstrap.js"
+   "components/typeahead.js/dist/typeahead.jquery.js"
+   "components/react/react.js"
+   "cljs-target/goog/base.js"
+   "main.js"])
+
+(def production-js
+  ["components/jquery/dist/jquery.min.js"
+   "components/bootstrap/dist/js/bootstrap.min.js"
+   "components/typeahead.js/dist/typeahead.jquery.min.js"
+   "components/react/react.min.js"
+   "main.js"])
+
+(def debug-css
+  ["components/bootstrap/dist/css/bootstrap.css"
+   "components/bootstrap/dist/css/bootstrap-theme.css"
+   "components/font-awesome/css/font-awesome.css"
+   "components/typeahead.js-bootstrap3.less/typeahead.css"
+   "main.css"])
+
+(def production-css
+  ["components/bootstrap/dist/css/bootstrap.min.css"
+   "components/bootstrap/dist/css/bootstrap-theme.min.css"
+   "components/font-awesome/css/font-awesome.min.css"
+   "components/typeahead.js-bootstrap3.less/typeahead.css"
+   "main.css"])

 (defn index-page []
   (let [is-debug (env :is-debug)]
@@ -13,34 +42,11 @@
                     :rel  "search"
                     :href (first (make-static "opensearch.xml"))}]
             [:title "Subman - subtitle search service"]
-            (when-not is-debug
-              (as-static include-css
-                         "components/bootstrap/dist/css/bootstrap.min.css"
-                         "components/bootstrap/dist/css/bootstrap-theme.min.css"
-                         "components/font-awesome/css/font-awesome.min.css"
-                         "components/typeahead.js-bootstrap3.less/typeahead.css"
-                         "main.css"))
-            (when-not is-debug
-              (as-static include-js
-                         "components/jquery/dist/jquery.min.js"
-                         "components/bootstrap/dist/js/bootstrap.min.js"
-                         "components/typeahead.js/dist/typeahead.jquery.min.js"
-                         "components/react/react.min.js"
-                         "main.js"))
-            (when is-debug
-              (as-static include-css
-                         "components/bootstrap/dist/css/bootstrap.css"
-                         "components/bootstrap/dist/css/bootstrap-theme.css"
-                         "components/font-awesome/css/font-awesome.css"
-                         "components/typeahead.js-bootstrap3.less/typeahead.css"
-                         "main.css"))
-            (when is-debug
-              (as-static include-js
-                         "components/jquery/dist/jquery.js"
-                         "components/bootstrap/dist/js/bootstrap.js"
-                         "components/typeahead.js/dist/typeahead.jquery.js"
-                         "components/react/react.js"
-                         "cljs-target/goog/base.js"
-                         "main.js"))
+            (apply as-static include-css (if is-debug
+                                           debug-css
+                                           production-css))
+            (apply as-static include-js (if is-debug
+                                          debug-js
+                                          production-js))
             [:script "goog.require('subman.core');"]]
            [:body [:script "subman.core.run();"]])))


add hostname parser

add hostname parser

--- src/cljs/consulate/core.cljs
+++ src/cljs/consulate/core.cljs
@@ -9,6 +9,15 @@

 ;; -------------------------
 ;; Views
+
+(def hostname-re (re-pattern "([a-z]{1,})-([a-z][a-z-]*[a-z]+)([0-9]+)?-?([0-9]+)?[-.]([a-z]{2,6})([.-][a-z]{2,6})?(?:.gdi)?"))
+
+(defrecord Server [hostname environment hostgroup number cluster location ] )
+
+(defn new-server [hostname]
+  (apply ->Server (re-matches hostname-re hostname)))
+
+(def test-list-of-servers ["qc-evoweb1.ep.gdi"] )

 (defn home-page []
   [:div [:h2 "Welcome to consulate"]


Add mana symbol counter

Add mana symbol counter

--- src/cljs/decktouch/core.cljs
+++ src/cljs/decktouch/core.cljs
@@ -23,6 +23,23 @@
      (for [card cards]
        ^{:key card} (card-in-list (get card "name")))]))

+(defn record-mana-freq [mana-map mana]
+  (if (contains? mana-map mana)
+    (assoc mana-map mana (inc (get mana-map mana)))
+    mana-map))
+
+(defn get-mana-symbol-counts [cards]
+  (let [mana-costs (reduce str (map #(get % "manaCost") cards))]
+    (reduce record-mana-freq {"R" 0 "G" 0 "U" 0 "W" 0 "B" 0} mana-costs)))
+
+(defn mana-cost-widget [cards]
+  (let [mana-symbol-counts (get-mana-symbol-counts cards)
+        sorted-mana-symbol-counts
+            (into (sorted-map-by (fn [key1 key2]
+                                   (compare [(get mana-symbol-counts key2) key2]
+                                            [(get mana-symbol-counts key1) key1])))
+                  mana-symbol-counts)]
+    [:div (str sorted-mana-symbol-counts)]))

 (defn card-counter [cards]
   [:h3 (count cards) " cards"])
@@ -30,7 +47,8 @@
 (defn home-page []
   [:div [:h2 "Welcome to decktouch"]
    [:div [card-input/component card-data/card-list]
-         [card-counter @card-data/card-list]]
+         [card-counter @card-data/card-list]
+         [mana-cost-widget @card-data/card-list]]
    [:div [card-list @card-data/card-list]]
    [:div [:a {:href "#/about"} "go to about page"]]])


use in? from helper library

use in? from helper library

--- src/cljs/smgui/settings.cljs
+++ src/cljs/smgui/settings.cljs
@@ -2,7 +2,8 @@
   (:require [om.dom :as dom :include-macros true]
             [om.core :as om :include-macros true]
             [cljs.reader]
-            [smgui.uuid :as uuid]))
+            [smgui.uuid :as uuid]
+            [smgui.ttiual :refer [in?]]))

 (def defaults
   {:languages ["pb" "pt" "en"]
@@ -38,10 +39,6 @@

 (defn language-from-iso639_1 [iso639_1]
   (first (filter #(= iso639_1 (:iso639_1 %)) languages-map)))
-
-(defn in?
-  [seq elm]
-  (some #(= elm %) seq))

 (defn add-items [cursor values]
   (om/transact! cursor #(vec (concat % values))))


fixed docstrings at sort-order

fixed docstrings at sort-order

--- src/clojure/cljam/sorter.clj
+++ src/clojure/cljam/sorter.clj
@@ -172,8 +172,8 @@
         (= so (name order-coordinate)))))

 (defn sort-order
-  "Returns sorting order of the sam as String. Returning order is one of the
-  following: \"queryname\", \"coordinate\", \"unsorted\", \"unknown\"."
+  "Returns sorting order of the sam as Keyword. Returning order is one of the
+  following: :queryname, :coordinate, :unsorted, :unknown ."
   [rdr]
   (if-let [so (:SO (:HD (io/read-header rdr)))]
     (keyword so)


Fix principal of MSPPrincipal

Fix principal of MSPPrincipal

--- src/clojure_fabric/proto.clj
+++ src/clojure_fabric/proto.clj
@@ -359,12 +359,12 @@
                              :organization-unit MspPrincipal$MSPPrincipal$Classification/ORGANIZATION_UNIT
                              :identity MspPrincipal$MSPPrincipal$Classification/IDENTITY})

-(defrecord MSPPrincipal [principal-classification ^bytes principal]
+(defrecord MSPPrincipal [principal-classification ^MSPRole principal]
   ICljToProto
   (clj->proto [this]
     (cond-> (MspPrincipal$MSPPrincipal/newBuilder)
       principal-classification (.setPrincipalClassification (classification-map principal-classification))
-      principal (.setPrincipal principal)
+      principal (.setPrincipal (.toByteString ^MspPrincipal$MSPRole (clj->proto principal)))
       true (.build))))

 (defn make-msp-principal


Change update-instruction-map-uuids to use vectors

This fixes errors that arise later when the autoconstruction code is
interpreted and tries to manipulate the genomes as vectors which fails
because *this* method turned all the vectors into lazy sequences.

--- src/clojush/pushgp/breed.clj
+++ src/clojush/pushgp/breed.clj
@@ -88,7 +88,7 @@
   [individual]
   (update individual :genome
           (fn [genome]
-            (map (fn [instruction-map]
+            (mapv (fn [instruction-map]
                    (if (:random-insertion instruction-map)
                      (dissoc instruction-map :random-insertion)
                      (assoc instruction-map


Rename "defaults" to better reflect intent

--- src/com/puppetlabs/jetty.clj
+++ src/com/puppetlabs/jetty.clj
@@ -105,6 +105,6 @@
   [handler options]
   (when (empty? (select-keys options [:port :ssl? :ssl-port]))
     (throw (IllegalArgumentException. "No ports were specified to bind")))
-  (let [defaults {:configurator add-gzip-handler}]
+  (let [overrides {:configurator add-gzip-handler}]
     (with-redefs [jetty/create-server create-server]
-      (jetty/run-jetty handler (merge options defaults)))))
+      (jetty/run-jetty handler (merge options overrides)))))


Replace pre/post-conditions with type hint

--- src/com/puppetlabs/jetty.clj
+++ src/com/puppetlabs/jetty.clj
@@ -90,9 +90,7 @@
 (defn add-gzip-handler
   "Jetty configurator that wraps GZIP compression around the existing
   web request handler"
-  [server]
-  {:pre  [(instance? Server server)]
-   :post [(instance? Server %)]}
+  [^Server server]
   (let [current-handler (.getHandler server)
         gzip-handler    (doto (GzipHandler.)
                           (.setHandler current-handler))]


add more options

add more options

--- src/babel/francais/morphology.cljc
+++ src/babel/francais/morphology.cljc
@@ -254,7 +254,10 @@
                                    (get-in word [:français]) "; stringness: "
                                    (string? (get-in word [:français])))))))))

-(defn fo [input]
+(defn fo [input &
+          {:keys [from-language show-notes]
+           :or {from-language nil
+                show-notes false}}]
   (cond
     (nil? input)
     nil


Use ns alias

Use ns alias

--- src/caesium/crypto/generichash.clj
+++ src/caesium/crypto/generichash.clj
@@ -1,22 +1,22 @@
 (ns caesium.crypto.generichash
   (:refer-clojure :exclude [bytes hash])
-  (:require [caesium.binding :refer [sodium defconsts]]
+  (:require [caesium.binding :as b]
             [caesium.byte-bufs :refer [buflen]]))

-(defconsts [bytes
-            bytes-min
-            bytes-max
-            keybytes
-            keybytes-min
-            keybytes-max
-            blake2b-bytes
-            blake2b-bytes-min
-            blake2b-bytes-max
-            blake2b-keybytes
-            blake2b-keybytes-min
-            blake2b-keybytes-max
-            blake2b-saltbytes
-            blake2b-personalbytes])
+(b/defconsts [bytes
+              bytes-min
+              bytes-max
+              keybytes
+              keybytes-min
+              keybytes-max
+              blake2b-bytes
+              blake2b-bytes-min
+              blake2b-bytes-max
+              blake2b-keybytes
+              blake2b-keybytes-min
+              blake2b-keybytes-max
+              blake2b-saltbytes
+              blake2b-personalbytes])

 (defn hash-to-buf!
   "Hashes a message with optional key into a given output buffer using
@@ -57,10 +57,10 @@
      (let [salt (or salt (byte-array blake2b-saltbytes))
            personal (or personal (byte-array blake2b-personalbytes))]
        (.crypto_generichash_blake2b_salt_personal
-        sodium buf (buflen buf) msg (buflen msg) key (buflen key)
+        b/sodium buf (buflen buf) msg (buflen msg) key (buflen key)
         salt personal))
      (.crypto_generichash_blake2b
-      sodium buf (buflen buf) msg (buflen msg) key (buflen key)))
+      b/sodium buf (buflen buf) msg (buflen msg) key (buflen key)))
    buf))

 (defn blake2b


Render `:forms` for special forms instead of arglists when present

--- src/clj/clojuredocs/pages/vars.clj
+++ src/clj/clojuredocs/pages/vars.clj
@@ -26,6 +26,9 @@
         (when-not (empty? a) " ")
         a
         ")")])
+
+(defn $argform [s]
+  [:li.arglist s])

 (defn see-alsos-for [{:keys [ns name library-url]}]
   (->> (mon/fetch :see-alsos
@@ -85,7 +88,7 @@
 (defn $number-badge [num]
   [:span.badge num])

-(defn $var-header [{:keys [ns name added arglists] :as v}]
+(defn $var-header [{:keys [ns name added arglists forms] :as v}]
   [:div.row.var-header
    [:div.col-sm-8
     [:h1.var-name (util/html-encode name)]]
@@ -103,7 +106,9 @@
    [:div.col-sm-12
     [:section
      [:ul.arglists
-      (map #($arglist name %) arglists)]]]])
+      (if forms
+        (map #($argform %) forms)
+        (map #($arglist name %) arglists))]]]])

 (defn var-page-handler [ns name]
   (let [name (util/cd-decode name)


Touch up some whitespace

Touch up some whitespace

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -1,6 +1,5 @@
 (ns reply.eval-modes.nrepl
-  (:import [java.util.concurrent LinkedBlockingQueue
-                                 TimeUnit])
+  (:import [java.util.concurrent LinkedBlockingQueue TimeUnit])
   (:require [clojure.main]
             [clojure.tools.nrepl.cmdline :as nrepl.cmdline]
             [clojure.tools.nrepl :as nrepl]
@@ -182,7 +181,6 @@
           options (if (:color options)
                     (merge options nrepl.cmdline/colored-output)
                     options)]
-
       (.start (Thread. (partial poll-for-responses connection)))
       (execute-with-client
                client
@@ -195,7 +193,6 @@
                            '(set-signal-handler! "INT" (fn [s]))
                            (reply.initialization/construct-init-code
                              options)))))
-
       (handle-client-interruption! client)
       (run-repl client options))))


Add fn for one general heading

Add fn for one general heading

--- src/discuss/utils/views.cljs
+++ src/discuss/utils/views.cljs
@@ -16,8 +16,7 @@
                :onClick   f})))

 (defn logo
-  "If no function is provided, show logo as is. Else bind function to onClick-event and add
-   pointer-class."
+  "If no function is provided, show logo as is. Else bind function to onClick-event and add pointer-class."
   ([] (fa-icon "fa-comments"))
   ([f] (fa-icon "fa-comments" f)))

@@ -68,4 +67,9 @@
   "Align divs to bottom. Scrolls down the complete content of each div."
   [class]
   (let [divs (gdom/getElementsByClass (lib/prefix-name class))]
-    (doall (map #(set! (.. % -scrollTop) (.. % -scrollHeight)) divs))))+    (doall (map #(set! (.. % -scrollTop) (.. % -scrollHeight)) divs))))
+
+(defn view-header
+  "Function to create a header for the views."
+  [heading]
+  (dom/h4 #js {:className "text-center"} heading))


Starting work of re-factoring Huh to actually render the component into a temporary DOM element, so the component is initialized correctly. main thing missing is sub-component assertions

--- web-client/test/test_burgerboard/huh.cljs
+++ web-client/test/test_burgerboard/huh.cljs
@@ -5,6 +5,7 @@
    [om.core :as om :include-macros true]
    [om.dom :as dom :include-macros true]
    [clojure.string :refer [lower-case]]
+   [goog.array :as g-array]
    )
   )

@@ -14,9 +15,18 @@
   )

 (defn -instrument [sub-component cursor m]
-  {:sub-component sub-component
-   :cursor cursor
-   :m m}
+  (dom/div #js {:data-huh-sub-component sub-component
+                :data-huh-cursor (.stringify js/JSON cursor)
+                :data-huh-m (.stringify js/JSON m)})
+  )
+
+(defn decode-sub-component [sub-component]
+  {:sub-component (js/eval (str "("
+                                (.getAttribute sub-component
+                                               "data-huh-sub-component")
+                                ")"))
+   :cursor (.parse js/JSON (.getAttribute sub-component "data-huh-cursor"))
+   :m (.parse js/JSON (.getAttribute sub-component "data-huh-m"))}
   )

 (defn test-predicates
@@ -40,22 +50,25 @@
    (gensym) nil)
   )

+(defn built-component
+  ([component state] (built-component component state nil))
+  ([component state m]
+     (binding [om/*state* state]
+       (om/build* component (om/to-cursor @state state []) m))
+     )
+  )
+
 (defn rendered-component
   ([component state] (rendered-component component state nil))
   ([component state m]
-     (binding [om/*state* state]
-       (.render (om/build* component (om/to-cursor @state state []) m))
-       )
-     )
+     (let [built-c (built-component component state m)
+           dom-el (js/document.createElement "div")]
+       (.getDOMNode (js/React.renderComponent built-c dom-el))
+     ))
   )

 (defn get-child [component child]
-  (let [children (js->clj (.. component -props -children))]
-    (if (sequential? children)
-      (nth children child)
-      children
-      )
-    )
+  (aget (.-children component) child)
   )

 (defn in [component & accessors]
@@ -119,10 +132,10 @@
 (defn display-child
   ([component]
      (cond
-      (not (nil? (.. component -props)))
+      (not (nil? (.-tagName component)))
       {
-       :tag (tag-name component)
-       :children (display-children (.. component -props -children))
+       :tag (.-tagName component)
+       :children (display-children (g-array/toArray (.. component -children)))
        }
       (fn? component) {:sub-component (component-name component)}
       (string? component) {:text component}
@@ -141,49 +154,34 @@

 (defn containing [& tests]
   (fn -containing-pred [component]
-    (let [children (.. component -props -children)
+    (let [children (g-array/toArray (.. component -children))
           test-count (count tests)]
-      (if (= (type children) js/Array)
-        ;; React annoyingly makes children = the single child element,
-        ;; when there is only one, instead of a list of one
-        (let [child-count (count children)]
-          (if (not= test-count child-count)
-            {:msg "Wrong number of child elements"
-             :expected test-count :actual child-count
-             :actual-children (display-children children)}
-            (if-let [failures
-                     (seq (filter (fn [result] (not= true result))
-                                  (map (fn [pred child] (pred child))
-                                       tests children
-                                       )))]
-              failures
-              true
-              )
+      (let [child-count (.-length children)]
+        (if (not= test-count child-count)
+          {:msg "Wrong number of child elements"
+           :expected test-count :actual child-count
+           :actual-children (display-children children)}
+          (if-let [failures
+                   (seq (filter (fn [result] (not= true result))
+                                (map (fn [pred child] (pred child))
+                                     tests children
+                                     )))]
+            failures
+            true
             )
           )
-        (if (not= 1 test-count) ;; Children is actually just one child
-          {:msg "Wrong number of child elements"
-           :expected test-count :actual 1
-           :actual-children (display-children children)}
-          ((nth tests 0) children)
-          )
-        )
-      )
-    )
-  )
-
-(defn nothing [component]
-  (if (nil? component)
-    true
-    {:msg "non empty container" :expected nil :actual component}
-    )
-  )
-
-(defn text [text]
+        )
+      )
+    )
+  )
+
+(defn with-text [text]
   (fn -text-pred [component]
-    (if (= text component)
-      true
-      {:msg "Text does not match" :expected text :actual component}
+    (let [actual-text (.-textContent component)]
+      (if (= text actual-text)
+        true
+        {:msg "Text does not match" :expected text :actual actual-text}
+        )
       )
     )
   )
@@ -193,11 +191,12 @@
   ([expected-component cursor m]
      (fn -sub-component-pred [component]
        (let [expected-name (component-name expected-component)
-             actual-name (component-name (:sub-component component))
-             actual-cursor @(:cursor component)
-             actual-m (:m component)]
+             {actual-sub-component :sub-component
+              actual-cursor :cursor
+              actual-m :m} (decode-sub-component component)
+             actual-name (component-name actual-sub-component)]
          (cond
-          (not= expected-component (:sub-component component))
+          (not= expected-component actual-sub-component)
           {:msg "sub-component does not match"
            :expected expected-name :actual actual-name}

@@ -218,8 +217,8 @@

 (defn with-class [class-name]
   (fn -with-class-pred [component]
-    (let [actual (.. component -props -className)]
-      (if (= class-name actual)
+    (let [actual (.. component -className)]
+      (if (.contains (.. component -classList) class-name)
         true
         {:msg "Class name does not match" :expected class-name :actual actual}
         )
@@ -229,22 +228,19 @@

 (defn with-attr [attr-name attr-value]
   (fn -with-attr-pred [component]
-    (let [actual-value (aget (.. component -props) attr-name)]
+    (let [actual-value (.getAttribute component attr-name)]
       (if (= attr-value actual-value)
         true
         {:msg "Attribute value does not match"
          :expected attr-value :actual actual-value
-         :attr attr-name :props (.. component -props)}
+         :attr attr-name}
         )
       )
     )
   )

 (defn after-event [event-attr event-arg component callback]
-  ((or
-    (aget (.. component -props) (name event-attr))
-    (fn [_] (throw (js/Error. (str "No event handler for " event-attr))))
-    )
-   event-arg)
+  ((aget js/React.addons.TestUtils.Simulate (name event-attr))
+   component event-arg)
   (callback component)
   )


(maint) add return schema for create-csr-attrs-exts

--- src/clj/puppetlabs/puppetserver/certificate_authority.clj
+++ src/clj/puppetlabs/puppetserver/certificate_authority.clj
@@ -598,7 +598,7 @@
                       "Cert subjectAltName contains a wildcard, which is not allowed: %s"
                       name)})))))

-(schema/defn create-csr-attrs-exts
+(schema/defn create-csr-attrs-exts :- (schema/maybe (schema/pred utils/extension-list?))
   "Parse the CSR attributes yaml file at the given path and create a list of
   certificate extensions from the `extensions_requests` section."
   [csr-attributes-file :- schema/Str]


(MAINT) Prefer clj-time/seconds over clj-time/secs

The latter is deprecated in favor of the former; we should no longer see
deprecation warnings during `lein test` for this.

--- src/clj/puppetlabs/puppetserver/certificate_authority.clj
+++ src/clj/puppetlabs/puppetserver/certificate_authority.clj
@@ -149,7 +149,7 @@
   [ca-ttl :- schema/Int]
   (let [now        (time/now)
         not-before (time/minus now (time/days 1))
-        not-after  (time/plus now (time/secs ca-ttl))]
+        not-after  (time/plus now (time/seconds ca-ttl))]
     {:not-before (.toDate not-before)
      :not-after  (.toDate not-after)}))


Fixed temporal search options and.

Fixed temporal search options and.

--- src/cmr/search/services/parameter_converters/temporal.clj
+++ src/cmr/search/services/parameter_converters/temporal.clj
@@ -27,7 +27,7 @@
 (defmethod p/parameter->condition :temporal
   [concept-type param value options]
   (if (sequential? value)
-    (if (contains? (set (keys (:temporal options))) :and)
+    (if (= "true" (get-in options [:temporal :and]))
       (qm/and-conds
         (map #(p/parameter->condition concept-type param % options) value))
       (qm/or-conds
@@ -38,3 +38,4 @@
                                 :end-date (h/string->datetime end-date)
                                 :start-day (string->int-value start-day)
                                 :end-day (string->int-value end-day)}))))
+


User names must be alphanumeric

User names must be alphanumeric

--- src/foreclojure/register.clj
+++ src/foreclojure/register.clj
@@ -28,8 +28,11 @@
              "User already exists",
              (< 3 (.length user) 13)
              "Username must be 4-12 characters long",
-             (< 6 (.length pwd) 13)
-             "Password must be 7-12 characters long",
+	     (= user
+		(first (re-seq #"[A-Za-z0-9_]+" user)))
+	     "Username must be alphanumeric"
+	     (< 6 (.length pwd) 13)
+	     "Password must be 7-12 characters long",
              (= pwd repeat-pwd)
              "Passwords don't match",
              (not (empty? email))


fixed refs to load-collection

fixed refs to load-collection

--- src/tutorial/untangled_tutorial/H_Server_Interactions.cljs
+++ src/tutorial/untangled_tutorial/H_Server_Interactions.cljs
@@ -169,7 +169,7 @@
   ROOT-centric query in your send function. Basically, you write a lot of plumbing. Server error handling is completely
   up to you in your send method.

-  In Untangled, initial load is an explicit step. You simply put calls to `load-collection` in your app start callback.
+  In Untangled, initial load is an explicit step. You simply put calls to `load-data` in your app start callback.
   State markers are put in place that allow you to then render the fact that you are loading data. Any number of separate
   server queries can be queued, and the queries themselves are used for normalization. Post-processing of the response
   is well-defined and trivial to access.
@@ -179,7 +179,7 @@
     :initial-state {}
     :started-callback
       (fn [app]
-        (df/load-collection :query [{:items (om/get-query CollectionComponent)}]
+        (df/load-data :query [{:items (om/get-query CollectionComponent)}]
                                      :without #{:comments}
                                      :post-mutation 'app/build-views)))
   ```
@@ -282,7 +282,7 @@

   #### Using `app/load` directly

-  TODO: See the helper functions `load-collection` and `load-field`. We might add more specific versions of `app/load`
+  TODO: See the helper functions `load-data` and `load-field`. We might add more specific versions of `app/load`
   that provide a clearer end-user API.

   ### Remote reads after a mutation


[CS] Document the reasoning behind `if-null`

--- src/vip/data_processor/validation/db/duplicate_records.clj
+++ src/vip/data_processor/validation/db/duplicate_records.clj
@@ -9,7 +9,13 @@
 (defn dupe-column-name [column]
   (str "dupes." column))

-(defn if-null [column-name]
+(defn if-null
+  "SQL does not believe that NULL = NULL, so in order to match NULL
+  values across rows which may be identical, we must transform NULLs
+  to a known value that will not naturally appear in the
+  data. IFNULL(column_name, \"NULL_VALUE\") will return the value in
+  the column if it's not NULL, otherwise \"NULL_VALUE\"."
+  [column-name]
   (str "IFNULL(" column-name ", \"NULL_VALUE\")"))

 (defn dupe-field-select [column-name]


Don't error building doc profile when no git

--- src/lein_pallet_release/plugin.clj
+++ src/lein_pallet_release/plugin.clj
@@ -7,11 +7,13 @@

 (defn src-uri
   [project]
-  (if-let [origin (git/origin)]
-    (let [branch (git/current-branch)
-          {:keys [login name]} (github/url->repo origin)]
-      (format "https://github.com/%s/%s/blob/%s"
-              login name branch))))
+  (try
+    (if-let [origin (git/origin)]
+      (let [branch (git/current-branch)
+            {:keys [login name]} (github/url->repo origin)]
+        (format "https://github.com/%s/%s/blob/%s"
+                login name branch)))
+    (catch Exception _)))               ; don't error on no git

 (defn doc-version
   [project]


More assertions for group, reverse order of locals

Can (keys &env) be depended upon to have locals
ordered by when they were bound?

If not, could fix with global counter added
to context local metadata.

--- src/main/clojure/com/stuartsierra/lazytest/examples.clj
+++ src/main/clojure/com/stuartsierra/lazytest/examples.clj
@@ -35,7 +35,7 @@
   "Returns a vector of locals bound by with-context in the
   environment."
   [env]
-  (vec (filter #(::local (meta %)) (keys env))))
+  (vec (reverse (filter #(::local (meta %)) (keys env)))))

 (defmacro example
   "Creates an example function, using current context locals for
@@ -44,7 +44,7 @@
   ([docstring expr]
      (let [locals (find-locals &env)]
        `(vary-meta (fn ~locals ~expr)
-                   merge ~(standard-metadata &form docstring)
+                   merge ~(standard-metadata expr docstring)
                    {:locals '~locals}))))

 (defmacro group-examples
@@ -75,7 +75,7 @@
          (even? (count bindings))]}
   (if (seq bindings)
     `(with-context ~(first bindings) ~(second bindings)
-       (group ~(nnext bindings) ~examples ~subgroups))
+       (group ~(vec (nnext bindings)) ~examples ~subgroups))
     `(new-group ~(find-locals &env)
                 (group-examples ~@examples)
                 ~subgroups
@@ -108,3 +108,56 @@
     (assert (integer? (:line m)))
     (assert (nil? (:name m)))
     (assert (= '[x] (:locals m)))))
+
+(let [c1 (com.stuartsierra.lazytest.contexts/context [] 1)
+      g (group [x c1] [(= 1 x) "foo" (= x 2)] [])]
+  (assert (group? g))
+  (assert (= [c1] (:contexts g)))
+  (let [exs (:examples g)]
+    (assert (vector? exs))
+    (assert (= 2 (count exs)))
+    (assert (every? fn? exs))
+    (let [[ex1 ex2] exs]
+      (assert (true? (ex1 1)))
+      (assert (false? (ex2 1)))
+      (let [m (meta ex1)]
+        (assert (nil? (:doc m)))
+        (assert (= *ns* (:ns m)))
+        (assert (string? (:file m)))
+        (assert (integer? (:line m)))
+        (assert (nil? (:name m)))
+        (assert (= '[x] (:locals m))))
+      (let [m (meta ex2)]
+        (assert (= "foo" (:doc m)))
+        (assert (= *ns* (:ns m)))
+        (assert (string? (:file m)))
+        (assert (integer? (:line m)))
+        (assert (nil? (:name m)))
+        (assert (= '[x] (:locals m)))))))
+
+(let [c1 (com.stuartsierra.lazytest.contexts/context [] 1)
+      c2 (com.stuartsierra.lazytest.contexts/context [] 2)
+      g (group [x c1 y c2] [(= 1 x) "foo" (= y 2)] [])]
+  (assert (group? g))
+  (assert (= [c1 c2] (:contexts g)))
+  (let [exs (:examples g)]
+    (assert (vector? exs))
+    (assert (= 2 (count exs)))
+    (assert (every? fn? exs))
+    (let [[ex1 ex2] exs]
+      (assert (true? (ex1 1 2)))
+      (assert (true? (ex2 1 2)))
+      (let [m (meta ex1)]
+        (assert (nil? (:doc m)))
+        (assert (= *ns* (:ns m)))
+        (assert (string? (:file m)))
+        (assert (integer? (:line m)))
+        (assert (nil? (:name m)))
+        (assert (= '[x y] (:locals m))))
+      (let [m (meta ex2)]
+        (assert (= "foo" (:doc m)))
+        (assert (= *ns* (:ns m)))
+        (assert (string? (:file m)))
+        (assert (integer? (:line m)))
+        (assert (nil? (:name m)))
+        (assert (= '[x y] (:locals m)))))))


Clojure 1.2.1 wants this explicitly imported.

--- integration-tests/apps/ring/basic-ring/src/basic_ring/core.clj
+++ integration-tests/apps/ring/basic-ring/src/basic_ring/core.clj
@@ -4,7 +4,8 @@
             [immutant.web.session    :as isession]
             [immutant.repl           :as repl]
             [ring.middleware.session :as rsession]
-            [clojure.java.io         :as io]))
+            [clojure.java.io         :as io])
+  (:import SomeClass))

 (def a-value (atom "default"))


fix silly typo

fix silly typo

--- src/main/clojure/org/dada/core.clj
+++ src/main/clojure/org/dada/core.clj
@@ -93,7 +93,7 @@
 (defn #^Collection collection [& args]
   (let [size (count args)
 	array-list (ArrayList. #^Integer size)]
-    (if (> 0 size) (.addAll array-list args))
+    (if (> size 0) (.addAll array-list args))
     array-list))

 (def #^ClassFactory *class-factory* (new ClassFactory))


fix for board name

fix for board name

--- src/oc/storage/resources/board.clj
+++ src/oc/storage/resources/board.clj
@@ -107,7 +107,7 @@
         clean
         (assoc :uuid (db-common/unique-id))
         (assoc :slug slug)
-        (assoc :name #(str/strip-tags % ["script"]))
+        (update :name #(str/strip-tags % ["script"]))
         (assoc :org-uuid org-uuid)
         (update :access #(or % default-access))
         (assoc :authors [(:user-id user)])


Performance improvements in the parallel fetcher

--- src/org/spootnik/cyanite/store.clj
+++ src/org/spootnik/cyanite/store.clj
@@ -170,7 +170,7 @@
                             (map detect-aggregate)
                             (seq)))
                     paths))]
-    (seq (remove nil? (reduce into (map deref futures))))))
+    (seq (into [] (r/remove nil? (r/reduce into [] (map deref futures)))))))

 (defn cassandra-metric-store
   "Connect to cassandra and start a path fetching thread.


Working on problem 0101...

Working on problem 0101...

--- src/project_euler/problem_0101.clj
+++ src/project_euler/problem_0101.clj
@@ -65,3 +65,13 @@
                       (map #(* y %) (lagrange-basis xs j))))
        (reduce #(map + %1 %2))
        ))
+
+(defn poly-eval [ks x]
+  (loop [[k & ks] ks
+         xn       1
+         y        0]
+    (if ks
+      (let [xn' (* xn x)]
+        (recur ks xn' (+ y (* k xn))))
+      y
+      )))


update workshop info, add :soldout flag to hide buy button

--- src/thi/ng/site/workshop/core.cljs
+++ src/thi/ng/site/workshop/core.cljs
@@ -17,6 +17,7 @@
     :capacity 8
     :id       "WS-LDN-2"
     :price    "£575.00 (+ 20% VAT in UK only)"
+    :soldout  true
     :topics   ["Advanced Clojure / Clojurescript concepts" "Macros" "DSL" "Channel based concurrency (CSP)" "Graphs" "Linked Data basics & queries" "Async server setup & components" "Interactive visualization" "Live coding" "SPA w/ Reactive UIs (using Reagent)" "SVG" "WebGL toolchain" "Realtime animation"]
     :shopify  {:store    "thi-ng-store.myshopify.com"
                :product  "Data visualization with Clojure, Clojurescript & thi.ng (Level 2)"
@@ -71,7 +72,8 @@
                 {:width "100%" :height "450" :scrolling "no" :frameBorder "no"
                  :src "https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/playlists/159061174&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true"}]]
     :desc     [:div
-               "This workshop is NOT related to Clojure and instead will introduce you to the exciting world of programming embedded devices outside the world of Arduino, working 'bare-metal' with the powerful ARM Cortex processor family, which too is used in many smart phones. We will use the STM32F401 discovery board (included in workshop fee) featuring an 84MHz 32bit CPU w/ FPU, 256KB ROM, 64KB RAM, 2x USB, 3-axis accelerometer & gyroscope, 44.1kHz audio codec & microphone, and learn how to implement our own polyphonic & stereo MIDI synthesizer and sequencer, which you can take home later."
+               "This workshop is NOT related to Clojure and instead will introduce you to the exciting world of programming embedded devices outside the world of Arduino, working 'bare-metal' with the much more powerful ARM Cortex processor family, which too is used in many smart phones and other embedded & wearable devices."
+               [:p " We will use the low-cost STM32F401 discovery board (included in workshop fee) featuring an 84MHz 32bit CPU w/ FPU, 256KB ROM, 64KB RAM, 2x USB, 3-axis accelerometer & gyroscope, 44.1kHz audio codec & microphone, and learn how to implement our own polyphonic & stereo MIDI synthesizer and sequencer, which you can take home later. This is not just going to be a lo-fi noise box!"]
                [:p "Commented source code scaffolding will be provided to maximize time for experimentation."]
                [:h3 "Scheduled topics"]
                [:ul
@@ -79,23 +81,22 @@
                 [:li "Open source toolchain setup (Eclipse, GCC, OpenOCD, ST-Link)"]
                 [:li "Overview/review of important C language concepts"]
                 [:li "Basic examples (clock config, timers, GPIO, 8x LED, gyroscope)"]
-                [:li "Multitasking using interrupts"]
+                [:li "Overview of multi-tasking via interrupts"]
                 [:li "Digital audio introduction, theory & experimentation"]
                 [:li "Intro to USB device classes & file systems (play/record WAV files)"]
                 [:li "Synthesizer DSP graph overview, audio/music theory, experimentation"]
-                [:li "Introduction to MIDI & integrating with synthesizer"]
-                [:li "Generative music composition techniques"]
+                [:li "Introduction to MIDI & integrating with synthesizer / sequencer"]
+                [:li "Generative music composition techniques (scales, cellular automata etc.)"]
                 [:li "Project development / making music"]]
                [:h3 "Requirements"]
-               [:p "This workshop is going to be fast paced, but intended for beginners to embedded development. Previous programming experience in Arduino/C or Processing/Java/Python etc. is desired."]
+               [:p "This workshop is going to be fast paced, but intended for beginners to embedded development. Previous programming experience in Arduino/C/C++ or Processing/Java/Python etc. is desired."]
                [:p "All participants need to bring the following items:"]
                [:ul
                 [:li "OSX / Linux / Windows7+ laptop"]
                 [:li "Headphones"]
                 [:li "USB Memory stick (MS-DOS formatted)"]
                 [:li "USB OTG cable"]
-                [:li "USB MIDI controller if you have one (e.g. Korg NanoKey / NanoKontrol2)"]]
-               ]}])
+                [:li "USB MIDI controller if you have one (e.g. Korg NanoKey / NanoKontrol2)"]]]}])

 (def prev-workshops
   [{:title    "Data visualization with Clojure(script) & thi.ng (Level 1)"
@@ -144,13 +145,14 @@
         [:tr [:th "Capacity:"] [:td (:capacity ws) " participants"]]
         [:tr [:th "\u00a0"] [:td]]
         [:tr [:th "Price:"] [:td [:strong (:price ws)]]]
-        (when-let [disc (-> ws :shopify :discount)]
-          [:tr
-           [:th "Discount:"]
-           [:td.discount
-            (:percent disc) " off for first " (:num disc) " participants"
-            [:br] "Checkout code: " [:strong (:id disc)]]])
-        [:tr [:th] [:td [shopify-button (:shopify ws)]]]]]
+        (when-not (:soldout ws)
+          (when-let [disc (-> ws :shopify :discount)]
+            [:tr
+             [:th "Discount:"]
+             [:td.discount
+              (:percent disc) " off for first " (:num disc) " participants"
+              [:br] "Checkout code: " [:strong (:id disc)]]]))
+        [:tr [:th] [:td (if (:soldout ws) [:strong "SOLD OUT"] [shopify-button (:shopify ws)])]]]]
       (:extras ws)]
      [:div.col2 (:desc ws)]]
     [:div.space]]


Db checking uses assert, so ensure *assert* is true

It seems that this has become false by default, or something to do
with the config changing, which broke tests

--- src/braid/core/server/db.clj
+++ src/braid/core/server/db.clj
@@ -25,7 +25,10 @@
   (d/connect db-url))

 (defstate conn
-  :start (connect config))
+  :start (do
+           ;; txn checking uses assert, so we want to make sure they run
+           (set! *assert* true)
+           (connect config)))

 (defn db [] (d/db conn))


removed packing of vector of modis values - DataChunk* will create appropriate data structure

--- src/clj/forma/source/hdf.clj
+++ src/clj/forma/source/hdf.clj
@@ -258,5 +258,4 @@
         (meta-values [keys] ?freetile :> ?productname ?tileid ?date)
         (split-id ?tileid :> ?mod-h ?mod-v)
         ((c/juxt #'spatial-res #'temporal-res) ?productname :> ?s-res ?t-res)
-        (thrift/pack ?chunk :> ?array)
-        (chunkifier ?dataset ?date ?s-res ?t-res ?mod-h ?mod-v ?chunkid ?array :> ?datachunk))))
+        (chunkifier ?dataset ?date ?s-res ?t-res ?mod-h ?mod-v ?chunkid ?chunk :> ?datachunk))))


Not sure how this got here...

Not sure how this got here...

--- src/clj/load_test_om/dev.clj
+++ src/clj/load_test_om/dev.clj
@@ -1,23 +0,0 @@
-(ns load-test-om.dev
-  (:require [environ.core :refer [env]]
-            [net.cgrand.enlive-html :refer [set-attr prepend append html]]
-            [cemerick.piggieback :as piggieback]
-            [weasel.repl.websocket :as weasel]
-            [leiningen.core.main :as lein]))
-
-(def is-dev? (env :is-dev))
-
-(def inject-devmode-html
-  (comp
-     (set-attr :class "is-dev")
-     (prepend (html [:script {:type "text/javascript" :src "/js/out/goog/base.js"}]))
-     (prepend (html [:script {:type "text/javascript" :src "/react/react.js"}]))
-     (append  (html [:script {:type "text/javascript"} "goog.require('load_test_om.dev')"]))))
-
-(defn browser-repl []
-  (piggieback/cljs-repl :repl-env (weasel/repl-env :ip "0.0.0.0" :port 9001)))
-
-(defn start-figwheel []
-  (future
-    (print "Starting figwheel.\n")
-    (lein/-main ["figwheel"])))


Changed id

Changed id

--- src/clj/skidskytte/views.clj
+++ src/clj/skidskytte/views.clj
@@ -36,7 +36,7 @@
      [:div.inner
       [:h1 "Skidskytteroulette"]
       [:p "Om du gillar skidskytte och nordisk kombination så kanske du också gillar"]
-      [:turbo-frame#sport
+      [:turbo-frame#the-sport
        [:p.sport [:span sport]]]
       [:p.something-else "Nja, det låter trist, jag vill pröva "
        [:span#link [:a {:href "/"} "något annat"]]]]]]))


Added vec2 constructor

Added vec2 constructor

--- src/cljs/cloj/math/vec2.cljs
+++ src/cljs/cloj/math/vec2.cljs
@@ -7,3 +7,4 @@
 (mk-vec-op div / :x :y)

 (defn v2 [x y] {:x x :y y})
+(defn vec2 [x y] {:x x :y y})


Added async implementation

Added async implementation

--- src/clojure/cljflow/core.clj
+++ src/clojure/cljflow/core.clj
@@ -1,28 +1,68 @@
 (ns cljflow.core
   (:require [cljflow.implementations :as implementations])
   (:import [com.amazonaws ClientConfiguration]
-           [cljflow.helloworld GreeterActivities GreeterActivitiesClientImpl GreeterWorkflowClientExternalFactoryImpl]
+           [cljflow.helloworld GreeterWorkflow GreeterActivities GreeterActivitiesClientImpl GreeterWorkflowClientExternalFactoryImpl]
            [com.amazonaws.services.simpleworkflow AmazonSimpleWorkflowClient]
-           [com.amazonaws.services.simpleworkflow.flow ActivityWorker WorkflowWorker])
+           [com.amazonaws.services.simpleworkflow.flow ActivityWorker WorkflowWorker DecisionContextProviderImpl]
+           [com.amazonaws.services.simpleworkflow.flow.core Functor Promise Task])
   (:gen-class))

 (def endpoint "https://swf.us-east-1.amazonaws.com")
 (def socket-timeout (* 70 1000))
 (def domain "helloWorldWalkthrough")

+(defn get-clock []
+  (-> (DecisionContextProviderImpl.)
+      .getDecisionContext
+      .getWorkflowClock))
+
+(defn promise-value [^Promise p]
+  (when p (.get p)))
+
+(defn create-task
+  "Takes a function and any number of promises and returns an AWS Flow async Task
+   that calls that function with the value of the promises once they complete."
+  [f & promises]
+  (let [promises (into-array Promise promises)]
+    (proxy [Task] [promises]
+      (doExecute []
+        (apply f (map promise-value promises))))))
+
+(defn create-functor
+  "Takes a function and any number of promises and returns an AWS Flow Async Functor
+   that calls that function with the value of the promises once they complete."
+  [f & promises]
+  (let [promises (into-array Promise promises)]
+    (proxy [Functor] [promises]
+      (doExecute []
+        (apply f (map promise-value promises))))))
+
+(defn get-greeting [name]
+  (str "Hello " name "!"))
+
 (defn greeter-activities-impl []
   (reify GreeterActivities
     (getName [this] "World")
-    (getGreeting [this name] (str "Hello " name "!"))
+    (getGreeting [this name] (get-greeting name))
     (say [this what] (println what))))

+; Simple, synchronous hello world workflow implementation
 (deftype GreeterWorkflowImpl []
-  cljflow.helloworld.GreeterWorkflow
+  GreeterWorkflow
   (greet [this]
     (let [activities-client (GreeterActivitiesClientImpl.)
           name (.getName activities-client)
           greeting (.getGreeting activities-client name)]
       (.say activities-client greeting))))
+
+; Asynchronous hello world workflow implementation
+(deftype GreeterWorkflowAsyncImpl []
+  GreeterWorkflow
+  (greet [this]
+    (let [activities-client (GreeterActivitiesClientImpl.)]
+      (->> (.getName activities-client)
+           (create-functor #(.getGreeting activities-client %))
+           (create-task #(.say activities-client %))))))

 (defn greeter-main []
   (let [config (doto (ClientConfiguration.) (.withSocketTimeout socket-timeout))
@@ -40,7 +80,7 @@
       (.addActivitiesImplementation (greeter-activities-impl))
       (.start))
     (doto (WorkflowWorker. service domain taskListToPoll)
-      (.addWorkflowImplementationType GreeterWorkflowImpl)
+      (.addWorkflowImplementationType GreeterWorkflowAsyncImpl)
       (.start))))

 (defn -main


Log the cache specs, too

Log the cache specs, too

--- modules/cache/src/main/clojure/immutant/cache/core.clj
+++ modules/cache/src/main/clojure/immutant/cache/core.clj
@@ -101,12 +101,14 @@
 (defn configure-cache
   "Defaults to :distributed with :sync=true for a clustered cache, otherwise :local"
   [name opts]
-  (log/info "Configuring cache" name)
-  (.defineConfiguration @manager name (build-config (merge {:mode (default-mode), :sync true} opts)))
-  (when-let [cache (get-cache name)]
-    (.stop cache)
-    (.start cache))
-  (.getCache @manager name))
+  (let [config (merge {:mode (default-mode), :sync true} opts)]
+    (log/info "Configuring cache" name "as"
+              (select-keys config [:mode :sync :locking :persist :max-entries :eviction]))
+    (.defineConfiguration @manager name (build-config config))
+    (when-let [cache (get-cache name)]
+      (.stop cache)
+      (.start cache))
+    (.getCache @manager name)))

 (defn lifespan-params [{:keys [ttl idle units] :or {ttl -1 idle -1 units :seconds}}]
   (let [u (.toUpperCase (name units))


:formula-in-progress is no longer used

:formula-in-progress is no longer used

--- src/midje/ideas/formulas.clj
+++ src/midje/ideas/formulas.clj
@@ -11,8 +11,7 @@
   (:require [midje.emission.boundaries :as emission-boundary]
             [midje.emission.api :as emit]
             [midje.emission.state :as state]
-            [midje.emission.plugins.silence :as emission-silence]
-            [midje.clojure-test-facade :as ctf]))
+            [midje.emission.plugins.silence :as emission-silence]))

 ;; Formulas work by running up to *num-trials* trials per formula.
 (def ^{:doc "The number of trials generated per formula."
@@ -27,9 +26,7 @@

 (defn- formula-fact [docstring body]
-  `(ctf/ignoring-counter-changes
-    (midje.sweet/fact ~docstring
-                      ~@body :formula :formula-in-progress)))
+  `(midje.sweet/fact ~docstring ~@body))

 (defn- deconstruct-formula-args [args]
   (let [[docstring? more-args] (pop-docstring args)


Also prefix the name of join sources inside prefixed properties

--- src/main/workflo/macros/query.cljc
+++ src/main/workflo/macros/query.cljc
@@ -91,13 +91,19 @@

 (defmethod parse-subquery :prefixed-properties
   [[_ {:keys [base children]}]]
-  (letfn [(prefix-name [x]
-            (let [prefixed-name (symbol (str base) (str (:name x)))]
-              (assoc x :name prefixed-name)))]
+  (letfn [(prefixed-name [sym]
+            (symbol (str base) (str sym)))
+          (prefix-name [x]
+            (update x :name prefixed-name))
+          (prefix-join-source-name [x]
+            (cond-> x
+              (:join-source x)
+              (update-in [:join-source :name] prefixed-name)))]
     (->> children
          (map parse-subquery)
          (apply concat)
          (map prefix-name)
+         (map prefix-join-source-name)
          (into []))))

 (defmethod parse-subquery :parameterization


Fixed function that did not return boolean even though it should have by naming convention.

--- src/clj_formal_specifications_app/examples.clj
+++ src/clj_formal_specifications_app/examples.clj
@@ -10,7 +10,8 @@

 (defn example-entry?
   [entry]
-  (re-matches (re-pattern (str example-dir ".*.clj")) (.getName entry)))
+  (boolean (re-matches (re-pattern (str example-dir ".*.clj"))
+                       (.getName entry))))

 ; Getting a list of files named public/examples/something.clj is quite a task.


Updated logging.

Updated logging.

--- src/cmr/exchange/common/components/logging.clj
+++ src/cmr/exchange/common/components/logging.clj
@@ -17,7 +17,7 @@
   (let [log-level (config/log-level this)
         log-nss (config/log-nss this)]
     (log/debug "Setting up logging with level" log-level)
-    (log/warn "Log config:" (get-in this [:config :data :logging]))
+    (log/trace "Log config:" (get-in this [:config :data :logging]))
     (log/debug "Logging namespaces:" log-nss)
     (if (true? (config/log-color? this))
       (do


exceptions will return wrapped 500 internal server error

--- server/src/server/routes/app.clj
+++ server/src/server/routes/app.clj
@@ -1,5 +1,6 @@
 (ns server.routes.app
   (:require
+    [clojure.stacktrace :as st]
     [taoensso.timbre :as timbre]
     [ring.middleware.cors :refer :all]
     [ring.middleware.params :refer :all]
@@ -49,6 +50,14 @@
         (debug response)
         response))))

+(defn wrap-exception [f]
+  (fn [request]
+    (try (f request)
+      (catch Exception e
+        (let [stacktrace (with-out-str (st/print-stack-trace e))]
+          {:status 500
+           :body stacktrace})))))
+
 (defn app-fn [component]
   (-> (routes (db-routes-fn component)
               (csv-routes-fn component)
@@ -61,6 +70,7 @@
       (wrap-json-response {:pretty true})
       ;; (wrap-cors :access-control-allow-origin [#"http://127.0.0.1:9000" #"http://localhost:9000"]
       ;;            :access-control-allow-methods [:get :put :post :delete :options])
+      wrap-exception
       allow-content-type
       allow-origin
       wrap-dir-index


cmdhistory: Use util.edn/read-vector in get-history (Fix Issue 576)

--- ccw.core/src/clj/ccw/repl/cmdhistory.clj
+++ ccw.core/src/clj/ccw/repl/cmdhistory.clj
@@ -1,5 +1,6 @@
 (ns ccw.repl.cmdhistory
   (:use [clojure.core.incubator :only [-?>]])
+  (:require [ccw.util.edn :refer [read-vector]])
   (:import
     ccw.CCWPlugin
     org.eclipse.core.runtime.jobs.Job
@@ -32,7 +33,7 @@
     ccw.launching.LaunchUtils/getProject
     org.eclipse.core.resources.ProjectScope.
     (.getNode pref-node-id)
-    (doto .sync)))
+    (doto .sync)))

 (defn- queue-expression
   [project-name expr]
@@ -58,7 +59,7 @@
     (if pref-node
       [(into (or (-?> pref-node
                    (.get history-key "[]")
-                   read-string)
+                   read-vector)
                [])
          (@queued-commands project-name))
        (partial queue-expression project-name)]
@@ -115,4 +116,4 @@
 (defn- schedule-job
   []
   (when (== Job/NONE (.getState save-cmds-job))
-    (.schedule save-cmds-job)))+    (.schedule save-cmds-job)))


Add tune-up

Add tune-up

--- src/obb_demo/views/play.cljs
+++ src/obb_demo/views/play.cljs
@@ -5,6 +5,12 @@
             [obb-rules.turn :as turn]
             [obb-rules.result :as result]
             [obb-demo.boardground :as boardground]))
+
+(defn- tune-up
+  "Prepare the game before deploying"
+  [game]
+  #_(assoc-in game [:stash :p1] (dissoc (get-in game [:stash :p1]) :crusader))
+  game)

 (defn- deployed-game
   "Creates a deployed game"
@@ -18,6 +24,7 @@
                     :fenix 25
                     :crusader 25)
       (game/create)
+      (tune-up)
       (turn/process-actions :p1 [[:auto-deploy :firingsquad]])
       (result/result-board)
       (turn/process-actions :p2 [[:auto-deploy :firingsquad]])


Make pub opening lazy

Make pub opening lazy

--- src/onyx/messaging/aeron.clj
+++ src/onyx/messaging/aeron.clj
@@ -160,10 +160,7 @@
    :aeron/external-addr (:external-addr messenger)})

 (def send-stream-id 1)
-(def acker-stream-id 2)
-(def completion-stream-id 3)
-(def retry-stream-id 4)
-(def aux-stream-id 5)
+(def aux-stream-id 2)

 (defn aeron-channel [addr port]
   (format "udp://%s:%s" addr port))
@@ -200,11 +197,13 @@
   (let [ctx (.errorHandler (Aeron$Context.) no-op-error-handler)
         aeron (Aeron/connect ctx)
         channel (aeron-channel external-addr port)
-        send-pub (.addPublication aeron channel send-stream-id)
-        aux-pub (.addPublication aeron channel aux-stream-id)]
+        f-send-pub #(.addPublication aeron channel send-stream-id)
+        f-aux-pub #(.addPublication aeron channel aux-stream-id)]
     {:conn aeron
-     :send-pub send-pub
-     :aux-pub aux-pub}))
+     :send-pub {:f-create f-send-pub
+                :pub (atom nil)}
+     :aux-pub {:f-create f-aux-pub
+               :pub (atom nil)}}))

 (defmethod extensions/receive-messages AeronConnection
   [messenger {:keys [onyx.core/task-map] :as event}]
@@ -218,10 +217,15 @@
           segments)
         segments))))

+(defn get-peer-link-pub [peer-link k]
+  (if-let [pub @(get-in peer-link [k :pub])]
+    pub
+    (reset! (get-in peer-link [k :pub]) ((get-in peer-link [k :f-create])))))
+
 (defmethod extensions/send-messages AeronConnection
   [messenger event peer-link batch]
   (let [[len unsafe-buffer] (protocol/build-messages-msg-buf (:compress-f messenger) batch)
-        pub ^uk.co.real_logic.aeron.Publication (:send-pub peer-link)
+        pub ^uk.co.real_logic.aeron.Publication (get-peer-link-pub peer-link :send-pub)
         offer-f (fn [] (.offer pub unsafe-buffer 0 len))]
     (while (not (offer-f))
       (.idle ^IdleStrategy (:send-idle-strategy messenger) 0))))
@@ -229,7 +233,7 @@
 (defmethod extensions/internal-ack-message AeronConnection
   [messenger event peer-link message-id completion-id ack-val]
   (let [unsafe-buffer (protocol/build-acker-message message-id completion-id ack-val)
-        pub ^uk.co.real_logic.aeron.Publication (:aux-pub peer-link)
+        pub ^uk.co.real_logic.aeron.Publication (get-peer-link-pub peer-link :aux-pub)
         offer-f (fn [] (.offer pub unsafe-buffer 0 protocol/ack-msg-length))]
     (while (not (offer-f))
       (.idle ^IdleStrategy (:send-idle-strategy messenger) 0))))
@@ -237,7 +241,7 @@
 (defmethod extensions/internal-complete-message AeronConnection
   [messenger event id peer-link]
   (let [unsafe-buffer (protocol/build-completion-msg-buf id)
-        pub ^uk.co.real_logic.aeron.Publication (:aux-pub peer-link)
+        pub ^uk.co.real_logic.aeron.Publication (get-peer-link-pub peer-link :aux-pub)
         offer-f (fn [] (.offer pub unsafe-buffer 0 protocol/completion-msg-length))]
     (while (not (offer-f))
       (.idle ^IdleStrategy (:send-idle-strategy messenger) 0))))
@@ -245,14 +249,16 @@
 (defmethod extensions/internal-retry-message AeronConnection
   [messenger event id peer-link]
   (let [unsafe-buffer (protocol/build-retry-msg-buf id)
-        pub ^uk.co.real_logic.aeron.Publication (:aux-pub peer-link)
+        pub ^uk.co.real_logic.aeron.Publication (get-peer-link-pub peer-link :aux-pub)
         offer-f (fn [] (.offer pub unsafe-buffer 0 protocol/retry-msg-length))]
     (while (not (offer-f))
       (.idle ^IdleStrategy (:send-idle-strategy messenger) 0))))

 (defmethod extensions/close-peer-connection AeronConnection
   [messenger event peer-link]
-  (.close (:send-pub peer-link))
-  (.close (:aux-pub peer-link))
+  (when-let [pub @(get-in peer-link [:send-pub :pub])]
+    (.close pub))
+  (when-let [pub @(get-in peer-link [:send-pub :aux-pub])]
+    (.close pub))
   (.close (:conn peer-link))
   {})


Make sure the headline key is present in the entry map when creating a new one, avoid overriding it.

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -100,6 +100,8 @@
           author (lib-schema/author-for-user user)]
       (-> entry-props
           keywordize-keys
+          ;; Make sure the headline key is present
+          (update :headline #(or % ""))
           clean
           clean-input
           (assoc :uuid (db-common/unique-id))