Make frogs hostile

Make frogs hostile

--- src/cljc/robinson/monstergen.cljc
+++ src/cljc/robinson/monstergen.cljc
@@ -133,12 +133,12 @@
   (Monster. :bird           "bird"           "birds"          nil  9 0 2.1   1     6    4 #{:head :body :tail :leg :beak :wing}       #{:bite :claw}                :retreat-after-sound    :random                                 8 #{:docile})
   (Monster. :centipede      "centipede"      "centipedes"     nil 10 0 0.5   0.1   7    3 #{:head :body :leg}                         #{:bite}                      :hostile-after-attacked :random                                 3 #{:hostile})
   (Monster. :turtle         "turtle"         "turtles"        nil  4 0 0.5  10     8   20 #{:head :neck :body :leg :face :shell}      #{:bite}                      :retreat-after-attacked :random                                 5 #{:hostile})
-  (Monster. :red-frog       "red frog"       "red frogs"      nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:docile})
-  (Monster. :orange-frog    "orange frog"    "orange frogs"   nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:docile})
-  (Monster. :yellow-frog    "yellow frog"    "yellow frogs"   nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:docile})
-  (Monster. :green-frog     "green frog"     "green frogs"    nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:docile})
-  (Monster. :blue-frog      "blue frog"      "blue frogs"     nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:docile})
-  (Monster. :purple-frog    "purple frog"    "purple frogs"   nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:docile})
+  (Monster. :red-frog       "red frog"       "red frogs"      nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
+  (Monster. :orange-frog    "orange frog"    "orange frogs"   nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
+  (Monster. :yellow-frog    "yellow frog"    "yellow frogs"   nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
+  (Monster. :green-frog     "green frog"     "green frogs"    nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
+  (Monster. :blue-frog      "blue frog"      "blue frogs"     nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
+  (Monster. :purple-frog    "purple frog"    "purple frogs"   nil  3 0 0.9   1     5    5 #{:head :body :leg :face}                   #{:claw}                      :hostile-after-attacked :random                                 4 #{:hostile})
   (Monster. :parrot         "parrot"         "parrots"        nil 15 0 2.1   1     6    9 #{:head :body :leg :face :wing :tail}       #{:claw :bite}                :hostile-during-day     :random                                10 #{:hostile})
   (Monster. :shark          "shark"          "sharks"         nil 16 0 1.4 800     9   15 #{:head :body :fin :nose :tail}             #{:bite}                      :hostile                :follow-player-in-range-or-random      10 #{:hostile})
   (Monster. :fish           "fish"           "fish"           nil  9 0 1.0   4     7    8 #{:head :body :fin :tail}                   #{:bite}                      :retreat-after-attacked :random                                 1 #{:hostile})


Add a quantity attribute to cards

Add a quantity attribute to cards

--- src/cljs/decktouch/card-data.cljs
+++ src/cljs/decktouch/card-data.cljs
@@ -35,12 +35,13 @@
         (for [c list-o-cards]
           (do
           (if (= (get card-data "name") (get c "name"))
-            card-data
+            (merge card-data c)
             c)))))

 (defn add-card-to-list! [card-name]
   (do
-    (swap! card-list conj {"name" card-name})
+    (swap! card-list conj {"name" card-name
+                           "quantity" 1})
     (go
       (let [response (js->clj (.parse js/JSON (<! (<lookup-card-data card-name))))]
         (swap! card-list add-more-card-data response)


clean search

clean search

--- src/cljs/tumblrsearch/search.cljs
+++ src/cljs/tumblrsearch/search.cljs
@@ -17,31 +17,27 @@
         ch  (chan)]
     (.send req nil #(put! ch %))
     (go (let [[v c] (alts! [t ch])]
-          (case
+          (case
             ; timeout
-            (= c t)
+            (= c t)
             (>! ajax-chan {:error :timeout})
-
-            ; Response error
+            ; Response !OK
             (not (= (.. v -meta -status) 200))
             (>! ajax-chan {:error :ajax})
-
             ; response OK
-            (>! ajax-chan {:error false
-                           :search-term search-term
-                           :items (-> v
-                                      (.. -response)
-                                      (js->clj :keywordize-keys true)
-                                      (#(filter #(= (:type %) "photo"))))
-                           }))))))
+            (let [items (-> (.. v -response)
+                            (js->clj :keywordize-keys true)
+                            (#(filter #(= (:type %) "photo"))))]
+              (>! ajax-chan {:error false
+                             :search-term search-term
+                             :items items})))))))

 (defn new-search [data ajax-chan query]
   (om/transact! data
-    #(assoc %
-            :state :loading
-            :before 0
-            :current-search query
-            :current-items [])))
+    #(assoc % :state :loading
+              :before 0
+              :current-search query
+              :current-items [])))

 ;; Response Handler
 ;; -----------------------------------------------------------------------------
@@ -53,11 +49,12 @@
                  (= (:current-search @data)
                     (:search-term response)))
       (cond
+        ; error
         (:error response)
         (om/transact! data
           #(assoc % :current-state :error
                     :error (:error response)))
-
+        ; empty response
         (empty? (:items response))
         (if (empty? (:current-items @data))
           (om/transact! data
@@ -65,7 +62,6 @@
                       :error :empty-search))
           (om/transact! data
             #(assoc % :current-state :loaded-final)))
-
         :else
         (om/transact! data
           #(assoc % :current-state :loaded


Stop client child, w/out logging (WIP)

Stop client child, w/out logging (WIP)

This change looks a lot bigger than it really is.

Trying to figure out where client/stop! is going wrong.

This is almost all about logging and exception handling.

I did spot/fix a failure in the way I copy/pasted the logic flow. If you
tried to stop a Client that had no log-state, it wasn't calling the
function to actually stop the Child ioloop.

I had high hopes that fixing this would solve the issue where that
ioloop isn't getting stopped.

That was before I realized that the StackOverflow is killing my test
just before I call this function, so this change is largely meaningless
for the task/problem at hand.

Still, squashing bugs is always a positive thing.

--- src/clojure/frereth_cp/client.clj
+++ src/clojure/frereth_cp/client.clj
@@ -381,20 +381,24 @@
               {log-state ::log/state
                logger ::log/logger
                :as this} @wrapper]
+          (log/flush-logs! logger log-state)
           (throw (ex-info (str "Timed out after " timeout
                                " milliseconds waiting to build HELLO packet")
                           {::problem problem
-                           ::failed-state #(update this ::log/state % (log/flush-logs! logger log-state))})))))
+                           ::failed-state (dissoc this ::log/state)})))))
     (catch Exception ex
       (println "client: Failed before I could even get to a logger:\n"
                (log/exception-details ex)))))

 (s/fdef stop!
         :args (s/cat :state-agent ::state/state-agent)
-        :ret ::state/state)
+        :ret any?)
 (defn stop!
   [wrapper]
-  (let [local-log-atom (atom (log/init ::stop!))]
+  (println "Top of client/stop!")
+  (let [local-log-atom (atom (log/init ::stop!))
+        stop-finished (promise)
+        logger (log/std-out-log-factory)]
     (try
       (swap! local-log-atom #(log/debug %
                                         ::stop!
@@ -419,107 +423,130 @@
         ;; This is worrisome.
         ;; And yet another reason to just ditch the thing.
         (try
-          ;; It seems like it might also make sense to make sure the child
-          ;; message loop (if any) exits.
-          ;; FIXME: Make sure that goes away
           (send wrapper
                 (fn [{:keys [::state/chan->server
                              ::log/logger
                              ::shared/packet-management]
                       log-state ::log/state
                       :as this}]
-                  (swap! local-log-atom #(log/trace % ::stop! "Made it into the real client stopper"))
-                  (if log-state
-                    (try
-                      (let [log-state (log/debug log-state
+                  (try
+                    (swap! local-log-atom #(log/trace % ::stop! "Made it into the real client stopper"))
+                    (if log-state
+                      (try
+                        (let [log-state (log/debug log-state
+                                                   ::stop!
+                                                   "Top of the real stopper")
+                              ;; Note that this signals the Child ioloop to stop
+                              log-state (state/do-stop (assoc this
+                                                              ::log/state log-state))
+                              log-state
+                              (try
+                                (swap! local-log-atom #(log/trace %
+                                                                  ::stop!
+                                                                  "Possibly closing the channel to server"
+                                                                  {::state/chan->server chan->server}))
+                                (if chan->server
+                                  (do
+                                    (strm/close! chan->server)
+                                    (log/debug log-state
+                                               ::stop!
+                                               "chan->server closed"))
+                                  (log/warn (log/clean-fork log-state ::possible-issue)
+                                            ::stop!
+                                            "chan->server already nil"
+                                            (dissoc this ::log/state)))
+                                (catch Exception ex
+                                  (log/exception log-state
+                                                 ex
+                                                 ::stop!)))
+                              log-state (log/flush-logs! logger
+                                                         (log/info log-state
+                                                                   ::stop!
+                                                                   "Done"))]
+                          (assoc this
+                                 ::chan->server nil
+                                 ::log/state log-state
+                                 ::shared/packet-management nil))
+                        (catch Exception ex
+                          (assoc this
+                                 ::chan->server nil
+                                 ::log/state (log/exception log-state
+                                                            ex
+                                                            ::stop!
+                                                            "Actual stop function failed")
+                                 ::shared/packet-management nil)))
+                      ;; No log state
+                      ;; It's very tempting to refactor the duplicate functionality into
+                      ;; its own function. This one is pretty unwieldy.
+                      ;; And I've botched the copy/paste between the two versions at least once.
+                      (try
+                        (swap! local-log-atom
+                               #(log/warn %
+                                          ::stop!
+                                          "Missing log-state. Trying to close the channel to server"
+                                          {::state/chan->server chan->server}))
+                        (swap! local-log-atom
+                               #(state/do-stop (assoc this ::log/state %)))
+                        (if chan->server
+                          (do
+                            (strm/close! chan->server)
+                            (swap! local-log-atom
+                                   #(log/info %
+                                              ::stop!
+                                              "client/stop! Failed logging DEBUG: chan->server closed"))
+                            (assoc this
+                                   ::chan->server nil
+                                   ::log/state (log/init ::resurrected-during-stop!)
+                                   ::shared/packet-management nil))
+                          (do
+                            (swap! local-log-atom
+                                   #(log/info %
+                                              ::stop!
+                                              "client/stop! Failed logging: chan->server already nil"
+                                              {::state/state (dissoc this ::log/state)}))
+                            (assoc this
+                                   ::chan->server nil
+                                   ::log/state (log/init ::resurrected-during-stop!)
+                                   ::shared/packet-management nil)))
+                        (catch Exception ex
+                          (swap! local-log-atom
+                                 #(log/exception %
+                                                 ex
                                                  ::stop!
-                                                 "Top of the real stopper")
-                            log-state (state/do-stop (assoc this
-                                                            ::log/state log-state))
-                            log-state
-                            (try
-                              (swap! local-log-atom #(log/trace %
-                                                                ::stop!
-                                                                "Possibly closing the channel to server"
-                                                                {::state/chan->server chan->server}))
-                              (if chan->server
-                                (do
-                                  (strm/close! chan->server)
-                                  (log/debug log-state
-                                             ::stop!
-                                             "chan->server closed"))
-                                (log/warn (log/clean-fork log-state ::possible-issue)
-                                          ::stop!
-                                          "chan->server already nil"
-                                          (dissoc this ::log/state)))
-                              (catch Exception ex
-                                (log/exception log-state
-                                               ex
-                                               ::stop!)))
-                            log-state (log/flush-logs! logger
-                                                       (log/info log-state
-                                                                 ::stop!
-                                                                 "Done"))]
-                        (assoc this
-                               ::chan->server nil
-                               ::log/state log-state
-                               ::shared/packet-management nil))
-                      (catch Exception ex
-                        (assoc this
-                               ::chan->server nil
-                               ::log/state (log/exception log-state
-                                                          ex
-                                                          ::stop!
-                                                          "Actual stop function failed")
-                               ::shared/packet-management nil)))
-                    (try
-                      (swap! local-log-atom
-                             #(log/warn %
-                                        ::stop!
-                                        "Missing log-state. Trying to close the channel to server"
-                                        {::state/chan->server chan->server}))
-                      (if chan->server
-                        (do
-                          (strm/close! chan->server)
-                          (swap! local-log-atom
-                                 #(log/info %
-                                            ::stop!
-                                            "client/stop! Failed logging DEBUG: chan->server closed"))
+                                                 "Couldn't even do that much"))
                           (assoc this
                                  ::chan->server nil
                                  ::log/state (log/init ::resurrected-during-stop!)
-                                 ::shared/packet-management nil))
-                        (do
-                          (swap! local-log-atom
-                                 #(log/info %
-                                            ::stop!
-                                            "client/stop! Failed logging: chan->server already nil"
-                                            {::state/state (dissoc this ::log/state)}))
-                          (assoc this
-                                 ::chan->server nil
-                                 ::log/state (log/init ::resurrected-during-stop!)
-                                 ::shared/packet-management nil)))
-                      (catch Exception ex
-                        (swap! local-log-atom
-                               #(log/exception %
-                                               ex
-                                               "Couldn't even do that much"))
-                        (assoc this
-                               ::chan->server nil
-                               ::log/state (log/init ::resurrected-during-stop!)
-                               ::shared/packet-management nil))))))
+                                 ::shared/packet-management nil))))
+                    (catch Exception ex
+                      (swap! local-log-atom
+                             #(log/exception %
+                                             ex
+                                             ::stop!))
+                      (dfrd/error! stop-finished ex))
+                    (finally
+                      (swap! local-log-atom
+                             #(log/flush-logs! logger %))
+                      (dfrd/success! stop-finished true)))))
           (catch Exception ex
             (swap! local-log-atom
                    #(log/exception %
                                    ex
-                                   "(send)ing the close function to the client agent failed"))
-            (assoc @wrapper
-                   ::chan->server nil
-                   ::log/state (log/init ::resurrected-during-stop!)
-                   ::shared/packet-management nil))))
-      (finally
-        (let [logger (log/std-out-log-factory)]
-          (log/flush-logs! logger @local-log-atom))))))
+                                   "(send)ing the close function to the client agent failed")))
+          (finally
+            (send wrapper
+                  assoc
+                  ::chan->server nil
+                  ::log/state (log/init ::resurrected-during-stop!)
+                  ::shared/packet-management nil))))
+      (dfrd/on-realized stop-finished
+                        ;; Flushing logs here should be totally redundant.
+                        (fn [success]
+                          (println "Actual bottom of client/stop!")
+                          (log/flush-logs! logger @local-log-atom))
+                        (fn [fail]
+                          (println "Failed bottom of client/stop!")
+                          (log/flush-logs! logger @local-log-atom))))))

 (s/fdef ctor
         :args (s/cat :opts (s/keys :req [::msg-specs/->child


cleaning the example up a bit

cleaning the example up a bit

--- example/src/example/cube.cljs
+++ example/src/example/cube.cljs
@@ -6,8 +6,8 @@
    [cljs.core.async.macros :refer [go-loop]]
    [figwheel.client :refer [defonce]]))

-;; a more advanced example
-;; edit any of this live
+;; A more advanced example using React and Sablono
+;; you can edit any of this live

 (defonce ex3-atom (atom {:rx 0 :ry 0 :rz 0}))
@@ -93,14 +93,14 @@
 ;; the magic of react here is that this is reloadable by default!!
 (render-ex-3 @ex3-atom)

+;; atom watches are as well :)
 (add-watch ex3-atom :renderer (fn [_ _ _ s] (render-ex-3 s)))

-;; a better way for reloadability is to hook this into the jsload-callback
+;; a better way for reloadability is to hook this into the :jsload-callback
 ;; this way non local changes will show up
 ;; if you want to use this comment out the lines above and hook this
 ;; reload callback in examples.core
 (defn stop-and-start-ex3 []
-  ;; the magic of react this is reloadable!!
   (render-ex-3 @ex3-atom)
   (add-watch ex3-atom :renderer (fn [_ _ _ s] (render-ex-3 s))))


fix error in destructuring of options

fix error in destructuring of options

--- panc/src/main/clojure/org/quattor/pan/pan_annotations.clj
+++ panc/src/main/clojure/org/quattor/pan/pan_annotations.clj
@@ -89,16 +89,16 @@
 (defn -main
   [& args]

-  (let [{:keys [{:keys [help verbose quiet] :as options}
-                arguments errors summary]} (parse-opts args cli-options)]
-    (cond
-      help (exit 0 (usage summary))
-      (zero? (count args)) (exit 1 (usage summary))
-      errors (exit 1 (str (error-msg errors) "\n\n" (usage summary))))
-    (when (pos? verbose)
-      (println "Templates to process: " arguments))
-    (let [^CompilerResults results (generate-annotations options arguments)]
-      (if-let [errors (.formatErrors results)]
-        (println errors))
-      (if-not quiet
-        (println (.formatStats results))))))
+  (let [{:keys [options arguments errors summary]} (parse-opts args cli-options)]
+    (let [{:keys [help verbose quiet]} options]
+      (cond
+        help (exit 0 (usage summary))
+        (zero? (count args)) (exit 1 (usage summary))
+        errors (exit 1 (str (error-msg errors) "\n\n" (usage summary))))
+      (when (pos? verbose)
+        (println "Templates to process: " arguments))
+      (let [^CompilerResults results (generate-annotations options arguments)]
+        (if-let [errors (.formatErrors results)]
+          (println errors))
+        (if-not quiet
+          (println (.formatStats results)))))))


Narrow down a problem w/ Server startup

Narrow down a problem w/ Server startup

Not necessarily the problem, and almost definitely not the really
interesting part of it.

But it really looks as though my socket constructor is getting called
with both namespaced and non-namespace keywords. Which almost definitely
violates the spec.

Not sure how that bleeds over into the generator, but it's the most
likely candidate I've found so far.

--- src/com/frereth/common/system.clj
+++ src/com/frereth/common/system.clj
@@ -51,10 +51,14 @@
     :or {direction :connect
          socket-type :dealer
          thread-count 2}}]
+  (throw (ex-info "Start here"
+                  {:huh? "Compare `git diff`"
+                   :suspicion "Does including non-namespaced keywords royally break (s/explain-data)?"
+                   :otoh "This breaks lots of existing unit tests"}))
   (let [url (cond-> url
-              (not (:protocol url)) (assoc :protocol :tcp)
-              (not (:address url)) (assoc :address [127 0 0 1])
-              (not (:port url)) (assoc :port 9182))]
+              (not (:cljeromq.common/zmq-protocol url)) (assoc :cljeromq.common/zmq-protocol :tcp)
+              (not (:cljeromq.common/zmq-address url)) (assoc :cljeromq.common/zmq-address [127 0 0 1])
+              (not (:cljeromq.common/port url)) (assoc :cljeromq.common/port 9182))]
     (let [options {::context {:thread-count thread-count}
                    ::event-loop {:_name event-loop-name}
                    ::ex-sock {:url url


[# 5603] Updated bounties.network address

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/ui/screens/browser/default_dapps.cljs
+++ src/status_im/ui/screens/browser/default_dapps.cljs
@@ -60,7 +60,7 @@
             :photo-path  "contacts://name-bazaar"
             :description "ENS name marketplace"}
            {:name        "The Bounties Network"
-            :dapp-url    "https://moksha.bounties.network/"
+            :dapp-url    "https://berlin.bounties.network/"
             :photo-path  "contacts://bounties-network"
             :description "Bounties on any task, paid in any token"}
            {:name        "Emoon"


Update deps.

Update deps.

--- metlog-agent/project.clj
+++ metlog-agent/project.clj
@@ -1,9 +1,17 @@
 (defproject metlog-agent "0.1.0-SNAPSHOT"
-  :description "FIXME: write description"
-  :url "http://example.com/FIXME"
+  :description "Metlog agent - polls data sources for upload to vault."
+
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
-  :dependencies [[org.clojure/clojure "1.6.0"]]
+
+  :dependencies [[org.clojure/clojure "1.6.0"]
+                 [org.clojure/tools.logging "0.3.1"]
+                 [ch.qos.logback/logback-classic "1.1.2"]
+                 [clj-http "1.0.1"
+                  :exclusions [com.fasterxml.jackson.core/jackson-core]]]
   :main ^:skip-aot metlog-agent.core
   :target-path "target/%s"
-  :profiles {:uberjar {:aot :all}})
+  :profiles {:uberjar {:aot :all}}
+
+  :jar-name "metlog-agent.jar"
+  :uberjar-name "metlog-agent-standalone.jar")


A few tests for the maybe transformer

A few tests for the maybe transformer

--- tests/test_maybe.cljx
+++ tests/test_maybe.cljx
@@ -3,15 +3,17 @@
   (:require [cemerick.cljs.test :as ts]
             [cats.core :as m]
             [cats.protocols :as p]
+            [cats.builtin :as b]
             [cats.monad.maybe :as maybe])
    #+cljs
   (:require-macros [cemerick.cljs.test
                     :refer (is deftest with-test run-tests testing test-var)]
-                   [cats.core :refer (mlet)])
+                   [cats.core :refer (mlet with-context)])
   #+clj
   (:require [clojure.test :refer :all]
-            [cats.core :as m :refer [mlet]]
+            [cats.core :as m :refer [mlet with-context]]
             [cats.protocols :as p]
+            [cats.builtin :as b]
             [cats.monad.maybe :as maybe]))

@@ -49,4 +51,22 @@
                                 (fn [y] (maybe/just (inc y))))))))))

-; TODO: test maybe transformer
+(deftest test-maybe-trans
+  (let [maybe-vector-trans (maybe/maybe-trans b/vector-monad)]
+
+    (testing "It can be combined with the effects of other monads"
+      (is (= [(maybe/just 2)]
+             (with-context maybe-vector-trans
+               (m/return 2))))
+
+      (is (= [(maybe/just 1) (maybe/just 2) (maybe/just 2) (maybe/just 3)]
+             (with-context maybe-vector-trans
+               (mlet [x [(maybe/just 0) (maybe/just 1)]
+                      y [(maybe/just 1) (maybe/just 2)]]
+                     (m/return (+ x y))))))
+
+      (is (= [(maybe/just 1) (maybe/nothing) (maybe/just 2) (maybe/nothing)]
+             (with-context maybe-vector-trans
+               (mlet [x [(maybe/just 0) (maybe/just 1)]
+                      y [(maybe/just 1) (maybe/nothing)]]
+                     (m/return (+ x y)))))))))


Fix trace--toggle selector in rule.

Fix trace--toggle selector in rule.

The previously generated CSS gives:
#--re-frame-10x-- tr:hover { .trace--toggle-color: #767A7C;}

The second selector ended up concatenated with the rule using the old nesting.

--- src/day8/re_frame_10x/styles.cljs
+++ src/day8/re_frame_10x/styles.cljs
@@ -266,9 +266,8 @@
        {:border-bottom  [[(px 1) "dotted" light-purple]]
         :padding-bottom 0}]]]

-    ["&:hover"
-     {".trace--toggle"
-      {:color text-color}}]
+    ["&:hover.trace--toggle"
+      {:color text-color}]
     ["th" "td"
      ["&:first-child" {:padding-left "7px"}]
      ["&:last-child" {:padding-right "7px"}]]]


Add a possible pending test for fact/resource subquery

--- test/com/puppetlabs/puppetdb/test/http/v2/facts.clj
+++ test/com/puppetlabs/puppetdb/test/http/v2/facts.clj
@@ -6,6 +6,7 @@
   (:use clojure.test
         ring.mock.request
         [com.puppetlabs.puppetdb.fixtures]
+        [com.puppetlabs.puppetdb.examples]
         [clj-time.core :only [now]]
         [com.puppetlabs.jdbc :only (with-transacted-connection)]))

@@ -185,3 +186,30 @@
               {:keys [status body]} (*app* request)]
           (is (= status pl-http/status-bad-request))
           (is (= body "[] is not well-formed; queries must contain at least one operator")))))))
+
+(deftest queries-by-resources
+  (testing "subqueries using a resource"
+    (scf-store/add-certname! "foo")
+    (scf-store/add-certname! "bar")
+    (scf-store/add-certname! "baz")
+    (scf-store/add-facts! "foo" {"ipaddress" "192.168.1.100"} (now))
+    (scf-store/add-facts! "bar" {"ipaddress" "192.168.1.101"} (now))
+    (scf-store/add-facts! "baz" {"ipaddress" "192.168.1.102"} (now))
+    (let [catalog (:empty catalogs)
+          apache-resource {:type "Class" :title "Apache"}
+          apache-catalog (update-in catalog [:resources] conj {apache-resource (assoc apache-resource :exported false)})]
+      (scf-store/replace-catalog! (assoc apache-catalog :certname "foo") (now))
+      (scf-store/replace-catalog! (assoc apache-catalog :certname "bar") (now))
+      (scf-store/replace-catalog! (assoc catalog :certname "baz") (now)))
+    (let [query ["and"
+                 ["=" ["fact" "name"] "ipaddress"]
+                 ["subquery" "resource"
+                  ["and"
+                   ["=" "type" "Class"]
+                   ["=" "title" "Apache"]]]]
+          request (make-request "/v2/facts" {"query" (json/generate-string query)})
+          {:keys [status body]} (*app* request)
+          result (json/parse-string body true)]
+      (is (= status pl-http/status-ok))
+      (is (= body [{:node "foo" :fact "ipaddress" :value "192.168.1.100"}
+                   {:node "bar" :fact "ipaddress" :value "192.168.1.101"}])))))


updated json-serialization to be a function

--- frameworks/Clojure/luminus/hello/src/hello/routes/home.clj
+++ frameworks/Clojure/luminus/hello/src/hello/routes/home.clj
@@ -5,8 +5,9 @@
             [ring.util.response :refer [response content-type]]
             [clojure.java.io :as io]))

-(def json-serialization
+(defn json-serialization
   "Test 1: JSON serialization"
+  []
   (response {:message "Hello, World!"}))

 (defn single-query-test
@@ -43,7 +44,7 @@
 (defroutes home-routes
   (GET "/"                 [] "Hello, World!")
   (GET "/plaintext"        [] plaintext)
-  (GET "/json"             [] json-serialization)
+  (GET "/json"             [] (json-serialization))
   (GET "/db"               [] (single-query-test))
   (GET "/queries/"         [] (multiple-query-test 1))
   (GET "/queries/:queries" [queries] (multiple-query-test queries))


create linked entry in same story

create linked entry in same story

--- iwaswhere-web/src/cljs/iwaswhere_web/ui/entry/actions.cljs
+++ iwaswhere-web/src/cljs/iwaswhere_web/ui/entry/actions.cljs
@@ -93,7 +93,9 @@
                                       :value %}])
         show-comments #(show-hide-comments query-id)
         create-comment (h/new-entry-fn put-fn {:comment-for ts} show-comments)
-        create-linked-entry (h/new-entry-fn put-fn {:linked-entries [ts]} nil)
+        story (:linked-story entry)
+        create-linked-entry (h/new-entry-fn put-fn {:linked-entries [ts]
+                                                    :linked-story story} nil)
         new-pomodoro (h/new-entry-fn
                        put-fn (p/pomodoro-defaults ts) show-comments)
         trash-entry #(if edit-mode?


fixes #346

fixes #346

Former-commit-id: 24777a560c7ac28f591392032b5a8fcfe2ad3e69

--- src/status_im/components/chat_icon/screen.cljs
+++ src/status_im/components/chat_icon/screen.cljs
@@ -39,12 +39,12 @@

 (defview chat-icon-view [chat-id group-chat name online styles]
   [photo-path [:chat-photo chat-id]
-   dapp-url [:chat :dapp-url]]
+   dapp? [:get-in [:contacts chat-id :dapp?]]]
   [view (:container styles)
    (if-not (s/blank? photo-path)
      [chat-icon photo-path styles]
      [default-chat-icon name styles])
-   (when dapp-url
+   (when dapp?
      [dapp-badge styles])])

 (defn chat-icon-view-chat-list [chat-id group-chat name color online]


Doubled the character limit on timeline posts

Now, you won't have to fight an arbitrary character limit on posts like Twitter, and you can pack more meaning into your messages without having to split them into multiple messages.

Signed-off-by: Andrea Maria Piana <39e16ece3c2d27e1889178b15ddb376e524032f8@gmail.com>

--- src/status_im/ui/screens/status/new/views.cljs
+++ src/status_im/ui/screens/status/new/views.cljs
@@ -43,7 +43,7 @@
         ^{:key (str "image" img)}
         [image-preview img])]]))

-(def message-max-lenght 300)
+(def message-max-lenght 600)

 (defn my-status []
   (let [images-opened (reagent/atom false)


Test documentation

Test documentation

--- test/puppetlabs/master/certificate_authority_test.clj
+++ test/puppetlabs/master/certificate_authority_test.clj
@@ -657,7 +657,7 @@
                             :value    "UUUU-IIIII-DDD"}]]
         (is (= exts exts-expected))))

-    (testing "only puppet extensions are copied from CSR to cert"
+    (testing "only puppet extensions are extracted from CSR and DNS alt names is ignored."
       (let [csr-exts [(utils/subject-dns-alt-names ["onefish"] false)
                       (utils/puppet-node-uid "AAAA-BBBB-CCCC-DDDD" false)]
             csr      (utils/generate-certificate-request


Fixed a bug related to posting statsd info

--- tron/src/clojure/funcatron/tron/modes/runner_mode.clj
+++ tron/src/clojure/funcatron/tron/modes/runner_mode.clj
@@ -24,7 +24,7 @@

 (defn- record-execution-time
   [^String url ^String method ^Number time]
-  (when-let [statsd common/statsd-client]
+  (when-let [statsd (common/statsd-client)]
     (.recordExecutionTime statsd (str url "$$" method) (.longValue time)))
   )


Fix react warning about wrong value for autoComplete field

--- src/braid/core/client/gateway/forms/user_auth/views.cljs
+++ src/braid/core/client/gateway/forms/user_auth/views.cljs
@@ -28,7 +28,7 @@
     :class "email"
     :type "email"
     :placeholder "you@awesome.com"
-    :auto-complete true
+    :auto-complete "on"
     :auto-focus true
     :help-text [:span "Or, log in with: " [auth-providers-view]]}])

@@ -166,7 +166,7 @@
     :title "Email"
     :class "email"
     :type "email"
-    :auto-complete true
+    :auto-complete "on"
     :auto-focus true
     :placeholder "you@awesome.com"
     :help-text [:span "Or, register with: " [auth-providers-view]]}])


disable autoredeploy if service not created via swarmpit api -> no metadata found

--- src/cljs/swarmpit/component/service/form_deployment.cljs
+++ src/cljs/swarmpit/component/service/form_deployment.cljs
@@ -98,6 +98,7 @@
     (comp/form-toogle
       {:name     "autoredaploy"
        :key      "autoredaploy"
+       :disabled (nil? value)
        :toggled  value
        :onToggle (fn [_ v]
                    (state/update-value [:autoredeploy] v cursor))})))


fix bug that causes task to be run multiple times when called from run-task rather than through dependencies

--- src/cake.clj
+++ src/cake.clj
@@ -17,15 +17,14 @@
     "org.clojure"
     (or (namespace project) (name project))))

-(def project nil)
-(def the-project (atom nil))
+(def cake-project (atom nil))

 (defmacro defproject [project-name version & args]
   (let [root (.getParent (java.io.File. *file*))
         artifact (name project-name)]
     `(do (require 'cake.ant)
          (cake.ant/init-project ~root)
-         (compare-and-set! the-project nil
+         (compare-and-set! cake-project nil
            (-> (apply hash-map '~args)
                (assoc :artifact-id ~artifact
                       :group-id    ~(group project-name)
@@ -37,7 +36,7 @@
                          :resources-path (str ~root "/resources")
                          :source-path    (str ~root "/src")
                          :test-path      (str ~root "/test"))))
-         ; @the-project must be set before we include the tasks for bake to work.
+         ; @cake-project must be set before we include the tasks for bake to work.
          (require 'cake.tasks.defaults))))

 (defn dependency? [form]
@@ -50,7 +49,7 @@

 (defn update-task [task deps doc actions]
   {:pre [(every? dependency? deps) (every? fn? actions)]}
-  (let [task (or task {:actions [] :deps []})]
+  (let [task (or task {:actions [] :deps [] :run? (atom false)})]
     (-> task
         (update :deps    into deps)
         (update :doc     cat  doc)
@@ -76,30 +75,26 @@
 (defn remove-task! [name]
   (swap! tasks dissoc name))

+(def project nil)
 (def current-task nil)

 (defn run-task
   "Execute the specified task after executing all prerequisite tasks."
-  ([name] (swap! tasks run-task name) nil)
-  ([tasks form]
-     (if (list? form)
-       (binding [project @the-project]
-         ((eval form)) ; excute anonymous dependency
-         tasks)
-       (let [name form, task (tasks name)]
-         (when (nil? task) (abort "Unknown task:" name))
-         (if (:run? task)
-           tasks
-           (let [tasks (reduce run-task tasks (task :deps))]
-             (doseq [action (task :actions)]
-               (binding [project @the-project, current-task name]
-                 (action)))
-             (when (verbose? opts) (println " " name "complete."))
-             (assoc-in tasks [name :run?] true)))))))
+  [form]
+  (if (list? form)
+    (binding [project @cake-project] ((eval form))) ; excute anonymous dependency
+    (let [name form, task (@tasks name)]
+      (when (nil? task) (abort "Unknown task:" name))
+      (when-not @(:run? task)
+        (doseq [dep (:deps task)] (run-task dep))
+        (doseq [action (:actions task)]
+          (binding [project @cake-project, current-task name]
+            (action)))
+        (compare-and-set! (get-in @tasks [name :run?]) false true)))))

 (defmacro bake [& body]
   "Execute body in a fork of the jvm with the classpath of your project."
-  (let [code (prn-str `(do (def ~'project '~(deref the-project))
+  (let [code (prn-str `(do (def ~'project '~(deref cake-project))
                            (def ~'opts ~opts)
                            ~@body))]
     `(do (require 'cake.ant)
@@ -119,5 +114,4 @@
   (init)
   (let [task (first *command-line-args*)]
     (run-task (symbol (or task 'default)))
-    (System/exit 0)
-    ))
+    (System/exit 0)))


Indentation

Indentation

--- src/main.clj
+++ src/main.clj
@@ -27,14 +27,12 @@
     (reset! server (run-server app {:port port}))))

 (defn -main []
-  (start-server)
-)
+  (start-server))

 (defn stop-server []
   (when-not (nil? @server)
     (@server)
-    (reset! server nil))
-  )
+    (reset! server nil)))

 (defn restart-server []
   (stop-server)


adding route for playing a card

adding route for playing a card

--- cartagena-engine/src/cartagena/server.clj
+++ cartagena-engine/src/cartagena/server.clj
@@ -10,6 +10,10 @@
 (def default-players [{:name "tanya" :color :orange} {:name "rusty" :color :black}])
 (defroutes app-routes
            (GET "/" [] "
Hello World
")
+
+           (POST "/play-card" req
+             (let [{:keys [player icon from-space board discard-pile]} (:body req)]
+               (response/response (engine/play-card player icon from-space board discard-pile))))

            (POST "/new-game" req
              (if-let [players (get (:body req) :players)]


feat(launch): improve lein launch by adding JVM options as does Leiningen

--- ccw.core/src/clj/ccw/leiningen/launch.clj
+++ ccw.core/src/clj/ccw/leiningen/launch.clj
@@ -7,26 +7,31 @@
   ([project command]
     (lein-launch-configuration project command nil))
   ([project command {:keys [leiningen-standalone-path launch-name] :as options}]
-    {
-     :private                true
-     :launch-in-background   false
-     :append-environment-variables true
-     :name                   launch-name
-
-     :java/project-name      (and project (e/project-name project))
-     :java/classpath         [{:entry-type :lib
-                               :path (or
-                                       leiningen-standalone-path
-                                       (e/get-file-inside-plugin "ccw.core" "leiningen-standalone.jar")) }
-                              {:entry-type :lib
-                               :path (e/get-file-inside-plugin "ccw.core" "lein")}
-                              {:entry-type :jre-container
-                               :name launch/default-jre-container-name}]
-     :java/default-classpath false
-     :java/vm-arguments      (str " -Dfile.encoding=UTF-8"
-                                  " -Dmaven.wagon.http.ssl.easy=false")
-     :java/main-type-name    "clojure.main"
-     :java/program-arguments (str "-m ccw.leiningen.main " command)}))
+    (let [leiningen-standalone-path (or leiningen-standalone-path
+                                        (e/get-file-inside-plugin "ccw.core" "leiningen-standalone.jar"))]
+      {
+       :private                true
+       :launch-in-background   false
+       :append-environment-variables true
+       :name                   launch-name
+
+       :java/project-name      (and project (e/project-name project))
+       :java/classpath         [{:entry-type :lib
+                                 :path leiningen-standalone-path}
+                                {:entry-type :lib
+                                 :path (e/get-file-inside-plugin "ccw.core" "lein")}
+                                {:entry-type :jre-container
+                                 :name launch/default-jre-container-name}]
+       :java/default-classpath false
+       :java/vm-arguments      (str
+                                 " -client"
+                                 " -Xbootclasspath/a:" (.toOSString (e/path leiningen-standalone-path))
+                                 " -XX:+TieredCompilation"
+                                 " -XX:TieredStopAtLevel=1"
+                                 " -Dfile.encoding=UTF-8"
+                                 " -Dmaven.wagon.http.ssl.easy=false")
+       :java/main-type-name    "clojure.main"
+       :java/program-arguments (str "-m ccw.leiningen.main " command)})))

 (defn lein
   "project can be nil"


Remove vestigial extract-seq-elements

Remove vestigial extract-seq-elements

--- src/leiningen/new/onyx_app/src/onyx_app/catalogs/sample_catalog.clj
+++ src/leiningen/new/onyx_app/src/onyx_app/catalogs/sample_catalog.clj
@@ -59,14 +59,6 @@
       :onyx/max-peers 1
       :onyx/doc "Reads segments from seq"}

-     {:onyx/name :extract-seq-elements
-      :onyx/fn :{{app-name}}.functions.sample-functions/get-in-segment
-      :onyx/type :function
-      :onyx/batch-size batch-size
-      :onyx/batch-timeout batch-timeout
-      :keypath [:elements]
-      :onyx/params [:keypath]}
-
      {:onyx/name :write-lines
       :onyx/plugin :onyx.plugin.core-async/output
       :onyx/type :output


More work on azulenoids.clj

More work on azulenoids.clj

--- clojure/org/gavrog/clojure/azulenoids.clj
+++ clojure/org/gavrog/clojure/azulenoids.clj
@@ -10,18 +10,18 @@
   (reduce (fn [D i] (.op ds i D)) D idxs))

 (defn chain-end [ds D i j]
-  (let [step (fn [E]
-               (let [E* (walk ds E j)]
-                 (cond
-                   (nil? E*) E
-                   (= E E*) E
-                   (= D E*) nil
-                   :else (recur (walk ds E j i)))))]
+  (letfn [(step [E]
+                (let [E* (walk ds E j)]
+                  (cond
+                    (nil? E*) E
+                    (= E E*) E
+                    (= D E*) nil
+                    :else (recur (walk ds E j i)))))]
     (step (walk ds D i))))

 (defn boundary-chambers [ds D i j k]
-  (let [a (fn [D] (walk ds D i))
-        b (fn [D] (chain-end ds D j k))]
+  (letfn [(a [D] (walk ds D i))
+          (b [D] (chain-end ds D j k))]
     (iterate-cycle [a b] D)))

 (defn max-curvature [ds]
@@ -32,12 +32,6 @@
   (if (.isNegative (max-curvature ds))
     []
     (new DefineBranching2d ds 3 2 Whole/ZERO)))
-
-(defn subdiv [ds pos]
-  )
-
-(defn subdivs-for [ds]
-  (map (partial subdiv ds) (range 1 16 2)))

 (def template
   (new DSymbol (str "1.1:60:"
@@ -55,3 +49,11 @@
 (def sets (new CombineTiles octagon))

 (def syms (mapcat syms-for sets))
+
+(def boundary-mappings
+  (let [start (fn [p] (mod (- 20 p) 16))
+        template-boundary (boundary-chambers template (Integer. 1) 0 1 2)
+        octagon-boundary (cycle (range (Integer. 1) (Integer. 17)))
+        mapping (fn [p] (zipmap (drop (start p) octagon-boundary)
+                                (take 16 template-boundary)))]
+    (map mapping (range 1 16 2))))


simplify3d.clj: added check that simplifications reduce the symbols complexity

--- clojure/org/gavrog/clojure/simplify3d.clj
+++ clojure/org/gavrog/clojure/simplify3d.clj
@@ -110,6 +110,9 @@
   (->> A (orbit-elements ds [0 1])
     (map (partial s ds 3)) (filter #{B D}) count (not= 1)))

+(defn- kf-complexity [ds]
+  (reduce + (for [D (orbit-reps ds [0 1 3])] (- (r ds 0 1 D) 2))))
+
 (defn pinch-first-local-2-cut [ds]
   (if-let [[A B C D] (first (filter (partial liftable? ds) (local-2-cuts ds)))]
     (let [[t1 E1] (cut-face ds A C)
@@ -130,5 +133,11 @@
         (let [t (f ds)]
           (if (= t ds)
             (recur ds (rest pending))
-            (recur (clean t) operations)))
+            (let [t (clean t)]
+              (assert (neg? (compare [(kf-complexity t) (size t)]
+                                     [(kf-complexity ds) (size ds)]))
+                      (str "Complexity not reduced by\n  " (prn-str (class f))
+                           (prn-str ds)
+                           "  =>\n" (prn-str t)))
+              (recur t operations))))
         ds))))


Basic Comments

Basic Comments

--- src/hackernews/shared/scenes/detail_view/detail_view.cljs
+++ src/hackernews/shared/scenes/detail_view/detail_view.cljs
@@ -11,15 +11,19 @@

 (defn comment-row
   [comment]
-  [rn/view {:style {:padding 15}}
-   [rn/html-view {:value comment
+  [rn/view {:style {:margin 10}}
+   [rn/text {:style {:padding 5
+                     :color "#f26522"}}
+    (str (:user comment) " " (:time_ago comment))]
+   [rn/html-view {:value (:content comment)
+                  :style {:flex 1}
                   :stylesheet {:p {:font-size 18}}}]])

 (defn collect-comments
   [comment]
-  (->> comment
-       (tree-seq map? :comments)
-       (map :content)))
+  (->>
+   (tree-seq map? :comments comment)
+   (filter :content)))

 (defn detail-view
   [{:keys [id]}]


Disable schema validation in dev, again (it's slowing down the player :/)

--- dev/cljs/asciinema/player/dev.cljs
+++ dev/cljs/asciinema/player/dev.cljs
@@ -12,7 +12,7 @@
             [ajax.core :refer [GET]])
   (:require-macros [cljs.core.async.macros :refer [go]]))

-(s/set-fn-validation! true)
+;; (s/set-fn-validation! true)

 (defonce poster-js [[["File Edit Options Buffers Tools C++ YASnippet Help                              " {"inverse" true}]] [["/" {"fg" 1, "inverse" true}] ["* Copyright (c) 2014 Vinícius dos San" {"fg" 1}] ["$" {}] ["|" {"inverse" true}] ["/* Copyright (c) 2014 Vinícius dos Sant" {"fg" 1}] ["$" {}]] [["                                       " {"fg" 1}] ["|" {"inverse" true}] ["                                        " {"fg" 1}]] [["   Distributed under the Boost Softwar" {"fg" 1}] ["$" {}] ["|" {"inverse" true}] ["   Distributed under the Boost Software" {"fg" 1}] ["$" {}]] [["   file LICENSE_1_0.txt or copy at htt" {"fg" 1}] ["$" {}] ["|" {"inverse" true}] ["   file LICENSE_1_0.txt or copy at http" {"fg" 1}] ["$" {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["#ifndef" {"fg" 4, "bold" true}] [" BOOST_HTTP_EMBEDDED_SERVER_SOC$" {}] ["|" {"inverse" true}] ["#ifndef" {"fg" 4, "bold" true}] [" BOOST_HTTP_EMBEDDED_SERVER_SOCK$" {}]] [["#define" {"fg" 4, "bold" true}] [" " {}] ["BOOST_HTTP_EMBEDDED_SERVER_SOC" {"fg" 3}] ["$" {}] ["|" {"inverse" true}] ["#define" {"fg" 4, "bold" true}] [" " {}] ["BOOST_HTTP_EMBEDDED_SERVER_SOCK" {"fg" 3}] ["$" {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<cstdint>" {"fg" 2}] ["                     " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<cstdint>" {"fg" 2}] ["                      " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<algorithm>" {"fg" 2}] ["                   " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<algorithm>" {"fg" 2}] ["                    " {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/asio/ip/tcp.hpp>" {"fg" 2}] ["       " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/asio/ip/tcp.hpp>" {"fg" 2}] ["        " {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/outgoing_state.hp" {"fg" 2}] ["$" {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/outgoing_state.hpp" {"fg" 2}] ["$" {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/message.hpp>" {"fg" 2}] ["      " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/message.hpp>" {"fg" 2}] ["       " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/http_errc.hpp>" {"fg" 2}] ["    " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<boost/http/http_errc.hpp>" {"fg" 2}] ["     " {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["// TODO: remove me                     " {"fg" 1}] ["|" {"inverse" true}] ["// TODO: remove me                      " {"fg" 1}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<iostream>" {"fg" 2}] ["                    " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<iostream>" {"fg" 2}] ["                     " {}]] [["#include" {"fg" 4, "bold" true}] [" " {}] ["<string>" {"fg" 2}] ["                      " {}] ["|" {"inverse" true}] ["#include" {"fg" 4, "bold" true}] [" " {}] ["<string>" {"fg" 2}] ["                       " {}]] [["                                       " {}] ["|" {"inverse" true}] ["                                        " {}]] [["-UUU:----F1  " {"inverse" true}] ["embedded_server_socket.hpp" {"bold" true, "inverse" true}] ["|-UUU:----F1  " {"inverse" true}] ["embedded_server_socket.hpp" {"bold" true, "inverse" true}] [" " {"inverse" true}]] [["                                                                                " {}]]])


Small refactor

Small refactor

--- src/cljs/conference_rating/conference_list_page/conference_list_page.cljs
+++ src/cljs/conference_rating/conference_list_page/conference_list_page.cljs
@@ -9,22 +9,15 @@
 (defonce displayed-past-conferences (atom nil))
 (defonce current-page-future-conferences (atom 1))

-(defn- turn-next-page [next-page-conferences]
+(defn- display-new-conferences [next-page-conferences]
   (reset! displayed-future-conferences next-page-conferences))

-(defn- load-more-conferences []
-  (swap! current-page-future-conferences inc)
-  (backend/load-future-conferences @current-page-future-conferences turn-next-page))
-
-(defn- turn-previous-page [next-page-conferences]
-  (reset! displayed-future-conferences next-page-conferences))
-
-(defn- load-less-conferences []
-  (swap! current-page-future-conferences dec)
-  (backend/load-future-conferences @current-page-future-conferences turn-previous-page))
+(defn- load-new-page [modify-atom-fn]
+  (swap! current-page-future-conferences modify-atom-fn)
+  (backend/load-future-conferences @current-page-future-conferences display-new-conferences))

 (defn- previous-page-handler [enable-button]
-  (if enable-button (load-less-conferences)))
+  (if enable-button (load-new-page dec)))

 (defn display-conference-list [future-conferences past-conferences]
   [:div {:data-e2e "page-conference-list"}
@@ -35,7 +28,7 @@
        (let [enable-button (> @current-page-future-conferences 1)]
          [:a {:class "btn btn-sm btn-orange" :data-e2e "button-previous-page-future-conferences" :on-click #(previous-page-handler enable-button) :disabled (not enable-button)} "Previous Page"])
        [:span {:class "current-page" } (str "Page: " @current-page-future-conferences)]
-       [:a {:class "btn btn-sm btn-orange" :data-e2e "button-next-page-future-conferences" :on-click #(load-more-conferences)} "Next Page"]
+       [:a {:class "btn btn-sm btn-orange" :data-e2e "button-next-page-future-conferences" :on-click #(load-new-page inc)} "Next Page"]
        ]
       [:div {:class "row"} (map #(list-entry/display-conference-list-item % future-conferences) (sort-by :to future-conferences))]
       [:h3 "Past conferences"]


Fixed potential bug with printing too big of ints

--- src/clojush/problems/software/replace_space_with_newline.clj
+++ src/clojush/problems/software/replace_space_with_newline.clj
@@ -116,7 +116,7 @@
                                  int-result (stack-ref :integer 0 final-state)]
                              (when print-outputs
                                (println (format "\n| Correct output: %s\n| Program output: %s" (pr-str correct-output) (pr-str printed-result)))
-                               (println (format "| Correct integer: %2d | Program integer: %d" correct-int int-result)))
+                               (println (format "| Correct integer: %2d | Program integer: %s" correct-int (str int-result))))
                              ; Record the behavior
                              (when @global-print-behavioral-diversity
                                (swap! behavior conj [printed-result int-result]))


Bump up date resolution so sorting orders things correctly

--- src/net/dishevelled/mailindex.clj
+++ src/net/dishevelled/mailindex.clj
@@ -90,7 +90,7 @@
                        (DateTools/dateToString
                         (or (.getSentDate msg)
                             (.getReceivedDate msg))
-                        DateTools$Resolution/DAY))
+                        DateTools$Resolution/SECOND))
            :boost 10
            :for-sorting true}


correctly get back source channel in alts!

--- src/org/spootnik/fleet/engine.clj
+++ src/org/spootnik/fleet/engine.clj
@@ -45,12 +45,12 @@
             (a/put! @subscription :close)
             (a/close! @subscription))
           (reset! subscription close-ch)
-          (when keepalive
+          (when (pos? keepalive)
             (info "found keepalive, starting loop")
             (go
               (loop []
-                (let [tm  (a/timeout keepalive)
-                      sig (alts! [close-ch tm])]
+                (let [tm      (a/timeout keepalive)
+                      [_ sig] (alts! [close-ch tm])]
                   (when (= tm sig)
                     ;; every keepalive interval
                     ;; send a dummy script on the wire to


Fix slot-window example

Fix slot-window example

--- satori-rules/rules/mysql/query.clj
+++ satori-rules/rules/mysql/query.clj
@@ -38,10 +38,8 @@
     (where (service #"^mysql\.query\..*-user-count$")
       (slot-window :service {:total "mysql.query.total-user-count",
                              :bad   "mysql.query.bad-user-count"}
-        (slot-coalesce :total {:service "app.sms.bad-user-percent",
-                               :metric (if (> bad 5) (/ bad total) -1)
-                               :bad-users bad
-                               :total-users total}
+        (slot-coalesce {:service "app.sms.bad-user-percent",
+                        :metric (if (> bad 5) (/ bad total) -1)}
           (set-state (> 0.5)
             (runs 2 :state
               (should-alarm-every 300


Styling fix

Styling fix

--- src/snailfinder_app/ios/core.cljs
+++ src/snailfinder_app/ios/core.cljs
@@ -42,7 +42,8 @@
                :height           50}
    :toolbar   {:position         "relative"
                :background-color "#01579B"}
-   :scenes    {:main  {:view      {:align-items "stretch"}
+   :scenes    {:main  {:view      {:align-items "stretch"
+                                   :top 50}
                        :city-card {:card        {:height     105
                                                  :flex       1
                                                  }
@@ -129,7 +130,7 @@
        [scroll
         [text {:style {}} "DETAIL!!!!"]
         [menu-item-component {:item  (first menu-items)
-                              :style {}}]
+                              :style (get style :city-card)}]
         [menu-item-component {:item  (second menu-items)
                               :style (get style :city-card)}]]
        ;[scroll


Add validation for email input component.

--- src/cljs/hatnik/web/client/form/add_action.cljs
+++ src/cljs/hatnik/web/client/form/add_action.cljs
@@ -1,7 +1,9 @@
 (ns hatnik.web.client.form.add-action
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
-            [hatnik.web.client.z-actions :as action])
+            [hatnik.web.client.z-actions :as action]
+            [hatnik.schema :as schm]
+            [schema.core :as s])
   (:use [jayq.core :only [$]]
         [clojure.string :only [split replace]]))

@@ -73,20 +75,29 @@

 (defn email-component [data owner]
   (reify
-    om/IRender
-    (render [this]
+    om/IInitState
+    (init-state [this]
+      {:status "has-success"})
+
+    om/IRenderState
+    (render-state [this state]
       (dom/div nil
                (dom/div #js {:className "form-group"}
                         (dom/label #js {:for "email-input"} "Email")
                         (dom/p #js {:id "email-input"}
                                (:email data)))
-               (dom/div #js {:className "form-group"}
+               (dom/div #js {:className (str "form-group " (:status state))}
                         (dom/label #js {:for "emain-body-input"} "Email body")
                         (dom/textarea #js {:cols "40"
                                            :className "form-control"
                                            :id "emain-body-input"
                                            :value (:template data)
-                                           :onChange #((:template-handler data) (.. % -target -value))}))))))
+                                           :onChange #(do
+                                                        ((:template-handler data) (.. % -target -value))
+                                                        (om/set-state! owner :status
+                                                                       (if (s/check schm/TemplateBody (.. % -target -value))
+                                                                         "has-error"
+                                                                         "has-success")))}))))))

 (defn github-issue-on-change [gh-repo timer form-handler form-status-handler error-handler]
   (js/clearTimeout timer)


Refactor AOC Day 20

Refactor AOC Day 20

--- clj/advent-of-code-2016/src/advent_of_code_2016/day20.clj
+++ clj/advent-of-code-2016/src/advent_of_code_2016/day20.clj
@@ -9,29 +9,27 @@

 (def max-ip 4294967295)

-(defn step
-  [[acc last-hi] [lo hi]]
-  (let [next-acc (if (> (- lo last-hi) 1) (cons [(inc last-hi) (dec lo)] acc) acc)]
-    [next-acc (max hi last-hi)]))
+(defn open-ranges-seq
+  [last-hi [[lo hi] & rest-blacklist]]
+  (cond
+    (nil? lo) (if (= last-hi max-ip) [] [[(inc last-hi) max-ip]])
+    (> (- lo last-hi) 1) (cons [(inc last-hi) (dec lo)] (lazy-seq (open-ranges-seq (max hi last-hi) rest-blacklist)))
+    :else (lazy-seq (open-ranges-seq (max hi last-hi) rest-blacklist))))

 (defn get-open-ranges
-  [initial-blacklist]
-  (let [[open-ranges last-hi] (reduce step [[] 0] (sort-by first initial-blacklist))
-        open-range-with-last (if (= last-hi max-ip) open-ranges (cons [(inc last-hi) max-ip] open-ranges))]
-    (reverse open-range-with-last)))
-
-(defn solve-part-1
   [input]
   (->> input
-      (parse-input)
-      (get-open-ranges)
-      (first)
-      (first)))
+       (parse-input)
+       (sort-by first)
+       (open-ranges-seq 0)))
+
+(def solve-part-1 (comp first first get-open-ranges))
+
+(defn size [[lo hi]] (inc (- hi lo)))

 (defn solve-part-2
   [input]
   (->> input
-       (parse-input)
        (get-open-ranges)
-       (map (fn [[lo hi]] (inc (- hi lo))))
-       (reduce +)))+       (map size)
+       (reduce +)))


fixed the transaction generation test

fixed the transaction generation test

--- scripts/transaction_graph/main.clj
+++ scripts/transaction_graph/main.clj
@@ -3,6 +3,7 @@
             [monger.core :as monger]
             [freecoin.config :as config]
             [freecoin.db.mongo :as mongo]
+            [freecoin.db.storage :as storage]
             [freecoin.blockchain :as blockchain]
             [freecoin.db.wallet :as wallet]
             [freecoin.db.uuid :as uuid])
@@ -13,7 +14,7 @@
 (def ^:private wallet-counter (atom 0))

 (defn new-wallet! [wallet-store blockchain wallet-data-generator]
-  (let [{:keys [sso-id name email]} (wallet-data-generator)]
+  (let [{:keys [name email]} (wallet-data-generator)]
     (wallet/new-empty-wallet! wallet-store blockchain name email)))

 (defn new-transaction! [blockchain transaction-data-generator wallets-and-secrets]
@@ -25,8 +26,7 @@
 (defn create-wallet-generator [index-generator]
   (fn []
     (let [index (index-generator)]
-      {:sso-id (str "sso-id-" index)
-       :name (str "name" index)
+      {:name (str "name" index)
        :email (str "test-" index "@email.com")})))

 (defn create-transaction-generator [from-selector to-selector amount-generator]
@@ -51,8 +51,9 @@
       (swap! current-index inc))))

 (defn populate-db [db n-wallets n-transactions]
-  (let [wallet-store (mongo/create-wallet-store db)
-        blockchain (blockchain/new-stub db)
+  (let [stores-m (storage/create-mongo-stores db)
+        blockchain (blockchain/new-stub stores-m)
+        wallet-store (:wallet-store stores-m)
         wallet-data-generator (create-wallet-generator (create-index-generator))
         transaction-data-generator (create-transaction-generator random-selection random-selection random-amount)
         wallets-and-secrets (->> #(new-wallet! wallet-store blockchain


More experiments with the way data is enqueued.


Added another unit test checking a veritical band.


CMR-1855 Fixes order of elements in ECHO platform instrument mappings.

--- umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/echo10.clj
+++ umm-spec-lib/src/cmr/umm_spec/umm_to_xml_mappings/echo10.clj
@@ -65,9 +65,9 @@
                                            :LongName
                                            :Technique
                                            :NumberOfSensors
+                                           [:Characteristics
+                                            (for-each "Characteristics"
+                                              characteristic-mapping)]
                                            [:OperationModes
                                             (for-each "OperationalModes"
-                                              [:OperationMode (xpath ".")])]
-                                           [:Characteristics
-                                            (for-each "Characteristics"
-                                              characteristic-mapping)]))]))]])
+                                              [:OperationMode (xpath ".")])]))]))]])


CMR-2023: Some minor changes to the unit tests to test additional scenorios.

--- virtual-product-app/test/cmr/virtual_product/test/config.clj
+++ virtual-product-app/test/cmr/virtual_product/test/config.clj
@@ -164,7 +164,8 @@
          {:granule-ur "SC:AST_L1T.003:2148809731"
           :related-urls (concat [{:type "GET RELATED VISUALIZATION" :url random-url}]
                                 (gen-access-urls [frbt-data-pool-url frbt-egi-url random-url]))
-          :product-specific-attributes [{:name "FullResolutionThermalBrowseAvailable" :values ["YES"]}]}
+          :product-specific-attributes [{:name "FullResolutionThermalBrowseAvailable" :values ["YES"]}
+                                        {:name "identifier_product_doi_authority" :values ["authority"]}]}
          {:granule-ur "SC:AST_FRBT.003:2148809731"
           :related-urls (gen-access-urls [frbt-data-pool-url frbt-egi-url])}

@@ -178,9 +179,12 @@
          {:granule-ur "SC:AST_L1T.003:2148809731"
           :related-urls (concat [{:type "GET RELATED VISUALIZATION" :url random-url}]
                                 (gen-access-urls [frbv-data-pool-url frbv-egi-url random-url]))
-          :product-specific-attributes [{:name "FullResolutionVisibleBrowseAvailable" :values ["YES"]}]}
+          :product-specific-attributes [{:name "FullResolutionVisibleBrowseAvailable" :values ["YES"]}
+                                        {:name "identifier_product_doi" :values ["doi"]}
+                                        {:name "some other psa" :values ["psa-val"]}]}
          {:granule-ur "SC:AST_FRBV.003:2148809731"
-          :related-urls (gen-access-urls [frbv-data-pool-url frbv-egi-url])}
+          :related-urls (gen-access-urls [frbv-data-pool-url frbv-egi-url])
+          :product-specific-attributes [{:name "some other psa" :values ["psa-val"]}]}

          "LPDAAC_ECS" ast-l1t "AST_FRBV"
          {:granule-ur "SC:AST_L1T.003:2148809731"


Kunal Updated as recommended by Rob

Kunal Updated as recommended by Rob

--- src-cljs/frontend/components/pricing.cljs
+++ src-cljs/frontend/components/pricing.cljs
@@ -84,13 +84,9 @@
                 [:p
                  [:span "You can run "]
                  [:strong {:class (when (> concurrent-count 9) "double-digits")} (str concurrent-count)]
-                 [:span " concurrent build"]
-                 [:span (if (> concurrent-count 1) "s") ]
-                 [:span " with "]
+                 [:span (str " concurrent build" (if (> concurrent-count 1) "s" "") " with ")]
                  [:strong {:class (when (> container-count 9) "double-digits")} (str container-count)]
-                 [:span " container"]
-                 [:span (if (> container-count 1) "s") ]
-                 [:span "  and "]
+                 [:span (str " container" (if (> container-count 1) "s" "") " and ")]
                  [:strong (str pricing-parallelism "x")]
                  [:span " parallelism."]]
                 [:div.parallelism-options


fix erroneous notification about rejected datoms

--- src-cljs/frontend/controllers/errors.cljs
+++ src-cljs/frontend/controllers/errors.cljs
@@ -111,11 +111,14 @@
                          "There was an error connecting to the server.\nPlease refresh to try again.")
   (js/Rollbar.error "entity ids request failed :("))

+(defn read-only-rejected? [state rejects datom-group]
+  (and (= (count rejects) (count datom-group))
+       (= :read (:max-document-scope state))))
+
 (defmethod error :datascript/rejected-datoms
   [container message {:keys [rejects datom-group sente-event]} state]
   (utils/mlog rejects)
-  (if (and (= (count rejects) (count datom-group))
-           (= :read (:max-document-scope state)))
+  (if (read-only-rejected? state rejects datom-group)
     (-> state
       (assoc-in (state/notified-read-only-path (:document/id state)) true)
       (update-in (state/doc-tx-rejected-count-path (:document/id state)) (fnil inc 0)))
@@ -123,7 +126,8 @@

 (defmethod post-error! :datascript/rejected-datoms
   [container message {:keys [rejects datom-group sente-event]} previous-state current-state]
-  (when (nil? (get-in previous-state (state/notified-read-only-path (:document/id previous-state))))
+  (when (and (read-only-rejected? previous-state rejects datom-group)
+             (nil? (get-in previous-state (state/notified-read-only-path (:document/id previous-state)))))
     (put! (get-in current-state [:comms :nav]) [:navigate! {:path (urls/overlay-path (:document/id previous-state) "sharing")}])))

 (defmethod error :datascript/sync-tx-error


Fixup `ns` declaration for `controls`

Fixup `ns` declaration for `controls`

--- frontend/controllers/controls.cljs
+++ frontend/controllers/controls.cljs
@@ -1,22 +1,13 @@
 (ns frontend.controllers.controls
-  (:require [cljs.core.async :as async :refer [>! <! alts! chan sliding-buffer put! close!]]
-            [clojure.string :as string]
-            [dommy.core :as dommy]
+  (:require [cljs.core.async :as async :refer [put!]]
             [frontend.models.project :as project-model]
-            [frontend.controllers.api :as api]
-            goog.dom
-            goog.dom.classes
             [goog.string :as gstring]
-            goog.string.format
             goog.style
             [frontend.intercom :as intercom]
             [frontend.utils.vcs-url :as vcs-url]
             [frontend.utils :as utils :refer [mlog]]
-            [cljs.reader :as reader]
-            [clojure.string :as string]
-            [frontend.utils :as utils :refer [mlog]])
-  (:require-macros [frontend.utils :refer [inspect timing]]
-                   [dommy.macros :refer [node sel sel1]])
+            [cljs.reader :as reader])
+  (:require-macros [dommy.macros :refer [sel sel1]])
   (:import [goog.fx.dom.Scroll]))

 ;; --- Helper Methods ---


printing uses stringbuilder and builds in the flusher

--- src/bolth.clj
+++ src/bolth.clj
@@ -138,13 +138,21 @@
         (redify "F")))))

 (defn start-printer [full-failures results]
-  (future
-    (loop [r (.poll results)]
-      (when (not= r :finished)
-        (if (nil? r)
-          (Thread/sleep 10)
-          (print (format-progress-result r full-failures)))
-        (recur (.poll results))))))
+  (let [builder (StringBuilder.)]
+    (future
+      (loop [r (.poll results)]
+        (if (= r :finished)
+          (do
+            (print (str builder))
+            (flush))
+          (do
+            (if (nil? r)
+              (do
+                (print (str builder))
+                (flush)
+                (.setLength builder 0))
+              (.append builder ^String (format-progress-result r full-failures))))
+          (recur (.poll results)))))))

 (defn run-gathered-tests [^AbstractQueue tests-to-run pharrallelism]
   (let [results (LinkedBlockingQueue.)
@@ -366,9 +374,6 @@
   (when (and (contains? options :warn-on-slow-test-limit-ms) (< (:warn-on-slow-test-limit-ms options 1000) (:runtime results)))
     (println (redify "SLOW TEST RUN"))))

-(defn start-flusher [interval]
-  (future (if interval (while true (do (Thread/sleep interval) (flush))))))
-
 (defn colorized-summary [results]
   (if (failing-tests? results)
     (redify (format-results results))
@@ -521,15 +526,13 @@
                *test-runner-state* (atom {})
                *colored-printing* (:colored-printing options true)]
        (clear-screen options)
-       (let [f (start-flusher (:flush-interval options 10))
-             t0 (System/nanoTime)
+       (let [t0 (System/nanoTime)
              test-run (run-tests ns-re (:parallelism options (default-pharrallelism)) (options->prioritizer options))
              t1 (System/nanoTime)
              results {:test-run test-run
                       :test-runner-state (if *test-runner-state* @*test-runner-state*)
                       :runtime (float (/ (- t1 t0) 1000000))}]
          (reset! state/*previous-test-run* @*test-runner-state*)
-         (future-cancel f)
          (println "\n")
          (println (colorized-summary results))
          (maybe-warn-on-slow-test-run results options)


Controller handling of API tap channel

Controller handling of API tap channel

--- src/cljs/gtfve/components/controller.cljs
+++ src/cljs/gtfve/components/controller.cljs
@@ -30,7 +30,7 @@
         (async/tap controls-mult controls-tap)
         (async/tap api-mult api-tap)
         (om/set-state! owner :controls-tap controls-tap)
-        (om/set-state! owner :api-tap controls-tap)
+        (om/set-state! owner :api-tap api-tap)
         (go-loop []
           (let [[v c] (alts! [kill-ch controls-tap api-tap])]
             (if (= c kill-ch)
@@ -40,6 +40,7 @@
                   controls-tap (control-handler v app cursors)
                   api-tap (api-handler v app cursors))
                 (recur))))
+          (async/untap api-mult api-tap)
           (async/untap controls-mult controls-tap))))
     om/IWillUnmount
     (will-unmount [_]


Add proper roles for tab elements

Add proper roles for tab elements

--- src/cljs/my_money/components/tab_bar.cljs
+++ src/cljs/my_money/components/tab_bar.cljs
@@ -4,8 +4,9 @@

 (defn tab [e! active-value value type]
   [:label.btn.btn-primary
-   (when (= value active-value)
-     {:class "active"})
+   {:role "tab"
+    :class [(when (= value active-value)
+              "active")]}
    (string/capitalize value)
    [:input {:type "radio"
             :value value
@@ -15,7 +16,7 @@

 (defn tab-bar [e! active-value]
   ;; TODO: Make this generic
-  [:div.btn-group.btn-group-toggle
+  [:div.btn-group.btn-group-toggle {:role "tablist"}
    [tab e! active-value "all" "type"]
    [tab e! active-value "expenses" "type"]
    [tab e! active-value "incomes" "type"]])


Add jwe backend.

Add jwe backend.

--- src/clojure/buddy/auth/backends/token.clj
+++ src/clojure/buddy/auth/backends/token.clj
@@ -15,6 +15,7 @@
 (ns buddy.auth.backends.token
   (:require [buddy.auth.protocols :as proto]
             [buddy.sign.jws :as jws]
+            [buddy.sign.jwe :as jwe]
             [slingshot.slingshot :refer [try+]]
             [ring.util.response :refer [get-header response?]]))

@@ -48,6 +49,25 @@
         (unauthorized-handler request metadata)
         (handle-unauthorized-default request)))))

+(defn jwe-backend
+  [{:keys [secret unauthorized-handler options token-name]
+    :or {token-name "Token"}}]
+  (reify
+    proto/IAuthentication
+    (parse [_ request]
+      (parse-authorization-header request token-name))
+    (authenticate [_ request data]
+      (try+
+        (assoc request :identity (jwe/decrypt data secret options))
+        (catch Object e
+          request)))
+
+    proto/IAuthorization
+    (handle-unauthorized [_ request metadata]
+      (if unauthorized-handler
+        (unauthorized-handler request metadata)
+        (handle-unauthorized-default request)))))
+
 (defn token-backend
   [{:keys [authfn unauthorized-handler token-name] :or {token-name "Token"}}]
   {:pre [(fn? authfn)]}


Fixing wrong namespace name

Fixing wrong namespace name

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

--- src/conexp/contrib/tests/experimental.clj
+++ src/conexp/contrib/tests/experimental.clj
@@ -6,7 +6,7 @@
 ;; the terms of this license.
 ;; You must not remove this notice, or any other, from this software.

-(ns conexp.contrib.tests.dl
+(ns conexp.contrib.tests.experimental
   (:use conexp.main))

 ;;;


cleanup; Updated element_cards.cljs with form control labels

--- src/guide/untangled/ui/element_cards.cljs
+++ src/guide/untangled/ui/element_cards.cljs
@@ -240,7 +240,20 @@
     (e/ui-checkbox {:id "checkbox-1"})
     (e/ui-checkbox {:id "checkbox-2" :disabled true})
     (e/ui-checkbox {:id "checkbox-3" :style :indeterminate})
-    (e/ui-checkbox {:id "checkbox-4" :style :indeterminate :disabled true})))
+    (e/ui-checkbox {:id "checkbox-4" :style :indeterminate :disabled true})
+    (dom/div nil
+      (e/ui-checkbox {:id "checkbox-5"})
+      (dom/label #js {:className "is-optional"} "With a label!"))
+    (dom/div nil
+      (e/ui-checkbox {:id "checkbox-6" :disabled true})
+      (dom/label #js {:className "is-optional" :disabled true} "With a label!"))
+    (dom/div nil
+      (e/ui-checkbox {:id "checkbox-7" :style :indeterminate})
+      (dom/label #js {:className "is-optional"} "With a label!"))
+    (dom/div nil
+      (e/ui-checkbox {:id "checkbox-8" :style :indeterminate :disabled true})
+      (dom/label #js {:className "is-optional" :disabled true} "With a label!"))
+    ))

 (defsample modals
   "# Modals
@@ -264,3 +277,16 @@
     (e/ui-progress {})
     (dom/p nil " ")
     (e/ui-progress {:max "100" :value "70"})))
+
+(defsample radio
+  (dom/div nil
+    (e/ui-radio {:id "radio-1"})
+    (dom/div nil
+      (e/ui-radio {:id "radio-2"})
+      (dom/label #js {:className "is-optional" :htmlFor "radio-2"} "With a label!"))
+    (e/ui-radio {:id "radio-3" :disabled true})
+    (dom/div nil
+      (e/ui-radio {:id "radio-4" :disabled true})
+      (dom/label #js {:className "is-optional" :htmlFor "radio-4" :disabled true} "With a label!"))
+    ))
+


implement read-eval with eval

implement read-eval with eval

--- src/main/clojure/clojure/tools/reader.clj
+++ src/main/clojure/clojure/tools/reader.clj
@@ -448,31 +448,7 @@
   [rdr _]
   (when-not *read-eval*
     (reader-error rdr "#= not allowed when *read-eval* is false"))
-  (let [o (read rdr true nil true)]
-    (if (symbol? o)
-      (RT/classForName (str ^Symbol o))
-      (if (list? o)
-        (let [fs (first o)
-              o (rest o)
-              fs-name (name fs)]
-          (cond
-           (= fs 'var) (let [vs (first o)]
-                         (RT/var (namespace vs) (name vs)))
-           (.endsWith fs-name ".")
-           (let [args (to-array o)]
-             (-> fs-name (subs 0 (dec (count fs-name)))
-                RT/classForName (Reflector/invokeConstructor args)))
-
-           (Compiler/namesStaticMember fs)
-           (let [args (to-array o)]
-             (Reflector/invokeStaticMethod (namespace fs) fs-name args))
-
-           :else
-           (let [v (Compiler/maybeResolveIn *ns* fs)]
-             (if (var? v)
-               (apply v o)
-               (reader-error rdr "Can't resolve " fs)))))
-        (throw (IllegalArgumentException. "Unsupported #= form"))))))
+  (eval (read rdr true nil true)))

 (def ^:private ^:dynamic gensym-env nil)


start serious work on ?monads? - checkpoint

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -7,6 +7,7 @@
  (:import [java.math
 	   ])
  (:import [java.util
+	   Date
 	   NavigableSet
 	   TreeSet
 	   ])
@@ -14,9 +15,6 @@
 	   Creator
 	   Metadata
 	   Model
-	   ])
- (:import [org.joda.time
-	   DateMidnight
 	   ])
  )

@@ -88,7 +86,7 @@

 (def attributes
      (list
-      :time DateMidnight
+      :time Date
       :version (Integer/TYPE)
       :type String
       :length (Float/TYPE)
@@ -157,9 +155,9 @@
       creator
       (into-array
        Object
-       [(DateMidnight. (+ (rand-int 10) 2000)
-		       (+ (rand-int 12) 1)
-		       (+ (rand-int 28) 1))
+       [(Date. (+ (rand-int 10) 0)
+	       (rand-int 12)
+	       (+ (rand-int 28) 1))
 	0
 	(rnd types)
 	(/ (rand-int max-length-x-100) 100)
@@ -231,195 +229,293 @@

 ;;----------------------------------------

-(def median-length (/ max-length 2))
-(def median-weight (/ max-weight 2))
-
-(def longer-whales
-     (dfilter whales (str "length>" median-length) '(:length) #(> % median-length)))
-
-(def heavier-whales
-     (dfilter whales (str "weight>" median-weight) '(:weight) #(> % median-weight)))
-
-;;----------------------------------------
-;; demonstrate transformation - only selecting a subset of the
-;; attributes from one model into another. We may support synthetic
-;; attributes...
-;;----------------------------------------
-
-(def longer-whales-weight
-     (dtransform longer-whales "weight" :time :version :time :version :weight))
-
-(def #^Model heavier-whales-length
-     (dtransform heavier-whales "length" :time :version :time :version :length))
-
-;;----------------------------------------
-;; demonstrate transformation - a synthetic field - metric tons per metre
-;;----------------------------------------
-
-(dtransform
- whales
- "tonsPerMetre"
- :time
- :version
- :time
- :version
- (list
-  :tonsPerMetre
-  Number
-  '(:weight :length)
-  (fn [weight length] (if (= length 0) 0 (/ weight length))))
- )
-
-;;----------------------------------------
-;; try a transformation on top of a filtration
-;; e.g. select time, version, length from whales where type="narwhal"
-;;----------------------------------------
-
-(def narwhals-length
-     (dtransform
-      (dfilter
-       whales
-       "type=narwhal"
-       '(:type)
-       #(= "narwhal" %))
-      "length"
-      :time
-      :version
-      :time
-      :version
-      :length)
-     )
-
-;;----------------------------------------
-;; demonstrate reduction (sum)
-;;----------------------------------------
-
-(dcount whales "whales")
-(dsum whales :length "whales")
-(dsum whales :weight "whales")
-(dcount heavier-whales-length "heavier-whales")
-(dsum heavier-whales-length :length "heavier-whales")
-(dsum longer-whales-weight :weight "longer-whales")
-(dcount longer-whales-weight "longer-whales")
-
-;;----------------------------------------
-;; demonstrate splitting [and more reduction] - a pivot...
-;;----------------------------------------
-
-;; PROBLEM -
-;; tgt-model values must be same shape as intermediate model values...
-;; EITHER: we prearrange the shape (preferred - complex - how do do this?)
-;; OR: we could construct the tgt mode lazily (simpler - but concurrency issues)
-
-;; (defn dpivot [#^Model src-model #^Keyword split-key #^boolean mutable #^String tgt-model-name #^IFn tgt-model-hook
-;; 	      #^Keyword key-key #^Keyword version-key & attribute-key-types]
-;;   (let [tgt-metadata (class-metadata
-;; 		      (name (gensym "org.dada.demo.core.Pivot"))
+;; (def median-length (/ max-length 2))
+;; (def median-weight (/ max-weight 2))
+
+;; (def longer-whales
+;;      (dfilter whales (str "length>" median-length) '(:length) #(> % median-length)))
+
+;; (def heavier-whales
+;;      (dfilter whales (str "weight>" median-weight) '(:weight) #(> % median-weight)))
+
+;; ;;----------------------------------------
+;; ;; demonstrate transformation - only selecting a subset of the
+;; ;; attributes from one model into another. We may support synthetic
+;; ;; attributes...
+;; ;;----------------------------------------
+
+;; (def longer-whales-weight
+;;      (dtransform longer-whales "weight" :time :version :time :version :weight))
+
+;; (def #^Model heavier-whales-length
+;;      (dtransform heavier-whales "length" :time :version :time :version :length))
+
+;; ;;----------------------------------------
+;; ;; demonstrate transformation - a synthetic field - metric tons per metre
+;; ;;----------------------------------------
+
+;; (dtransform
+;;  whales
+;;  "tonsPerMetre"
+;;  :time
+;;  :version
+;;  :time
+;;  :version
+;;  (list
+;;   :tonsPerMetre
+;;   Number
+;;   '(:weight :length)
+;;   (fn [weight length] (if (= length 0) 0 (/ weight length))))
+;;  )
+
+;; ;;----------------------------------------
+;; ;; try a transformation on top of a filtration
+;; ;; e.g. select time, version, length from whales where type="narwhal"
+;; ;;----------------------------------------
+
+;; (def narwhals-length
+;;      (dtransform
+;;       (dfilter
+;;        whales
+;;        "type=narwhal"
+;;        '(:type)
+;;        #(= "narwhal" %))
+;;       "length"
+;;       :time
+;;       :version
+;;       :time
+;;       :version
+;;       :length)
+;;      )
+
+;; ;;----------------------------------------
+;; ;; demonstrate reduction (sum)
+;; ;;----------------------------------------
+
+;; (dcount whales "whales")
+;; (dsum whales :length "whales")
+;; (dsum whales :weight "whales")
+;; (dcount heavier-whales-length "heavier-whales")
+;; (dsum heavier-whales-length :length "heavier-whales")
+;; (dsum longer-whales-weight :weight "longer-whales")
+;; (dcount longer-whales-weight "longer-whales")
+
+;; ;;----------------------------------------
+;; ;; demonstrate splitting [and more reduction] - a pivot...
+;; ;;----------------------------------------
+
+;; ;; PROBLEM -
+;; ;; tgt-model values must be same shape as intermediate model values...
+;; ;; EITHER: we prearrange the shape (preferred - complex - how do do this?)
+;; ;; OR: we could construct the tgt mode lazily (simpler - but concurrency issues)
+
+;; ;; (defn dpivot [#^Model src-model #^Keyword split-key #^boolean mutable #^String tgt-model-name #^IFn tgt-model-hook
+;; ;; 	      #^Keyword key-key #^Keyword version-key & attribute-key-types]
+;; ;;   (let [tgt-metadata (class-metadata
+;; ;; 		      (name (gensym "org.dada.demo.core.Pivot"))
+;; ;; 		      Object
+;; ;; 		      key-key
+;; ;; 		      version-key
+;; ;; 		      attribute-key-types)
+;; ;; 	tgt-model (model tgt-model-name tgt-metadata)]
+;; ;;     (insert *metamodel* tgt-model)
+;; ;;     (dsplit
+;; ;;      src-model
+;; ;;      split-key
+;; ;;      mutable
+;; ;;      (fn [#^Model model value]
+;; ;; 	 (connect (dcount model String value tgt-metadata) tgt-model)
+;; ;; 	 (tgt-model-hook model value)
+;; ;; 	 )
+;; ;;      ))
+;; ;;   )
+
+;; (let [union-metadata (class-metadata
+;; 		      "org.dada.demo.whales.TypeCount"
 ;; 		      Object
-;; 		      key-key
-;; 		      version-key
-;; 		      attribute-key-types)
-;; 	tgt-model (model tgt-model-name tgt-metadata)]
-;;     (insert *metamodel* tgt-model)
-;;     (dsplit
-;;      src-model
-;;      split-key
-;;      mutable
-;;      (fn [#^Model model value]
-;; 	 (connect (dcount model String value tgt-metadata) tgt-model)
-;; 	 (tgt-model-hook model value)
-;; 	 )
-;;      ))
-;;   )
-
-(let [union-metadata (class-metadata
-		      "org.dada.demo.whales.TypeCount"
-		      Object
-		      :key
-		      :version
-		      [:key String :version Integer :count Integer])
-      union-model (model "Whales.union(count(split(type)))" union-metadata)
-      ]
-  (insert *metamodel* union-model)
-  (dsplit
-   whales
-   :type
-   false
-   (fn [#^Model model value]
-       (connect (dcount model String value union-metadata) union-model)
-       (dsum model :length value)
-       (dsum model :weight value)
-       model ; TODO: do we really need to be able to override the model ? should threading go here ?
-       )
-   ))
-
-(def #^NavigableSet dates (TreeSet.
-	    (list
-	    (DateMidnight. 2000 1 1)
-	    (DateMidnight. 2001 1 1)
-	    (DateMidnight. 2002 1 1)
-	    (DateMidnight. 2003 1 1)
-	    (DateMidnight. 2004 1 1)
-	    (DateMidnight. 2005 1 1)
-	    (DateMidnight. 2006 1 1)
-	    (DateMidnight. 2007 1 1)
-	    (DateMidnight. 2008 1 1)
-	    (DateMidnight. 2009 1 1))))
-
-(def year-names (map (fn [day] (.toString day "yyyy")) dates))
-
-(eval (list 'deftype 'pivot-type (apply vector 'type 'version (map (fn [year-name] (symbol year-name)) year-names))))
-
-(def attribute-names (apply collection "type" "version" year-names))
-
-(import org.dada.core.Creator)
-(import org.dada.core.Getter)
-(import org.dada.core.GetterMetadata)
-
-(def pivot-metadata
-     (GetterMetadata.
-      (proxy [Creator] [] (create [args] (apply pivot-type args)))
-      (collection "type" "version") ;; key-attribute-names
-      (apply collection String Integer (repeat 10 DateMidnight)) ;; attribute-types
-      attribute-names
-      (apply collection
-	     (map
-	      (fn [name]
-		  (let [key (keyword (symbol name))]
-		    (proxy [Getter] [] (get [instance] (key instance)))))
-	      attribute-names))))
-
-(def survey-metadata (class-metadata
-		      (name (gensym "org.dada.demo.whales.Survey"))
-		      Object
-		      :time
-		      :version
-		      [:time DateMidnight :version Integer :count Integer]))
-
-(def pivot-model (model (str (.getName whales) ".pivot(count(time))") pivot-metadata))
-(insert *metamodel* pivot-model)
-
-(dsplit
- whales
- :type
- false
- (fn [#^Model type-model type]
-     (let [survey-model (model (str (.getName type-model) ".count(time)") survey-metadata)]
-       (insert *metamodel* survey-model)
-       ;; need some sort of transform here...'
-       ;;(connect survey-model pivot-model)
-       (dsplit
-	type-model
-	:time
-	false
-	(fn [time] (list (or (.lower dates time) time)))
-	identity
-	(fn [#^Model time-model time]
-	    (connect (dcount time-model DateMidnight time survey-metadata) survey-model)
-	    time-model))
-       )
-     type-model)
- )
+;; 		      :key
+;; 		      :version
+;; 		      [:key String :version Integer :count Integer])
+;;       union-model (model "Whales.union(count(split(type)))" union-metadata)
+;;       ]
+;;   (insert *metamodel* union-model)
+;;   (dsplit
+;;    whales
+;;    :type
+;;    false
+;;    (fn [#^Model model value]
+;;        (connect (dcount model String value union-metadata) union-model)
+;;        (dsum model :length value)
+;;        (dsum model :weight value)
+;;        model ; TODO: do we really need to be able to override the model ? should threading go here ?
+;;        )
+;;    ))
+
+;; (import java.util.NavigableSet)
+;; (import java.util.TreeSet)
+
+;; (def #^NavigableSet pivot-years
+;;      (TreeSet.
+;;       (list
+;;        (Date. 0 0 1)
+;;        (Date. 1 0 1)
+;;        (Date. 2 0 1)
+;;        (Date. 3 0 1)
+;;        (Date. 4 0 1)
+;;        (Date. 5 0 1)
+;;        (Date. 6 0 1)
+;;        (Date. 7 0 1)
+;;        (Date. 8 0 1)
+;;        (Date. 9 0 1))))
+
+;; (def pivot-key-keys (collection "type" "version"))
+;; (def pivot-keys (apply collection (concat pivot-key-keys pivot-years)))
+;; (def pivot-types (apply collection String Integer (repeat 10 Date)))
+;; (def pivot-names (map (fn [key](.toString key)) pivot-keys))
+;; (def pivot-symbols (map (fn [name] (symbol name)) pivot-names))
+;; (def pivot-keywords (map (fn [name] (keyword name)) pivot-names))
+
+;; (eval (list 'deftype 'pivot-type (apply vector pivot-symbols)))
+
+;; (import org.dada.core.Creator)
+;; (import org.dada.core.Getter)
+;; (import org.dada.core.GetterMetadata)
+
+;; (def pivot-metadata
+;;      (GetterMetadata.
+;;       (proxy [Creator] [] (create [args] (apply pivot-type args)))
+;;       pivot-key-keys ;; key-attribute-keys
+;;       pivot-types ;; attribute-types
+;;       pivot-keys
+;;       (apply
+;;        collection
+;;        (map
+;; 	(fn [keyword] (proxy [Getter] [] (get [instance] (keyword instance))))
+;; 	pivot-keywords))))
+
+;; (def survey-metadata (class-metadata
+;; 		      (name (gensym "org.dada.demo.whales.Survey"))
+;; 		      Object
+;; 		      :time
+;; 		      :version
+;; 		      [:time Date :version Integer :count Integer]))
+
+;; (def pivot-model (model (str (.getName whales) ".pivot(count(time))") pivot-metadata))
+;; (insert *metamodel* pivot-model)
+
+;; (dsplit
+;;  whales
+;;  :type
+;;  false
+;;  (fn [#^Model type-model type]
+;;      (let [survey-model (model (str (.getName type-model) ".count(time)") survey-metadata)]
+;;        (insert *metamodel* survey-model)
+;;        ;; need some sort of transform here...'
+;;        ;;(connect survey-model pivot-model)
+;;        (dsplit
+;; 	type-model
+;; 	:time
+;; 	false
+;; 	(fn [time] (list (or (.lower pivot-years time) time)))
+;; 	identity
+;; 	(fn [#^Model time-model time]
+;; 	    (connect (dcount time-model Date time survey-metadata) survey-model)
+;; 	    time-model))
+;;        )
+;;      type-model)
+;;  )
+
+;;--------------------------------------------------------------------------------
+;; lets try improving the sytax using ?monads?
+
+;; I want to say e.g. (munion (mcount (msplit whales :type))
+
+;; return a fn which when applied to a model, value and a chain, applies
+;; itself to the model then applies the chain to this...
+
+;; example queries:
+
+;; summarise a table where the row is :type, column is :time and cell
+;; contains number of whales of this type sighted this year...
+
+;; (union (count (split :time
+
+;; this won't do it...
+
+(defn mlift [model key]
+  (fn []
+      [;; get metadata / key
+       (fn [] [(.getMetadata model) key])
+       ;; apply
+       (fn [hook] (hook model key))
+       ]))
+
+(defn munion [chain tgt-key]
+  (fn []
+      (let [[downstream-metadata-accessor applicator] (chain)
+	    [src-metadata src-key] (downstream-metadata-accessor)]
+	[ ;; get metadata / key
+	 (fn [] [src-metadata tgt-key])
+	 ;; apply
+	 (fn [hook]
+	     (let [tgt-model (model (.toString tgt-key) src-metadata)]
+	       (insert *metamodel* tgt-model)
+	       (hook tgt-model tgt-key)
+	       (applicator (fn [src-model src-key] (connect src-model tgt-model)))
+	       tgt-model))
+	 ])
+      ))
+
+(defn mcount [chain tgt-key]
+  (fn []
+      (let [[downstream-metadata-accessor applicator] (chain)
+	    tgt-key-type (type tgt-key)
+	    tgt-metadata (count-reducer-metadata tgt-key-type)]
+	[ ;; get metadata / key
+	 (fn [] [tgt-metadata tgt-key])
+	 ;; apply
+	 (fn [hook]
+	     (applicator
+	      (fn [src-model src-key]
+		  (let [tgt-model (do-reduce-count src-model tgt-key-type tgt-key tgt-metadata tgt-key)]
+		    (insert *metamodel* tgt-model)
+		    ;;(connect src-model tgt-model)
+		    (hook tgt-model tgt-key)
+		    tgt-model))))])))
+
+(defn msplit [chain split-key mutable]
+  (fn []
+      (let [[downstream-metadata-accessor applicator] (chain)
+	    [src-metadata src-key] (downstream-metadata-accessor)]
+	[ ;; get metadata / key
+	 (fn [] [src-metadata split-key])
+	 ;; apply
+	 (fn [hook]
+	     (applicator
+	      (fn [src-model src-key]
+		  (dsplit src-model split-key mutable
+			  (fn [tgt-model tgt-key]
+			      (insert *metamodel* tgt-model)
+			      (hook tgt-model (str src-key "." tgt-key))
+			      tgt-model)))))
+	 ])
+      ))
+
+;; next step e.g. (select [a <model.field> b <model.field> c <model.field>] from [model....] where [(= a 10)...]....)
+
+(defn execute [monad]
+  ((second (monad)) (fn [model key])))
+
+(def my-whales (mlift whales "my-whales"))
+
+(execute
+ (munion
+  (mcount
+   (msplit my-whales :type false)
+   "count()")
+  "union()"))
+
+;;--------------------------------------------------------------------------------

 ;; TODO: Reducers need to support variable length set of attribute keys

@@ -490,3 +586,25 @@
 ;; how about the application of fns vertically as well as horizontally
 ;; during transforms.

+
+
+;;--------------------------------------------------------------------------------
+;; THOUGHTS:
+
+;; union fn needs access-to/to-coordinate metadata in subsequent layer of models
+;; when a union is used, the class-related md etc used in these models should be shared
+
+;; when sum fn is used must interrogate src-model md for details of chosed attribute
+
+;; do I need type - e.g. Operation and Query<Operation> with a
+;; lifecycle, with e.g. plan() and execute() phases ?
+;; plan would allow the arrangement of metadata
+;; execute would run the models... - maybe creating more and connecting them...
+;; a metamodel could be optionally injected at the top of the query...
+
+;; would our syntax be expressive enough ?
+
+;; do we have to go the whole sql hog and have e.g.
+
+;;(select/query :from <src-model> :where <filter> :groupby <split/union>)
+


convinience

convinience

--- src/user.clj
+++ src/user.clj
@@ -1,2 +1,2 @@
  (ns user
-   (:require [resume.core :refer [compile-dev]]))
+   (:require [resume.core :refer [compile-dev compile-resume]]))


Pass message-seq options along [IMMUTANT-371]

--- modules/messaging/src/main/clojure/immutant/messaging.clj
+++ modules/messaging/src/main/clojure/immutant/messaging.clj
@@ -149,7 +149,8 @@
   "A lazy sequence of messages received from a destination. Accepts
    same options as receive."
   [dest & opts]
-  (lazy-seq (cons (apply receive dest opts) (message-seq dest))))
+  (lazy-seq (cons (apply receive dest opts)
+                  (apply message-seq dest opts))))

 (def ^:dynamic *raw-message*
   "Will be bound to the raw javax.jms.Message during the invocation of a


Fixed ns for internal-sequencer example

Fixed ns for internal-sequencer example

--- src/overtone/examples/timing/internal_sequencer.clj
+++ src/overtone/examples/timing/internal_sequencer.clj
@@ -1,4 +1,4 @@
-(ns overtone.examples.internal-sequencer
+(ns overtone.examples.timing.internal-sequencer
   (:use [overtone.live]))

 ;; A fully server-side sample sequencer.