can generate empty pcoll with generate input

--- src/clj/datasplash/core.clj
+++ src/clj/datasplash/core.clj
@@ -625,7 +625,11 @@
                  (Create/empty coder)
                  (Create/of coll))]
      (apply-transform p ptrans base-schema opts)))
-  ([coll p] (generate-input coll {} p)))
+  ([coll p] (generate-input coll {} p))
+  ([p] (let [opts (merge {:coder (make-nippy-coder)}
+                     (assoc options :label :generate-input))
+         ptrans (Create/empty (:coder opts))]
+     (apply-transform p ptrans base-schema opts))))

 (definterface ICombineFn
   (getReduceFn [])


clean up code

clean up code

--- src/clj_opengrok/search.clj
+++ src/clj_opengrok/search.clj
@@ -4,12 +4,10 @@
    (java.util ArrayList List)
    (java.util.concurrent Executors ExecutorService)
    (org.apache.lucene.document Document)
-   (org.apache.lucene.index DirectoryReader IndexableField IndexReader
-                            MultiReader)
+   (org.apache.lucene.index DirectoryReader IndexReader MultiReader)
    (org.apache.lucene.search IndexSearcher Query ScoreDoc Sort SortField
                              SortField$Type TopFieldDocs)
    (org.apache.lucene.store FSDirectory)
-   (org.opensolaris.opengrok.analysis Definitions)
    (org.opensolaris.opengrok.configuration Project RuntimeEnvironment)
    (org.opensolaris.opengrok.search Hit QueryBuilder)
    (org.opensolaris.opengrok.search.context Context HistoryContext)
@@ -31,23 +29,23 @@
 (defn- number-processor []
   (.availableProcessors (Runtime/getRuntime)))

-(defn- get-root-path ^String []
+(defn- root-path ^String []
   (.getSourceRootPath env))

-(defn- get-data-root-path ^String []
+(defn- data-root-path ^String []
   (.getDataRootFile env))

 (defn- hits-per-page []
   (.getHitsPerPage env))

-(defn- get-sort ^Sort [opts]
+(defn- get-sort [opts]
   (let [sort (:sort opts)]
     (cond
       (= sort "date") (Sort. (SortField. "date" SortField$Type/STRING true))
       (= sort "path") (Sort. (SortField. "fullpath" SortField$Type/STRING))
       :else (Sort/RELEVANCE))))

-(defn- query-builder ^QueryBuilder [opts]
+(defn- query-builder [opts]
   (let [qb (QueryBuilder.)]
     (doto qb
       (.setDefs (:def opts))
@@ -61,7 +59,7 @@
 (defn- subreaders [projects]
   (map #(DirectoryReader/open
          (FSDirectory/open
-          (File. (str (get-data-root-path)
+          (File. (str (data-root-path)
                       "/index" (.getPath ^Project %))))) projects))

 (defn- search-multi-database [projects]
@@ -78,7 +76,7 @@
 (defn- search-single-database []
   (IndexSearcher. (DirectoryReader/open
                    (FSDirectory/open
-                    (File. (str (get-data-root-path) "/index"))))))
+                    (File. (str (data-root-path) "/index"))))))

 (defn- searcher []
   (if (has-projects?)
@@ -87,7 +85,7 @@

 (defn- fdocs [^IndexSearcher searcher ^Query query opts]
   (.search searcher query nil
-           (int (* (:page opts) (hits-per-page))) (get-sort opts)))
+           (* (:page opts) (hits-per-page)) (get-sort opts)))

 (defn- total-page [^TopFieldDocs fdocs]
   (let [total-hits (.totalHits fdocs)]
@@ -97,15 +95,8 @@
   (when-not (:quiet opts)
     (println (format "clj-opengrok> %s/%s" (:page opts) (:total-page opts)))))

-(defn- documents [^IndexSearcher searcher ^TopFieldDocs fdocs opts]
-  (let [hpp (hits-per-page)
-        n (* (dec (:page opts)) hpp)]
-    (page-info opts)
-    (map #(.doc searcher (.doc ^ScoreDoc %))
-         (take hpp (drop n (.scoreDocs fdocs))))))
-
 (defn- print-hit [^Hit hit]
-  (let [file (.getAbsolutePath (File. (get-root-path) (.getPath hit)))
+  (let [file (.getAbsolutePath (File. (root-path) (.getPath hit)))
         line-num (.getLineno hit)
         line (.getLine hit)]
     (println (str file ":" line-num ": "
@@ -121,12 +112,12 @@
       (when (= "p" (.get doc "t"))
         (.getContext scontext
                      (InputStreamReader.
-                      (FileInputStream. (str (get-root-path) file)))
+                      (FileInputStream. (str (root-path) file)))
                      nil nil nil file nil false false hit))

       (not (.isEmpty hcontext))
       (.getContext hcontext
-                   (str (get-root-path) file) file hit)
+                   (str (root-path) file) file hit)

       :else
       (.add hit (Hit. file "..." "1" false true)))
@@ -134,29 +125,32 @@
     (doseq [h hit]
       (print-hit h))))

-(defn- hits [docs ^Query query ^QueryBuilder qb]
-  (remove nil? (flatten (map #(hit % query qb) docs))))
-
 (defn- close [^IndexSearcher searcher]
   (IOUtils/close ^IndexReader (.getIndexReader searcher))
   (when @executor
     (.shutdown ^ExecutorService @executor)))

+(defn- document [^IndexSearcher searcher ^TopFieldDocs fdocs
+                 ^Query query ^QueryBuilder qb opts]
+  (let [hpp (hits-per-page)
+        n (* (dec (:page opts)) hpp)
+        scores (take hpp (drop n (.scoreDocs fdocs)))]
+    (doseq [score scores]
+      (hit (.doc searcher (.doc ^ScoreDoc score)) query qb))
+    (close searcher)))
+
 (defn- search-page [opts]
-  (let [qb (query-builder opts)
+  (let [qb ^QueryBuilder (query-builder opts)
         query (.build qb)
         searcher (searcher)
         fdocs (fdocs searcher query opts)
-        total-page (total-page fdocs)
-        documents (documents searcher fdocs
-                             (assoc opts :total-page total-page))
-        hits (hits documents query qb)
-        close (close searcher)]
+        total-page (total-page fdocs)]
+    (page-info (assoc opts :total-page total-page))
+    (document searcher fdocs query qb opts)
     {:total-page total-page :page (:page opts)}))

 (defn search [opts]
   (read-configuration (:conf opts))
-  (let [context (search-page (assoc opts :page 1))
-        total-page (:total-page context)]
-    (doseq [page (range 2 (inc total-page))]
+  (let [context (search-page (assoc opts :page 1))]
+    (doseq [page (range 2 (inc (:total-page context)))]
       (search-page (assoc opts :page page)))))


Revert a misleading simplification

Revert a misleading simplification

--- src/cljam/io/vcf/writer.clj
+++ src/cljam/io/vcf/writer.clj
@@ -32,7 +32,7 @@

 (defn- nil->dot
   [s]
-  (or s "."))
+  (if (nil? s) "." s))

 (defn- write-line
   [^BufferedWriter bwtr ^String s]


Put graphs side-by-side for easier comparison and more content above the fold.

--- src/cljs/om_sente/core.cljs
+++ src/cljs/om_sente/core.cljs
@@ -197,7 +197,7 @@
 (defn line-graph
   "Example from http://www.janwillemtulp.com/2011/04/01/tutorial-line-chart-in-d3/"
   [raw-data]
-  (let [h 200 w 960 m 30
+  (let [h 380 w 480 m 30
         d (clj->js raw-data)
         y-scale (.. js/d3 -scale linear
                     (domain #js [(apply max raw-data) 0])
@@ -273,7 +273,7 @@
                   (line-graph (vec (make-target (:data/text app))))))
     om/IRender
     (render [this]
-            (dom/div #js {:style #js {:height 250}
+            (dom/div #js {:style #js {:height 400 :float "right" :width "50%"}
                           :react-key "d3-node" ;; ensure React knows this is non-reusable
                           :ref "d3-node"       ;; label it so we can retrieve it via get-node
                           :id "d3-node"}))))   ;; set id so D3 can find it!
@@ -313,7 +313,7 @@
                   (nv-line-graph (mapv (fn [a b] {:y a :x b}) (make-target (:data/text app)) (range)))))
     om/IRender
     (render [this]
-            (dom/div #js {:style #js {:height 400}
+            (dom/div #js {:style #js {:height 400 :float "left" :width "50%"}
                           :react-key "nv-node"
                           :id "nv-node"}
                      ;; add the SVG node once, NVD3 updates the data via transition
@@ -331,7 +331,8 @@
                    (om/build text-sender app {})
                    (om/build animated-bar-graph app {})
                    (om/build d3-test app {})
-                   (om/build nvd3-test app {})]))))
+                   (om/build nvd3-test app {})
+                   [:div {:style {:clear "both"}}]]))))

 (defn application
   "Component that represents our application. Maintains session state.


simplify the store

simplify the store

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -32,8 +32,7 @@
          :help false}))

 (def current-turn (reaction (game/current-turn (:games @app-state))))
-(def board (reaction (turn/get-board @current-turn)))
-(def scores (reaction (turn/get-scores @current-turn)))
+(def current-board (reaction (turn/get-board @current-turn)))
 (def current-player (reaction (turn/get-player @current-turn)))

@@ -49,7 +48,7 @@

 (defn- handle-ai! []
   ;; TODO - Find a way to cache the cells-strenght as it was done before
-  (let [move (ai/best-move (ai/compute-cells-strength @board) @current-turn @current-player)]
+  (let [move (ai/best-move (ai/compute-cells-strength @current-board) @current-turn @current-player)]
     (play-game-turn! move)))

 (defn- handle-game-event!


update code

update code

--- src/clojure/nossal/data.clj
+++ src/clojure/nossal/data.clj
@@ -99,7 +99,7 @@
              :description "💲 Ganhe R$10,00 de desconto em 2 primeiras viagens! ✅"
              :text [:p "Ganhe " [:span.value "R$10,00"]" de desconto nas suas " [:strong "2 primeiras"] " corridas! " [:ruby "🎉 " [:rt "ta-da!"]]
                      [:small "Este cupom pode ser utilizado duas vezes por pessoa, nas suas primeiras viagens. São " [:span.value "R$20,00"] " de desconto em duas viagens."]]}
-   "99"     {:code "qlP2zNrIwOpOY"
+   "99"     {:code "qlP3zJuETY3Ar"
              :title "99"
              :url "https://d.didiglobal.com/qlP3zJuETY3Ar?t=copyLink"
              :description "💲 Ganhe R$15,00 de desconto na primeira corrida 99 (99POP também)! ✅"


make tag autocomplete work with multiple lines

--- src/chat/client/new-message.cljs
+++ src/chat/client/new-message.cljs
@@ -25,12 +25,12 @@
             thread-tag-ids (-> (store/id->thread (config :thread-id))
                                :tag-ids
                                set)
-            partial-tag (second (re-matches #".*#(.*)" text))
+            partial-tag (second (re-matches #"(?:.|\n)*#(.*)" text))
             results (->> (store/all-tags)
                          (remove (fn [t]
                                    (contains? thread-tag-ids (t :id))))
                          (filter (fn [t]
-                                   (re-matches (re-pattern (str ".*" partial-tag ".*")) (t :name)))))
+                                   (not= -1 (.indexOf (t :name) partial-tag)))))
             highlight-next!
             (fn []
               (om/update-state! owner :highlighted-result-index


return response

return response

--- src/clj/dokkaa_builder/route.clj
+++ src/clj/dokkaa_builder/route.clj
@@ -25,11 +25,12 @@
         ps (Integer. (or (get-in req [:params :ps]) 1))
         port-bind-to (+ (rand-int 1000) 10000)]
     (if user
-      (apps/create app-name user image
-                   :tag tag
-                   :command command
-                   :port port
-                   :ps ps)
+      {:status 200
+       :body (j/encode (apps/create app-name user image
+                                    :tag tag
+                                    :command command
+                                    :port port
+                                    :ps ps))}
       {:status 401, :body "token is invalid"})))

 (defn update-app [req]
@@ -40,7 +41,8 @@
         token (get-in req [:params :token])
         user (auth/token->user token)]
     (if user
-      (apps/delete app-name user)
+      {:status 200
+       :body (j/encode (apps/delete app-name user))}
       {:status 401, :body "token is invalid"})))

 (defn logs [req]


fiddle with namespace context

fiddle with namespace context

--- src/clj_money/import/gnucash.clj
+++ src/clj_money/import/gnucash.clj
@@ -45,7 +45,7 @@
                        identity)
         raw-value ($x:text? xpath node)
         value (if raw-value
-                (transform-fn raw-value)
+                 (transform-fn raw-value)
                 default)]
     (if (nil? value)
       result
@@ -53,7 +53,8 @@

 (defn- node->model
   [node attributes]
-  (reduce (partial process-node-attribute node) {} attributes))
+  (with-namespace-context namespace-map
+    (reduce (partial process-node-attribute node) {} attributes)))

 (def ^:private account-types-map
   {"ASSET"      :asset
@@ -83,17 +84,16 @@

 (defn- node->account
   [node]
-  (with-namespace-context namespace-map
-    (let [account (node->model node account-attributes)]
-      (-> account
-          (assoc :commodity {:exchange (when-let [exchange (:commodity-exchange account)]
-                                         (-> exchange
-                                             s/lower-case
-                                             keyword))
-                             :symbol (:commodity-symbol account)})
-          (dissoc :commodity-exchange :commodity-symbol)
-          (with-meta {:record-type :account
-                      :ignore? (ignored-accounts (:name account))})))))
+  (let [account (node->model node account-attributes)]
+    (-> account
+        (assoc :commodity {:exchange (when-let [exchange (:commodity-exchange account)]
+                                       (-> exchange
+                                           s/lower-case
+                                           keyword))
+                           :symbol (:commodity-symbol account)})
+        (dissoc :commodity-exchange :commodity-symbol)
+        (with-meta {:record-type :account
+                    :ignore? (ignored-accounts (:name account))}))))

 (defmethod process-node :gnc:account
   [node]
@@ -128,8 +128,7 @@

 (defn- node->budget-item-period
   [node]
-  (with-namespace-context namespace-map
-    (node->model node budget-item-period-attributes)))
+  (node->model node budget-item-period-attributes))

 (defn- node->budget-item
   [node]
@@ -143,10 +142,11 @@

 (defmethod process-node :gnc:budget
   [node]
-  (-> node
-      (node->model budget-attributes)
-      (assoc :items (map node->budget-item ($x "bgt:slots/slot" node)))
-      (with-meta {:record-type :budget})))
+  (with-namespace-context namespace-map
+    (-> node
+        (node->model budget-attributes)
+        (assoc :items (map node->budget-item ($x "bgt:slots/slot" node)))
+        (with-meta {:record-type :budget}))))

 (def ^:private commodity-attributes
   [{:attribute :exchange
@@ -172,12 +172,11 @@

 (defn- node->commodity
   [node]
-  (with-namespace-context namespace-map
-    (let [commodity (node->model node commodity-attributes)]
-      (when (not= :template (:exchange commodity))
-        (-> commodity
-            refine-commodity
-            (with-meta {:record-type :commodity}))))))
+  (let [commodity (node->model node commodity-attributes)]
+    (when (not= :template (:exchange commodity))
+      (-> commodity
+          refine-commodity
+          (with-meta {:record-type :commodity})))))

 (defmethod process-node :gnc:commodity
   [node]
@@ -225,10 +224,7 @@

 (defn- node->transaction-item
   [node]
-  ; I'm not sure why I need to add the namespace
-  ; context again here
-  (with-namespace-context namespace-map
-    (node->model node transaction-item-attributes)))
+  (node->model node transaction-item-attributes))

 (def ^:private transaction-attributes
   [{:attribute :transaction-date
@@ -250,20 +246,21 @@

 (defn- append-trading-attributes
   [transaction node]
-  (if (= :buy (:action transaction))
-    (let [commodity-item-node (first ($x "trn:splits/trn:split[split:action = \"Buy\"]" node))
-          commodity-account-node (first ($x (format "//gnc:book/gnc:account[act:id = \"%s\"]"
-                                                    ($x:text "split:account" commodity-item-node))
-                                            node))
-          symbol ($x:text "act:commodity/cmdty:id" commodity-account-node)
-          exchange (keyword (s/lower-case ($x:text "act:commodity/cmdty:space" commodity-account-node)))]
-      (assoc transaction
-             :shares (parse-decimal ($x:text "split:quantity" commodity-item-node))
-             :commodity-account-id ($x:text "split:account" commodity-item-node)
-             :account-id ($x:text "act:parent" commodity-account-node)
-             :symbol symbol
-             :exchange exchange))
-    transaction))
+  (with-namespace-context namespace-map
+    (if (= :buy (:action transaction))
+      (let [commodity-item-node (first ($x "trn:splits/trn:split[split:action = \"Buy\"]" node))
+            commodity-account-node (first ($x (format "//gnc:book/gnc:account[act:id = \"%s\"]"
+                                                      ($x:text "split:account" commodity-item-node))
+                                              node))
+            symbol ($x:text "act:commodity/cmdty:id" commodity-account-node)
+            exchange (keyword (s/lower-case ($x:text "act:commodity/cmdty:space" commodity-account-node)))]
+        (assoc transaction
+               :shares (parse-decimal ($x:text "split:quantity" commodity-item-node))
+               :commodity-account-id ($x:text "split:account" commodity-item-node)
+               :account-id ($x:text "act:parent" commodity-account-node)
+               :symbol symbol
+               :exchange exchange))
+      transaction)))

 (defmethod process-node :gnc:transaction
   [node]


move main panel declaration below

move main panel declaration below

--- src/cljs/just_married/views.cljs
+++ src/cljs/just_married/views.cljs
@@ -5,22 +5,6 @@
    [just-married.payment-views :as payment-views]
    [just-married.countdown :as countdown]
    [just-married.settings :as settings]))
-
-(declare find-us)
-(declare rvsp)
-(declare accommodation)
-(declare contacts)
-(declare story)
-(declare gifts)
-
-(def SECTIONS
-  {:story story
-   :find-us find-us
-   ;; :rvsp rvsp
-   ;; :gifts gifts
-   ;;:accomodation accommodation
-   ;;:contacts contacts
-   })

 (defn get-browser-language
   "Return the language set in the browser, assuming that
@@ -31,29 +15,6 @@
     (if (clojure.string/starts-with? browser-lang "it")
       :italian
       :english)))
-
-;; this is quite bootstrap specific in a way
-;; would be good to extract even further
-(defn navbar
-  []
-  (let [language (subscribe [:current-language])
-        tr (fn [s] (translate @language s))]
-
-    (fn []
-      [:nav {:class "navbar navbar-dark bg-primary"}
-       [:div {:class "container-fluid"}
-        [:div {:class "navbar-header"}
-         [:a {:class "navbar-brand" :href "#"} "Home" ]]
-
-        (into
-         [:ul {:class "nav navbar-nav"}]
-         (for [sec (keys SECTIONS)]
-           [:li {:key (name sec)}
-            [:a {:href (str "#" (name sec))} (tr sec)]]))
-
-        [:ul {:class "nav navbar-right" :key "language"}
-         (lang-selection @language)]
-        ]])))

 ;; should dispatch the right language also here of course
 (defn add-to-calendar
@@ -119,6 +80,43 @@
    #_[:div {:class "g-recaptcha"
           :data-sitekey settings/RECAPTCHA-KEY}]])

+(defn contacts
+  []
+  (let [language (subscribe [:current-language])]
+    #_[:div {:class "email"} "Email Address"]))
+
+(def SECTIONS
+  {:story story
+   :find-us find-us
+   ;; :rvsp rvsp
+   ;; :gifts gifts
+   ;;:accomodation accommodation
+   :contacts contacts
+   })
+
+;; this is quite bootstrap specific in a way
+;; would be good to extract even further
+(defn navbar
+  []
+  (let [language (subscribe [:current-language])
+        tr (fn [s] (translate @language s))]
+
+    (fn []
+      [:nav {:class "navbar navbar-dark bg-primary"}
+       [:div {:class "container-fluid"}
+        [:div {:class "navbar-header"}
+         [:a {:class "navbar-brand" :href "#"} "Home" ]]
+
+        (into
+         [:ul {:class "nav navbar-nav"}]
+         (for [sec (keys SECTIONS)]
+           [:li {:key (name sec)}
+            [:a {:href (str "#" (name sec))} (tr sec)]]))
+
+        #_[:ul {:class "nav navbar-right" :key "language"}
+         (lang-selection @language)]
+        ]])))
+
 ;; devtools does not seem to be set up correctly
 ;; since it doesn't find hints.js for example
 ;; (log "hello")
@@ -126,6 +124,8 @@
 (defn main-panel
   []
   (fn []
-    [:g
-     (into [navbar]
-           (vals SECTIONS))]))
+    ;;TODO: there could be a better way to do this
+    (into [:g]
+          (map vector
+               (concat [navbar] (vals SECTIONS))))))
+


Fixed broken file.

Fixed broken file.

--- src/clojure/freactive/units.cljs
+++ src/clojure/freactive/units.cljs
@@ -71,4 +71,5 @@
   (-cur-value [_] #js [x y]))

 (defn svg-translate
-
+  ([x] (SVGTranslateX. x))
+  ([x y] (SVGTranslate. x y)))


(PE-5369) Update the jetty9 dependency

(PE-5369) Update the jetty9 dependency

--- configs/pe-console-services/pe-console-services.clj
+++ configs/pe-console-services/pe-console-services.clj
@@ -7,7 +7,7 @@
                  [puppetlabs/rbac-ui "{{{pe-rbac-ui-version}}}"]
                  ;[puppetlabs/pe-activity-service "{{{pe-classifier-version}}}"]
                  ;[puppetlabs/pe-trapperkeeper-proxy "{{{pe-trapperkeeper-proxy}}}"]
-                 [puppetlabs/trapperkeeper-webserver-jetty9 "0.5.2"]]
+                 [puppetlabs/trapperkeeper-webserver-jetty9 "0.6.0"]]

   :uberjar-name "console-services-release.jar"


play around with cost

play around with cost

--- src/mekena/logistic-reg.clj
+++ src/mekena/logistic-reg.clj
@@ -58,25 +58,71 @@

 (defn compute-cost
   "Calculate the cost of using theta (mse : mean square error):
+   J(θ) =−1/m(log(g(Xθ))Ty+(log(1−g(Xθ)))T(1−y))
    -1/m Sigma (1,m)[ y.log( h(theta.x) ) + (1 - y).log( 1 - h(theta.x) )]
    input xs is dataset "
   [xs y theta]
   (let [normalized-x (normalize-features xs)
         theta-x      (i/mmult normalized-x theta)
         h-tx         (i/matrix-map hypothesis theta-x)
-        y-1-term     (i/mmult (i/trans y) (i/log h-tx))
-        y-0-term     (i/mmult (i/trans (i/minus 1 y)) (i/log (i/minus 1 h-tx)))
+        y-1-term     (i/mmult (i/trans (i/log h-tx)) y)
+        y-0-term     (i/mmult (i/trans (i/log (i/minus 1 h-tx))) (i/minus 1 y))
         m            (count y)]
     (-> y-1-term
         (i/plus y-0-term)
         (i/div (- m)))))

+  ;(let [normalized-x (normalize-features xs)
+        ;theta-x      (i/mmult normalized-x theta)
+        ;h-tx         (i/matrix-map hypothesis theta-x)
+        ;y-1-term     (i/mmult (i/trans y) (i/log h-tx))
+        ;y-0-term     (i/mmult (i/trans (i/minus 1 y)) (i/log (i/minus 1 h-tx)))
+        ;m            (count y)]
+    ;(-> y-1-term
+        ;(i/plus y-0-term)
+        ;(i/div (- m))))
+;; J(θ) =−1m(log(g(Xθ))Ty+(log(1−g(Xθ)))T(1−y))
 ;; deftest : compute-cost xs y [0 0 0] => 0.693
 ;; where: xs : (sel training-data :except-cols (dec (ncol training-data)))
 ;; y : (def y (sel training-data :cols (dec (ncol training-data))))

-(defn gradient
-  "Compute the partial derivatives and set gradient to the partial
-  derivatives of the cost w.r.t. each parameter in theta
-  gradient should have the same dimensions as theta"
-  [theta x y])
+(def alpha 0.01)
+(def iterations 1500)
+
+(defn calc-theta
+  "Gradient descent is: theta - (alpha/m).x^T(g(x.theta) - y)
+  calculate an iteration"
+  [xs y theta]
+  (let [xs' (i/trans xs)]
+    (->> theta
+         (i/mmult xs)
+         (i/matrix-map hypothesis)
+         (i/minus y)
+         (i/mmult xs')
+         (i/div (count xs))
+         (i/mult alpha)
+         (i/minus theta))))
+
+(defn gradient-descent
+  "Calculate gradient descent. Matrix contains multiple features with the y column
+  as the last column (the dependent variable).
+  An optional number of iterations can be passed as another parameter."
+  [iter y xs]
+  (drop (dec iter)
+        (take iter (iterate (partial calc-theta xs y)
+                            (repeat (i/ncol xs) 0)))))
+
+(defn logistic-regression
+  "Calculate gradient descent. input is Dataset containing multiple features
+  with the y column as the last column (the dependent variable).
+  An optional number of iterations can be passed as another parameter."
+  ([dataset] (logistic-regression dataset iterations))
+  ([dataset iters] (let [y (i/sel dataset :cols (dec (i/ncol dataset)))
+                         xs (i/sel dataset :except-cols (dec (i/ncol dataset)))]
+                     (->> (i/ncol xs)
+                          range
+                          (map (fn [c] (normalize (i/sel xs :cols c))))
+                          matrix
+                          trans
+                          prepare-features
+                          (gradient-descent iters y)))))


Added rope.

Added rope.

--- src/divergence/entity.cljs
+++ src/divergence/entity.cljs
@@ -6,6 +6,7 @@
 (def boxTexture (js/PIXI.Texture.fromImage "assets/img/box.png"))
 (def goalTexture (js/PIXI.Texture.fromImage "assets/img/door.png"))
 (def bgTexture (js/PIXI.Texture.fromImage "assets/img/background.png"))
+(def ropeTexture (js/PIXI.Texture.fromImage "assets/img/rope.png"))

 (defn entity [components]
   (reduce
@@ -91,6 +92,13 @@
 (def regular-block
   (partial block .1 .1))

+(defn rope-block [x y stage]
+  (entity [(c/named :rope)
+           (c/sprite ropeTexture)
+           (c/position x y 0)
+           (c/on-stage stage)
+           (c/scale 1 1)]))
+
 (defn some-text [stage]
   (entity [(c/named :fps-counter)
            (c/text "Hello World" #js {:font "20px Arial" :fill "black"})


condensed colorize code.

condensed colorize code.

--- src/midje/util/colorize.clj
+++ src/midje/util/colorize.clj
@@ -9,33 +9,24 @@
   (.toUpperCase (or (getenv "MIDJE_COLORIZE")
                     (str (not (on-windows?))))))

-(defn- default-color-choice? []
-  (= (colorize-choice) "TRUE"))
-
-(defn reverse-color-choice? []
-  (= (colorize-choice) "REVERSE"))
-
 (defn colorizing? []
   (not (= (colorize-choice) "FALSE")))

-(cond (default-color-choice?)
-      (do
-        (def fail color/red)
-        (def pass color/green)
-        (def note color/cyan))
+(case (colorize-choice)
+  "TRUE" (do
+           (def fail color/red)
+           (def pass color/green)
+           (def note color/cyan))

-      (reverse-color-choice?)
-      (do
-        (def fail color/red-bg)
-        (def pass color/green-bg)
-        (def note color/cyan-bg))
+  "REVERSE" (do
+              (def fail color/red-bg)
+              (def pass color/green-bg)
+              (def note color/cyan-bg))

-      :else
-      (do
-        (def fail identity)
-        (def pass identity)
-        (def note identity)))
+  (do
+    (def fail identity)
+    (def pass identity)
+    (def note identity)))

 (defn colorized? [s]
-  (.startsWith s "\033["))
-
+  (.startsWith s "\033["))


Changed enemy effect for level 2.

Changed enemy effect for level 2.

--- src/divergence/entity/enemy.cljs
+++ src/divergence/entity/enemy.cljs
@@ -52,6 +52,8 @@
   )

 (defn enemy-effect-two [player enemy]
+  (let [{[x y rot] :position} @player]
+    (swap! player assoc-in [:position] [(- x 200) y rot]))
   (set! (.-textures (e/entity-atom->ref player)) (cljs-to-js (map textures/textures e/batAnimation)))
   )


Use same logic in org response to check if user is a member of the org as in the org representation.

--- src/oc/storage/api/orgs.clj
+++ src/oc/storage/api/orgs.clj
@@ -233,7 +233,9 @@
   :handle-ok (fn [ctx] (let [user (:user ctx)
                              user-id (:user-id user)
                              org (or (:updated-org ctx) (:existing-org ctx))
-                             user-is-part-of-the-team? (when user ((set (:teams user)) (:team-id org)))
+                             user-is-member? (and (not (:id-token user))
+                                                  (or (= (:access-level ctx) :author)
+                                                      (= (:access-level ctx) :viewer)))
                              org-id (:uuid org)
                              boards (board-res/list-boards-by-org conn org-id [:created-at :updated-at :authors :viewers :access])
                              board-access (map #(board-with-access-level org % user) boards)
@@ -248,10 +250,12 @@
                                                         (pos? (count author-access-boards))))
                              draft-entry-count (if show-draft-board? (entry-res/list-entries-by-org-author conn org-id user-id :draft {:count true}) 0)
                              must-see-count (entry-res/list-entries-by-org conn org-id :asc (db-common/current-timestamp) :before (map :uuid allowed-boards) {:must-see true :count true})
-                             inbox-count (entry-res/list-all-entries-for-inbox conn org-id user-id :asc (db-common/current-timestamp) :before {:count true})
+                             inbox-count (if user-is-member?
+                                           (entry-res/list-all-entries-for-inbox conn org-id user-id :asc (db-common/current-timestamp) :before {:count true})
+                                           0)
                              after-date (f/parse (f/formatter "yyyyMMdd") "19700101")
                              after-parse (f/unparse db-common/timestamp-format after-date)
-                             follow-ups-count (if user-is-part-of-the-team?
+                             follow-ups-count (if user-is-member?
                                                 (entry-res/list-all-entries-by-follow-ups conn org-id user-id :asc after-parse :after {:count true})
                                                 0)
                              full-boards (if show-draft-board?
@@ -263,7 +267,7 @@
                              author-reps (map #(org-rep/render-author-for-collection org % (:access-level ctx)) authors)
                              has-sample-content? (> (entry-res/sample-entries-count conn org-id) 1)]
                          (org-rep/render-org (-> org
-                                                 (assoc :boards (if user-is-part-of-the-team? board-reps (map #(dissoc % :authors :viewers) board-reps)))
+                                                 (assoc :boards (if user-is-member? board-reps (map #(dissoc % :authors :viewers) board-reps)))
                                                  (assoc :must-see-count must-see-count)
                                                  (assoc :inbox-count inbox-count)
                                                  (assoc :follow-ups-count follow-ups-count)


Reject orgs with name shorter than 3 chars and longer than 50 on creation and update.

--- src/oc/storage/api/orgs.clj
+++ src/oc/storage/api/orgs.clj
@@ -25,6 +25,9 @@
             [oc.storage.resources.entry :as entry-res]))

 ;; ----- Utility functions -----
+
+(def org-name-min-length 50)
+(def org-name-max-length 50)

 (defn- board-with-access-level
   "
@@ -192,8 +195,12 @@
   (try
     ;; Create the new org from the data provided
     (let [org-map (:data ctx)
+          org-name (:name org-map)
           author (:user ctx)]
-      {:new-org (api-common/rep (org-res/->org org-map author))})
+      (if (and (<= (count org-name) org-name-max-length)
+               (>= (count org-name) org-name-min-length))
+        {:new-org (api-common/rep (org-res/->org org-map author))}
+        [false, {:reason (str "Org name too long. Max allowed length is " org-name-max-length)}]))

     (catch clojure.lang.ExceptionInfo e
       [false, {:reason (.getMessage e)}]))) ; Not a valid new org
@@ -202,8 +209,14 @@
   (if-let [org (org-res/get-org conn slug)]
     (let [samples? (:samples org-props)
           updated-props (if samples? (dissoc org-props :samples :boards) org-props)
-          updated-org (merge org (org-res/ignore-props updated-props))]
-      (if (lib-schema/valid? common-res/Org updated-org)
+          updated-org (merge org (org-res/ignore-props updated-props))
+          updating-org-name? (contains? org-props :name)
+          org-name (:name org-props)]
+      (if (and (lib-schema/valid? common-res/Org updated-org)
+               (or (not updating-org-name?)
+                   (and updating-org-name?
+                        (<= (count org-name) org-name-max-length)
+                        (>= (count org-name) org-name-min-length))))
         {:existing-org (api-common/rep org) :updated-org (api-common/rep updated-org)
          :samples (api-common/rep samples?) :boards (api-common/rep (:boards org-props))}
         [false, {:updated-org (api-common/rep updated-org)}])) ; invalid update


Only use 1 session for the HQ input, rollback on fail.

--- src/onyx/plugin/hornetq.clj
+++ src/onyx/plugin/hornetq.clj
@@ -29,23 +29,81 @@
                (conj rets segment)
                (recur f n (conj rets segment)))))))))

-(defn read-batch [consumer task]
-  (let [queue-name (:hornetq/queue-name task)
-        timeout (or (:onyx/batch-timeout task) 1000)]
-    (let [f (fn [] {:message (.receive consumer timeout)})
+(defmethod l-ext/start-lifecycle? :hornetq/read-segments
+  [_ event]
+  {:onyx.core/start-lifecycle? true})
+
+(defmethod l-ext/inject-lifecycle-resources :hornetq/read-segments
+  [_ {:keys [onyx.core/task-map] :as event}]
+  (let [config {"host" (:hornetq/host task-map) "port" (:hornetq/port task-map)}
+        tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
+        locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))]
+    (let [session-factory (.createSessionFactory locator)
+          session (.createSession session-factory true true 0)
+          consumer (.createConsumer session (:hornetq/queue-name task-map))]
+      (.start session)
+      {:hornetq/pending-messages (atom {})
+       :hornetq/locator locator
+       :hornetq/session-factory session-factory
+       :hornetq/session session
+       :hornetq/consumer consumer})))
+
+(defmethod l-ext/close-temporal-resources :hornetq/read-segments
+  [_ event] event)
+
+(defmethod l-ext/close-lifecycle-resources :hornetq/read-segments
+  [_ event]
+  (.close (:hornetq/consumer event))
+  (.close (:hornetq/session event))
+  (.close (:hornetq/session-factory event))
+  (.close (:hornetq/locator event))
+  event)
+
+(defmethod p-ext/read-batch [:input :hornetq]
+  [{:keys [onyx.core/task-map hornetq/consumer hornetq/pending-messages]}]
+  (let [queue-name (:hornetq/queue-name task-map)
+        timeout (or (:onyx/batch-timeout task-map) 1000)]
+    (let [f (fn [] {:id (java.util.UUID/randomUUID)
+                   :message (.receive consumer timeout)})
           rets (filter (comp not nil? :message)
-                       (take-segments f (:onyx/batch-size task)))]
+                       (take-segments f (:onyx/batch-size task-map)))]
+      (doseq [m rets]
+        (swap! pending-messages assoc (:id m) (:message m)))
       {:onyx.core/batch (or rets [])})))

-(defn decompress-segment [segment]
-  (fressian/read (.toByteBuffer (.getBodyBuffer segment))))
+(defmethod p-ext/decompress-batch [:input :hornetq]
+  [{:keys [onyx.core/batch]}]
+  (let [decompress-f #(fressian/read (.toByteBuffer (.getBodyBuffer %)))]
+    {:onyx.core/decompressed (map (comp decompress-f :message) batch)}))

-(defn compress-segment [segment]
-  (.array (fressian/write segment)))
+(defmethod p-ext/apply-fn [:input :hornetq]
+  [event]
+  {:onyx.core/results (:onyx.core/decompressed event)})

-(defn write-batch [session-factory task compressed]
+(defmethod p-ext/ack-message [:input :hornetq]
+  [{:keys [onyx.core/message-id hornetq/pending-messages] :as event}]
+  (let [message (get @pending-messages message-id)]
+    (.acknowledge message)
+    (swap! pending-messages dissoc message-id)))
+
+(defmethod p-ext/replay-message [:input :hornetq]
+  [{:keys [onyx.core/message-id hornetq/pending-messages] :as event}]
+  (.rollback (:hornetq/session event))
+  (swap! pending-messages dissoc message-id))
+
+(defmethod p-ext/apply-fn [:output :hornetq]
+  [event]
+  {:onyx.core/results (:onyx.core/decompressed event)})
+
+(defmethod p-ext/compress-batch [:output :hornetq]
+  [{:keys [onyx.core/results]}]
+  (let [compress-f #(.array (fressian/write %))]
+    {:onyx.core/compressed (map compress-f results)}))
+
+(defmethod p-ext/write-batch [:output :hornetq]
+  [{:keys [onyx.core/task-map onyx.core/compressed hornetq/session-factory]}]
   (let [session (.createTransactedSession session-factory)
-        queue (:hornetq/queue-name task)
+        queue (:hornetq/queue-name task-map)
         producer (.createProducer session queue)]
     (.start session)
     (doseq [x compressed]
@@ -57,45 +115,29 @@
      :hornetq/producer producer
      :onyx.core/written? true}))

-(defn read-batch-shim [{:keys [onyx.core/task-map] :as event}]
-  (merge event (read-batch (:hornetq/consumer event) task-map)))
+(defmethod l-ext/inject-lifecycle-resources :hornetq/write-segments
+  [_ {:keys [onyx.core/task-map] :as pipeline}]
+  (let [config {"host" (:hornetq/host task-map) "port" (:hornetq/port task-map)}
+        tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
+        locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
+        session-factory (.createSessionFactory locator)]
+    {:hornetq/locator locator
+     :hornetq/session-factory session-factory}))

-(defn decompress-batch-shim [{:keys [onyx.core/batch] :as event}]
-  (let [decompressed (map (comp decompress-segment :message) batch)]
-    (merge event {:onyx.core/decompressed decompressed})))
+(defmethod l-ext/close-temporal-resources :hornetq/write-segments
+  [_ event]
+  (.close (:hornetq/producer event))
+  (.close (:hornetq/session event))
+  {})

-(defn strip-sentinel-shim [event]
-  (operation/on-last-batch
-   event
-   (fn [{:keys [onyx.core/task-map hornetq/session]}]
-     (let [queue-name (:hornetq/queue-name task-map)
-           query (.queueQuery session (SimpleString. queue-name))]
-       (.getMessageCount query)))))
+(defmethod l-ext/close-lifecycle-resources :hornetq/write-segments
+  [_ event]
+  (.close (:hornetq/session-factory event))
+  (.close (:hornetq/locator event))
+  {})

-(defn requeue-sentinel-shim [{:keys [onyx.core/task-map] :as event}]
-  (let [queue-name (:hornetq/queue-name task-map)]
-    (let [session (:hornetq/session event)]
-      (let [producer (.createProducer session queue-name)
-            message (.createMessage session true)]
-        (.writeBytes (.getBodyBuffer message) (.array (fressian/write :done)))
-        (.send producer message)
-        (.close producer)))
-    (merge event {:onyx.core/requeued? true})))
-
-(defn apply-fn-in-shim [event]
-  (merge event {:onyx.core/results (:onyx.core/decompressed event)}))
-
-(defn apply-fn-out-shim [event]
-  (merge event {:onyx.core/results (:onyx.core/decompressed event)}))
-
-(defn compress-batch-shim [{:keys [onyx.core/results] :as event}]
-  (merge event {:onyx.core/compressed (map compress-segment results)}))
-
-(defn write-batch-shim
-  [{:keys [onyx.core/task-map onyx.core/compressed] :as event}]
-  (merge event (write-batch (:hornetq/session-factory event) task-map compressed)))
-
-(defn seal-resource-shim [{:keys [onyx.core/task-map] :as event}]
+(defmethod p-ext/seal-resource [:output :hornetq]
+  [{:keys [onyx.core/task-map] :as event}]
   (let [queue-name (:hornetq/queue-name task-map)]
     (let [session (.createTransactedSession (:hornetq/session-factory event))]
       (let [producer (.createProducer session queue-name)
@@ -104,99 +146,6 @@
         (.send producer message)
         (.close producer))
       (.commit session)
-      (.close session))))
-
-(defmethod l-ext/start-lifecycle? :hornetq/read-segments
-  [_ {:keys [hornetq/session onyx.core/ingress-queues onyx.core/task-map]}]
-  {:onyx.core/start-lifecycle?
-   (if (= (:task/consumption task-map) :sequential)
-     (let [query (.queueQuery session (SimpleString. (:hornetq/queue-name task-map)))]
-       (zero? (.getConsumerCount query)))
-     true)})
-
-(defmethod l-ext/inject-lifecycle-resources :hornetq/read-segments
-  [_ {:keys [onyx.core/task-map] :as pipeline-data}]
-  (let [config {"host" (:hornetq/host task-map) "port" (:hornetq/port task-map)}
-        tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
-        locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))]
-    (let [session-factory (.createSessionFactory locator)
-          session (.createTransactedSession session-factory)]
-      (merge pipeline-data
-             {:onyx.core/holding-pen (atom {})
-              :hornetq/locator locator
-              :hornetq/session-factory session-factory
-              :hornetq/session session
-              :hornetq/consumer (.createConsumer session (:hornetq/queue-name task-map))}))))
-
-(defmethod l-ext/close-temporal-resources :hornetq/read-segments
-  [_ pipeline-data]
-  (.commit (:hornetq/session pipeline-data))
-  pipeline-data)
-
-(defmethod l-ext/close-lifecycle-resources :hornetq/read-segments
-  [_ pipeline-data]
-  (.close (:hornetq/consumer pipeline-data))
-  (.close (:hornetq/session pipeline-data))
-  (.close (:hornetq/session-factory pipeline-data))
-  (.close (:hornetq/locator pipeline-data))
-  pipeline-data)
-
-(defmethod p-ext/read-batch [:input :hornetq]
-  [event] (read-batch-shim event))
-
-(defmethod p-ext/decompress-batch [:input :hornetq]
-  [event] (decompress-batch-shim event))
-
-(defmethod p-ext/apply-fn [:input :hornetq]
-  [event] (apply-fn-in-shim event))
-
-(defmethod p-ext/ack-message [:input :hornetq]
-  [event]
-  (let [state @(:onyx.core/holding-pen event)
-        message (get state (:onyx.core/message-id event))]
-    (.acknowledge message)
-    (swap! (:onyx.core/holding-pen event) dissoc (:onyx.core/message-id event))))
-
-(defmethod p-ext/replay-message [:input :hornetq]
-  [event]
-  (println "Releasing HornetQ message"))
-
-(defmethod p-ext/apply-fn [:output :hornetq]
-  [event] (apply-fn-out-shim event))
-
-(defmethod p-ext/compress-batch [:output :hornetq]
-  [event] (compress-batch-shim event))
-
-(defmethod p-ext/write-batch [:output :hornetq]
-  [event] (write-batch-shim event))
-
-(defmethod l-ext/inject-lifecycle-resources :hornetq/write-segments
-  [_ {:keys [onyx.core/task-map] :as pipeline}]
-  (let [config {"host" (:hornetq/host task-map) "port" (:hornetq/port task-map)}
-        tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
-        locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))]
-
-    (when (= (:onyx/consumption task-map) :sequential)
-      (.setConsumerWindowSize locator 0))
-
-    (let [session-factory (.createSessionFactory locator)]
-      {:hornetq/locator locator
-       :hornetq/session-factory session-factory})))
-
-(defmethod l-ext/close-temporal-resources :hornetq/write-segments
-  [_ pipeline-data]
-  (.close (:hornetq/producer pipeline-data))
-  (.close (:hornetq/session pipeline-data))
+      (.close session)))
   {})

-(defmethod l-ext/close-lifecycle-resources :hornetq/write-segments
-  [_ pipeline-data]
-  (.close (:hornetq/session-factory pipeline-data))
-  (.close (:hornetq/locator pipeline-data))
-  {})
-
-(defmethod p-ext/seal-resource [:output :hornetq]
-  [pipeline-data]
-  (seal-resource-shim pipeline-data)
-  {})
-


Cleanup onyx.state.log.atom

Cleanup onyx.state.log.atom

--- src/onyx/state/log/atom.clj
+++ src/onyx/state/log/atom.clj
@@ -1,16 +1,22 @@
 (ns onyx.state.log.atom
   (:require [onyx.state.state-extensions :as state-extensions]
-            [onyx.state.core :as state]))
+            [onyx.state.core :as state]
+            [taoensso.timbre :refer [info error warn trace fatal] :as timbre]))

 (defmethod state-extensions/initialise-log :atom [_ event]
-  (get (:onyx.core/test-entries-log event) (state/peer-log-id event)))
+  (let [test-entries-log (:onyx.core/test-entries-log event)
+        path [(:onyx.core/task-id event) (state/peer-slot-id event)]
+        rets (swap! test-entries-log
+                    update-in
+                    path
+                    (fn [log]
+                      (or log (atom []))))]
+    (get-in rets path)))

 (defmethod state-extensions/store-log-entry clojure.lang.Atom [log _ entry]
   (swap! log conj entry))

 (defmethod state-extensions/playback-log-entries clojure.lang.Atom [log {:keys [onyx.core/windows :as event]} state]
-  ;; Extract some of this.
-  ;; Main requirement is to apply without reading entire log before application
   (let [id->window (into {}
                          (map (juxt :window/id identity)
                               windows))
@@ -37,3 +43,6 @@
 (defmethod state-extensions/playback-seen-ids clojure.lang.Atom [seen-log _ bucket-state apply-fn]
   bucket-state
   #_(reduce apply-fn bucket-state @seen-log))
+
+(defmethod state-extensions/close-log clojure.lang.Atom
+  [log event])


fixed play button

fixed play button

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -225,9 +225,10 @@
     om/IRender
     (render [this]
       (if (:paused? data)
-        (dom/div #js {:className "svg"
+        (dom/div #js {:className "svg-player-button-clickable"
                       :onClick core/resume}
-          (dom/object #js {:data "/images/player/play.svg"
+          (dom/object #js {:className "svg-player-button"
+                           :data "/images/player/play.svg"
                            :title "Resume Track"}))

         (dom/div #js {:className "svg-player-button-clickable"


load_all.clj: remove pre.altcrawl

load_all.clj: remove pre.altcrawl

--- src/org/altlaw/load_all.clj
+++ src/org/altlaw/load_all.clj
@@ -1,6 +1,6 @@
 (ns org.altlaw.load-all
   (:require
-   org.altlaw.jobs.pre.altcrawl
+   ;; org.altlaw.jobs.pre.altcrawl
    org.altlaw.jobs.pre.ohm1
    org.altlaw.jobs.pre.profed
    org.altlaw.jobs.analyze.graph


Log removal of dropped posts.

Log removal of dropped posts.

--- src/org/scode/sob/repos.clj
+++ src/org/scode/sob/repos.clj
@@ -60,6 +60,9 @@
                                       (< (.lastModified f) (:scan-checkpoint old)))
                                old
                                (make-page f))))]
+    (doall (for [[fname _] old-map
+                 :when (not (contains? file-map fname))]
+             (logging/info (str "dropped removed post " fname))))
     (into #{} (map make-page-cached file-map))))

 (defn scan


Press space to start, instead of any key

--- src/game/title_screen.cljs
+++ src/game/title_screen.cljs
@@ -26,7 +26,8 @@
                                  instructions-style))]

         (.. instr-text -anchor (set 0.5))
-        (.. title-text -anchor (set 0.5))
+        (.. title-text -anchor (set 0.5))))

-        (.. game -input -keyboard
-            (addCallbacks nil nil #(.. game -state (start "mainGame"))))))))
+    (update [this]
+      (if (.. game -input -keyboard (isDown js/Phaser.Keyboard.SPACEBAR))
+        (.. game -state (start "mainGame" true))))))


add cs80lead inst

add cs80lead inst

(modified version of https://github.com/supercollider-quarks/SynthDefPool/blob/master/pool/cs80lead_mh.scd)

--- src/overtone/inst/synth.clj
+++ src/overtone/inst/synth.clj
@@ -4,6 +4,37 @@
         [overtone.sc.machinery.ugen.fn-gen]
         [overtone.music pitch]
         [overtone.studio mixer inst]))
+
+;;modified version of: https://github.com/supercollider-quarks/SynthDefPool/blob/master/pool/cs80lead_mh.scd
+(definst cs80lead
+  [freq 880
+   amp 0.5
+   att 0.75
+   decay 0.5
+   sus 0.8
+   rel 1.0
+   fatt 0.75
+   fdecay 0.5
+   fsus 0.8
+   frel 1.0
+   cutoff 200
+   dtune 0.002
+   vibrate 4
+   vibdepth 0.015
+   gate 1
+   ratio 1
+   cbus 1
+   freq-lag 0.1]
+  (let [freq (lag freq freq-lag)
+        cuttoff (in:kr cbus)
+        env     (env-gen (adsr att decay sus rel) gate :action FREE)
+        fenv    (env-gen (adsr fatt fdecay fsus frel 2) gate :action FREE)
+
+        vib     (+ 1 (lin-lin:kr (sin-osc:kr vibrate) -1 1 (- vibdepth) vibdepth))
+
+        freq    (* freq vib)
+        sig     (mix (* env amp (saw [freq (* freq (+ dtune 1))])))]
+    sig))

 (definst supersaw [freq 440 amp 1]
   (let [input  (lf-saw freq)


Add retrieved AW posts to list widget

Add retrieved AW posts to list widget

--- src/ecregister/posts_ui.clj
+++ src/ecregister/posts_ui.clj
@@ -16,7 +16,7 @@
    :items [[(label :border (line-border :color "#ddd" :thickness 1) :size [42 :by 42]) "spany 2"]
            [(label :id :author :text author :font (font :name "Arial" :style :bold :size 17))
             "cell 1 0,pushy,bottom"]
-           [(label :id :title :text title :font (font :name "Arial" :style :italic :size 15)) "cell 1 1,pushy,top"]]
+           [(label :id :title :text title :font (font :name "Arial" :style :italic :size 15)) "cell 1 1,pushy,top,wmax 400px"]]
    :constraints ["", "[][]", "[][]"]
    :border (line-border :color "#ccc" :thickness 1)
    :minimum-size [400 :by 60]))
@@ -37,16 +37,19 @@
                  (config! (select form [:#latest-fa-post]) :visible? true)
                  )))
            fa-stream)
-    ;; setup 'fetching from aw'
+    ;; when fa post is retrived, start fetching aw posts
     (r/map (fn [e]
-             (add! (select form [:#aw-posts]) (make-post-widget {:author "he1" :title "ho"}))
-             (add! (select form [:#aw-posts]) (make-post-widget {:author "he" :title "ho"}))
-             (add! (select form [:#aw-posts]) (make-post-widget {:author "he" :title "ho"}))
-             (add! (select form [:#aw-posts]) (make-post-widget {:author "he" :title "ho"}))
-             (add! (select form [:#aw-posts]) (make-post-widget {:author "he" :title "ho"}))
-             (add! (select form [:#aw-posts]) (make-post-widget {:author "he" :title "ho"}))
-             (add! (select form [:#aw-posts]) (make-post-widget {:author "he" :title "ho"}))
-             (add! (select form [:#aw-posts]) (make-post-widget {:author "he" :title "ho"})))
+             (let [c (async/chan)
+                   fa-post (:value e)]
+               ;; FIXME if c will contain :error, dismiss all fetched so far and clear listbox
+               (posts/fetch-unpublished-aw-posts fa-post c)
+               (async/go-loop []
+                        (let [post (<! c)]
+                          (when (not= :end post)
+                            (add! (select form [:#aw-posts]) (make-post-widget post))
+                            (recur)
+                            )))
+               ))
            fa-post-stream)
     ))


feat(ccw.api.repl): addition of 'active (repl) fn and new arities for send

--- ccw.core/src/clj/ccw/api/repl.clj
+++ ccw.core/src/clj/ccw/api/repl.clj
@@ -3,6 +3,10 @@
    API for User Plugins."
   (:refer-clojure :exclude [send namespace])
   (:import [ccw.repl REPLView]))
+
+(defn active
+  "Return the active REPL"
+  [] (.get REPLView/activeREPL))

 (defn send
   "Send expression expr (a String) to repl (repl object obtained e.g. via an
@@ -12,11 +16,15 @@
    print-to-log:     truthy if the expression should be logged in the log area
                      of the repl (defaults to true)
    repeat-last-eval: truthy if the preferences for repeating the last
-                     user sent expression should be honored (defaults to false)"
+                     user sent expression should be honored (defaults to false)
+   If repl is not specified, then the active repl is used.
+   If expr is a String it is used as is. If it's not a String, then pr-str is
+   called on it first."
+  ([expr] (send (active) expr false true false))
   ([repl expr] (send repl expr false true false))
   ([repl expr add-to-history print-to-log repeat-last-eval]
     (when (and repl expr)
-      (.evalExpression repl expr
+      (.evalExpression repl (if (string? expr) expr (pr-str expr))
         (boolean add-to-history)
         (boolean print-to-log)
         (boolean repeat-last-eval)))
@@ -28,4 +36,4 @@

 (defn namespace!
   "Set the namespace (a String) for the repl"
-  [repl namespace] (.setCurrentNamespace repl namespace))+  [repl namespace] (.setCurrentNamespace repl namespace))


Trival refactoring

Trival refactoring

--- src/refactor_nrepl/core.clj
+++ src/refactor_nrepl/core.clj
@@ -25,7 +25,11 @@
 (defn ns-from-string
   "Retrieve the symbol naming the ns from file-content."
   [file-content]
-  (second (parse/read-ns-decl (PushbackReader. (java.io.StringReader. file-content)))))
+  (-> file-content
+      java.io.StringReader.
+      PushbackReader.
+      parse/read-ns-decl
+      second))

 (defn ns-name-from-readable
   "Call slurp on readable and extract the ns-name from the content."


fix routes

fix routes

--- src/cljs/daveconservatoire/site/routes.cljs
+++ src/cljs/daveconservatoire/site/routes.cljs
@@ -26,7 +26,6 @@
 (def routes
   ["/" {""                 ::home
         "login"            ::login
-        "profile"          ::profile
         "about"            ::about
         "donate"           ::donate
         "tuition"          ::tuition


refactoring api_access

refactoring api_access

--- src/cljs/swarmpit/component/api_access.cljs
+++ src/cljs/swarmpit/component/api_access.cljs
@@ -63,6 +63,25 @@
                        :style    {:fontFamily "monospace"}}
      :InputLabelProps {:shrink true}}))

+(defn old-token-form [api-token]
+  [(comp/typography
+     {:key "ost"}
+     ["Token for this user was already created. If you lost your token, please generate new one and "
+      "the former token will be revoked."])
+   (form-token (str "Bearer ..." (:mask api-token)))])
+
+(defn new-token-form [token]
+  [(comp/typography
+     {:key "nst"}
+     ["Copy your token and store it safely, value will be displayed only once."])
+   (form-token (:token token))])
+
+(defn no-token-form []
+  [(comp/typography
+     {:key "nost1"} "Your user doesn't have any API token.")
+   (comp/typography
+     {:key "nost2"} "New token doesn't expire, but it can be revoked.")])
+
 (rum/defc form-api-token < rum/static [{:keys [api-token token]}]
   (let [state (if (and api-token (not token))
                 :old
@@ -80,7 +99,10 @@
         (comp/card-header
           {:className "Swarmpit-form-card-header"
            :key       "aagch"
-           :title     (case state :none "Create API token" :old "API Token" :new "New API token")})
+           :title     (case state
+                        :none "Create API token"
+                        :old "API Token"
+                        :new "New API token")})
         (comp/card-content
           {:key "aagcc"}
           (comp/grid
@@ -92,19 +114,9 @@
                :key  "aagcccig"
                :xs   12}
               (case state
-                :old [(comp/typography
-                        {:key "ost"}
-                        ["Token for this user was already created. If you lost your token, please generate new one and "
-                         "the former token will be revoked."])
-                      (form-token (str "Bearer ..." (:mask api-token)))]
-                :new [(comp/typography
-                        {:key "nst"}
-                        ["Copy your token and store it safely, value will be displayed only once."])
-                      (form-token (:token token))]
-                :none [(comp/typography
-                         {:key "nost1"} "Your user doesn't have any API token.")
-                       (comp/typography
-                         {:key "nost2"} "New token doesn't expire, but it can be revoked.")])))
+                :old (old-token-form api-token)
+                :new (new-token-form token)
+                :none (no-token-form))))
           (html
             [:div {:class "Swarmpit-form-buttons"
                    :key   "aagccbtn"}


Much faster DB garbage-collection queries

Previously, our database cleanup queries were requiring 2 sequential scans a
piece, each with no filtering. By rewriting those queries to use sql's EXISTS
operator, we can leverage Postgres' hash-ant-join feature to speed things up
considerably.

On my large-ish database containing ~28k resource parameters, this optimization
cut resource-parameter GC time from around 1000 seconds (!) to around 77
milliseconds.

Here is the query plan for the old parameter GC query:

grayskull=# EXPLAIN SELECT * FROM resource_params WHERE resource NOT IN (SELECT resource FROM catalog_resources);
                                      QUERY PLAN
---------------------------------------------------------------------------------------
 Seq Scan on resource_params  (cost=0.00..28099275.21 rows=13794 width=84)
   Filter: (NOT (SubPlan 1))
   SubPlan 1
     ->  Materialize  (cost=0.00..1971.38 rows=26225 width=41)
           ->  Seq Scan on catalog_resources  (cost=0.00..1609.25 rows=26225 width=41)
(5 rows)

Notice the cost estimate of the outer sequential scan. Here's the plan for the
revised query:

grayskull=# EXPLAIN SELECT * FROM resource_params rp WHERE NOT EXISTS (SELECT * FROM catalog_resources cr WHERE cr.resource=rp.resource);
                                       QUERY PLAN
----------------------------------------------------------------------------------------
 Hash Anti Join  (cost=2168.06..4275.27 rows=1 width=84)
   Hash Cond: ((rp.resource)::text = (cr.resource)::text)
   ->  Seq Scan on resource_params rp  (cost=0.00..671.89 rows=27589 width=84)
   ->  Hash  (cost=1609.25..1609.25 rows=26225 width=41)
         ->  Seq Scan on catalog_resources cr  (cost=0.00..1609.25 rows=26225 width=41)
(5 rows)

Much nicer!

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- src/com/puppetlabs/puppetdb/scf/storage.clj
+++ src/com/puppetlabs/puppetdb/scf/storage.clj
@@ -565,13 +565,13 @@
   "Remove any catalogs that aren't associated with a certname"
   []
   (time! (:gc-catalogs metrics)
-   (sql/delete-rows :catalogs ["hash NOT IN (SELECT catalog FROM certname_catalogs)"])))
+   (sql/delete-rows :catalogs ["NOT EXISTS (SELECT * FROM certname_catalogs cc WHERE cc.catalog=catalogs.hash)"])))

 (defn delete-unassociated-params!
   "Remove any resources that aren't associated with a catalog"
   []
   (time! (:gc-params metrics)
-   (sql/delete-rows :resource_params ["resource NOT IN (SELECT resource FROM catalog_resources)"])))
+   (sql/delete-rows :resource_params ["NOT EXISTS (SELECT * FROM catalog_resources cr WHERE cr.resource=resource_params.resource)"])))

 (defn garbage-collect!
   "Delete any lingering, unassociated data in the database"


complete the contextual data schema

complete the contextual data schema

--- src/kixi/hecuba/api/profiles.clj
+++ src/kixi/hecuba/api/profiles.clj
@@ -8,7 +8,8 @@
    [kixi.hecuba.webutil :as util]
    [kixi.hecuba.webutil :refer (decode-body authorized? stringify-values update-stringified-lists sha1-regex)]
    [liberator.core :refer (defresource)]
-   [liberator.representation :refer (ring-response)]))
+   [liberator.representation :refer (ring-response)]
+   [schema.core :as s]))

 (defn index-exists? [querier ctx]
   (let [request       (:request ctx)
@@ -74,52 +75,601 @@
        (into {})))

 (defn attribute-type [attr]
-  (if (coll? attr)
-       :associated-items
-       (try
-         (if (map? (json/decode attr))
-           :nested-item
-           :attribute)
-          (catch Exception e
-                 :attribute))))
-
-(defn explode-nested-item [item-name item-string]
-  (let [item (json/decode item-string)]
-    (->> item
+  (if (keyword? attr)
+    :attribute
+    (:type attr)))
+
+(def profile-data-schema
+  [
+    :id
+    :occupancy_under_18
+    :onsite_days_new_build
+    :flat_floor_heat_loss_type
+    :best_u_value_for_walls
+    :estimated_cost_new_build
+    :ter
+    :sap_version_year
+    :total_envelope_area
+    :sap_regulations_date
+    :multiple_glazing_area_percentage
+    :flat_floor_position
+    :modelling_software_methods_used
+    :co_heating_loss
+    :sap_assessor
+    :inadequate_heating
+    :profile_noise
+    :multiple_glazing_type
+    :sap_software
+    :profile_bus_summary_index
+    :thermal_bridging_strategy
+    :sealed_fireplaces
+    :flat_floors_in_block
+    :property_id
+    :air_tightness_assessor
+    :glazing_area_glass_only
+    :final_cost_new_build
+    :lighting_strategy
+    :fabric_energy_efficiency
+    :habitable_rooms
+    :profile_needs
+    :co_heating_assessor
+    :best_u_value_for_other
+    :renewable_contribution_heat
+    :total_area
+    :profile_temperature_in_summer
+    :draught_proofing_location
+    :heat_storage_present
+    :profile_productivity
+    :number_of_storeys
+    :passive_solar_strategy
+    :external_perimeter
+    :intervention_completion_date
+    :heat_loss_parameter_hlp
+    :electricity_storage_present
+    :roof_rooms_present
+    :primary_energy_requirement
+    :dwelling_u_value_other
+    :ventilation_approach
+    :construction_time_new_build
+    :draught_proofing
+    :frame_type
+    :appliances_strategy
+    :bedroom_count
+    :co_heating_equipment
+    :flat_heat_loss_corridor_other
+    :ber
+    :profile_image_to_visitors
+    :air_tightness_equipment
+    :innovation_approaches
+    :orientation
+    :total_budget_new_build
+    :best_u_value_for_floors
+    :completeness
+    :onsite_days
+    :water_saving_strategy
+    :airtightness_and_ventilation_strategy
+    :glazing_area_percentage
+    :occupant_change
+    :intention_ofpassvhaus
+    :profile_health
+    :occupancy_over_60
+    :annual_heating_load
+    :intervention_start_date
+    :profile_design
+    :gross_internal_area
+    :profile_air_in_winter
+    :intervention_description
+    :mains_gas
+    :profile_lightning
+    :multiple_glazing_type_other
+    :total_volume
+    :sap_version_issue
+    :profile_comfort
+    :heated_habitable_rooms
+    :open_fireplaces
+    :occupancy_18_to_60
+    :flat_length_sheltered_wall
+    :planning_considerations
+    :profile_bus_report_url
+    :design_guidance
+    :sap_rating
+    :overheating_cooling_strategy
+    :best_u_value_for_windows
+    :used_passivehaus_principles
+    :moisture_condensation_mould_strategy
+    :ventilation_approach_other
+    :sap_performed_on
+    :best_u_value_for_doors
+    :pipe_lagging
+    :renewable_contribution_elec
+    :controls_strategy
+    :conservation_issues
+    :annual_space_heating_requirement
+    :air_tightness_performed_on
+    :flat_heat_loss_corridor
+    :total_rooms
+    :space_heating_requirement
+    :multiple_glazing_u_value
+    :best_u_value_party_walls
+    :best_u_value_for_roof
+    :frame_type_other
+    :electricity_meter_type
+    :category
+    :cellar_basement_issues
+    :profile_air_in_summer
+    :co_heating_performed_on
+    :profile_temperature_in_winter
+    :air_tightness_rate
+    :footprint
+    ])
+
+(def window-set-schema
+  [ :window_type
+    :frame_type
+    :frame_type_other
+    :percentage_glazing
+    :area
+    :location
+    :uvalue
+    :created_at
+    :updated_at
+   ])
+
+(def thermal-images-schema
+  [])
+
+(def storey-schema
+  [
+   :storey_type
+   :storey
+   :heat_loss_w_per_k
+   :heat_requirement_kwth_per_year
+   :created_at
+   :updated_at
+   ])
+
+(def wall-schema
+  [
+   :wall_type
+   :construction
+   :construction_other
+   :insulation
+   :insulation_date
+   :insulation_type
+   :insulation_thickness
+   :insulation_product
+   :uvalue
+   :location
+   :area
+   :created_at
+   :updated_at
+   ])
+
+(def roof-schema
+  [
+   :roof_type
+   :construction
+   :construction_other
+   :insulation_location_one
+   :insulation_location_one_other
+   :insulation_location_two
+   :insulation_location_two_other
+   :insulation_thickness_one
+   :insulation_thickness_one_other
+   :insulation_thickness_two
+   :insulation_thickness_two_other
+   :insulation_date
+   :insulation_type
+   :insulation_product
+   :uvalue
+   :uvalue_derived
+   :created_at
+   :updated_at])
+
+(def floor-schema
+  [
+   :floor_type
+   :construction
+   :construction_other
+   :insulation_thickness_one
+   :insulation_thickness_two
+   :insulation_type
+   :insulation_product
+   :uvalue
+   :uvalue_derived
+   :created_at
+   :updated_at])
+
+(def roof-room-schema
+  [:location
+   :age
+   :insulation_placement
+   :insulation_thickness_one
+   :insulation_thickness_one_other
+   :insulation_thickness_two
+   :insulation_thickness_two_other
+   :insulation_date
+   :insulation_type
+   :insulation_product
+   :uvalue
+   :uvalue_derived
+   :created_at
+   :updated_at])
+
+(def door-set-schema
+  [:door_type
+   :door_type_other
+   :frame_type
+   :frame_type_other
+   :percentage_glazing
+   :area
+   :location
+   :uvalue
+   :created_at
+   :updated_at])
+
+(def extension-schema
+  [:age
+   :construction_date
+   :created_at
+   :updated_at])
+
+(def conservatory-schema
+  [:conservatory_type
+   :area
+   :double_glazed
+   :glazed_perimeter
+   :height
+   :created_at
+   :updated_at])
+
+(def wind-turbine-schema
+  [:turbine_type
+   :turbine_type_other
+   :make_model
+   :mcs_no
+   :inverter_type
+   :inverter_make_model
+   :inverter_mcs_no
+   :installer
+   :installer_mcs_no
+   :commissioning_date
+   :capacity
+   :hub_height
+   :height_above_canpoy
+   :wind_speed
+   :wind_speed_info_source
+   :wind_speed_info_source_other
+   :est_annual_generation
+   :est_percentage_requirement_met
+   :est_percentage_exported
+   :created_at
+   :updated_at])
+
+(def small-hydro-schema
+  [:hydro_type
+   :make_model
+   :mcs_no
+   :inverter_type
+   :inverter_make_model
+   :inverter_mcs_no
+   :installer
+   :installer_mcs_no
+   :commissioning_date
+   :capacity
+   :head_drop
+   :design_flow
+   :est_annual_generation
+   :est_percentage_requirement_met
+   :est_percentage_exported
+   :created_at
+   :updated_at])
+
+(def photovoltaic-schema
+  [:percentage_roof_covered
+   :photovoltaic_type
+   :photovoltaic_type_other
+   :make_model
+   :mcs_no
+   :efficiency
+   :inverter_type
+   :inverter_make_model
+   :inverter_mcs_no
+   :installer
+   :installer_mcs_no
+   :commissioning_date
+   :capacity
+   :area
+   :orientation
+   :pitch
+   :est_annual_generation
+   :est_percentage_requirement_met
+   :est_percentage_exported
+   :created_at
+   :updated_at
+   :performance])
+
+(def solar-thermal-schema
+  [:solar_type
+   :solar_type_other
+   :make_model
+   :mcs_no
+   :installer
+   :installer_mcs_no
+   :commissioning_date
+   :capacity
+   :area
+   :orientation
+   :pitch
+   :est_annual_generation
+   :est_percentage_requirement_met
+   :created_at
+   :updated_at
+   ])
+
+(def heat-pump-schema
+  [:heat_pump_type
+   :make_model
+   :cop
+   :spf
+   :mcs_no
+   :installer
+   :installer_mcs_no
+   :commissioning_date
+   :heat_source_type
+   :heat_source_type_other
+   :depth
+   :geology
+   :capacity
+   :est_annual_generation
+   :est_percentage_requirement_met
+   :dhw
+   :est_percentage_dhw_requirement_met
+   :created_at
+   :updated_at
+   ])
+
+(def biomass-schema
+  [:biomass_type
+   :model
+   :mcs_no
+   :installer
+   :installer_mcs_no
+   :commissioning_date
+   :capacity
+   :percentage_efficiency_from_spec
+   :est_annual_generation
+   :est_percentage_requirement_met
+   :created_at
+   :updated_at
+   ])
+
+(def chp-schema
+  [:chp_type
+   :model
+   :mcs_no
+   :installer
+   :installer_mcs_no
+   :commissioning_date
+   :capacity_elec
+   :capacity_thermal
+   :est_annual_generation
+   :est_percentage_thermal_requirement_met
+   :est_percentage_exported
+   :created_at
+   :updated_at])
+
+(def heating-system-schema
+  [:heating_type
+   :heat_source
+   :heat_transport
+   :heat_delivery
+   :heat_delivery_source
+   :efficiency_derivation
+   :boiler_type
+   :boiler_type_other
+   :fan_flue
+   :open_flue
+   :fuel
+   :heating_system
+   :heating_system_other
+   :heating_system_type
+   :heating_system_type_other
+   :heating_system_solid_fuel
+   :heating_system_solid_fuel_other
+   :bed_index
+   :make_and_model
+   :controls
+   :controls_other
+   :controls_make_and_model
+   :emitter
+   :trvs_on_emitters
+   :use_hours_per_week
+   :installer
+   :installer_engineers_name
+   :installer_registration_number
+   :commissioning_date
+   :inspector
+   :inspector_engineers_name
+   :inspector_registration_number
+   :inspection_date
+   :created_at
+   :updated_at
+   :efficiency
+   ])
+
+(def hot-water-system-schema
+  [:dhw_type
+   :fuel
+   :fuel_other
+   :immersion
+   :cylinder_capacity
+   :cylinder_capacity_other
+   :cylinder_insulation_type
+   :cylinder_insulation_type_other
+   :cylinder_insulation_thickness
+   :cylinder_insulation_thickness_other
+   :cylinder_thermostat
+   :controls_same_for_all_zones
+   :created_at
+   :updated_at])
+
+(def low-energy-light-schema
+  [:light_type
+   :light_type_other
+   :bed_index
+   :created_at
+   :updated_at
+   :proportion ])
+
+(def ventilation-system-schema
+  [:approach
+   :approach_other
+   :ventilation_type
+   :ventilation_type_other
+   :mechanical_with_heat_recovery
+   :manufacturer
+   :ductwork_type
+   :ductwork_type_other
+   :controls
+   :controls_other
+   :manual_control_location
+   :operational_settings
+   :operational_settings_other
+   :installer
+   :installer_engineers_name
+   :installer_registration_number
+   :commissioning_date
+   :total_installed_area
+   :created_at
+   :updated_at])
+
+(def airflow-measurement-schema
+  [:reference
+   :system
+   :inspector
+   :inspector_engineers_name
+   :inspector_registration_number
+   :inspection_date
+   :created_at
+   :updated_at
+   :measured_low
+   :design_low
+   :measured_high
+   :design_high])
+
+(def profile-schema
+  [ :id
+    :entity_id
+    { :name    :profile_data
+      :type    :nested-item
+      :schema  profile-data-schema }
+    { :name    :window_sets
+      :type    :associated-items
+      :schema   window-set-schema}
+    { :name    :thermal-images
+      :type    :associated-items
+      :schema  thermal-images-schema }
+    { :name    :storeys
+      :type    :associated-items
+      :schema  storey-schema }
+    { :name    :walls
+      :type    :associated-items
+      :schema  wall-schema }
+    { :name    :roofs
+      :type    :associated-items
+      :schema  roof-schema }
+    { :name    :floors
+      :type    :associated-items
+      :schema  floor-schema }
+    { :name    :roof_rooms
+      :type    :associated-items
+      :schema  roof-room-schema }
+    { :name    :door_sets
+      :type    :associated-items
+      :schema  door-set-schema }
+    { :name    :extensions
+      :type    :associated-items
+      :schema  extension-schema }
+    { :name    :conservatories
+      :type    :associated-items
+      :schema  conservatory-schema }
+    { :name    :wind_turbines
+      :type    :associated-items
+      :schema  wind-turbine-schema }
+    { :name    :small_hydros
+      :type    :associated-items
+      :schema  small-hydro-schema }
+    { :name    :photovoltaics
+      :type    :associated-items
+      :schema  photovoltaic-schema }
+    { :name    :solar_thermals
+      :type    :associated-items
+      :schema  solar-thermal-schema }
+    { :name    :heat_pumps
+      :type    :associated-items
+      :schema  heat-pump-schema }
+    { :name    :biomasses
+      :type    :associated-items
+      :schema  biomass-schema }
+    { :name    :chps
+      :type    :associated-items
+      :schema  chp-schema }
+    { :name    :heating_systems
+      :type    :associated-items
+      :schema  heating-system-schema }
+    { :name    :hot_water_systems
+      :type    :associated-items
+      :schema  hot-water-system-schema }
+    { :name    :low_energy_lights
+      :type    :associated-items
+      :schema  low-energy-light-schema }
+    { :name    :ventilation_systems
+      :type    :associated-items
+      :schema  ventilation-system-schema }
+    { :name    :airflow_measurements
+      :type    :associated-items
+      :schema  airflow-measurement-schema }
+   ])
+
+(defn explode-nested-item [association item-string]
+  (let [item (json/decode item-string)
+        association-name   (:name   association)
+        association-schema (:schema association)
+        ]
+    (->> association-schema
          (map
-           (fn [pair]
-             { (str item-name "_" (key pair)) (val pair) }))
-         (into {}))))
-
-(defn explode-associated-items [association-name items]
-  (->> items
-       (map-indexed
-         (fn [index item]
-           (let [item-name (str association-name "_" index)]
-             (case (attribute-type item)
-               :nested-item (explode-nested-item (str association-name "_" index) item)
-               :attribute   { item-name item }))))
-       (into {})))
-
-(defn explode-items [profile]
-  (->> profile
-       (map
-         (fn [attribute]
-           (let [attr-name   (name (key attribute))
-                 attr-value  (val attribute)
-                 _ (println "Considering\n\tKey: " attr-name "\n\tVal: " attr-value)]
-             (case (attribute-type attr-value)
-               :associated-items (do
-                                   (println "Found associated-items for " attr-name)
-                                   (explode-associated-items attr-name attr-value))
-               :nested-item      (do
-                                   (println "Found nested-item for " attr-name)
-                                   (explode-nested-item attr-name attr-value))
-               :attribute        (do
-                                   (println "Found standard attribute " attr-name)
-                                   { attr-name attr-value})))))
-
-       (into {})))
+           (fn [attr]
+             [ (str (name association-name) "_" (name attr)) (item (name attr)) ]))
+         )))
+
+(defn explode-associated-items [association items]
+  (let [association-name   (name (:name    association))
+        association-schema (:schema  association)
+        ]
+    (apply concat
+    (map-indexed
+      (fn [index item-string]
+         (let [item-name         (str association-name "_" index)
+               named-association (assoc association :name item-name)]
+           (if (empty? association-schema)
+             [ item-name item-string ]
+             (explode-nested-item named-association item-string))))
+      items))))
+
+(defn explode-and-sort-by-schema [item schema]
+  (let [exploded-item (->> schema
+                           (mapcat
+                             (fn [attr]
+                               (let [t (attribute-type attr)]
+                                 (case t
+                                   :attribute          (do
+                                                          (list [(name attr) (item attr)]))
+                                   :nested-item        (do
+                                                          (explode-nested-item attr (item (:name attr))))
+                                   :associated-items   (do
+                                                          (explode-associated-items attr (item (:name attr)))))))))]
+    exploded-item))

 (defn index-handle-ok [ctx]
   (let [{items ::items
@@ -128,16 +678,14 @@
           route-params :route-params} :request} ctx
         userless-items (->> items
                             (map #(dissoc % :user_id)))
-        exploded-items (->> items
-                            (map #(dissoc % :user_id))
-                            (map #(explode-items %)))
+        exploded-items (->> userless-items
+                            (map #(explode-and-sort-by-schema % profile-schema)))
         formatted-items (if (= "text/csv" mime)
                           ; serving tall csv style profiles
-                          (apply util/map-longest add-profile-keys ["" ""] exploded-items)
+                            (apply util/map-longest add-profile-keys ["" ""] exploded-items)
                           ; serving json profiles
                           userless-items)
         ]
-
         (util/render-items ctx formatted-items)))

 (defn index-handle-created [handlers ctx]


Inlined

Inlined

--- src/layzee/adapters/settings.clj
+++ src/layzee/adapters/settings.clj
@@ -13,10 +13,9 @@

 (defn- from-disk []
   (when (exists?)
-    (let [f (slurp settings-file-name)]
-      (json/read-str f :key-fn keyword))))
+    (json/read-str (slurp settings-file-name) :key-fn keyword)))

-(defn- env[name] (or (System/getenv name) )) ;;
+(defn- env[name] (System/getenv name))

 (defn- from-env[] { :key (env "TWITTER_CONSUMER_KEY")  :secret (env "TWITTER_CONSUMER_SECRET")} )


Add main view to search devcard

Add main view to search devcard

--- src/devcards/discuss/components/search.cljs
+++ src/devcards/discuss/components/search.cljs
@@ -6,6 +6,11 @@
             [om.next :as om]
             [discuss.components.search.statements :as search]
             [clojure.spec.test.alpha :as stest]))
+
+
+(defcard-om-next main-content-view
+  views/MainContentView
+  parser/reconciler)

 (def two-search-results
   [{:position? true


cleanup

cleanup

--- data/celestial/fixtures/core.clj
+++ data/celestial/fixtures/core.clj
@@ -1,9 +1,5 @@
 (ns celestial.fixtures.core
-  (:refer-clojure :exclude [type])
-  (:require
-    [celestial.redis :as r]
-    [celestial.persistency.systems :as s]
-    ))
+  (:refer-clojure :exclude [type]))

 (defn is-type? [type]
   (fn [exception]
@@ -37,8 +33,4 @@
   `(with-admin
     (with-conf ~@args)))

-;; (clojure.pprint/pprint (macroexpand '(with-conf local-conf)))
-
 (def host (.getHostName (java.net.InetAddress/getLocalHost)))
-
-


Add additional helper function for render page as svg.

--- src/uxbox/main/exports.cljs
+++ src/uxbox/main/exports.cljs
@@ -64,3 +64,9 @@
   [id]
   (let [page (get-in @st/state [:pages id])]
     (mx/render-static-html (page-svg page))))
+
+(defn render-page*
+  [id]
+  (let [page (get-in @st/state [:pages id])]
+    (when (:shapes page)
+      (mx/render-static-html (page-svg page)))))


PDOK-1599 error handling extracts

PDOK-1599 error handling extracts

--- src/main/clojure/pdok/featured/extracts.clj
+++ src/main/clojure/pdok/featured/extracts.clj
@@ -31,7 +31,12 @@
   "Returns the rendered representation of the collection of features for a given feature-type inclusive tiles-set"
   (let [template (template templates-dir dataset feature-type extract-type)
         partials (partials templates-dir dataset extract-type)]
-    (map #(vector (:_tiles %) (m/render template % partials) (:_valid_from %) (:_valid_to %)) features)))
+    (if (or (nil? template) (nil? partials))
+      [(str "Template or partials cannot be found for dataset: " dataset
+                                                    " feature-type: " feature-type
+                                                    " extract-type: " extract-type
+                                                    " template-dir: " templates-dir) nil]
+      [nil (map #(vector (:_tiles %) (m/render template % partials) (:_valid_from %) (:_valid_to %)) features)])))

 (defn create-extract-collection [db table]
@@ -68,13 +73,20 @@
   (do
    (create-extract-collection config/data-db table)
    (doseq [[tiles xml-feature valid-from valid-to] rendered-features]
-     (jdbc-insert db table valid-from valid-to (vec tiles) xml-feature nil)))))
+     (jdbc-insert db table valid-from valid-to (vec tiles) xml-feature nil))
+   {:count (count rendered-features)})))

 (defn fill-extract [dataset collection extract-type extract-version]
   (let [feature-type collection
         features (timeline/all (config/timeline) dataset collection)
-        features-for-extract (features-for-extract dataset feature-type extract-type features "src/main/resources/pdok/featured/templates")]
-      (add-extract-records config/data-db dataset feature-type extract-type extract-version features-for-extract)))
+        [error features-for-extract] (features-for-extract dataset
+                                                           feature-type
+                                                           extract-type
+                                                           features
+                                                           "src/main/resources/pdok/featured/templates")]
+    (if (nil? error)
+      (add-extract-records config/data-db dataset feature-type extract-type extract-version features-for-extract)
+      {:error error})))

 (defn file-to-features [path dataset]
   "Helper function to read features from a file.


Added data-window key

Added data-window key

Added data-window key

--- src/webapp/framework/client/coreclient.cljs
+++ src/webapp/framework/client/coreclient.cljs
@@ -1136,10 +1136,10 @@

 -----------------------------------------------------------"
-(defn update-view-for-query [ view-key  query-key ]
-
-  (let [   data-view-atom   (get @client-data-windows  view-key)    ]
-    ;(log (pr-str "Active view : " (get @ui-paths-v2  (:full-path view-key))))
+(defn update-view-for-query [ data-window-key  query-key ]
+
+  (let [   data-view-atom   (get @client-data-windows  data-window-key)    ]
+    ;(log (pr-str "Active view : " (get @ui-paths-v2  (:full-path data-window-key))))

     (cond

@@ -1158,7 +1158,7 @@
      ; if the query does match and is the current live view
      (and
          (= (@data-view-atom :query) query-key)
-         (= (get @ui-paths-v2  (:full-path view-key))  view-key)
+         (= (get @ui-paths-v2  (:full-path data-window-key))  data-window-key)
         )

      (let [
@@ -1166,8 +1166,8 @@
            view-start       (:start @data-view-atom)
            view-end         (:end @data-view-atom)

-           data-source      (:data-source view-key)
-           full-path        (:full-path view-key)
+           data-source      (:data-source data-window-key)
+           full-path        (:full-path data-window-key)
            ui-full-path     (conj full-path  :values)

            value-path   (conj full-path :values)
@@ -1176,7 +1176,7 @@
            start-path   (conj full-path :start)
            order-path   (conj full-path :order)

-           rel-path         (get view-key :relative-path)
+           rel-path         (get data-window-key :relative-path)
            rel-value-path   (conj rel-path :values)
            rel-count-path   (conj rel-path :count)
            rel-end-path     (conj rel-path :end)


fix(classpath): fix a NPE when exception thrown when searching for the leiningen classpath

--- ccw.core/src/clj/ccw/leiningen/classpath_container.clj
+++ ccw.core/src/clj/ccw/leiningen/classpath_container.clj
@@ -261,8 +261,8 @@
   [exc java-project]
   (if-not exc
     [(e/resource java-project) "unknown problem (missing exception)"]
-    (let [exc (if (check-class java.lang.reflect.InvocationTargetException exc) (.getCause exc) exc)
-          exc (if (check-class clojure.lang.ExceptionInfo exc) (.getCause exc) exc)]
+    (let [exc (if (check-class java.lang.reflect.InvocationTargetException exc) (or (.getCause exc) exc) exc)
+          exc (if (check-class clojure.lang.ExceptionInfo exc) (or (.getCause exc) exc) exc)]
       (cond
         (check-class DependencyResolutionException exc)
           (dependency-resolution-message exc java-project)


add test for crossing partition boundary

--- test/clj_money/models/transactions_test.clj
+++ test/clj_money/models/transactions_test.clj
@@ -652,6 +652,51 @@
     (testing "transaction is updated"
       (is (= (t/local-date 2016 3 10)
              (:transaction-date (transactions/reload storage-spec updated)))
+          "The transaction should be updated"))))
+
+; TODO: Uncomment this test
+#_(deftest update-a-transaction-cross-partition-boundary
+  (let [context (serialization/realize storage-spec update-context)
+        [checking
+         salary
+         groceries] (:accounts context)
+        [t1 t2 t3] (:transactions context)
+        updated (assoc t2 :transaction-date (t/local-date 2016 4 12))
+        result (transactions/update storage-spec updated)
+        expected-checking [{:index 2 :amount 101M :balance 797M}
+                           {:index 1 :amount 102M :balance 898M}
+                           {:index 0 :amount 1000M :balance 1000M}]
+        actual-checking (->> (:id checking)
+                             items-by-account
+                             (map #(select-keys % [:index :amount :balance])))
+        expected-groceries [{:index 1 :amount 101M :balance 203M}
+                            {:index 0 :amount 102M :balance 102M}]
+        actual-groceries (->> (:id groceries)
+                              items-by-account
+                              (map #(select-keys % [:index :amount :balance])))]
+    (is (empty? (validation/error-messages result))
+        "The transaction is saved successfully")
+    (testing "transaction item balances are correct"
+      (when-not (= expected-checking actual-checking)
+        (pprint {:expected expected-checking
+                 :actual actual-checking
+                 :diff (diff expected-checking actual-checking)}))
+      (is (= expected-checking actual-checking)
+          "Checking items should have the correct values after update")
+      (is (= expected-groceries actual-groceries)
+          "Groceries items should have the correct values after update"))
+    (testing "account balances are correct"
+      (is (= 797M (->> checking
+                               (accounts/reload storage-spec)
+                               :balance))
+          "The checkout account balance should be correct after update")
+      (is (= 203M (->> groceries
+                               (accounts/reload storage-spec)
+                               :balance))
+          "The groceries account balance should be correct after update"))
+    (testing "transaction is updated"
+      (is (= (t/local-date 2016 4 12)
+             (:transaction-date (transactions/reload storage-spec t2)))
           "The transaction should be updated"))))

 (def short-circuit-context


removed debug line

removed debug line

--- src/latte_compiler/core.clj
+++ src/latte_compiler/core.clj
@@ -25,7 +25,6 @@
   (match/match (run filepath)
     [:succ tree] (do
                    (util/println-err "OK")
-                   (util/println-err tree)
                    (compilation/asm-compile tree)
                    )
     [:err msg] (util/println-err msg))


update index page

update index page

--- src/midara/views/index.clj
+++ src/midara/views/index.clj
@@ -5,9 +5,27 @@
 (defn index []
   (html5
     [:head
-      [:title "Midara"]
+      [:title "Midara Hook"]
+      (include-css "https://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.3/normalize.css")
+      (include-css "/css/milligram.min.css")
       (include-css "/css/style.css")]
     [:body
-      [:h1 "Midara"]
-      [:p "Simply  asas setup your webhook to midara/hook"]
-    ]))
+      [:main.wrapper
+        [:nav.navigation
+          [:section.container
+            [:a.navigation-title {:href "#"} "Midara"]
+            [:ul.navigation-list.float-right
+              [:li.navigation-item
+                [:a.navigation-link {:href "docs"} "Docs"]
+              ]
+              [:li.navigation-item
+                [:a.navigation-link {:href "docs"} "Support"]
+              ]
+            ]
+          ]
+        ]
+
+        [:section.container
+          [:p "Simply setup your webhook to send push event to midara/hook"]
+        ]]]))
+


Update filter-codec construction.

Update filter-codec construction.

--- src/multicodec/codecs/filter.clj
+++ src/multicodec/codecs/filter.clj
@@ -4,8 +4,6 @@
   (:require
     [multicodec.core :as codec]))

-
-;; ## Filter Codec

 (defrecord FilterCodec
   [header codec encoding-fn decoding-fn]
@@ -44,6 +42,10 @@
         value))))

+(alter-meta! #'->FilterCodec assoc :private true)
+(alter-meta! #'map->FilterCodec assoc :private true)
+
+
 (defn filter-codec
   "Creates a new filter codec, wrapping the given codec. Opts may include:

@@ -51,13 +53,8 @@
   - `:encoding` function which will transform values before they are encoded
   - `:decoding` function which will transform values after they are decoded"
   [codec & {:as opts}]
-  (FilterCodec.
+  (->FilterCodec
     (:header opts (:header codec))
     codec
     (:encoding opts)
     (:decoding opts)))
-
-
-;; Remove automatic constructor functions.
-(ns-unmap *ns* '->FilterCodec)
-(ns-unmap *ns* 'map->FilterCodec)


Allowed users to use both lists and vectors for :group-by-key

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -94,7 +94,7 @@
 (defn group-message [segment catalog task]
   (let [t (find-task-fast catalog task)]
     (if-let [k (:onyx/group-by-key t)]
-      (if (vector? k)
+      (if (sequential? k)
         (hash (sort ((apply juxt k) segment)))
         (hash (get segment k)))
       (when-let [f (:onyx/group-by-fn t)]


Make peer opts available in pipeline map.

--- src/onyx/peer/task_lifecycle.clj
+++ src/onyx/peer/task_lifecycle.clj
@@ -274,6 +274,7 @@
                          :onyx.core/drained-back-off (or (:drained-back-off opts) 400)
                          :onyx.core/queue queue
                          :onyx.core/sync sync
+                         :onyx.core/peer-opts opts
                          :onyx.core/pipeline-state (atom {})}

           pipeline-data (assoc pipeline-data :onyx.core/queue (extensions/optimize-concurrently queue pipeline-data))


Do the same for utils.

Do the same for utils.

--- src/onyx/queue/hornetq_utils.clj
+++ src/onyx/queue/hornetq_utils.clj
@@ -15,6 +15,7 @@
 (defn create-queue! [config queue-name]
   (let [tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
         locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
+        _ (.setReconnectAttempts locator -1)
         session-factory (.createSessionFactory locator)
         session (.createTransactedSession session-factory)]
     (.start session)
@@ -29,6 +30,7 @@
 (defn write! [config queue-name messages echo]
   (let [tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
         locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
+        _ (.setReconnectAttempts locator -1)
         session-factory (.createSessionFactory locator)
         session (.createTransactedSession session-factory)]

@@ -50,6 +52,7 @@

 (defn write-and-cap! [config queue-name messages echo]
   (let [tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
+        _ (.setReconnectAttempts locator -1)
         locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
         session-factory (.createSessionFactory locator)
         session (.createTransactedSession session-factory)]
@@ -77,6 +80,7 @@
 (defn read! [config queue-name n echo]
   (let [tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
         locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
+        _ (.setReconnectAttempts locator -1)
         session-factory (.createSessionFactory locator)
         session (.createTransactedSession session-factory)]

@@ -103,6 +107,7 @@
 (defn consume-queue! [config queue-name echo]
   (let [tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
         locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
+        _ (.setReconnectAttempts locator -1)
         session-factory (.createSessionFactory locator)
         session (.createTransactedSession session-factory)]

@@ -129,6 +134,7 @@
 (defn message-count [config queue-name]
   (let [tc (TransportConfiguration. (.getName NettyConnectorFactory) config)
         locator (HornetQClient/createServerLocatorWithoutHA (into-array [tc]))
+        _ (.setReconnectAttempts locator -1)
         session-factory (.createSessionFactory locator)
         session (.createTransactedSession session-factory)
         query (.queueQuery session (SimpleString. queue-name))]


cleaned up laziness.clj

cleaned up laziness.clj

--- src/midje/util/laziness.clj
+++ src/midje/util/laziness.clj
@@ -1,8 +1,7 @@
 (ns ^{:doc "To evaluate a fact it needs to be eagerly evaluated."}
   midje.util.laziness
   (:use [midje.util.form-utils :only [pred-cond]]
-        [midje.util.backwards-compatible-utils :only [some-fn-m]])
-  (:import clojure.lang.Sorted))
+        [midje.util.backwards-compatible-utils :only [some-fn-m]]))

 (defn eagerly
   "Descend form, converting all lazy seqs into lists.
@@ -17,9 +16,6 @@
       (some-fn-m seq? list?)  (m (apply list (map eagerly form)))
       vector?                 (m (vec (map eagerly form)))
       map?                    (m (into form (map eagerly form)))
-      set?                    (m (into (if (sorted? form)
-                                          (sorted-set-by (.comparator ^Sorted form))
-                                          #{})
-                                       (map eagerly form)))
+      set?                    (m (into (empty form) (map eagerly form)))
       :else                   form)))


exception? makes flow routes very slow.

exception? makes flow routes very slow.

--- src/onyx/peer/operation.clj
+++ src/onyx/peer/operation.clj
@@ -17,8 +17,7 @@
   (kw->fn (:onyx/fn task-map)))

 (defn exception? [e]
-  (let [classes (supers (class e))]
-    (boolean (some #{java.lang.Throwable} classes))))
+  (instance? java.lang.Throwable e))

 (defn start-lifecycle?
   [{:keys [onyx.core/queue onyx.core/ingress-queues onyx.core/task-map]}]


Improve validation when read-log is used with mem://

--- src/onyx/plugin/datomic.clj
+++ src/onyx/plugin/datomic.clj
@@ -268,7 +268,7 @@

 (defn inject-read-log-resources
   [{:keys [onyx.core/task-map onyx.core/log onyx.core/task-id onyx.core/pipeline] :as event} lifecycle]
-  (when (re-matches #"mem://.*" (:datomic/uri task-map))
+  (when (re-matches #"datomic:mem://.*" (:datomic/uri task-map))
     (throw (ex-info "Read datoms cannot support in mem datomic instances, as these do not have a transaction log." task-map)))

   (when-not (or (= 1 (:onyx/max-peers task-map))


Fix clean-ns edge-case

Fix clean-ns edge-case

When the ns contained only a docstring clean ns would return an ns
missing the closing parens.

--- src/refactor_nrepl/ns/pprint.clj
+++ src/refactor_nrepl/ns/pprint.clj
@@ -95,8 +95,15 @@
           (if (or docstring? attrs? forms)
             (println)
             (print ")"))
-          (when docstring? (printf "\"%s\"\n" docstring? ))
-          (when attrs? (pprint attrs?))
+          (when docstring?
+            (printf "\"%s\"" docstring?)
+            (if (or (seq attrs?) (seq forms))
+              (print "\n")
+              (print ")")))
+          (when attrs?
+            (pprint attrs?)
+            (when (empty? (forms))
+              (print ")")))
           (dorun
            (map-indexed
             (fn [idx form]


move simple-flute amp to a more sensible location

--- src/overtone/inst/synth.clj
+++ src/overtone/inst/synth.clj
@@ -15,12 +15,12 @@
                        release 1
                        gate 1
                        out 0]
-  (let [env  (env-gen (adsr attack decay sustain release) gate amp :action FREE)
+  (let [env  (env-gen (adsr attack decay sustain release) gate :action FREE)
         mod1 (lin-lin:kr (sin-osc:kr 6) -1 1 (* freq 0.99) (* freq 1.01))
         mod2 (lin-lin:kr (lf-noise2:kr 1) -1 1 0.2 1)
         mod3 (lin-lin:kr (sin-osc:kr (ranged-rand 4 6)) -1 1 0.5 1)
         sig (distort (* env (sin-osc [freq mod1])))
-        sig (* sig mod2 mod3)]
+        sig (* amp sig mod2 mod3)]
     sig))

 ;;modified version of: https://github.com/supercollider-quarks/SynthDefPool/blob/master/pool/cs80lead_mh.scd


fix declaration of apply-at's arg-list

fix declaration of apply-at's arg-list

--- src/overtone/time_utils.clj
+++ src/overtone/time_utils.clj
@@ -72,8 +72,8 @@

 (def *APPLY-AHEAD* 150)

-(defn apply-at
-  {:arglists '([f args* argseq])}
+(defn apply-at
+  {:arglists '([f ms-time args* argseq])}
   [#^clojure.lang.IFn f ms-time & args]
   (let [delay-time (- ms-time *APPLY-AHEAD* (now))]
     (if (<= delay-time 0)


test cleanup

test cleanup

--- test/puppetlabs/trapperkeeper/core_test.clj
+++ test/puppetlabs/trapperkeeper/core_test.clj
@@ -11,7 +11,6 @@
             [puppetlabs.trapperkeeper.testutils.logging :refer [with-test-logging with-test-logging-debug]]
             [puppetlabs.trapperkeeper.testutils.bootstrap :refer :all]
             [puppetlabs.kitchensink.classpath :refer [with-additional-classpath-entries]]
-            [puppetlabs.trapperkeeper.examples.bootstrapping.test-services :refer [foo-test-service]]
             [puppetlabs.kitchensink.testutils.fixtures :refer [with-no-jvm-shutdown-hooks]]))

 (use-fixtures :once with-no-jvm-shutdown-hooks)
@@ -372,9 +371,9 @@
   (testing "debug mode is off by default"
     (let [app (bootstrap-services-with-empty-config [])
           get-in-config (trapperkeeper/get-service-fn app :config-service :get-in-config)]
-      (is (= false (get-in-config [:debug]))))))
+      (is (false? (get-in-config [:debug]))))))

   (testing "--debug puts TK in debug mode"
     (let [app (bootstrap*-with-empty-config [] ["--debug"])
           get-in-config (trapperkeeper/get-service-fn app :config-service :get-in-config)]
-      (is (= true (get-in-config [:debug])))))
+      (is (true? (get-in-config [:debug])))))


Fixed typo in url-encode doc-string.

Fixed typo in url-encode doc-string.

--- ring-core/src/ring/util/codec.clj
+++ ring-core/src/ring/util/codec.clj
@@ -5,7 +5,7 @@
            org.apache.commons.codec.binary.Base64))

 (defn url-encode
-  "Returns the form-url-encoded ersion of the given string, using either a
+  "Returns the form-url-encoded version of the given string, using either a
   specified encoding or UTF-8 by default."
   [unencoded & [encoding]]
   (URLEncoder/encode unencoded (or encoding "UTF-8")))


Fix arity.

Fix arity.

--- src/onyx/log/zookeeper.clj
+++ src/onyx/log/zookeeper.clj
@@ -206,9 +206,9 @@
     (let [entry (extensions/read-log-entry log position)]
       (>!! ch entry))
     (catch KeeperException$NoNodeException e
-      (seek-to-new-origin!))
+      (seek-to-new-origin! log ch))
     (catch KeeperException$NodeExistsException e
-      (seek-to-new-origin!))))
+      (seek-to-new-origin! log ch))))

 (defmethod extensions/subscribe-to-log ZooKeeper
   [{:keys [conn opts prefix] :as log} ch]


added stepped Fibonacci sequence solution instead of filtering.

--- euler-clj/src/euler_clj/core.clj
+++ euler-clj/src/euler_clj/core.clj
@@ -34,7 +34,7 @@
     (fib* n 0 1)))

 (defn fib-seq
-  "Return a lazy sequence of the Fibonacci sequence."
+  "Return a lazy sequence of the Fibonacci numbers."
   []
   (map fib (range)))

@@ -42,3 +42,13 @@
   "Find the sum of the even terms Fibonacci sequence whose values are less than n."
   [n]
   (apply + (filter even? (take-while (partial > n) (fib-seq)))))
+
+(defn stepped-fib-seq
+  "Retur a lazy sequence of every nth Fibonacci numbers."
+  [step]
+  (map fib (iterate #(+ % step) step)))
+
+(defn problem-2-unfiltered
+  "Find the sum of the even terms Fibonacci sequence whose values are less than n."
+  [n]
+  (apply + (take-while (partial > n) (stepped-fib-seq 3))))