Do not return existing-entry to avoid Liberator sum the value of the internal keys on the next handler.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -109,7 +109,7 @@
             _seq? (seq? share-props)
             share-requests (map #(assoc % :shared-at ts) share-props)]
     (if (every? #(lib-schema/valid? common-res/ShareRequest %) share-requests)
-        {:existing-entry existing-entry :share-requests share-requests}
+        {:share-requests share-requests}
         [false, {:share-requests share-requests}]) ; invalid share request

     true)) ; no existing entry, so this will fail existence check later


Include comments and reactions in secure UUID story retrieval for board author/viewers.

--- src/oc/storage/api/stories.clj
+++ src/oc/storage/api/stories.clj
@@ -484,16 +484,26 @@
                                          (story-res/get-story-by-secure conn org-uuid secure-uuid))
                                board (board-res/get-board conn (:board-uuid story))
                                access-level (or (:access-level (access/access-level-for org board (:user ctx))) :public)
+                               reactions? (or (= :author access-level) (= :viewer access-level))
+                               comments (if reactions?
+                                          (or (:existing-comments ctx)
+                                              (story-res/list-comments-for-story conn (:uuid story)))
+                                          [])
+                               reactions (if reactions?
+                                          (or (:existing-reactions ctx)
+                                              (story-res/list-reactions-for-story conn (:uuid story)))
+                                          [])
                                _matches? (= org-uuid (:org-uuid board))] ; sanity check
-                        {:existing-org org :existing-board board :existing-story story :access-level access-level}
+                        {:existing-org org :existing-board board :existing-story story
+                         :existing-comments comments :existing-reactions reactions :access-level access-level}
                         false))

   ;; Responses
   :handle-ok (fn [ctx] (story-rep/render-story (:existing-org ctx)
                                                (:existing-board ctx)
                                                (:existing-story ctx)
-                                               [] ; no comments
-                                               [] ; no reactions
+                                               (:existing-comments ctx)
+                                               (:existing-reactions ctx)
                                                (:access-level ctx)
                                                :secure)))


Add the sharer avatar to the share request.

--- src/oc/storage/async/email.clj
+++ src/oc/storage/async/email.clj
@@ -13,6 +13,7 @@
    :note (schema/maybe schema/Str)
    :reply-to (schema/maybe schema/Str)
    :sharer-name (schema/maybe schema/Str)
+   :sharer-avatar-url (schema/maybe schema/Str)
    :org-slug lib-schema/NonBlankStr
    :org-name (schema/maybe schema/Str)
    :org-logo-url (schema/maybe schema/Str)
@@ -33,6 +34,7 @@
    :note (:note share-request)
    :reply-to (:email user)
    :sharer-name (:name user)
+   :sharer-avatar-url (:avatar-url user)
    :org-slug (:slug org)
    :org-name (:name org)
    :org-logo-url (:logo-url org)


Play all the opening melody (sorta).

Play all the opening melody (sorta).

--- src/overtunes/songs/at_all.clj
+++ src/overtunes/songs/at_all.clj
@@ -54,9 +54,12 @@
       (even-melody# (from timing 1) notes))))

 (defn play []
-  (let [timing (from (bpm 120) 4)]
-    (even-melody# timing (take 64 (cycle [9 7])))
+  (let [timing (from (bpm 120) 2)]
+    (even-melody# timing (take 32 (cycle [9 7])))
     (rythm-n-bass# timing (take 16 (cycle progression)))
-    (even-melody# (speed-up (from timing 63) 2) [4 7 9 7 7 4 7])))
+    (even-melody# (speed-up (from timing 31) 2) [4 7 9 7 7 4 7])
+    (even-melody# (speed-up (from timing 39) 2) [7 2 4 2 2 7 2])
+    (even-melody# (speed-up (from timing 47) 2) [7 2 4 2 2 7 2 4 5 7])
+    (even-melody# (speed-up (from timing 55) 2) [7 2 4 2 2 7 2 4 2 11])))

 (play)


Fix #65 Check ClojureScript versions

Fix #65 Check ClojureScript versions

If a version mismatch is detected a warning will be
displayed when connecting.

--- Clojure/src/ambly/repl/jsc.clj
+++ Clojure/src/ambly/repl/jsc.clj
@@ -254,59 +254,68 @@
           core (io/resource "cljs/core.cljs")]
       ((println-fn opts) "\nConnecting to" (bonjour-name->display-name bonjour-name) "...\n")
       (set-up-socket repl-env opts endpoint-address (dec endpoint-port))
-      (when (= "true" (:value (jsc-eval repl-env "typeof cljs === 'undefined'")))
-        ;; compile cljs.core & its dependencies, goog/base.js must be available
-        ;; for bootstrap to load, use new closure/compile as it can handle
-        ;; resources in JARs
-        (let [core-js (closure/compile core
-                        (assoc opts
-                          :output-dir webdav-mount-point
-                          :output-file
-                          (closure/src-file->target-file core)))
-              deps (closure/add-dependencies opts core-js)]
-          ;; output unoptimized code and the deps file
-          ;; for all compiled namespaces
-          (apply closure/output-unoptimized
-            (assoc opts
-              :output-dir webdav-mount-point
-              :output-to (.getPath (io/file output-dir "ambly_repl_deps.js")))
-            deps))
-        ;; Set up CLOSURE_IMPORT_SCRIPT function, injecting path
-        (jsc-eval repl-env
-          (str "CLOSURE_IMPORT_SCRIPT = function(src) {"
-            (form-ambly-import-script-expr-js
-              (str "'goog" File/separator "' + src"))
-            "return true; };"))
-        ;; bootstrap
-        (jsc-eval repl-env
-          (form-ambly-import-script-path-js (io/file "goog" "base.js")))
-        ;; load the deps file so we can goog.require cljs.core etc.
-        (jsc-eval repl-env
-          (form-ambly-import-script-path-js (io/file "ambly_repl_deps.js")))
-        ;; monkey-patch isProvided_ to avoid useless warnings - David
-        (jsc-eval repl-env
-          (str "goog.isProvided_ = function(x) { return false; };"))
-        ;; monkey-patch goog.require, skip all the loaded checks
-        (repl/evaluate-form repl-env env "<cljs repl>"
-          '(set! (.-require js/goog)
-             (fn [name]
-               (js/CLOSURE_IMPORT_SCRIPT
-                 (aget (.. js/goog -dependencies_ -nameToPath) name)))))
-        ;; load cljs.core, setup printing
-        (repl/evaluate-form repl-env env "<cljs repl>"
-          '(do
-             (.require js/goog "cljs.core")
-             (set-print-fn! js/AMBLY_PRINT_FN)))
-        ;; redef goog.require to track loaded libs
-        (repl/evaluate-form repl-env env "<cljs repl>"
-          '(do
-             (set! *loaded-libs* #{"cljs.core"})
-             (set! (.-require js/goog)
-               (fn [name reload]
-                 (when (or (not (contains? *loaded-libs* name)) reload)
-                   (set! *loaded-libs* (conj (or *loaded-libs* #{}) name))
-                   (js/CLOSURE_IMPORT_SCRIPT
-                     (aget (.. js/goog -dependencies_ -nameToPath) name))))))))
+      (if (= "true" (:value (jsc-eval repl-env "typeof cljs === 'undefined'")))
+        (do
+          ;; compile cljs.core & its dependencies, goog/base.js must be available
+          ;; for bootstrap to load, use new closure/compile as it can handle
+          ;; resources in JARs
+          (let [core-js (closure/compile core
+                          (assoc opts
+                            :output-dir webdav-mount-point
+                            :output-file
+                            (closure/src-file->target-file core)))
+                deps (closure/add-dependencies opts core-js)]
+            ;; output unoptimized code and the deps file
+            ;; for all compiled namespaces
+            (apply closure/output-unoptimized
+              (assoc opts
+                :output-dir webdav-mount-point
+                :output-to (.getPath (io/file output-dir "ambly_repl_deps.js")))
+              deps))
+          ;; Set up CLOSURE_IMPORT_SCRIPT function, injecting path
+          (jsc-eval repl-env
+            (str "CLOSURE_IMPORT_SCRIPT = function(src) {"
+              (form-ambly-import-script-expr-js
+                (str "'goog" File/separator "' + src"))
+              "return true; };"))
+          ;; bootstrap
+          (jsc-eval repl-env
+            (form-ambly-import-script-path-js (io/file "goog" "base.js")))
+          ;; load the deps file so we can goog.require cljs.core etc.
+          (jsc-eval repl-env
+            (form-ambly-import-script-path-js (io/file "ambly_repl_deps.js")))
+          ;; monkey-patch isProvided_ to avoid useless warnings - David
+          (jsc-eval repl-env
+            (str "goog.isProvided_ = function(x) { return false; };"))
+          ;; monkey-patch goog.require, skip all the loaded checks
+          (repl/evaluate-form repl-env env "<cljs repl>"
+            '(set! (.-require js/goog)
+               (fn [name]
+                 (js/CLOSURE_IMPORT_SCRIPT
+                   (aget (.. js/goog -dependencies_ -nameToPath) name)))))
+          ;; load cljs.core, setup printing
+          (repl/evaluate-form repl-env env "<cljs repl>"
+            '(do
+               (.require js/goog "cljs.core")
+               (set-print-fn! js/AMBLY_PRINT_FN)))
+          ;; redef goog.require to track loaded libs
+          (repl/evaluate-form repl-env env "<cljs repl>"
+            '(do
+               (set! *loaded-libs* #{"cljs.core"})
+               (set! (.-require js/goog)
+                 (fn [name reload]
+                   (when (or (not (contains? *loaded-libs* name)) reload)
+                     (set! *loaded-libs* (conj (or *loaded-libs* #{}) name))
+                     (js/CLOSURE_IMPORT_SCRIPT
+                       (aget (.. js/goog -dependencies_ -nameToPath) name))))))))
+        (let [expected-clojurescript-version (cljs.util/clojurescript-version)
+              actual-clojurescript-version (:value (jsc-eval repl-env "cljs.core._STAR_clojurescript_version_STAR_"))]
+          (when-not (= expected-clojurescript-version actual-clojurescript-version)
+            ((println-fn opts)
+              (str "WARNING: " (bonjour-name->display-name bonjour-name)
+                "\n         is running ClojureScript " actual-clojurescript-version
+                ", while the Ambly REPL is\n         set up to use ClojureScript "
+                expected-clojurescript-version ".\n")))))
       {:merge-opts {:output-dir webdav-mount-point}})
     (catch Throwable t
       (tear-down repl-env)


(maint) Remove suffix check in dlo/metrics-for-dir

Remove a redundant check for a ".json" suffix on the filename from
`puppetdb.command.dlo/metrics-for-dir`, since the metadata parser also
performs this check, and can handle random strings that aren't the form
it expects, so there's no need to do this pre-screening.

--- src/puppetlabs/puppetdb/command/dlo.clj
+++ src/puppetlabs/puppetdb/command/dlo.clj
@@ -61,8 +61,7 @@
               ;; Assume the trailing .json here and in
               ;; entry-cmd-data-filename below.
               (let [name (-> p .getFileName str)]
-                (if-let [cmd (:command (and (.endsWith name ".json")
-                                            (parse-cmd-filename name)))]
+                (if-let [cmd (:command (parse-cmd-filename name))]
                   (update-metrics (ensure-cmd-metrics metrics registry cmd)
                                   cmd
                                   (Files/size p))


Some more reflection avoiding; not affecting performance much, but what the hey

--- src/polismath/named_matrix.clj
+++ src/polismath/named_matrix.clj
@@ -61,6 +61,7 @@
   (rownames [this] "Vector of row names, in order")
   (colnames [this] "Vector of column names, in order")
   (get-matrix [this] "Extract the matrix object")
+  (get-row-index [this] "Extract the row-index object")
   (rowname-subset [this names] "Get a new PNamedMatrix subsetting to just the given rownames"))

 ;(defn- padding-dimcounts
@@ -86,7 +87,7 @@

 (defn add-padding
   "Adds specified value padding to 2d matrices"
-  [mat dim n & [value]]
+  [mat ^Integer dim ^Integer n & [value]]
   (let [other-dim (mod (inc dim) 2)
         other-dimcount (cm/dimension-count mat other-dim)]
     (case dim
@@ -147,6 +148,7 @@
     (rownames [this] (get-names (.row-index this)))
     (colnames [this] (get-names (.col-index this)))
     (get-matrix [this] (.matrix this))
+    (get-row-index [this] (.row-index this))
     (rowname-subset [this names]
       (let [row-indices (map (partial index (.row-index this)) names)
             row-index (subset (.row-index this) names)]
@@ -171,13 +173,13 @@
   are in nmat, it just subsets to the rownames that are. Should scrap other one?"
   (let [safe-names (filter
                      ; XXX This is kinda bad; should only be using protocol
-                     (partial index (.row-index nmat))
+                     (partial index (get-row-index nmat))
                      names)]
     (rowname-subset nmat names)))

 (defn get-row-by-name [nmat row-name]
   ; XXX This is kinda bad; should only be using protocol
-  (cm/get-row (get-matrix nmat) (index (.row-index nmat) row-name)))
+  (cm/get-row (get-matrix nmat) (index (get-row-index nmat) row-name)))

 (defn inv-rowname-subset [nmat row-names]
   "Returns named matrix which has been subset to all the rows not in row-names"


Make textarea, radio buttons and checkboxes async-friendly

And clean up code a little

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -75,29 +75,40 @@

 (def DOM (aget React "DOM"))

-(def input-components #{(aget DOM "input")})
+(def input-components #{(aget DOM "input")
+                        (aget DOM "textarea")})
+
+(defn get-props [this]
+  (-> this (aget "props") (aget cljs-props)))

 (defn input-initial-state []
   (this-as this
-           (let [props (-> this (aget "props") (aget cljs-props))]
-             #js {:value (:value props)})))
+           (let [props (get-props this)]
+             #js {:value (:value props)
+                  :checked (:checked props)})))

 (defn input-handle-change [e]
   (this-as this
-           (let [props (-> this (aget "props") (aget cljs-props))
+           (let [props (get-props this)
                  on-change (or (props :on-change) (props "onChange"))]
              (when-not (nil? on-change)
-               (.setState this #js {:value (-> e .-target .-value)})
-               (on-change e)))))
+               (on-change e)
+               (let [target (.-target e)]
+                 (.setState this #js {:value (.-value target)
+                                      :checked (.-checked target)}))))))

 (defn input-will-receive-props [new-props]
   (this-as this
            (let [props (aget new-props cljs-props)]
-             (.setState this #js {:value (:value props)}))))
+             (.setState this #js {:value (:value props)
+                                  :checked (:checked props)}))))

 (defn input-render-setup [this jsprops]
-  (aset jsprops "value" (-> this (aget "state") (aget "value")))
-  (aset jsprops "onChange" (aget this "handleChange")))
+  (let [state (aget this "state")]
+    (doto jsprops
+      (aset "value" (.-value state))
+      (aset "checked" (.-checked state))
+      (aset "onChange" (aget this "handleChange")))))

 (defn wrapped-render [this comp id-class]
   (let [inprops (aget this "props")
@@ -121,14 +132,14 @@
     (not (util/equal-args p1 c1 p2 c2))))

 (defn wrap-component [comp extras name]
-  (let [def (js-obj "render"
-                    #(this-as C (wrapped-render C comp extras))
-                    "shouldComponentUpdate"
-                    #(this-as C (wrapped-should-update C %1 %2))
-                    "displayName"
-                    (or name "ComponentWrapper"))]
+  (let [def #js {:render
+                 #(this-as C (wrapped-render C comp extras))
+                 :shouldComponentUpdate
+                 #(this-as C (wrapped-should-update C %1 %2))
+                 :displayName (or name "ComponentWrapper")}]
     (when (input-components comp)
       (doto def
+        (aset "shouldComponentUpdate" nil)
         (aset "getInitialState" input-initial-state)
         (aset "handleChange" input-handle-change)
         (aset "componentWillReceiveProps" input-will-receive-props)))


try to see if app-state exists in localStorage

--- src/saved_for_reddit/core.cljs
+++ src/saved_for_reddit/core.cljs
@@ -35,12 +35,25 @@
 ;; retreive the redirect uri from browser location
 ;;(def redirect-uri (str "http://" (get (clojure.string/split (str (.-location js/window)) #"/") 2) "/"))

+;; check if :saved-for-reddit-app-state already exists in localStorage
+(def app-state-exists? (atom false))
+(let [localstr (.-localStorage js/window)]
+  (for [c (range js/localStorage.length)]
+    (if (= "saved-for-reddit-app-state"
+           (re-find #"saved-for-reddit-app-state" (.key js/localStorage c)))
+      (do
+        (println c)
+        (reset! app-state-exists? true)))))
+
+(if (not app-state-exists?)
+  (println "app-state-does not exists"))
+
 ;; save app data in local-storage so that it doesn't get over-written on page reload
-(def app-state (local-storage (atom {:username ""
-                                     :token ""
-                                     :after nil
-                                     :state ""})
-                              :saved-for-reddit-app-state))
+(defonce app-state (local-storage (r/atom {:username ""
+                                           :token ""
+                                           :after nil
+                                           :state ""})
+                                  :saved-for-reddit-app-state))

 (def saved-posts (r/atom {}))
 (def subreddits (r/atom {}))


Fix lein project

Fix lein project

--- sre/project.clj
+++ sre/project.clj
@@ -6,7 +6,6 @@
                  [net.mikera/core.matrix "0.60.3"]
                  [funcool/cats "2.1.0"]
                  [ingraph/indexer "0.4.0-SNAPSHOT"]
-                 [ingraph/csv-loader "0.4.0-SNAPSHOT"]
                  [com.taoensso/tufte "1.1.2"]]
   :repositories [["acceleo" "https://repo.eclipse.org/content/groups/acceleo"]
                  ["viatra2" "https://repo.eclipse.org/content/groups/viatra2"]
@@ -14,12 +13,12 @@
   :profiles {
              :dev {
                    :dependencies [[org.clojure/test.check "0.9.0"]
+                                  [ingraph/csv-loader "0.4.0-SNAPSHOT"]
                                   [pjstadig/humane-test-output "0.8.3"]
                                   [com.esotericsoftware/kryo "4.0.0"]]
                    :plugins [[com.jakemccrary/lein-test-refresh "0.20.0"]
                              [jonase/eastwood "0.2.4"]
                              [refactor-nrepl "2.4.0-SNAPSHOT"]
-                             [cider/cider-nrepl "0.16.0-SNAPSHOT"]
-                             [org.clojure/tools.trace "0.7.9"]]
+                             [cider/cider-nrepl "0.16.0-SNAPSHOT"]]
                    :injections [(require 'pjstadig.humane-test-output)
                                 (pjstadig.humane-test-output/activate!)]}})


record execute stats

record execute stats

--- storm-multicore/src/clj/backtype/storm/daemon/executor.clj
+++ storm-multicore/src/clj/backtype/storm/daemon/executor.clj
@@ -463,19 +463,19 @@
 ;                                  (.setProcessSampleStartTime tuple now))
 ;                                (when execute-sampler?
 ;                                  (.setExecuteSampleStartTime tuple now))
-                                (.execute bolt-obj tuple)))))]
-;                                (let [delta (tuple-execute-time-delta! tuple)]
+                                (.execute bolt-obj tuple)
+                                (let [delta (tuple-execute-time-delta! tuple)]
 ;                                  (task/apply-hooks user-context .boltExecute (BoltExecuteInfo. tuple task-id delta))
-;                                  (when delta
+                                  (when delta
 ;                                    (builtin-metrics/bolt-execute-tuple! (:builtin-metrics task-data)
 ;                                                                         executor-stats
 ;                                                                         (.getSourceComponent tuple)
 ;                                                                         (.getSourceStreamId tuple)
 ;                                                                         delta)
-;                                    (stats/bolt-execute-tuple! executor-stats
-;                                                               (.getSourceComponent tuple)
-;                                                               (.getSourceStreamId tuple)
-;                                                               delta)))))))]
+                                    (stats/bolt-execute-tuple! executor-stats
+                                                               (.getSourceComponent tuple)
+                                                               (.getSourceStreamId tuple)
+                                                               delta)))))))]

     ;; TODO: can get any SubscribedState objects out of the context now


restructured core compiler to make it easier to target other impls (om and reagent)

--- src/kioo/core.clj
+++ src/kioo/core.clj
@@ -4,8 +4,49 @@
             [net.cgrand.enlive-html :refer [at html-resource select
                                             any-node]]))

-(declare compile)
+(declare compile component*)

+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; BASE REACT EMIT FUNCTIONS
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(defn get-react-sym [tag]
+  (symbol "js" (str "React.DOM." (name tag))))
+
+
+(defn emit-trans [node children]
+  `(kioo.core/make-react-dom
+    (~(:trans node) ~(-> node
+                         (dissoc :trans)
+                         (assoc :attrs (convert-attrs (:attrs node))
+                                :content children
+                                :sym (get-react-sym (:tag node)))))))
+
+(defn emit-node [node children]
+  `(apply ~(get-react-sym (:tag node))
+        (cljs.core/clj->js ~(convert-attrs (:attrs node)))
+        ~children))
+
+
+(defn wrap-fragment [tag child-sym]
+  `(apply ~(get-react-sym tag) nil ~child-sym))
+
+
+(def react-emit-opts {:emit-trans emit-trans
+                      :emit-node emit-node
+                      :wrap-fragment wrap-fragment})
+
+
+(defmacro component
+  "React base component definition"
+  [path & body]
+  (component* path body react-emit-opts))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Using Enlive to do selection and
+;; attache base transforms
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defn attach-transform [trans]
   (fn [node]
     (if (:trans node)
@@ -35,40 +76,44 @@
           node
           trans-lst))

-(defn get-react-sym [tag]
-  (symbol "js" (str "React.DOM." (name tag))))

-(defmacro component [path & body]
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Main Structure of Compiler
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+(defn component*
+  "this is the generic component that takes emitter
+   options that define how the component is mapped
+   to the underlying library (react, om, reagent)"
+  [path body emit-opts]
   (let [[sel trans-lst] (if (map? (first body))
                           [[:body :> any-node] (first body)]
                           body)
         root (html-resource path)
         start (if (= :root sel)
                 root
-                (select root (eval-selector sel)))]
-    `(let [ch# ~(compile (map-trans start trans-lst))]
-       (if (= 1 (count ch#))
-         (first ch#)
-         (apply ~(get-react-sym :span) nil ch#)))))
+                (select root (eval-selector sel)))
+        child-sym (gensym "ch")]
+    `(let [~child-sym ~(compile (map-trans start trans-lst) emit-opts)]
+       (if (= 1 (count ~child-sym))
+         (first ~child-sym)
+         ~((:wrap-fragment emit-opts) :span child-sym)))))

-(defn compile-node [node]
-  (let [children (compile (:content node))]
-    (if (:trans node)
-      `(kioo.core/make-react-dom
-        (~(:trans node) ~(-> node
-                             (dissoc :trans)
-                             (assoc :attrs (convert-attrs (:attrs node))
-                                    :content children
-                                    :sym (get-react-sym (:tag node))))))
-      `(apply ~(get-react-sym (:tag node))
-        (cljs.core/clj->js ~(convert-attrs (:attrs node)))
-        ~children))))
+(defn compile-node
+  "Emits the compiled sturcure for a single node & its children"
+  [node emit-opts]
+  (let [children (compile (:content node) emit-opts)
+        emit (if (:trans node)
+               (:emit-trans emit-opts)
+               (:emit-node emit-opts))]
+    (emit node children)))

-(defn compile [node]
+(defn compile
+  "Emits the compiled structure for a list of nodes"
+  [node emit-opts]
   (let [nodes (if (map? node) [node] node)
-        react-nodes (vec (map #(if (map? %) (compile-node %) %)
+        cnodes (vec (map #(if (map? %) (compile-node % emit-opts) %)
                               nodes))]
-    `(kioo.core/flatten-nodes ~react-nodes)))
+    `(kioo.core/flatten-nodes ~cnodes)))


It is ok for an element to provide no language

--- src/sinusoides/components.cljs
+++ src/sinusoides/components.cljs
@@ -224,7 +224,8 @@
        (fetch-data []
          (go (let [entries   (map #(assoc % :slug (util/to-slug (:name %)))
                                (:body  (<! (http/get "/data/do.json"))))
-                   languages (apply sorted-set (map :lang entries))]
+                   languages (apply sorted-set
+                               (filter identity (map :lang entries)))]
                (swap! do assoc-in [:entries] entries)
                (swap! do assoc-in [:languages] languages))))]


Fixes #2

Fixes #2

--- src/todo_mvc/android/core.cljs
+++ src/todo_mvc/android/core.cljs
@@ -25,7 +25,8 @@
   [view {:style {:flex 1}}
    [scroll-view {:style                        {:margin 40 :flex 1}
                  :content-container-style      {:align-items "center"}
-                 :showsVerticalScrollIndicator false}
+                 :showsVerticalScrollIndicator false
+                 :keyboardShouldPersistTaps    true}
     [text {:style {:font-size     50
                    :font-weight   "100"
                    :margin-bottom 20


fixing indentation and adding exceptions

--- src/vignette/storage/local.clj
+++ src/vignette/storage/local.clj
@@ -6,18 +6,22 @@
             [clojure.java.shell :as sh])
   (:import  (java.io FileInputStream)))

+; TODO: when the logger has a closure port, we should create an exception that has context that we can log w/ exceptions
 (defrecord LocalObjectStorage [directory]
   ObjectStorageProtocol

- (get-object [this bucket path]
-   (let [real-file (io/file (resolve-local-path (:directory this) bucket path))]
-     (when (file-exists? real-file)
-       real-file)))
+  (get-object [this bucket path]
+    (let [real-file (io/file (resolve-local-path (:directory this) bucket path))]
+      (if (file-exists? real-file)
+        real-file
+        (throw (Exception. "get-object failed")))))

- (put-object [this resource bucket path]
-   (let [real-path (resolve-local-path (:directory this) bucket path)]
-     (create-local-path (get-parent real-path))
-     (transfer! resource real-path)))
+  (put-object [this resource bucket path]
+    (let [real-path (resolve-local-path (:directory this) bucket path)]
+      (create-local-path (get-parent real-path))
+      (if (transfer! resource real-path)
+        true
+        (throw (Exception. "put-object failed")))))

   (delete-object [this bucket path]
     (let [real-path (resolve-local-path (:directory this) bucket path)]


add error handling for strings leap year clojure

--- tech-int/src/tech_int/core.clj
+++ tech-int/src/tech_int/core.clj
@@ -13,21 +13,26 @@

 (defn -leapYear []
     (println "Enter a year: ")
-    (def inputYear (Integer. (read-line)))
-    (println "--")
-    (def i (atom 0))
-    (loop [leapYearVector []
-           year inputYear]
-        (when (< @i 20)
-            (if (checkIfLeapYear year)
-                (do
-                    (conj leapYearVector year)
-                    (swap! i inc)
-                    (println year)
-                ))
+    (try
+        (do
+            (def inputYear (Integer. (read-line)))
+            (println "--")
+            (def i (atom 0))
+            (loop [leapYearVector []
+                   year inputYear]
+                (when (< @i 20)
+                    (if (checkIfLeapYear year)
+                        (do
+                            (conj leapYearVector year)
+                            (swap! i inc)
+                            (println year)
+                        ))

-            (recur leapYearVector (inc year))
+                    (recur leapYearVector (inc year))
+                )
+            )
         )
+        (catch Exception e (println "Sorry, invalid choice."))
     )
 )


Fix cljs tests

Fix cljs tests

--- test/cljc/fqcss/core_test.cljc
+++ test/cljc/fqcss/core_test.cljc
@@ -24,7 +24,7 @@
       (is (= (fqcss/wrap-reagent component) resolved-component))))
   (testing "It should fail to wrap an empty vector"
     (is (= "exception" (try (fqcss/wrap-reagent [])
-                            (catch Error e (str "exception")))))))
+                            (catch #?(:clj Error :cljs :default) e (str "exception")))))))

 (deftest test-replace-css
   (testing "It should replace class keywords in a CSS string"


Fix bug in archive thinner.

Fix bug in archive thinner.

--- src/algebolic/algorithms/spea2.clj
+++ src/algebolic/algorithms/spea2.clj
@@ -90,7 +90,7 @@
                               oversized-archive)
         sorted-archive (sort-by :spea2-distance < measured-archive)]
     {:archive (rest sorted-archive)
-     :tree    (kdtree/delete tree (coords-from-individual (first sorted-archive)))}))
+     :tree    (kdtree/delete tree (coords-from-individual goals (first sorted-archive)))}))

 (defn simple-archive-thinner
   "SPEA2 has a fairly complicated prescription for thinning out the archive if it's oversized. It specifies
@@ -121,7 +121,7 @@
         ;; 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 raw size: " new-size)
+        _ (println "New archive raw size: " new-size)
         ]
     ;; there are three cases here: either the new archive is exactly the right size, too big, or too small
     (cond


add function documentation for (defn analyze) and (defn analyze-regular)

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1329,7 +1329,7 @@
      concat)))

 (defn analyze-regular [surface-form lexicon]
-  "do regular (i.e. non-exceptional) morphological analysis to determine lexical information for a conjugated surface-form"
+  "do regular (i.e. non-exceptional) morphological analysis to determine lexical information for a conjugated surface-form, using the (defonce replace-patterns) defined above."
   (mapcat
    (fn [replace-pattern]
      (let [ ;; regular expression that matches the surface form
@@ -1364,7 +1364,11 @@

 (declare analyze-capitalization-variant)

-(defn analyze [surface-form lexicon]
+(defn analyze
+  "take the union of:
+      - analyzing _surface-form_ according to the (defonce replace-patterns) above
+      - looking up _surface-form_ in the supplied lexicon."
+  [surface-form lexicon]
   (mapcat (fn [each-variant]
             (analyze-capitalization-variant each-variant lexicon))
           (set


add storm release version in storm-ui

add storm release version in storm-ui

--- src/clj/backtype/storm/ui/core.clj
+++ src/clj/backtype/storm/ui/core.clj
@@ -7,10 +7,12 @@
   (:use [clojure.contrib.def :only [defnk]])
   (:use [clojure.contrib.seq-utils :only [find-first]])
   (:use [ring.adapter.jetty :only [run-jetty]])
+  (:use [clojure.string :only [trim]])
   (:import [backtype.storm.generated TaskSpecificStats
             TaskStats TaskSummary TopologyInfo SpoutStats BoltStats
             ErrorInfo ClusterSummary SupervisorSummary TopologySummary
             Nimbus$Client StormTopology GlobalStreamId])
+  (:import [java.io File])
   (:require [compojure.route :as route]
             [compojure.handler :as handler]
             [backtype.storm [thrift :as thrift]])
@@ -69,6 +71,14 @@
     (seq body)
     ]))

+(defn read-storm-version []
+  (let [storm-home (System/getProperty "storm.home")
+        release-path (format "%s/RELEASE" storm-home)
+        release-file (File. release-path)]
+    (if (and (.exists release-file) (.isFile release-file))
+      (trim (slurp release-path))
+      "Unknown")))
+
 (defn cluster-summary-table [^ClusterSummary summ]
   (let [sups (.get_supervisors summ)
         used-slots (reduce + (map #(.get_num_used_workers ^SupervisorSummary %) sups))
@@ -77,8 +87,9 @@
         total-tasks (->> (.get_topologies summ)
                          (map #(.get_num_tasks ^TopologySummary %))
                          (reduce +))]
-    (table ["Nimbus uptime" "Supervisors" "Used slots" "Free slots" "Total slots" "Running tasks"]
-           [[(pretty-uptime-sec (.get_nimbus_uptime_secs summ))
+    (table ["Storm version" "Nimbus uptime" "Supervisors" "Used slots" "Free slots" "Total slots" "Running tasks"]
+           [[(read-storm-version)
+             (pretty-uptime-sec (.get_nimbus_uptime_secs summ))
              (count sups)
              used-slots
              free-slots


add note on implementation detail of using cljs.analyzer

--- src/clj/com/rpl/specter/macros.clj
+++ src/clj/com/rpl/specter/macros.clj
@@ -447,6 +447,9 @@

 (defn cljs-macroexpand [env form]
   (require 'cljs.analyzer)
+  ;; need to get the expansion function like this so that
+  ;; this code compiles in a clojure environment where cljs.analyzer
+  ;; namespace does not exist
   (let [expand-fn (eval 'cljs.analyzer/macroexpand-1)
         mform (expand-fn env form)]
     (cond (identical? form mform) mform


Restore parsing of :port option in nREPL mode

Fixes a regression introduced in 7fe67e4e2eb5580e42da6662fd05cd4c62a6533c.

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -156,7 +156,9 @@
 (defn get-connection [{:keys [attach host port scheme]
                        :or {scheme "nrepl"}}]
   (let [server (when-not attach
-                 (nrepl.server/start-server :port port))
+                 (nrepl.server/start-server
+                   :port (when port
+                           (-> port str Integer/parseInt))))
         port (when-not attach
                (:port server))
         url (url-for attach host port scheme)]


Fix broken submit bug on add example

Fix broken submit bug on add example

--- src/cljs/clojuredocs/examples.cljs
+++ src/cljs/clojuredocs/examples.cljs
@@ -55,7 +55,7 @@
    [:h5 "New Example"]
    [:div.add-example-preview
     [:div.live-preview {:ref "live-preview"}]]
-   [:div.form
+   [:form
     {:on-submit #(validate-and-submit
                    owner
                    {:text text
@@ -183,5 +183,4 @@
          (if user
            (om/build $add app)
            [:div.login-required-message
-            [:a {:href "#" #_(common/gh-auth-url uri)} "Log in"]
-            " to add an example"])]))))
+            "Log in to add an example"])]))))


bindPopup

bindPopup

--- src/cljs/om_next_leaflet/core.cljs
+++ src/cljs/om_next_leaflet/core.cljs
@@ -54,7 +54,7 @@
       (let [[lng lat] geometry
             marker (leaflet/create-marker lat lng :radius 6 :fillColor "#0000ff" :fillOpacity 1.0 :weight 1)]
         (doto marker
-          ;; (.bindPopup (str "" line-name "
" station-name))
+          (.bindPopup (str "" line-name "
" station-name))
           (.on "click" (fn [e] (let [station (filter (fn [station] (= (:id station) id)) stations)
                                      new-station-info (-> station
                                                           first


Generic signer module now works with safe base64 instead of hex encoding.

--- src/clojure/buddy/sign/generic.clj
+++ src/clojure/buddy/sign/generic.clj
@@ -23,22 +23,22 @@

 (def ^{:doc "List of supported signing algorithms"
        :static true}
-  signers-map {:hs256 {:signer hmac/hmac-sha256
-                       :verifier hmac/hmac-sha256-verify}
-               :hs512 {:signer hmac/hmac-sha512
-                       :verifier hmac/hmac-sha512-verify}
-               :rs256 {:signer (comp bytes->hex sign/rsassa-pkcs-sha256)
-                       :verifier #(sign/rsassa-pkcs-sha256-verify %1 (hex->bytes %2) %3)}
-               :rs512 {:signer (comp bytes->hex sign/rsassa-pkcs-sha512)
-                       :verifier #(sign/rsassa-pkcs-sha512-verify %1 (hex->bytes %2) %3)}
-               :ps256 {:signer (comp bytes->hex sign/rsassa-pss-sha256)
-                       :verifier #(sign/rsassa-pss-sha256-verify %1 (hex->bytes %2) %3)}
-               :ps512 {:signer (comp bytes->hex sign/rsassa-pss-sha512)
-                       :verifier #(sign/rsassa-pss-sha512-verify %1 (hex->bytes %2) %3)}
-               :es256 {:signer (comp bytes->hex sign/ecdsa-sha256)
-                       :verifier #(sign/ecdsa-sha256-verify %1 (hex->bytes %2) %3)}
-               :es512 {:signer (comp bytes->hex sign/ecdsa-sha512)
-                       :verifier #(sign/ecdsa-sha512-verify %1 (hex->bytes %2) %3)}})
+  signers-map {:hs256 {:signer (comp bytes->safebase64 hmac/hmac-sha256)
+                       :verifier #(hmac/hmac-sha256-verify %1 (safebase64->bytes %2) %3)}
+               :hs512 {:signer (comp bytes->safebase64 hmac/hmac-sha512)
+                       :verifier #(hmac/hmac-sha512-verify %1 (safebase64->bytes %2) %3)}
+               :rs256 {:signer (comp bytes->safebase64 sign/rsassa-pkcs-sha256)
+                       :verifier #(sign/rsassa-pkcs-sha256-verify %1 (safebase64->bytes %2) %3)}
+               :rs512 {:signer (comp bytes->safebase64 sign/rsassa-pkcs-sha512)
+                       :verifier #(sign/rsassa-pkcs-sha512-verify %1 (safebase64->bytes %2) %3)}
+               :ps256 {:signer (comp bytes->safebase64 sign/rsassa-pss-sha256)
+                       :verifier #(sign/rsassa-pss-sha256-verify %1 (safebase64->bytes %2) %3)}
+               :ps512 {:signer (comp bytes->safebase64 sign/rsassa-pss-sha512)
+                       :verifier #(sign/rsassa-pss-sha512-verify %1 (safebase64->bytes %2) %3)}
+               :es256 {:signer (comp bytes->safebase64 sign/ecdsa-sha256)
+                       :verifier #(sign/ecdsa-sha256-verify %1 (safebase64->bytes %2) %3)}
+               :es512 {:signer (comp bytes->safebase64 sign/ecdsa-sha512)
+                       :verifier #(sign/ecdsa-sha512-verify %1 (safebase64->bytes %2) %3)}})

 (defn timestamp-millis
   "Get current timestamp in millis."


bug spamming characters across cols

bug spamming characters across cols

--- src/clojure/zensols/dataset/db.clj
+++ src/clojure/zensols/dataset/db.clj
@@ -652,6 +652,7 @@
                        (map (fn [{:keys [class-label id instance]}]
                               (let [id (or id "")]
                                 (->> (instance-fn instance)
+                                     list
                                      (concat fields [class-label id])))))
                        ((if header?
                           #(cons (concat col-names


More error handling, detailed ex-info maps

--- src/com/stuartsierra/component.clj
+++ src/com/stuartsierra/component.clj
@@ -34,7 +34,8 @@
       (into {} (map (fn [x] [x x]) dependencies))
     :else
       (throw (ex-info "Dependencies must be a map or vector"
-                      {:component component
+                      {:reason ::invalid-dependencies
+                       :component component
                        :dependencies dependencies})))))

 (defn dependency-graph
@@ -49,25 +50,57 @@
              (dep/graph)
              (select-keys system component-keys)))

+(defn- assoc-dependency [system component dependency-key system-key]
+  (let [dependency (get system system-key)]
+    (when-not dependency
+      (throw (ex-info "Missing component dependency"
+                      {:reason ::missing-dependency
+                       :system-key system-key
+                       :dependency-key dependency-key
+                       :component component
+                       :system system})))
+    (assoc component dependency-key dependency)))
+
+(defn- assoc-dependencies [component system]
+  (reduce-kv #(assoc-dependency system %1 %2 %3)
+             component
+             (dependencies component)))
+
+(defn- start-component [component system]
+  (try (start component)
+       (catch Throwable t
+         (throw (ex-info "Error starting component"
+                         {:reason ::start-threw-exception
+                          :component component
+                          :system system}
+                         t)))))
+
+(defn- stop-component [component system]
+  (try (stop component)
+       (catch Throwable t
+         (throw (ex-info "Error stopping component"
+                         {:reason ::stop-threw-exception
+                          :component component
+                          :system system}
+                         t)))))
+
+(defn- get-component [system key]
+  (or (get system key)
+      (throw (ex-info "Missing component from system"
+                      {:reason ::missing-component
+                       :component-key key
+                       :system system}))))
+
 (defn start-system
-  "Recursively starts components in the system, in dependency order."
+  "Recursively starts components in the system, in dependency order,
+  assoc'ing in their dependencies along the way."
   [system component-keys]
   (let [graph (dependency-graph system component-keys)]
     (reduce (fn [system key]
-              (let [component (get system key)]
-                (try
-                  (assoc system key
-                         (start
-                          (reduce-kv (fn [component dependency-key system-key]
-                                       (assoc component dependency-key
-                                              (get system system-key)))
-                                     component
-                                     (dependencies component))))
-                  (catch Throwable t
-                    (throw (ex-info "Error starting component"
-                                    {:component component
-                                     :system system}
-                                    t))))))
+              (assoc system key
+                     (-> (get-component system key)
+                         (assoc-dependencies system)
+                         (start-component system))))
             system
             (sort (dep/topo-comparator graph) component-keys))))

@@ -77,14 +110,9 @@
   [system component-keys]
   (let [graph (dependency-graph system component-keys)]
     (reduce (fn [system key]
-              (let [component (get system key)]
-                (try
-                  (assoc system key (stop component))
-                  (catch Throwable t
-                    (throw (ex-info "Error stopping component"
-                                    {:component component
-                                     :system system}
-                                    t))))))
+              (assoc system key
+                     (-> (get-component system key)
+                         (stop-component system))))
             system
             (reverse (sort (dep/topo-comparator graph) component-keys)))))


Test for function render-html-header

Test for function render-html-header

--- test/zg/html_renderer_test.clj
+++ test/zg/html_renderer_test.clj
@@ -13,6 +13,8 @@
 (ns zg.html-renderer-test
   (:require [clojure.test :refer :all]
             [zg.html-renderer :refer :all]))
+
+(require '[hiccup.page :as page])

 ;
 ; Common functions used by tests.
@@ -114,3 +116,16 @@
 ; Test for function behaviours
 ;

+(deftest test-render-html-header
+    "Checking the function zg.html-renderer/render-html-header."
+    (testing "the function zg.html-renderer/render-html-header."
+        (are [x y] (= (slurp x) y)
+            "test/expected/html_header1.html" (page/xhtml (render-html-header "" "" ""))
+            "test/expected/html_header2.html" (page/xhtml (render-html-header "" "" "title"))
+            "test/expected/html_header3.html" (page/xhtml (render-html-header "" "http://10.20.30.40/" ""))
+            "test/expected/html_header4.html" (page/xhtml (render-html-header "" "http://10.20.30.40/" "title"))
+            "test/expected/html_header5.html" (page/xhtml (render-html-header "word" "" ""))
+            "test/expected/html_header6.html" (page/xhtml (render-html-header "word" "" "title"))
+            "test/expected/html_header7.html" (page/xhtml (render-html-header "word" "http://10.20.30.40/" ""))
+            "test/expected/html_header8.html" (page/xhtml (render-html-header "word" "http://10.20.30.40/" "title")))))
+


Work in progress on physics.

Work in progress on physics.

--- ClojureScript/hello.cljs
+++ ClojureScript/hello.cljs
@@ -5,11 +5,50 @@
         [goog.dom :only [appendChild createDom createTextNode removeChildren]]
         [goog.events :only [listen]]
         [goog.events.EventType :only [CLICK]]
-        [goog.graphics :only [createGraphics Stroke SolidFill]]
+        [goog.graphics :only [createGraphics Stroke SolidFill Path]]
         [goog :only [Timer]]
         ))

 (def my-code-url "https://github.com/pauldoo/scratch/blob/master/ClojureScript/hello.cljs")
+(def tick-step (/ 1 100))
+(def render-step (/ 1 30))
+(def gravity-strength 15)
+(def ground-strength 10)
+(def initial-game-state {
+    :nodes {
+        :t {
+            :pos [150 100]
+            :vel [(- 10) 0]
+        }
+        :u {
+            :pos [350 200]
+            :vel [(- 10) 0]
+        }
+        :v {
+            :pos [250 100]
+            :vel [(- 10) 0]
+        }
+    }
+    :springs [
+        {
+            :node-a :t
+            :node-b :u
+            :rest-length 224.0
+            :strength 50
+        }
+        {
+            :node-a :u
+            :node-b :v
+            :rest-length 141.0
+            :strength 50
+        }
+        {
+            :node-a :t
+            :node-b :v
+            :rest-length 100.0
+            :strength 50
+        }
+    ] })

 (defn print-to-log [v]
     (.log js/console v))
@@ -27,22 +66,48 @@
         force (vec* (normalize a-b) pressure)]
             force))

-(defn calculate-node-forces [nodes springs]
+(defn calculate-spring-forces [nodes springs]
     (loop [forces {} springs springs]
         (if (empty? springs) forces
             (let [
                 [s & r] springs
                 node-a-id (s :node-a)
                 node-b-id (s :node-b)
-                force (calculate-force (nodes node-a-id) (nodes node-b-id) (:rest-length s) (:strength s))]
+                force (calculate-force (:pos (nodes node-a-id)) (:pos (nodes node-b-id)) (:rest-length s) (:strength s))]
                 (recur
                     (assoc forces
                         node-a-id (vec+ (get forces node-a-id [0 0]) force)
                         node-b-id (vec- (get forces node-b-id [0 0]) force))
                     r)))))

-(print-to-log
-    (pr-str (calculate-node-forces {:t [1 1] :u [2 3] } [{:node-a :t :node-b :u :rest-length 2.0 :strength 5.0}] )))
+(defn calculate-gravity-forces [nodes]
+    (zipmap (keys nodes) (repeat [0 (- gravity-strength)])))
+
+(defn calculate-ground-forces [nodes]
+    (zipmap (keys nodes)
+        (map (fn [{[ x y ] :pos [ xv yv ] :vel }]
+            (if (< y 0)
+                (vec* [(- xv) (+ (- yv) (- y))] ground-strength)
+                [0 0])) (vals nodes))))
+
+(defn calculate-all-node-forces [nodes springs]
+    (merge-with vec+
+        (calculate-spring-forces nodes springs)
+        (calculate-gravity-forces nodes)
+        (calculate-ground-forces nodes)))
+
+(defn update-node-velocities [nodes forces time-step]
+    (merge-with (fn [n f]
+        (assoc n
+            :vel (vec+ (:vel n) (vec* f time-step))))
+        nodes
+        forces))
+
+(defn update-node-positions [nodes time-step]
+    (zipmap (keys nodes) (map (fn [n]
+        (assoc n
+            :pos (vec+ (:pos n) (vec* (:vel n) time-step)))
+        ) (vals nodes))))

 (defn input-event [input-state-ref event]
     (swap! input-state-ref
@@ -55,28 +120,57 @@
                         (conj keys (.keyCode event))
                     :else keys)})))

-(defn tick [game-state-ref input-state]
-    (swap! game-state-ref
-        (fn [{[x y] :pos}]
-            {:pos [(inc x) (* 50 (count (:keys input-state)))]})))
+(defn tick-imp [state tick-step]
+    (assoc state :nodes
+        (update-node-positions
+            (update-node-velocities
+                (:nodes state)
+                (calculate-all-node-forces (:nodes state) (:springs state))
+                tick-step)
+            tick-step)))
+
+(defn tick [game-state-ref input-state] (do
+    (swap! game-state-ref #(tick-imp % tick-step))))
+
+(defn world-to-screen [[x y]]
+    [x (- 275 y)])
+
+(defn draw-line [g x1 y1 x2 y2]
+    (.drawPath g
+        (let [p (Path.)] (do
+            (.moveTo p x1 y1)
+            (.lineTo p x2 y2)
+            p))
+        (Stroke. 1 "green") nil))

 (defn rerender [canvas-element game-state]
-    (let [{[x y] :pos} game-state
-        graphics (goog.graphics/createGraphics 400 300)]
+    (let [
+        graphics (goog.graphics/createGraphics 400 300)
+        {nodes :nodes springs :springs} game-state]
         (do
-            (.drawCircle graphics x y 30 (Stroke. 2 "green") (SolidFill. "yellow"))
+            (apply draw-line graphics (apply concat (map world-to-screen [[0 0] [400 0]])))
+            (dorun (map
+                (fn [{a :node-a b :node-b}]
+                    (let [
+                        [x1 y1] (world-to-screen (:pos (nodes a)))
+                        [x2 y2] (world-to-screen (:pos (nodes b)))]
+                        (draw-line graphics x1 y1 x2 y2))) springs))
+            (dorun (map
+                (fn [{p :pos}] (let [[x y] (world-to-screen p)]
+                    (.drawCircle graphics x y 3 (Stroke. 2 "green") (SolidFill. "yellow"))))
+                (vals nodes)))
             (goog.dom/removeChildren canvas-element)
             (.render graphics canvas-element)
             )))

 (defn ^:export main []
     (let [
-        game-state-ref (atom {:pos [0 0]})
+        game-state-ref (atom initial-game-state)
         input-state-ref (atom {:keys (set)})
         canvas (goog.dom/createDom "div" {} "")
         button (goog.dom/createDom "button" {} "Click!")
-        tick-timer (Timer. 100)
-        render-timer (Timer. 100)
+        tick-timer (Timer. (Math/round (* 1000 tick-step)))
+        render-timer (Timer. (Math/round (* 1000 render-step)))
         ]
         (do
             (. tick-timer (start))


Revert time zone change

Revert time zone change

--- src/main/clojure/pdok/postgres.clj
+++ src/main/clojure/pdok/postgres.clj
@@ -15,7 +15,7 @@
 (def wkt-writer (WKTWriter.))

 (def utcCal (Calendar/getInstance (TimeZone/getTimeZone "UTC")))
-(def nlZone (DateTimeZone/forID "Europe/Amsterdam")) ;; used for reading datetimes, because postgres returns Z values
+(def nlZone (DateTimeZone/getDefault)) ;; used for reading datetimes, because postgres returns Z values

 (extend-protocol j/ISQLValue
   org.joda.time.DateTime


[#1796] Refactor

[#1796] Refactor

--- backend/src/akvo/lumen/lib/update.clj
+++ backend/src/akvo/lumen/lib/update.clj
@@ -41,49 +41,47 @@
                  (set (map #(select-keys % [:id :type]) columns)))))

 (defn do-update [conn config dataset-id data-source-id job-execution-id data-source-spec]
-  (let [table-name (util/gen-table-name "ds")
-        imported-table-name (util/gen-table-name "imported")
-        dataset-version (latest-dataset-version-by-dataset-id conn {:dataset-id dataset-id})
-        initial-dataset-version (initial-dataset-version-to-update-by-dataset-id conn {:dataset-id dataset-id})
-        imported-dataset-columns (vec (:columns initial-dataset-version))]
-    (with-open [importer (import/dataset-importer (get data-source-spec "source") config)]
-      (let [importer-columns (p/columns importer)]
-        (if-not (compatible-columns? imported-dataset-columns importer-columns)
-          (failed-update conn job-execution-id "Column mismatch")
-          (do (postgres/create-dataset-table conn table-name importer-columns)
-              (doseq [record (map postgres/coerce-to-sql (p/records importer))]
-                (jdbc/insert! conn table-name record))
-              (clone-data-table conn
-                                {:from-table table-name
-                                 :to-table imported-table-name}
-                                {}
-                                {:transaction? false})
-              (let [coerce-column-fn (fn [{:keys [title id type key multiple-id multiple-type] :as column}]
-                                       (cond-> {"type" (name type)
-                                                "title" title
-                                                "columnName" (name id)
-                                                "sort" nil
-                                                "direction" nil
-                                                "hidden" false}
-                                         key           (assoc "key" (boolean key))
-                                         multiple-type (assoc "multipleType" multiple-type)
-                                         multiple-id   (assoc "multipleId" multiple-id)))
-                    importer-columns (mapv coerce-column-fn importer-columns)]
-                (engine/apply-transformation-log conn
-                                                 table-name
-                                                 imported-table-name
-                                                 importer-columns
-                                                 imported-dataset-columns
-                                                 dataset-id
-                                                 job-execution-id
-
-                                                 dataset-version)
-                (successful-update conn
-                                   job-execution-id
-                                   dataset-id
-                                   table-name
-                                   imported-table-name
-                                   dataset-version))))))))
+  (with-open [importer (import/dataset-importer (get data-source-spec "source") config)]
+    (let [initial-dataset-version (initial-dataset-version-to-update-by-dataset-id conn {:dataset-id dataset-id})
+          imported-dataset-columns (vec (:columns initial-dataset-version))
+          importer-columns (p/columns importer)]
+      (if-not (compatible-columns? imported-dataset-columns importer-columns)
+        (failed-update conn job-execution-id "Column mismatch")
+        (let [table-name (util/gen-table-name "ds")
+              imported-table-name (util/gen-table-name "imported")]
+          (postgres/create-dataset-table conn table-name importer-columns)
+          (doseq [record (map postgres/coerce-to-sql (p/records importer))]
+            (jdbc/insert! conn table-name record))
+          (clone-data-table conn {:from-table table-name
+                                  :to-table imported-table-name}
+                            {}
+                            {:transaction? false})
+          (let [dataset-version (latest-dataset-version-by-dataset-id conn {:dataset-id dataset-id})
+                coerce-column-fn (fn [{:keys [title id type key multiple-id multiple-type] :as column}]
+                                   (cond-> {"type" (name type)
+                                            "title" title
+                                            "columnName" (name id)
+                                            "sort" nil
+                                            "direction" nil
+                                            "hidden" false}
+                                     key           (assoc "key" (boolean key))
+                                     multiple-type (assoc "multipleType" multiple-type)
+                                     multiple-id   (assoc "multipleId" multiple-id)))
+                importer-columns (mapv coerce-column-fn importer-columns)]
+            (engine/apply-transformation-log conn
+                                             table-name
+                                             imported-table-name
+                                             importer-columns
+                                             imported-dataset-columns
+                                             dataset-id
+                                             job-execution-id
+                                             dataset-version)
+            (successful-update conn
+                               job-execution-id
+                               dataset-id
+                               table-name
+                               imported-table-name
+                               dataset-version)))))))

 (defn update-dataset [tenant-conn config error-tracker dataset-id data-source-id data-source-spec]
   (let [job-execution-id (str (util/squuid))]


Fixed broken test.

Fixed broken test.

--- app/test/clj_web_example/localization_test.clj
+++ app/test/clj_web_example/localization_test.clj
@@ -4,4 +4,4 @@

 (deftest tr-test
   (testing "Translations are fetched correctly."
-    (is (= (tr :hello) "Hello World!"))))
+    (is (= (tr :title) "Hello World!"))))


latest dependencies

latest dependencies

--- iwaswhere-web/project.clj
+++ iwaswhere-web/project.clj
@@ -7,11 +7,11 @@
                  [org.clojure/clojurescript "1.9.293"]
                  [org.clojure/tools.logging "0.3.1"]
                  [org.clojure/tools.namespace "0.3.0-alpha3"]
-                 [com.taoensso/encore "2.86.1"]
+                 [com.taoensso/encore "2.87.0"]
                  [ch.qos.logback/logback-classic "1.1.7"]
                  [hiccup "1.0.5"]
                  [clj-pid "0.1.2"]
-                 [clj-time "0.12.0"]
+                 [clj-time "0.12.2"]
                  [clj-http "3.3.0"]
                  [me.raynes/fs "1.4.6"]
                  [markdown-clj "0.9.90"]
@@ -21,7 +21,7 @@
                  [com.drewnoakes/metadata-extractor "2.9.1"]
                  [ubergraph "0.3.0"]
                  [camel-snake-kebab "0.4.0"]
-                 [matthiasn/systems-toolbox "0.6.1-alpha8"]
+                 [matthiasn/systems-toolbox "0.6.1-alpha9"]
                  [matthiasn/systems-toolbox-ui "0.6.1-alpha11"]
                  [matthiasn/systems-toolbox-sente "0.6.1-alpha13"]
                  [matthiasn/inspect-probe "0.6.1-alpha1"]


I can tweet now

I can tweet now

--- markov-clj/src/twitter/twitter.clj
+++ markov-clj/src/twitter/twitter.clj
@@ -3,7 +3,8 @@
    [twitter.oauth]
    [twitter.callbacks]
    [twitter.callbacks.handlers]
-   [twitter.api.restful])
+   [twitter.api.restful]
+   [twitter.request])
   (:import
    (twitter.callbacks.protocols SyncSingleCallback)))

@@ -14,26 +15,17 @@

 ; simply retrieves the user, authenticating with the above credentials
 ; note that anything in the :params map gets the -'s converted to _'s
-(defn- get-statuses [user-id] (->>
-                               (:body (statuses-user-timeline :oauth-creds my-creds
-                                                              :params {:screen-name user-id}))
+(defn- get-tweets [user-id] (->>
+                               (get-page user-id)
                                (map :text)))

-(get-statuses "bbombgardener")
+(defn- get-page [user-id & since-id]
+  (:body (statuses-user-timeline :oauth-creds my-creds
+                                 :params {:screen-name user-id
+                                          :count 200
+                                          :include-rts "false"})))

+(get-tweets "bbombgardener")

-; shows the users friends
-(friendships-show :oauth-creds my-creds
-                  :params {:target-screen-name "AdamJWynne"})
-
-; use a custom callback function that only returns the body of the response
-(friendships-show :oauth-creds my-creds
-                  :callbacks (SyncSingleCallback. response-return-body
-                                                  response-throw-error
-                                                  exception-rethrow)
-                  :params {:target-screen-name "AdamJWynne"})
-
-; upload a picture tweet with a text status attached, using the default sync-single callback
-(statuses-update-with-media :oauth-creds *creds*
-                            :body [(file-body-part "/pics/test.jpg")
-                                   (status-body-part "testing")])
+(statuses-update :oauth-creds my-creds
+                 :params {:status "Hello, world!"})


mobile: Update chapters loading

mobile: Update chapters loading

--- apps/mobile/src/souptitle_mobile/handlers.cljs
+++ apps/mobile/src/souptitle_mobile/handlers.cljs
@@ -98,6 +98,12 @@
 (defn set-active-serial [serial-id active-content-index]
   (assoc active-content-index 0 serial-id))

+(defn set-active-season [season-id active-content-index]
+  (assoc active-content-index 1 season-id))
+
+(defn set-active-chapter [chapter-id active-content-index]
+  (assoc active-content-index 2 chapter-id))
+
 ;; TODO: think about lenses

 (defn save-apply [& args]
@@ -160,6 +166,8 @@
    (fn [chapters]
      (-> chapters
          (update (-> index (rest) (rest) (first)) updater)))))
+
+;; -------- Content loading -----------

 (defn load-if-not-exist
   ([getter load-fn on-loaded]
@@ -229,13 +237,95 @@
 (register-handler
   :seasons-load-error
   (fn [db [_ error]]
-    (print error)
+    (if (= (.-message err) "Network request failed")
+      (dispatch [:show-network-error])
+      (print err))
     db))

-(register-handler
-  :resort-chapter
-  (fn [db [_ sort-type]]
-    (assoc db :sort-chapter sort-type)))
+(defn load-chapters-content [content active-content remote-db chapters-path]
+  (-> (load-if-not-exist
+       (partial get-chapters-by-index content active-content)
+       (partial rdb/download-json remote-db chapters-path)
+       (fn [chapters]
+         (dispatch [:chapters-load-success chapters])))
+      (.catch
+       (fn [err]
+         (dispatch [:chapters-load-error err])))))
+
+(register-handler
+  :chapters-load
+  (fn [{:keys [content active-content remote-db] :as db}
+       [_ {id :id chapters-path :path}]]
+    (let [new-active-content (set-active-season id active-content)]
+      (api-proxy
+       (partial load-chapters-content
+                content
+                active-content
+                remote-db
+                chapters-path))
+      (-> db
+          (assoc :active-content new-active-content)))))
+
+(register-handler
+  :chapters-load-success
+  (fn [{:keys [content active-content] :as db} [_ chapters]]
+    (-> db
+        (assoc :content (update-chapters
+                         content
+                         active-content
+                         #(parse-chapters chapters))))))
+
+(register-handler
+  :chapters-load-error
+  (fn [db [_ error]]
+    (if (= (.-message err) "Network request failed")
+      (dispatch [:show-network-error])
+      (print err))
+    db))
+
+(defn load-srt-content [content active-content remote-db srt-path]
+  (-> (load-if-not-exist
+       (partial get-chapter-by-index content active-content)
+       (partial rdb/download remote-db srt-path)
+       (fn [srt]
+         (dispatch [:srt-load-success srt])))
+      (.catch
+       (fn [err]
+         (dispatch [:srt-load-error err])))))
+
+(register-handler
+  :chapter-load
+  (fn [{:keys [content active-content remote-db] :as db}
+       [_ {id :id srt-path :path}]]
+    (let [new-active-content (set-active-chapter id active-content)]
+      (api-proxy
+       (partial load-srt-content
+                content
+                active-content
+                remote-db
+                srt-path))
+      (-> db
+          (assoc :active-content new-active-content)))))
+
+(register-handler
+  :srt-load-success
+  (fn [{:keys [content active-content] :as db} [_ chapter]]
+    (-> db
+        (assoc :content (update-chapter
+                         content
+                         active-content
+                         #(parse-srt chapter))))))
+
+(register-handler
+  :srt-load-error
+  (fn [db [_ error]]
+    (if (= (.-message err) "Network request failed")
+      (dispatch [:show-network-error])
+      (print err))
+    db))
+
+;; ------ Translate -------
+;; TODO: need to cache translations

 (register-handler
   :translate-term
@@ -274,6 +364,14 @@
     (-> db
         (assoc-in [:translate :show?] false))))

+;; ------- Other --------
+
+(register-handler
+ :resort-chapter
+ (fn [db [_ sort-type]]
+   (assoc db :sort-chapter sort-type)))
+
+;; TODO: what is it???
 (register-handler
   :reset-seasons-and-chapter
   (fn [db _]
@@ -282,7 +380,7 @@
       (-> db
           (assoc :seasons-list saved-seasons)
           (assoc :chapters-list saved-chapters)))))
-
+;; TODO: what is it???
 (register-handler
   :save-seasons-and-chapters
   (fn [db _]
@@ -291,65 +389,6 @@
       (-> db
           (assoc :saved-seasons-list seasons)
           (assoc :saved-chapters-list chapters)))))
-
-(register-handler
-  :chapters-load
-  (fn [db [_ season-number {chapters :path}]]
-    (api-proxy
-      #(-> (rdb/download-json (get db :remote-db) chapters)
-           (.then (fn [chts] (dispatch [:chapters-load-success chts])))
-           (.catch (fn [err]
-                     (if (= (.-message err) "Network request failed")
-                       (dispatch [:show-network-error])
-                       (print err))))))
-    (-> db
-        (update :seasons-list #(->> %
-                                    (map-indexed (fn [index season]
-                                                   (assoc season :active? (= index season-number))))))
-        (assoc :chapters-list nil))))
-
-(register-handler
-  :chapters-load-success
-  (fn [db [_ chapters]]
-    (-> db
-        (assoc :chapters-list (->> chapters
-                                   (map-indexed #(assoc %2 :active? (= %1 0))))))))
-
-(register-handler
-  :chapters-load-error
-  (fn [db [_ error]]
-    (-> db
-        (assoc :chapters-list nil))))
-
-(register-handler
-  :chapter-load
-  (fn [db [_ number {srt :path}]]
-    (api-proxy
-      #(-> (rdb/download (get db :remote-db) srt)
-           (.then (fn [srt] (dispatch [:srt-load-success (parse-srt srt)])))
-           (.catch (fn [err]
-                     (if (= (.-message err) "Network request failed")
-                       (dispatch [:show-network-error])
-                       (print err))))))
-    (-> db
-        (update :chapters-list #(->> %
-                                     (map-indexed (fn [index chapter]
-                                                    (assoc chapter :active? (= index number))))))
-        (assoc :chapter nil)
-        (assoc :sort-chapter :by-rank))))
-
-(register-handler
-  :srt-load-success
-  (fn [db [_ chapter]]
-    (-> db
-        (assoc :chapter chapter))))
-
-(register-handler
-  :srt-load-error
-  (fn [db [_ error]]
-    (print error)
-    (-> db
-        (assoc :chapter nil))))

 (register-handler
   :toggle-search


Updated command line usage info

Updated command line usage info

--- src/spekl_package_manager/core.clj
+++ src/spekl_package_manager/core.clj
@@ -53,18 +53,20 @@
         options-summary
         ""
         "General Actions:"
-        "  install  Install any required specs and tools for this project"
+        "  install  Install any required specs and tools for this project. You may specify "
+        "           an optional argument that is a package name or a package name and a version"
+        "           of the package to install."
         "  help     Displays this message"
         ""
         "Check-Related Actions:"
-        "  add      Adds a new check to this project                     "
-        "  remove   Removes a named check from this project              "
-        "  check    Run the configured tools on the current project"
+        "  check    Run the configured tools on the current project. The checks will be run using the "
+        "           configured checks in the spekl.yml file. If an argument to this command is supplied, then"
+        "           only the named check will be run."
         ""
         "Specification-Related Actions:"
-        "  attach   Attaches a named specification to this project       "
-        "  release  Unattaches a named specification from this project   "
-        "  refresh  Checks the central repository for updates to any atttached specifications"
+        "  refresh  Checks the central repository for updates to any atttached specifications. This process "
+        "           normally happens during the checking of your project, however it can be invoked manually"
+        "           using this command."
         "  find     Searches spekl for specification libraries that might work for your current project"
         ""
         "Project-Related Actions:"
@@ -72,6 +74,7 @@
         "             project     Creates a new project that you can attach specs and checks to (default)"
         "             tool        Creates a new project for building a Spekl tool/check"
         "             specs       Creates a new project for writing a Spekl specification library."
+        "  extend   Create a new Spekl Project that extends another project. "
         ""
         "Package Management Actions:"
         "  list     Displays a list of available tools and specification libraries. May be one of:"
@@ -79,9 +82,9 @@
         "             specs       Displays a list of available specification libraries."
         "             tools       Displays a list of available verification tools (checks)."
         ""
-        "  publish  Contribute back the specs you've written for this project."
+        "  publish  Contribute back the current tool or specification project."
         ""
-        "For more information please see http://spekl.org/docs."]
+        "For more information please see http://spekl-project.org/docs."]
        (string/join \newline)))

@@ -89,11 +92,7 @@

 (def spekl-options
   ;; An option with a required argument
-  [["-p" "--port PORT" "Port number"
-    :default 80
-    :parse-fn #(Integer/parseInt %)
-    :validate [#(< 0 % 0x10000) "Must be a number between 0 and 65536"]]
-
+  [
    ["-d" "--dir DIRECTORY" "The effective project directory. Defaults to the current directory."
     :id :directory
     :default "."


[fixes #2447] correct ru translation of validation-amount-invalid-number string

--- src/status_im/translations/ru.cljs
+++ src/status_im/translations/ru.cljs
@@ -335,7 +335,7 @@
    :wallet-address-from-clipboard         "Использовать Адрес Из Буфера Обмена"
    :wallet-invalid-address                "Недействительный адрес: \n {{data}}"
    :wallet-browse-photos                  "Просмотреть Фотографии"
-   :validation-amount-invalid-number      "Сумма не действительна"
+   :validation-amount-invalid-number      "Сумма недействительна"
    :validation-amount-is-too-precise      "Слишком много чисел после запятой. Наименьшая сумма, которую вы можете отправить это 1 Wei (1x10^-18 ETH)"


Changed test to be always false

Changed test to be always false

--- tracer_test.clj
+++ tracer_test.clj
@@ -2,6 +2,6 @@
   (:require [clojure.test :refer :all]))

 (deftest f-test
-  (is (= 1 1)))
+  (is (= 1 2)))

 (run-tests)


add limit

add limit

--- build.boot
+++ build.boot
@@ -36,13 +36,13 @@
                              (quot (System/currentTimeMillis) 1000))]
     (condp = status
         200 {:code (decode-bot (:content (parse-string body true)))
-             :ratelimit-message (str "Note: You can pass a github API token to increase your rate limit\n\n"
+             :ratelimit-message (str (if-not token "Note: You can pass a github API token to increase your rate limit\n")
                                      "You have "
                                      x-ratelimit-remaining
-                                     " ramaining API calls"
-                                     "\nMax Limit: "
+                                     " remaining API calls"
+                                     "\nMax Rate Limit: "
                                      x-ratelimit-limit
-                                     "\nTime till refresh: "
+                                     "\nTime Till Refresh: "
                                      time-till-refresh " seconds")}
         401 (println "Invalid API Token")
         (println "Failed to retrive " username "/" repo "/bot.clj"))))
@@ -52,7 +52,7 @@
   [u username USERNAME  str  "github username"
    r repo     REPO      str  "bot repo"
    e energy   ENERGY    int  "energy"
-   f frames   FRAMES    int  "number of frames to process"
+   f frames   FRAMES    int  "number of frames to process (max 50)"
    t token    TOKEN     str  "github API token"]
   (let [{:keys [code ratelimit-message]} (get-bot-code-simulator username repo token)
         player {:_id "1"
@@ -67,15 +67,16 @@
                                           [a b p (gu/sanitize-player player) o b]
                                           [f f o o b o]
                                           [f b f o b o]]
-                            :players [player]}]
+                            :players [player]}
+        initial-frame-count (min 50 (or frames 1))]
     (println "Running Simulation...")

     (when code
       (loop [{:keys [clean-arena messages players] :as game-state} initial-game-state
-             frame-count (or frames 1)
+             frame-count initial-frame-count
              frame-display "Starting Arena"]

-        (println "\nFrame: " frame-display)
+        (println "\nFRAME: " frame-display)
         (au/pprint-arena clean-arena)
         (println (str "\n\nMessages: " (or messages {})
                       "\nEnergy: " (:energy (first players))))
@@ -86,4 +87,4 @@
           (recur
            ((comp finalize-frame process-frame initialize-frame) game-state)
            (dec frame-count)
-           (- frames (dec frame-count))))))))
+           (- initial-frame-count (dec frame-count))))))))


inc alpha version

inc alpha version

--- build.boot
+++ build.boot
@@ -1,5 +1,5 @@
 (set-env! :project 'wombats
-          :version "0.1.0-SNAPSHOT"
+          :version "1.0.0-alpha1"
           :source-paths #{"src" "test"}
           :resource-paths #{"src" "resources" "config"}
           :dependencies   '[;; Core Clojure libs


Bump test.chuck version

Bump test.chuck version

--- build.boot
+++ build.boot
@@ -5,7 +5,7 @@
                     [moxaj/macrowbar             "0.1.0"]

                     ;; test
-                    [com.gfredericks/test.chuck  "0.2.7"  :scope "test"]
+                    [com.gfredericks/test.chuck  "0.2.8"  :scope "test"]

                     ;; script
                     [adzerk/boot-test            "1.2.0"  :scope "test"]


fix windows regex

fix windows regex

--- build.boot
+++ build.boot
@@ -28,7 +28,7 @@
   (with-pre-wrap fileset
     (let [nm (io/file "node_modules")]
       (-> fileset
-        (add-resource (io/file ".") :include #{#"^node_modules/parinfer"})
+        (add-resource (io/file ".") :include #{#"^node_modules[\\\/]parinfer"})
         commit!))))

 (deftask testing []


CMR-2281 Removes unused :require

CMR-2281 Removes unused :require

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/dif10.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/dif10.clj
@@ -1,7 +1,6 @@
 (ns cmr.umm-spec.xml-to-umm-mappings.dif10
   "Defines mappings from DIF10 XML into UMM records"
-  (:require [cmr.common.date-time-parser :as dtp]
-            [cmr.umm-spec.json-schema :as js]
+  (:require [cmr.umm-spec.json-schema :as js]
             [cmr.umm-spec.simple-xpath :refer [select]]
             [camel-snake-kebab.core :as csk]
             [clojure.string :as string]


When body is an InputStream, ensure it gets closed at the end

--- ring-servlet/src/ring/util/servlet.clj
+++ ring-servlet/src/ring/util/servlet.clj
@@ -82,11 +82,10 @@
           (.print writer (str chunk))
           (.flush writer)))
     (instance? InputStream body)
-      (let [^InputStream b body]
-        (with-open [out (.getOutputStream response)]
-          (io/copy b out)
-          (.close b)
-          (.flush out)))
+      (with-open [out (.getOutputStream response)
+                  ^InputStream b body]
+        (io/copy b out)
+        (.flush out))
     (instance? File body)
       (let [^File f body]
         (with-open [stream (FileInputStream. f)]


lein-release plugin: bumped version from 0.1.1 to 0.1.2-SNAPSHOT for next development cycle

--- re-frame-simple/project.clj
+++ re-frame-simple/project.clj
@@ -1,4 +1,4 @@
-(defproject re-view/re-frame-simple "0.1.1"
+(defproject re-view/re-frame-simple "0.1.2-SNAPSHOT"

   :description "re-view syntax for re-frame"


added test with request violation

added test with request violation

--- test/clj_raml_tester/core_test.clj
+++ test/clj_raml_tester/core_test.clj
@@ -55,9 +55,6 @@
        (response {:id 1
                   :name "banana"}))
   (POST "/fruits" [:as request]
-        (assert
-          (= (get-in request [:body :name])
-             "orange"))
         (created "fake-url" {:id 2
                              :name "orange"}))
   (route/not-found "Not Found"))
@@ -214,5 +211,17 @@
         (wait-n-requests rtp 2)
         (full-api-coverage-assertions rtp 0)))))

-;; TODO add full API coverage with request violation
+(deftest full-api-coverage-invalid-request
+  (testing "full API coverage, invalid request"
+    (testing "with RAML file"
+      (with-open [rtp (start-proxy-with-raml-file)]
+        (full-api-tests "{\"kind\":\"fruit\"}")
+        (wait-n-requests rtp 2)
+        (full-api-coverage-assertions rtp 1)))
+    (testing "with RAML HTTP"
+      (with-open [rtp (start-proxy-with-raml-http)]
+        (full-api-tests "{\"kind\":\"fruit\"}")
+        (wait-n-requests rtp 2)
+        (full-api-coverage-assertions rtp 1)))))
+
 ;; TODO add test-report tests


threads now tagged by starting a message with /foo

--- src/chat/client/views/new_message.cljs
+++ src/chat/client/views/new_message.cljs
@@ -44,8 +44,9 @@

 (def engines
   [
+   ; /<tag-name>  ->  adds tag to message
    (fn [text thread-id]
-     (when-let [query (second (re-matches #"(?:.|\n)*#(\S*)" text))]
+     (when-let [query (second (re-matches #"^/(\S{1,})" text))]
        (let [thread-tag-ids (-> (store/id->thread thread-id)
                                 :tag-ids
                                 set)]
@@ -61,8 +62,7 @@
                         (dispatch! :tag-thread {:thread-id thread-id
                                                 :id (tag :id)}))
                       :message-transform
-                      (fn [text]
-                        (string/replace text #"( *#\S*)" ""))
+                      (fn [text] "")
                       :html
                       (fn []
                         (dom/div #js {:className "tag-match"}


uncomment

uncomment

--- src/clj/rumahsewa141/routes/member.clj
+++ src/clj/rumahsewa141/routes/member.clj
@@ -55,10 +55,9 @@
     (layout/render "member.html" (merge {:username username
                                          :section section
                                          :subsection subsection}
-                                        ;; (if (nil? get-content-fn)
-                                        ;;   nil
-                                        ;;   (get-content-fn))
-                                        ))))
+                                        (if (nil? get-content-fn)
+                                          nil
+                                          (get-content-fn))))))

 (defn settings-page [subsection req & [get-content-fn]]
   (member-page "settings" get-content-fn req subsection))


cleanup; private

cleanup; private

--- src/clojure/zensols/nlparse/locale.clj
+++ src/clojure/zensols/nlparse/locale.clj
@@ -13,7 +13,6 @@
 (def ^:private unicodes-inst (atom nil))
 (def ^:private unicode-to-locale-inst (atom nil))
 (def ^:private unicode-to-locale-vals-inst (atom nil))
-
 (defa- name-to-locale-fn-inst)

 (defn set-name-to-locale-fn
@@ -76,6 +75,16 @@
                      {lang-name loc}))))
           (remove (fn [m] (->> m vals first nil?)))
           (apply merge)))))
+
+(defn- print-unicode-range
+  ([]
+   (print-unicode-range (read-string (str "0x" "0600"))
+                        (read-string (str "0x" "06FF"))))
+  ([start end]
+   (->> (range start end)
+        (map #(Character/toString (char %)))
+        (apply str)
+        println)))

 (defn- unicode-ranges
   "Return a map with values each with `:name` of a Unicode
@@ -159,10 +168,10 @@
            (concat (map #(hash-map (:name %) %) non-lang-sets))
            (apply merge)))))

-(defn unicodes []
+(defn- unicodes []
   (swap! unicodes-inst #(or % (create-unicodes))))

-(defn locale-to-unicode []
+(defn- locale-to-unicode []
   (->> (unicodes)
        vals
        (map (fn [{:keys [loc] :as m}]
@@ -185,7 +194,7 @@
        (apply concat)
        (apply merge)))

-(defn unicode-to-locale []
+(defn- unicode-to-locale []
   (swap! unicode-to-locale-inst #(or % (create-unicode-to-locale))))

 (defn- unicode-to-locale-vals []


Gave the timing panel some layout love

Gave the timing panel some layout love

--- src/day8/re_frame_10x/view/timing.cljs
+++ src/day8/re_frame_10x/view/timing.cljs
@@ -2,14 +2,15 @@
   (:require [devtools.prefs]
             [devtools.formatters.core]
             [mranderson047.re-frame.v0v10v2.re-frame.core :as rf]
-            [day8.re-frame-10x.utils.re-com :as rc]
+            [day8.re-frame-10x.utils.re-com :as rc :refer [css-join]]
             [day8.re-frame-10x.common-styles :as common]
             [day8.re-frame-10x.view.components :as components]))

 (def timing-styles
   [:#--re-frame-10x--
    [:.timing-details
-    {:margin-top common/gs-31s}]
+    {:margin-top   common/gs-31s
+     :margin-right common/gs-19s}]
    [:.timing-details--line
     {:margin "1em 0"}]

@@ -28,12 +29,13 @@
      :width            "63px"}]

    [".timing-elapsed-panel"
-    {:padding "12px 12px 12px 0"
-     :margin  common/gs-7s}]
+    {:padding "12px 12px 12px 0px"
+     :margin  (css-join common/gs-7s "0px")}]
    [".timing-part-panel"
     (merge (common/panel-style "3px")
-           {:padding "12px"
-            :margin  common/gs-7s})]
+           {:padding  common/gs-12s
+            :margin   (css-join common/gs-7s "0px")
+            :overflow "hidden"})]
    ])

 (defn timing-tag [label]
@@ -51,9 +53,7 @@
                             (= time 0) (str "0ms")
                             (< time 0.1) (str "<0.1ms")
                             (< time 1) (str (.toFixed time 1) "ms")
-                            (some? time) (str (js/Math.round time) "ms")
-
-                            )]]])
+                            (some? time) (str (js/Math.round time) "ms"))]]])

 (defn render []
   (let [timing-data-available? @(rf/subscribe [:timing/data-available?])
@@ -75,22 +75,19 @@
                    :gap common/gs-12s
                    :class "timing-part-panel"
                    :align :center
-                   :children
-                   [[rc/v-box
-                     :align :center
-                     :width common/gs-81s
-                     :children [[:span "event"] [:span "processing"]]]
-                    [timing-section "total" (:timing/event-total event-processing-time)]
-                    [:span "="]
-                    [timing-section "handler" (:timing/event-handler event-processing-time)]
-                    [:span "+"]
-                    [timing-section "effects" (:timing/event-effects event-processing-time)]
-                    #_[:span "+"]
-                    #_[timing-section "other int." (:timing/event-interceptors event-processing-time)]
-                    [:span "+"]
-                    [timing-section "misc" (:timing/event-misc event-processing-time)]
-
-                    ]]
+                   :children [[rc/v-box
+                               :align :center
+                               :width common/gs-81s
+                               :children [[:span "event"] [:span "processing"]]]
+                              [timing-section "total" (:timing/event-total event-processing-time)]
+                              [:span "="]
+                              [timing-section "handler" (:timing/event-handler event-processing-time)]
+                              [:span "+"]
+                              [timing-section "effects" (:timing/event-effects event-processing-time)]
+                              #_[:span "+"]
+                              #_[timing-section "other int." (:timing/event-interceptors event-processing-time)]
+                              [:span "+"]
+                              [timing-section "misc" (:timing/event-misc event-processing-time)]]]
                   (doall
                     (for [frame (range 1 (inc @(rf/subscribe [:timing/animation-frame-count])))
                           :let [frame-time @(rf/subscribe [:timing/animation-frame-time frame])]]


Kovaa kamaA!

Kovaa kamaA!

--- src/distributed_transducers_poc/rc.clj
+++ src/distributed_transducers_poc/rc.clj
@@ -1,6 +1,6 @@
 (ns distributed-transducers-poc.rc
   (:require [cheshire.core :refer [generate-string parse-string parse-stream]]
-            [clojure.core.async :refer [go]]
+            [clojure.core.async :refer [chan go go-loop >! <! <!!]]
             [clojure.java.io :as io]
             [serializable.fn :as s])
   (:import [com.amazonaws ClientConfiguration]
@@ -67,6 +67,14 @@
         (.getBody)
         (to-json))))

+(defn receive-messages [queue-url wait-in-seconds]
+  (let [to-json #(parse-string % true)
+        raw-messages (-> (.receiveMessage sqs-client (-> (ReceiveMessageRequest.)
+                                        (.withQueueUrl queue-url)
+                                        (.withWaitTimeSeconds (int wait-in-seconds))))
+        (.getMessages))]
+    (map #(-> % .getBody to-json) raw-messages)))
+
 (defn delete-queue [queue-url]
   (.deleteQueue sqs-client queue-url))

@@ -76,17 +84,89 @@
           response {:result (f (:param payload))}]
       (send-message out-queue response))))

+(defn message-loop [f in-queue out-queue]
+  (go-loop []
+     (let [messages (receive-message in-queue 5)]
+       (doseq [message (filter #(= "process" (:type "message")) messages)]
+          (send-message out-queue {:result (f (:param message))}))
+       (when-not (some #(= "stop" (:type %)) messages)
+         (recur)))))
+
+(defn uber-queue [key-fn]
+  {:next-items []
+   :next-index 0
+   :key-fn key-fn
+   :queue (java.util.PriorityQueue. 10 (comparator (fn [x y] (< (key-fn x) (key-fn y)))))})
+
+(defn add [{:keys [next-items next-index key-fn queue] :as uber} element]
+  (.add queue element)
+  (if (= next-index (key-fn (.peek queue)))
+    (do
+      (.poll queue)
+      {:next-items (conj next-items element)
+       :next-index (inc next-index)
+       :key-fn key-fn
+       :queue queue})
+    uber))
+
+(defn add-all [{:keys [next-items next-index key-fn queue] :as uber} elements]
+  (if (empty? elements)
+    uber
+    (add-all (add uber (first elements)) (drop 1 elements))))
+
+(defn vittu [uber]
+  (update uber :next-items (partial drop 1)))
+
+(defn head [{:keys [next-items]}]
+  (first next-items))
+
+(defn send-ok-messages [c buffer]
+  (if-let [result (head buffer)]
+    (do
+      (go (>! c result))
+      (send-ok-messages c (vittu buffer)))
+    buffer))
+
+(defn handler-loop [in-queue max-index]
+  (let [buffer (uber-queue :index)
+        ret (chan 10)]
+    (go-loop [next-index 0
+              buffer (uber-queue :index)]
+             (when (< next-index max-index)
+               (let [messages (receive-messages in-queue 4)]
+                 (recur (inc next-index)
+                        (send-ok-messages ret (add-all buffer messages))))))
+    ret))
+
 (defn uuid [] (str (java.util.UUID/randomUUID)))

+;(create-queue (uuid))
+
+;(comment
+(defn lol []
+ (let [queue (create-queue (uuid))
+      a (handler-loop queue 4)]
+  (println (send-message queue {:index 0 :result "a"}))
+  (send-message queue {:index 2 :result "b"})
+  (send-message queue {:index 1 :result "b"})
+  (send-message queue {:index 3 :result "b"})
+  [(<!! a) (<!! a) (<!! a) (<!! a)]))
+;)
+
+;(lol)
+
+
 (defn queue-reduce [f xs in-queue out-queue]
-  (let [batches (partition-all 1024 xs)]
-    (reduce (fn [acc batch]
-              (send-message in-queue {:param batch})
-              (message-handler #(reduce f %) in-queue out-queue)
-              (let [response (receive-message out-queue 5)]
-                (f acc (:result response))))
-            0
-            batches)))
+  (message-loop #(reduce f %) in-queue out-queue)
+  (let [batches (partition-all 1024 xs)
+        response (reduce (fn [acc batch]
+                           (send-message in-queue {:type "process" :param batch})
+                           (let [response (receive-message out-queue 5)]
+                             (f acc (:result response))))
+                         0
+                         batches)]
+    (send-message in-queue {:type "stop"})
+    response))

 (comment
 (let [in (create-queue (uuid))


Update boot installer comment for latest version

--- src/docker_clojure/dockerfile/boot.clj
+++ src/docker_clojure/dockerfile/boot.clj
@@ -17,9 +17,8 @@
       (concat
        [""
         "# NOTE: BOOT_VERSION tells the boot.sh script which version of boot to install"
-        "# on its first run. We always download version 2.7.2 of boot.sh because it is"
-        "# just the installer script. When/if the boot project releases a new installer"
-        "# script we will update this to use it."
+        "# on its first run. We always download the latest version of boot.sh because"
+        "# it is just the installer script."
         "RUN mkdir -p $BOOT_INSTALL \\"
         "  && wget -q https://github.com/boot-clj/boot-bin/releases/download/latest/boot.sh \\"
         "  && echo \"Comparing installer checksum...\" \\"


Erm... clean up language

Erm... clean up language

--- src/strange_coop/components/config.clj
+++ src/strange_coop/components/config.clj
@@ -17,7 +17,7 @@
 (def defaults
   {:nrepl-port 9999
    :satellite {:url "http://localhost:3000/"
-               :credentials {:username "fuckshit" :password "stack"}}
+               :credentials {:username "bobjones" :password "xyz"}}
    :channels {:buffer-size 100}
    :day-state-machine {:day-threshold   0.13
                        :night-threshold 0.03}


Added text for databases and Neo4j to the main page

--- src/webapp/client/views/main_view.cljs
+++ src/webapp/client/views/main_view.cljs
@@ -30,7 +30,7 @@
   (el :div {} [
         (header-text "Welcome to Clojure on Coils" )
         (body-text "Clojure on Coils is a Clojure based webapp framework for
-                   single page database backed webapps")
+                   single page database or Neo4j backed webapps")
 ]))

@@ -67,7 +67,24 @@

Both Closurescript anfd Google closure compile down to native Javascript, so they are both cross platform.
")
 ]))

+(defn database-html []
+    (el :div {} [
+        (header-text "Database" )
+        (body-html "

+                   Clojure on Coils can connect to any relational database backend using a unique technology where the developer can
+                   synchronously program database calls from the web client to the database. Under the covers the code is translated to
+                   server side code.
+
")
+]))

+(defn neo4j-html []
+    (el :div {} [
+        (header-text "Neo4j" )
+        (body-html "

+                   Neo4j is a leading graph database. Clojure for Coils is developing first class client side support for Neo4j Cypher
+                   queries. Watch this space!
+
")
+]))

 (define-action
@@ -85,6 +102,8 @@
        {:text "Technologies" :html (technologies-html)}
        {:text "Clojure" :html (clojure-html)}
        {:text "Clojurescript" :html (clojuresript-html)}
+       {:text "Database" :html (database-html)}
+       {:text "Neo4j" :html (neo4j-html)}
    )
 )


using vconstruct

using vconstruct

--- test/celestial/integration/proxmox.clj
+++ test/celestial/integration/proxmox.clj
@@ -3,7 +3,7 @@
   (:use clojure.test
         proxmox.provider
         [celestial.common :only (config slurp-edn)]
-        [celestial.model :only (create-vm)]
+        [celestial.model :only (vconstruct)]
         [celestial.fixtures :only (spec local-prox)]
         )
   (:import
@@ -14,13 +14,13 @@

 (deftest ^:proxmox non-existing
   (with-redefs [config local-prox]
-    (let [ct (create-vm fake-id)]
+    (let [ct (vconstruct fake-id)]
     (.stop ct)
     (.delete ct))))

 (deftest ^:proxmox full-cycle
   (with-redefs [config local-prox]
-   (let [ct (create-vm spec)]
+   (let [ct (vconstruct spec)]
     (.stop ct)
     (.delete ct)
     (.create ct)


Extend test for parsing durations

Extend test for parsing durations

--- test/cider_ci/utils/tests/duration.clj
+++ test/cider_ci/utils/tests/duration.clj
@@ -5,6 +5,17 @@
     ))

 (deftest duration
+
+  (is (instance? Double (parse-string-to-seconds "1 Second")))
+
+  (is (thrown? Exception (parse-string-to-seconds "1 hourglass" )))
+
+  (is (thrown? Exception (parse-string-to-seconds "Blah" )))
+
+  (is (= 1.0 (parse-string-to-seconds "1 Second")))
+
+  (is (= 3600.333 (parse-string-to-seconds "1 hour and 333 milliseconds")))
+
   (is (=
        (parse-string-to-seconds "1 Year and 3 Months and 3 weeks, 3 days , 7 minutes plus 1 second and 3 milliseconds")
        (+ (* 1 YEAR)
@@ -13,4 +24,8 @@
           (* 3 DAY)
           (* 7 MINUTE)
           (* 1 SECOND)
-          (* 3 MILLISECOND)))))
+          (* 3 MILLISECOND))))
+
+  )
+
+


Addressed lint error.

Addressed lint error.

--- test/clj/cmr/client/testing/runner.clj
+++ test/clj/cmr/client/testing/runner.clj
@@ -1,5 +1,6 @@
 (ns cmr.client.testing.runner
   (:require
+   [clojure.string :as string]
    [cmr.client.tests]
    [ltest.core :as ltest])
   (:gen-class))
@@ -17,7 +18,7 @@
 (defn print-header
   []
   (println)
-  (println (apply str (repeat 80 "=")))
+  (println (string/join (repeat 80 "=")))
   (println "CMR Client Test Runner")
   (println (apply str (repeat 80 "=")))
   (println))


write test for intword function

write test for intword function


✅ Fix test data leaking

✅ Fix test data leaking

Why:
- Once it happened in the Docker build that after the tests had been ran,
  the app-cds-setup failed because the test_territorybro.gis_change_log
  table contained rows:

territorybro=# select * from test_territorybro.gis_change_log;
 id |     schema      |   table   |   op   |     user     |             time              | old |                                                                             new                                                                             | processed | replacement_id
----+-----------------+-----------+--------+--------------+-------------------------------+-----+-------------------------------------------------------------------------------------------------------------------------------------------------------------+-----------+----------------
  1 | test_gis_schema | subregion | INSERT | territorybro | 2020-04-24 18:04:37.431867+00 |     | {"id": "87023905-fe8b-40c6-928e-554d9ef4a605", "name": "Somewhere", "location": "MULTIPOLYGON(((30 20,45 40,10 40,30 20)),((15 5,40 10,10 20,5 10,15 5)))"} | f         |
(1 row)

    ...which lead to the event validation failing on startup to an event
    with missing congregation ID:

{:command/type :region.command/create-region,
 :command/system "territory-bro.gis.gis-change",
 :command/time #object[java.time.Instant 0x42018e32 "2020-04-24T18:04:37.431867Z"],
 :congregation/id nil,
 :gis-change/id 1,
 :region/id #uuid "87023905-fe8b-40c6-928e-554d9ef4a605",
 :region/location "MULTIPOLYGON(((30 20,45 40,10 40,30 20)),((15 5,40 10,10 20,5 10,15 5)))",
 :region/name "Somewhere"}

--- test/territory_bro/gis/gis_db_test.clj
+++ test/territory_bro/gis/gis_db_test.clj
@@ -26,6 +26,8 @@
       (.migrate schema)
       (f)
       (finally
+        (db/with-db [conn {}]
+          (jdbc/execute! conn ["DELETE FROM gis_change_log"]))
         (.clean schema)))))

 (defn test-schema-fixture [f]


api context

api context

--- cloc-web/src/cloc_web/core.clj
+++ cloc-web/src/cloc_web/core.clj
@@ -13,12 +13,14 @@
 (defroutes app
   (GET "/:user/:repo/:branch/svg_badge" {params :params} (get-svg-badge params))

-  (POST "/user/:repo/register" {params :params} (register params))
-  (PATCH "/user/:repo/display_lang" {params :params body :body} (update-display-lang params body))
-  (GET "/user/registered_repos" {params :params} (list-registered-repos params))
+  (context "/user" []
+    (POST "/:repo/register" {params :params} (register params))
+    (PATCH "/:repo/display_lang" {params :params body :body} (update-display-lang params body))
+    (GET "/registered_repos" {params :params} (list-registered-repos params)))

-  (GET "/github/auth" auth)
-  (GET "/github/auth_callback" {params :params} (auth-callback params)))
+  (context "github" []
+    (GET "/auth" auth)
+    (GET "/auth_callback" {params :params} (auth-callback params))))

 (def handlers
   (-> (handler/site app)


fix _gaq.push before the script has finished loading

--- frontend/analytics/google.cljs
+++ frontend/analytics/google.cljs
@@ -2,8 +2,9 @@
   (:require [frontend.utils :as utils :include-macros true]))

 (defn push [args]
-  (let [gaq (aget js/window "_gaq")]
-     ((aget gaq "push") (clj->js args))))
+  (let [gaq (aget js/window "_gaq")
+        push (aget gaq "push")]
+     (.call push gaq (clj->js args))))

 (defn track-event [& args]
   (utils/swallow-errors (push (cons "_trackEvent" args))))