Finished up 11_sequence_comprehension in clojure

--- hackerrank/functional_programming/clojure/clojure-koans/src/koans/11_sequence_comprehensions.clj
+++ hackerrank/functional_programming/clojure/clojure-koans/src/koans/11_sequence_comprehensions.clj
@@ -3,7 +3,7 @@

 (meditations
   "Sequence comprehensions can bind each element in turn to a symbol"
-  (= __
+  (= (range 6)
      (for [x (range 6)]
        x))

@@ -12,20 +12,20 @@
      (map (fn [x] (* x x))
           (range 6))
      (for [x (range 6)]
-       __))
+       (* x x)))

   "And also filtering"
   (= '(1 3 5 7 9)
      (filter odd? (range 10))
-     (for [x __ :when (odd? x)]
+     (for [x (range 10) :when (odd? x)]
        x))

   "Combinations of these transformations is trivial"
   (= '(1 9 25 49 81)
      (map (fn [x] (* x x))
           (filter odd? (range 10)))
-     (for [x (range 10) :when __]
-       __))
+     (for [x (range 10) :when (odd? x)]
+       (* x x)))

   "More complex transformations simply take multiple binding forms"
   (= [[:top :left] [:top :middle] [:top :right]
@@ -33,4 +33,4 @@
       [:bottom :left] [:bottom :middle] [:bottom :right]]
      (for [row [:top :middle :bottom]
            column [:left :middle :right]]
-       __)))
+      [row column])))


require goog.date

require goog.date

--- src-cljs/frontend/components/doc_viewer.cljs
+++ src-cljs/frontend/components/doc_viewer.cljs
@@ -8,6 +8,7 @@
             [frontend.datascript :as ds]
             [frontend.state :as state]
             [frontend.utils :as utils :include-macros true]
+            [goog.date]
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true])
   (:require-macros [frontend.utils :refer [html]])


keep recent docs menu open when switching docs

--- src-cljs/frontend/components/doc_viewer.cljs
+++ src-cljs/frontend/components/doc_viewer.cljs
@@ -52,7 +52,7 @@

             (for [doc bucket-docs]
               (html
-                [:a.recent-doc.make {:href (urls/doc-path doc)}
+                [:a.recent-doc.make {:href (str (urls/doc-path doc) "/doc-viewer")}
                  [:img {:src (urls/doc-svg-path doc)}]

                  (common/icon :loading)


Team main component state :show-modal? -> :show-invite-modal?

--- src-cljs/frontend/components/pages/team.cljs
+++ src-cljs/frontend/components/pages/team.cljs
@@ -213,7 +213,7 @@
     om/IInitState
     (init-state [_]
       {:selected-org-ident nil
-       :show-modal? nil})
+       :show-invite-modal? nil})

     om/IWillMount
     (will-mount [_]
@@ -232,7 +232,7 @@
           (api/get-org-settings-normalized name vcs-type api-chan))))

     om/IRenderState
-    (render-state [_ {:keys [selected-org-ident show-modal?]}]
+    (render-state [_ {:keys [selected-org-ident show-invite-modal?]}]
       (let [user (:current-user app)
             selected-org (when selected-org-ident (get-in app selected-org-ident))
             available-orgs (filter :org (:organizations user))]
@@ -264,14 +264,14 @@
                          (button/button
                           {:primary? true
                            :on-click #(do
-                                        (om/set-state! owner :show-modal? true)
+                                        (om/set-state! owner :show-invite-modal? true)
                                         ((om/get-shared owner :track-event)
                                          {:event-type :invite-teammates-clicked
                                           :properties {:view :team}}))}
                           "Invite Teammates")
                          (om/build invite-teammates-modal {:selected-org (select-keys selected-org [:name :vcs_type :vcs-users-by-handle])
-                                                           :close-fn #(om/set-state! owner :show-modal? false)
-                                                           :show-modal? show-modal?})]}
+                                                           :close-fn #(om/set-state! owner :show-invite-modal? false)
+                                                           :show-modal? show-invite-modal?})]}
                (if-let [users (:users selected-org)]
                  (table (add-follow-counts users (:projects selected-org)))
                  (html [:div.loading-spinner common/spinner])))


Update RANGE tests

Update RANGE tests

--- test/structural_typing/use/f_path_mismatches.clj
+++ test/structural_typing/use/f_path_mismatches.clj
@@ -85,8 +85,7 @@
                                                 (err:required [3 2])))

       (let [in [ :unchecked [10 11 12] nil [30 31 32] :unchecked]]
-        (check-for-explanations :X in) =future=> (just (err:required [2 1])
-                                                       (err:required [2 2])))
+        (check-for-explanations :X in) => (just (err:bad-range-target path in nil)))

       (fact "in a combination of non-sequential value and truncation, you only see impossible path"
         (let [in [ :unchecked [10 11 12] :oops [30 31 32] :unchecked]]
@@ -96,11 +95,9 @@
     (let [path [(RANGE 1 2) (RANGE 1 3)]]
       (type! :X {path [required-path]})
       (fact "top level"
-        (check-for-explanations :X []) =future=> (just (err:required [1 1])
-                                                (err:required [1 2])))
+        (check-for-explanations :X []) => (just (err:bad-range-target path [] nil))
       (fact "nested"
-        (check-for-explanations :X [ [] ]) =future=> (just (err:required [1 1])
-                                                    (err:required [1 2])))))
+        (check-for-explanations :X [ [] ]) => (just (err:bad-range-target path [[]] nil))))))

   (fact "cannot take maps or sets"
     (type! :X (requires [(RANGE 1 2)]))


free-word.clj: reformatting

free-word.clj: reformatting

--- clojure/org/gavrog/clojure/free_word.clj
+++ clojure/org/gavrog/clojure/free_word.clj
@@ -5,12 +5,9 @@

 (defn normalise [xs]
   (assert (every? integer? xs))
-  (reduce (fn [w x] (cond (= 0 x)
-                          w,
-                          (= (last w) (- x))
-                          (pop w),
-                          :else
-                          (conj w x)))
+  (reduce (fn [w x] (cond (= 0 x)            w
+                          (= (last w) (- x)) (pop w)
+                          :else              (conj w x)))
           [] xs))

 (defn- overlap [w1 w2]


set the right content type

set the right content type

--- src/clj/just_married/api.clj
+++ src/clj/just_married/api.clj
@@ -17,7 +17,11 @@
    [raven-clj.ring :refer [wrap-sentry]]))

 (defroutes app-routes
-  (GET "/" [] (response/file-response "index.html" {:root "resources/public"}))
+  (GET "/" []
+       (response/content-type
+        (response/file-response "index.html" {:root "resources/public"})
+        "text/html"))
+
   (POST "/send-email" request
         (send-email
          (-> request :params :content)))


fixed resolve-fqname and fqname to deal with the "clojure.core//" corner case - resolution and display is now correct for clojure.core's "/" - even for multiple selections and categorized view

--- src/clj_ns_browser/utils.clj
+++ src/clj_ns_browser/utils.clj
@@ -206,21 +206,23 @@
   ([ns n]
     (let [n-str (str n)
           n-sym (symbol n-str)]
-      (if (some #(= % n-str) special-forms) n-str
-        (if-let [n-ns (find-ns n-sym)]
-          (str n-ns)
-          (if-let [n-class (= (type n) java.lang.Class)]
-            (.getName n)
-            (when-let [ns-ns (if (= (type ns) clojure.lang.Namespace)
-                               ns
-                               (find-ns (symbol (str ns))))]
-              (if-let [var-n (when (var? n) (str (.ns n) "/" (.sym n)))]
-                var-n
-                (let [n-sym (symbol (str n))]
-                  (when-let [v-n (try (ns-resolve ns-ns n-sym)(catch Exception e))]
-                    (if (var? v-n)
-                      (str (.ns v-n) "/" (.sym v-n))
-                      (.getName v-n))))))))))))
+      (if (= n-str "clojure.core//")
+        "clojure.core//"  ;; special corner case :-(
+        (if (some #(= % n-str) special-forms) n-str
+          (if-let [n-ns (find-ns n-sym)]
+            (str n-ns)
+            (if-let [n-class (= (type n) java.lang.Class)]
+              (.getName n)
+              (when-let [ns-ns (if (= (type ns) clojure.lang.Namespace)
+                                 ns
+                                 (find-ns (symbol (str ns))))]
+                (if-let [var-n (when (var? n) (str (.ns n) "/" (.sym n)))]
+                  var-n
+                  (let [n-sym (symbol (str n))]
+                    (when-let [v-n (try (ns-resolve ns-ns n-sym)(catch Exception e))]
+                      (if (var? v-n)
+                        (str (.ns v-n) "/" (.sym v-n))
+                        (.getName v-n)))))))))))))

 (defn ns-name-class-str
@@ -242,12 +244,13 @@

 (defn resolve-fqname
   "Returns the resolved fully qualified name fqn (string) or nil."
-  [fqn]
-  (when (and (string? fqn) (not= fqn ""))
-    (if-let [ns (find-ns (symbol fqn))]
-      ns
-      (when-let [var-or-class (try (resolve *ns* (symbol fqn))(catch Exception e))]
-        var-or-class))))
+  [a-fqn]
+  (when (and (string? a-fqn) (not= a-fqn ""))
+    (let [fqn (if (= a-fqn "clojure.core//") "/" a-fqn)] ;; special corner case :-(
+      (if-let [ns (find-ns (symbol fqn))]
+        ns
+        (when-let [var-or-class (try (resolve *ns* (symbol fqn))(catch Exception e))]
+          var-or-class)))))

 (defn pprint-str


ideas

ideas

--- src/cljs/triboard/ai/ai.cljs
+++ src/cljs/triboard/ai/ai.cljs
@@ -81,17 +81,18 @@

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

-;; TODO - use the heuristic for the scoring (worse move after)
+;; TODO - use the heuristic for the scoring (worse move after - look-ahead)
 (defn leaf-score
   [ai turn]
-  (get (:scores turn) (:player ai)))
+  (get (:scores turn) (:player ai))
+  ;; (* -1 (get-in turn [:scores :blue])) ;; TODO - Make AI aligned against blue
+  )

 (defn tree-score
   [ai turn depth]
   (if (= 0 depth)
     (leaf-score ai turn)
-    (let [                                                  ;;turn (game/current-turn game)
-          transitions (turn/player-transitions turn)
+    (let [transitions (turn/player-transitions turn)
           min-max (if (= (:player ai) (:player turn)) max min)]
       (apply min-max
         (map


adjust spacing

adjust spacing

--- src/babel/english/lab.cljc
+++ src/babel/english/lab.cljc
@@ -46,26 +46,38 @@

 (defn relative-clauses []
   ;; TODO: improve performance by using {:mod {:first {:obj :modified}}.
-  (let [specs
-        [
-         {:synsem {:cat :verb :subcat []}
-          :comp {:phrasal true :rule "noun-phrase"
+  (let [tree-spec
+         {:rule "sentence-nonphrasal-head"
+          :phrasal true
+          :comp {:phrasal true
+                 :rule "noun-phrase"
                  :head {:rule "nbar-s-obj"
-                        :head {:rule "nbar"}
-                        :comp {:rule "s/obj"}}
-                 :synsem {:sem {:mod {:first {:pred :eat}
-                                      :rest {:first {:pred :red
-                                                     :rest []}}}}}}}
-         {:synsem {:cat :verb :subcat []}
-          :comp {:phrasal true :rule "noun-phrase"
-                 :head {:rule "nbar-s-obj"}
-                 :synsem {:sem {:mod {:first {:pred :see}
-                                      :rest {:first {:pred :tall
-                                                     :rest []}}}}}}}]]
+                        :phrasal true
+                        :head {:rule "nbar"
+                               :phrasal true
+                               :comp {:phrasal false}
+                               :head {:phrasal false}}
+                        :comp {:rule "s/obj"
+                               :head {:phrasal false}
+                               :comp {:phrasal false}
+                               :phrasal true}}}}
+        meaning-spec
+        {:comp {:phrasal true}
+         :synsem {:cat :verb
+                  :subcat []
+                  :sem {:pred :sleep
+                        :subj {:mod {:first {:pred :see}
+                                     :rest {:first {:pred :red}}}}}}}
+        spec (unify tree-spec meaning-spec)
+        spec meaning-spec]
+
     (repeatedly #(println
-                  (let [spec (first (shuffle specs))]
-                    (let [result (morph (time (binding [babel.generate/truncate? true]
-                                                (wait wait-ms-for-generation (fn [] (generate spec model))))))]
+                  (let [spec spec]
+                    (let [result (morph-ps (time (binding [babel.generate/println? false]
+                                                        babel.generate/truncate? false
+                                                   (wait wait-ms-for-generation
+                                                      (fn []
+                                                        (generate spec model))))))]
                       (or (and (not (empty? result)) result)
                           "TIMEOUT.")))))))
 (defn basecamp [])


Tweak pad brightness levels.

Tweak pad brightness levels.


CMR-3279 fixes validate map for collection concept id

--- access-control-app/src/cmr/access_control/services/acl_search_service.clj
+++ access-control-app/src/cmr/access_control/services/acl_search_service.clj
@@ -227,7 +227,7 @@
  (let [[safe-params type-errors] (cpv/apply-type-validations
                                    params
                                    [(partial cpv/validate-map [:options])
-                                    ;(partial cpv/validate-map [:collection-concept-id])
+                                    (partial cpv/validate-map [:options :collection-concept-id])
                                     (partial cpv/validate-map [:options :permitted-group])
                                     (partial cpv/validate-map [:options :identity-type])
                                     (partial cpv/validate-map [:options :provider])


Add list integration tests for block stores.

--- src/blocks/store/tests.clj
+++ src/blocks/store/tests.clj
@@ -4,19 +4,28 @@
   (:require
     [blocks.core :as block]
     [byte-streams :as bytes]
-    [clojure.test :refer :all])
+    [clojure.test :refer :all]
+    [multihash.core :as multihash])
   (:import
     blocks.data.PersistentBytes))

 (defn random-bytes
-  "Returns a byte array between one and `max-size` bytes long with random
+  "Returns a byte array between one and `max-len` bytes long with random
   content."
-  [max-size]
-  (let [size (inc (rand-int max-size))
+  [max-len]
+  (let [size (inc (rand-int max-len))
         data (byte-array size)]
     (.nextBytes (java.security.SecureRandom.) data)
     data))
+
+
+(defn random-hex
+  "Returns a random hex string between one and `max-len` characters long."
+  [max-len]
+  (->> (repeatedly #(rand-nth "0123456789abcdef"))
+       (take (inc (rand-int max-len)))
+       (apply str)))

 (defn populate-blocks!
@@ -29,7 +38,7 @@
        (into (sorted-map))))

-(defn test-block
+(defn- test-block
   "Determines whether the store contains the content for the given identifier."
   [store id content]
   (testing "block stats"
@@ -62,6 +71,22 @@
            (:stored-at new-status)))))

+(defn- test-list-stats
+  "Tests the functionality of list's marker option."
+  [store ids n]
+  (let [prefix (-> (block/list store :limit 1) first :id multihash/hex (subs 0 4))]
+    (dotimes [i n]
+      (let [after (str prefix (random-hex 10))
+            limit (inc (rand-int 100))
+            stats (block/list store :after after :limit limit)
+            expected (->> ids
+                          (filter #(pos? (compare (multihash/hex %) after)))
+                          (sort)
+                          (take limit))]
+        (is (= expected (map :id stats))
+            "list should return the expected ids in sorted order")))))
+
+
 (defn test-block-store
   "Tests a block store implementation."
   [label store & {:keys [blocks max-size], :or {blocks 10, max-size 1024}}]
@@ -74,7 +99,8 @@
           (is (= (keys stored-content) (map :id stats))
               "enumerates all ids in sorted order")
           (is (every? #(= (:size %) (count (get stored-content (:id %)))) stats)
-              "returns correct size for all blocks")))
+              "returns correct size for all blocks"))
+        (test-list-stats store (keys stored-content) 100))
       (doseq [[id content] stored-content]
         (test-block store id content))
       (let [[id content] (first (seq stored-content))]


Fix email on copyright notice on core.padding ns.

--- src/buddy/core/padding.clj
+++ src/buddy/core/padding.clj
@@ -1,4 +1,4 @@
-;; Copyright (c) 2015 Andrey Antukh <niwi@niwi.be>
+;; Copyright (c) 2015 Andrey Antukh <niwi@niwi.nz>
 ;;
 ;; Licensed under the Apache License, Version 2.0 (the "License")
 ;; you may not use this file except in compliance with the License.


Make sure md headings are lower than h1

Make sure md headings are lower than h1

so that they will be lower than the :editorial or :recommendation
heading

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -115,11 +115,11 @@
     (apply #(external-link href %) content)
     (external-link href href)))
 (defmethod to-fop :h1 [{content :content} path opts]
-  (heading :h1 (conj path (string/join content)) opts))
+  (heading :h2 (conj path (string/join content)) opts))
 (defmethod to-fop :h2 [{content :content} path opts]
-  (heading :h2 (conj path (string/join content)) opts))
+  (heading :h3 (conj path (string/join content)) opts))
 (defmethod to-fop :h3 [{content :content} path opts]
-  (heading :h3 (conj path (string/join content)) opts))
+  (heading :h4 (conj path (string/join content)) opts))
 (defmethod to-fop :ul [{content :content} _ _] [:fo:list-block content])
 (defmethod to-fop :li [{content :content} _ _] (bullet-list content))
 (defmethod to-fop :em [{content :content} _ _] (inline {:font-style "italic"} content))


adding form workflow

adding form workflow

--- src/celestial/security.clj
+++ src/celestial/security.clj
@@ -30,13 +30,16 @@
       (debug request-method " on " uri "by" (friend/current-authentication))
       (app req))))

+(defn no-redirect
+  [{:keys [form-params params] :as request}]
+  {:status 401}
+  )
+
 (defn secured-app [routes]
   (friend/authenticate
     (friend/wrap-authorize (user-tracking routes) roles/user)
     {:allow-anon? true
-     :unauthenticated-handler
-        #(assoc (workflows/http-basic-deny "celestial" %) :body {:message "login failed" } )
-     :workflows [(workflows/http-basic
-                   :credential-fn #(creds/bcrypt-credential-fn p/get-user! %)
-                   :realm "celestial")]}))
+     :credential-fn #(creds/bcrypt-credential-fn p/get-user! %)
+     :unauthenticated-handler #(assoc (workflows/http-basic-deny "basic-celestial" %) :body {:message "login failed" } )
+     :workflows [(workflows/interactive-form ) (workflows/http-basic :realm "basic-celestial")]}))


CMR-2118 Removes unused function.

CMR-2118 Removes unused function.

--- common-lib/src/cmr/common/mime_types.clj
+++ common-lib/src/cmr/common/mime_types.clj
@@ -34,12 +34,6 @@
 ;; Define vars for each of the mime type formats, e.g. (def json "application/json")
 (doseq [[format-kw {:keys [mime-type]}] mime-types]
   (eval `(def ~(symbol (name format-kw)) ~mime-type)))
-
-(defn xml?
-  "Returns true if format is a known XML format."
-  [format]
-  (contains? #{xml echo10 iso-smap iso19115 dif dif10 atom serf}
-             format))

 (def iso
   "Defines a shorter alias for iso19115."


fixed Crick being able to install from HQ

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -142,13 +142,14 @@
                  :effect (effect (damage :net (:memory runner) {:card card}))}]}

    "Crick"
-   {:abilities [{:msg (msg (corp-install-msg target))
-                  :prompt "Choose a card to install from Archives"
-                  :show-discard true :priority true
-                  :choices {:req #(and (not= (:type %) "Operation")
-                                       (#{[:hand] [:discard]} (:zone %))
-                                       (= (:side %) "Corp"))}
-                  :effect (effect (corp-install target nil))}]
+   {:abilities [{:label "install a card from Archives"
+                 :msg (msg (corp-install-msg target))
+                 :prompt "Choose a card to install from Archives"
+                 :show-discard true :priority true
+                 :choices {:req #(and (not= (:type %) "Operation")
+                                      (= (:zone %) [:discard])
+                                      (= (:side %) "Corp"))}
+                 :effect (effect (corp-install target nil))}]
     :strength-bonus (req (if (= (second (:zone card)) :archives) 3 0))}

    "Curtain Wall"


Bot prefix should be configurable

Bot prefix should be configurable

--- src/clj_mrazik/irc_bot.clj
+++ src/clj_mrazik/irc_bot.clj
@@ -40,11 +40,11 @@
     (.startsWith (:target message) "#"))

 (defn message-for-me?
-    [my-name message]
+    [my-name special-prefix message]
     (or (.startsWith (:target message) my-name)        ; private message
         (.startsWith (:text message) (str my-name ":")); direct message
         (.startsWith (:text message) (str my-name ",")); direct message
-        (.startsWith (:text message) "!")              ; special prefix
+        (.startsWith (:text message) special-prefix)   ; special prefix
     ))

 (defn create-reply
@@ -146,13 +146,13 @@
           dictionary?      (:dictionary modules)
           random-messages? (:random-messages modules)
           input       (if in-channel?
-                          (if (.startsWith input-text "!")
+                          (if (.startsWith input-text (-> @dyncfg/configuration :bot :prefix))
                               (subs input-text 1)
                               (subs input-text (+ 2 (count @dyncfg/bot-nick))))
                           input-text)
           prefix      (if in-channel? (str nick ": "))
           response    (condp = input
-                          "help" (-> @dyncfg/configuration :bot :help)
+                          "help"     (-> @dyncfg/configuration :bot :help)
                           "status"   (dictionary-status)
                           "schedule" (if (:scheduler modules)
                                          (format-schedule @dyncfg/schedule)
@@ -190,7 +190,7 @@
            command :command} incoming-message]
            (println "Received message from" nick "to" target ":" text "(" host command ")")
            (println incoming-message)
-           (if (message-for-me? @dyncfg/bot-nick incoming-message)
+           (if (message-for-me? @dyncfg/bot-nick (-> @dyncfg/configuration :bot :prefix) incoming-message)
                (let [reply  (create-reply incoming-message)
                      output (prepare-reply-text incoming-message nick text)]
                      (if (seq? (:response output))


Fixed typo

Fixed typo

--- src/clj_mrazik/irc_bot.clj
+++ src/clj_mrazik/irc_bot.clj
@@ -181,7 +181,7 @@
                     "%s, congrats on your new achievement! Your achievement is indeed a great addition to your personality."
                     "Many dream, few dare and very few actually succeed. Long live %s."
                     "%s, you have proved once again that hard work pays off! I am so happy for you."
-                    "Keep going, %s, and may your achievement bring even more hapinness into your life and family."]
+                    "Keep going, %s, and may your achievement bring even more happiness into your life and family."]
           message (rand-nth messages)]
     (format message name)))


Sync fact id number

Sync fact id number

--- src/cljc/precept/repl.cljc
+++ src/cljc/precept/repl.cljc
@@ -7,6 +7,7 @@
       #?(:clj [cljs.env :as env])
       #?(:clj [cljs.analyzer.api :as ana-api])
       #?(:clj [cljs.analyzer :as ana])
+      #?(:clj [cljs.build.api :as build-api])
       #?(:clj [clara.macros :as cm]))
   #?(:cljs (:require-macros [precept.repl])))

@@ -53,7 +54,7 @@
       "REPL utility function to reload a session.
       Clears all interned rules from nses and loads files containing those namespaces to ensure
       rules are in sync. Redefines the session with the arguments it was created with.
-      Synchronizes session state by re-inserting all unconditinal inserts and firing rules."
+      Synchronizes session state by re-inserting all unconditional inserts and firing rules."
       (do
         (unmap-all-rules! sess)
         (doseq [filename @state/rule-files]
@@ -114,7 +115,15 @@
         `(doseq [[rule-ns# rule-name#] ~quoted-productions]
            (swap! precept.state/rules precept.util/dissoc-in [rule-name#])))))

-;; TODO. - [ ] Reset state/fact-id to max-fact-id
+(defn ns-name-intern-pairs [rule-ns]
+  (let [syms (keys (ana-api/ns-interns rule-ns))]
+    (->> syms
+      (interleave (repeat (count syms) rule-ns))
+      (partition 2)
+      (map vec))))
+
+;; TODO. - [ ] Programmatically force reload of session's namespace https://github.com/bhauman/lein-figwheel/issues/341
+;; TODO. - [x] Reset state/fact-id to max-fact-id
 ;; TODO. - [x] Sync runtime rule defs
 ;; TODO. - [x] Unmap old session ~~or silence Google Closure :duplicate-vars warning~~ so Figwheel
 ;; can compile when session is deffed in file and macro is invoked
@@ -142,33 +151,23 @@
      (let [compiled-rules (all-compiled-rules env/*compiler*)
            non-impl-rules (without-impl-rules compiled-rules)
            rule-nses (vec (set (map first non-impl-rules)))
-           interns (mapcat
-                     (fn [rule-ns]
-                       (let [syms (keys (ana-api/ns-interns rule-ns))]
-                         ;(->> syms
-                         ;  (interleave (repeat (count syms) rule-ns))
-                         ;  (partition 2)
-                         ;  (map vec)
-                         (map vec
-                           (partition 2
-                             (interleave (repeat (count syms) rule-ns)
-                                         syms)))))
-                     rule-nses)
+           interns (mapcat #(ns-name-intern-pairs %) rule-nses)
            stale-productions (clojure.set/difference (set non-impl-rules) (set interns))
            [quot session-name] sess
            session-defs (get @env/*compiler* :precept.macros/session-defs)
            session-def (first (filter #(= session-name (:name %)) session-defs))]
        (remove-stale-productions! env/*compiler* stale-productions)
-       `(let [uncond-inserts# (vec @precept.state/unconditional-inserts)]
+       (build-api/mark-cljs-ns-for-recompile! (:ns-name session-def))
+       `(let [uncond-inserts# (vec @precept.state/unconditional-inserts)
+              max-fact-id# (apply max (map :t uncond-inserts#))]
          (do
            (cljs.core/ns-unmap '~(:name session-def) '~(:ns-name session-def))
            (remove-stale-runtime-rule-defs! ~'precept.state/rules ~stale-productions)
            (reset! precept.state/unconditional-inserts #{})
            (reset! precept.state/fact-index {})
+           (reset! precept.state/fact-id max-fact-id#)
            (precept.macros/session ~session-def)
            (-> ~session-name
              (precept.listeners/replace-listener)
              (precept.util/insert uncond-inserts#)
              (precept.rules/fire-rules)))))))
-
-(map (fn [x] `'~x) ['sym1 'sym2])


Stop reducing over a number range like a silly man

I realized that by pulling the subnode ordering out of the main
reduction function for ordering sparse graphs, I could do
everything without keeping track of the number of orderings we've
already done. So now we're reducing over an infinite cycle and
bailing when necessary instead.

--- src/cljs/fatlip/order.cljs
+++ src/cljs/fatlip/order.cljs
@@ -497,46 +497,44 @@
         first-ordered-layer (map->OrderedLayer
                              (-> first-sparse-layer
                                  (dissoc :nodes)
-                                 (assoc :items (:nodes first-sparse-layer))))]
+                                 (assoc :items (:nodes first-sparse-layer))))
+        rev-sparse-graph (rev sparse-graph)]
     (->>
-     (range max-sweeps)
-     (reduce (fn [[orderings first-layers first-layer] c]
+     (cycle [sparse-graph rev-sparse-graph])
+     (reduce (fn [[orderings first-layers first-layer :as reduced-info]
+                  input-graph]
                ;; Graph orderings are determined by the first layer. If we've
                ;; seen this first layer before, then we can be sure that we're
                ;; about to enter a cycle, and can thus short circuit
-               (if (contains? first-layers first-layer)
+               (if (or (contains? first-layers first-layer)
+                       (= max-sweeps (count reduced-info)))
                  (reduced [orderings first-layers first-layer])
-                 (let [reverse? (odd? c)
-                       graph (-> (if reverse?
-                                   (rev sparse-graph)
-                                   sparse-graph)
-                                 (SparseGraph->OrderedGraph first-layer))
-                       backward-graph (if reverse?
-                                        graph
-                                        (rev graph))
-                       ;; This is sort of ugly, but once we order the nodes, we
-                       ;; still have to come up with a good subnode
-                       ;; ordering. Conceptually, this belongs in
-                       ;; SparseGraph->OrderedGraph, but it's also conceptually
-                       ;; cromulent to have SparseGraph->OrderedGraph know
-                       ;; nothing about the forward/reverse dance that we do
-                       ;; here. However, subnode ordering is dependent on
-                       ;; direction. My choice then, is to make
-                       ;; SparseGraph->OrderedGraph direction-aware, or pull
-                       ;; the subnode ordering out and put it here, where we're
-                       ;; aware of the direction.  For now, I've chosen the
-                       ;; latter.
-                       backward-subnode-pass (order-subnodes backward-graph)
-                       forward-subnode-pass (order-subnodes
-                                             (rev backward-subnode-pass))
+                 (let [graph (SparseGraph->OrderedGraph input-graph
+                                                        first-layer)
                        layers (:layers graph)]
                    ;; The last layer of the current ordering is the first layer
                    ;; of the next
-                   [(conj orderings forward-subnode-pass)
+                   [(conj orderings graph)
                     (conj first-layers first-layer)
                     (layers last-layer-idx)])))
              [[] #{} first-ordered-layer])
-     first)))
+     first
+     ;; This is sort of ugly, but once we order the nodes, we still have to
+     ;; come up with a good subnode ordering. Conceptually, this belongs in
+     ;; SparseGraph->OrderedGraph, but it's also conceptually cromulent to have
+     ;; SparseGraph->OrderedGraph know nothing about the forward/reverse dance
+     ;; that we do here. However, subnode ordering is dependent on
+     ;; direction. My choice then, is to make SparseGraph->OrderedGraph
+     ;; direction-aware, or pull the subnode ordering out and put it here,
+     ;; where we're aware of the direction.  For now, I've chosen the latter.
+     (map-indexed (fn [idx graph]
+                    (let [backward-graph (if (odd? idx)
+                                           graph
+                                           (rev graph))]
+                      (-> backward-graph
+                          order-subnodes
+                          rev
+                          order-subnodes)))))))

 (defn OrderedGraph->CountedAndMarkedGraph


Use consistent key names

Use consistent key names

This allows property maps to be merged, etc.

--- src/cljs/pizarra/core.cljs
+++ src/cljs/pizarra/core.cljs
@@ -10,7 +10,7 @@
 (def app-state
   (atom {:canvas {:dimensions {:width 800 :height 400}
                   :actions []}
-         :tools {:width 4
+         :tools {:lineWidth 4
                  :strokeStyle "#000000" }}))

 (defprotocol Drawable
@@ -36,10 +36,8 @@
     (.restore context)))

 (defn new-line-action []
-  (->LineAction [] {:strokeStyle (get-in @app-state [:tools :strokeStyle])
-                    :lineCap "round"
-                    :lineJoin "round"
-                    :lineWidth (get-in @app-state [:tools :width])}))
+  (->LineAction [] (merge {:lineCap "round"
+                           :lineJoin "round"} (:tools @app-state))))
 (def line-tool
   (reify
     ITool
@@ -114,10 +112,10 @@
     (render [_]
       (dom/div nil
                (apply dom/select
-                      #js {:value (:width tools)
+                      #js {:value (:lineWidth tools)
                            :onChange (fn [e]
                                        (let [newval (.-value (.-currentTarget e))]
-                                         (om/update! tools [:width] newval)))}
+                                         (om/update! tools [:lineWidth] newval)))}
                       (map (fn [i]
                              (dom/option #js {:value i} i))
                            (range 1 11)))
@@ -154,6 +152,6 @@

 (deref app-state)

-(swap! app-state update-in [:tools] assoc :width 3)
+(swap! app-state update-in [:tools] assoc :lineWidth 3)

 )


basic stuff

basic stuff

--- src/cljs/tsoha16/core.cljs
+++ src/cljs/tsoha16/core.cljs
@@ -19,22 +19,57 @@
  :initialize
  (fn
    [_ _]
-   {}))
+   {:aihealueet [{:nimi "Mukavat asiat" :id "1"} {:nimi "Jännät jutut" :id "2"} {:nimi "Niitä näitä" :id "3"}]
+    :keskustelut-aihealueittain {"1" [{:nimi "Hieno päivä tänään" :viesti "Hei kaikki! Tänään on todella hieno päivä. Join aamukahvit ja kävin pitkällä kävelyllä kauniissa talvisäässä." :id "1"}]}
+    }))
+
+;;=-------------
+;;SUBSRIPTIONSa
+
+(re-frame/register-sub
+ :aihealueet
+ (fn [db _]
+   (reaction (:aihealueet @db))))
+
+(re-frame/register-sub
+ :aiheet
+ (fn [db [_ aihealue-id]]
+   (reaction (get-in @db [:keskustelut-aihealueittain aihealue-id]))))

 ;; -------------------------
 ;; Views

+(defn aihealue-sivu [{id :id nimi :nimi}]
+  (print id)
+  (let [aiheet (re-frame/subscribe [:aiheet id])]
+    [:div
+     [:h2 nimi]
+     [:ul
+      (for [aihe @aiheet]
+         ^{:key aihe} [:li (:nimi aihe)])]]))
+
+(defn aihealue-komponentti [aihealue]
+  [:li
+   [:a {:href (str "#/aihealueet/" (:id aihealue) "/" (:nimi aihealue))} (:nimi aihealue)]])
+
+(defn aihealue-lista []
+  (let [aihealueet (re-frame/subscribe [:aihealueet])]
+    (fn []
+      [:ul
+       (for [aihealue @aihealueet]
+         ^{:key aihealue} [aihealue-komponentti aihealue])])))
+
 (defn home-page []
-  [:div [:h2 "Hello world "]
-   [:div [:a {:href "/"} "about me"]]])
+  [:div [:h2 "Keskustelupalsta"]
+   [aihealue-lista]])

 (defn about-page []
   [:div [:h2 "About tsoha16"]
    [:div [:a {:href "/"} "go to the home page"]]])

 (defn current-page []
-  [:div [(session/get :current-page)]])
+  [:div [(session/get :current-page) (session/get :params)]])

 ;; -------------------------
 ;; Routes
@@ -42,7 +77,12 @@
 (secretary/defroute "/" []
   (session/put! :current-page #'home-page))

-(secretary/defroute "/about" []
+(secretary/defroute "/#/aihealueet/:id/:nimi" {:as params}
+  (session/put! :current-page #'aihealue-sivu)
+  (session/put! :params params))
+
+
+(secretary/defroute "/#/about" []
   (session/put! :current-page #'about-page))

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


exclude max min

exclude max min

--- src/clojure/flambo/api.clj
+++ src/clojure/flambo/api.clj
@@ -10,7 +10,7 @@
 ;; happily accepted!
 ;;
 (ns flambo.api
-  (:refer-clojure :exclude [fn map reduce first count take distinct filter group-by values partition-by])
+  (:refer-clojure :exclude [fn map reduce first count take distinct filter group-by values partition-by min max])
   (:require [serializable.fn :as sfn]
             [clojure.tools.logging :as log]
             [flambo.function :refer [flat-map-function
@@ -486,16 +486,16 @@
   program computes all the elements)."
   [rdd cnt]
   (.take rdd cnt))
-
+
 (defn take-ordered
   "Return an array with the first n elements of `rdd`.
   (Note: this is currently not executed in parallel. Instead, the driver
   program computes all the elements)."
   [rdd cnt compare-fn]
-  (.takeOrdered rdd cnt
+  (.takeOrdered rdd cnt
     (if (instance? Comparator compare-fn)
       compare-fn
-      (comparator compare-fn))))
+      (comparator compare-fn))))

 (defmulti histogram "compute histogram of an RDD of doubles"
   (fn [_ bucket-arg] (sequential? bucket-arg)))


Clean up blocks, fix function def usage of blocks

--- src/clj/jest/compiler/NativeJestCompiler.clj
+++ src/clj/jest/compiler/NativeJestCompiler.clj
@@ -67,6 +67,15 @@
     :else [obj]))

+(defn- wrap-in-do
+  [expressions]
+  (cond
+    (not (instance? List expressions)) expressions
+    (= 0 (count expressions)) (throw (new NotImplementedException))
+    (= 1 (count expressions)) (first expressions)
+    :else `(do ~@expressions)))
+
+
 ;; HELPER
 (defn merge-items
   "Takes two items and joins them as a single sequence."
@@ -105,12 +114,14 @@
 (defn -visitStatementTerm
   [this ^JestParser$StatementTermContext ctx]

-  ;; Should this always return a list?
   (cond
     (. ctx statement)   (self-visit this ctx statement)
     (. ctx functionDef) (self-visit this ctx functionDef)
     (. ctx recordDef)   (self-visit this ctx recordDef)
-    (. ctx block)       (self-visit this ctx block)
+
+    ;; I believe we want to wrap this in a do to make it
+    ;; a single statement, not a list, correct...?
+    (. ctx block)       (wrap-in-do (self-visit this ctx block))
     (. ctx varScope)    (self-visit this ctx varScope)

     :else (throw (new ClojureSourceGenerator$BadSource ctx))))
@@ -271,7 +282,10 @@

     (. ctx recordConstructor) (self-visit this ctx recordConstructor)

-    (. ctx block) (self-visit this ctx block)
+    ;; A block, when used as an expression, must consist of a
+    ;; single expression or otherwise must be wrapped
+    ;; in a do statement
+    (. ctx block) (wrap-in-do (self-visit this ctx block))

     (. ctx expression) (self-visit this ctx expression)

@@ -342,7 +356,7 @@
   `(defn
      ~(get-symbol ctx name)
      [~@(self-visit this ctx functionDefParams)]
-     ~(self-visit this ctx block)))
+     ~@(self-visit this ctx block)))

 (defn -visitMethodDef
@@ -357,8 +371,9 @@
   ;                                   }

-  `(~(symbol (.. ctx name getText)) [~@(self-visit this ctx functionDefParams)]
-     ~(self-visit this ctx block)))
+  `(~(symbol (.. ctx name getText))
+     [~@(self-visit this ctx functionDefParams)]
+     ~@(self-visit this ctx block)))

 (defn -visitFunctionDefParams
@@ -409,39 +424,46 @@
       `(doall (map ~func ~@iterator)))))

-(defn- wrap-in-do
-  [expressions]
-  (cond
-    (not (instance? List expressions)) expressions
-    (= 0 (count expressions)) (throw (new NotImplementedException))
-    (= 1 (count expressions)) (first expressions)
-    :else `(do ~@expressions)))
-
-
 (defn -visitBlock
-  "A block doesn't return a list, it only returns a single expression.
-  However, if there are multiple expressions coming from that block,
-  it wraps them in a do expression"
+  "Note that a block, unlike most other visit statements,
+  returns a list of clojure forms, not just a single form.
+  This can make working with blocks tricky.  One must take
+  care to do one of the following:
+  - Unwrap the list in a macro using the ~@ operator
+  - Wrap the list in a single 'do' expression with the wrap-in-do function
+  You would use the first version if it's okay to have a number of
+  clojure forms in a row.  For example, a function body is allowed to
+  consist of multiple clojure forms each representing an expression:
+
+  (defn foobar [x]
+      (A)
+      (B)
+      (C))
+
+  On the other hand, the 'true' or 'false' part of an if statement
+  must be a single expression, and therefore it must be wrapped in a
+  do expression if one wants to use a block that consists of multiple
+  expressions:
+
+  (if true
+      (do
+          (A)
+          (B)
+          (C))
+      false)
+
+  We could have automatically wrapped all blocks in do statements in
+  visitBlock (if necessary) but we like in the 'defn' example above
+  having all the expressions inline an an unwrapped list, so we here
+  return a list and leave the unwrapping of the list to the consumer."
   [this ^JestParser$BlockContext ctx]

   (cond
-    (. ctx expression) (self-visit this ctx expression)
-
-    ;;(. ctx term) (into [] (map #(.. this (visitStatementTerm %)) (. ctx term)))
-
-    (. ctx term) (let [num-terms (.. (. ctx term) size)]
-                   (cond
-                     (= 0 num-terms) (throw (new NotImplementedException))
-                     (= 1 num-terms) (.. this (visitStatementTerm (.. (. ctx term) (get 0))))
-                     :else `(do ~@(into [] (map #(.. this (visitStatementTerm %)) (. ctx term))))))
-
-    ;;(. ctx scope) (into [] (map #(.. this (visitVarScope %)) (. ctx scope)))
-
-    (. ctx scope) (let [num-scopes (.. (. ctx scope) size)]
-                    (cond
-                      (= 0 num-scopes) (throw NotImplementedException)
-                      (= 1 num-scopes) (.. this (visitVarScope (.. (. ctx scope) (get 0))))
-                      :else `(do ~@(into [] (map #(.. this (visitVarScope %)) (. ctx scope))))))
+    (. ctx expression) [(self-visit this ctx expression)]
+
+    (. ctx term) (into [] (map #(.. this (visitStatementTerm %)) (. ctx term)))
+
+    (. ctx scope) (into [] (map #(.. this (visitVarScope %)) (. ctx scope)))

     :else (throw (new ClojureSourceGenerator$BadSource ctx))))

@@ -460,8 +482,8 @@
   [this ^JestParser$ConditionalContext ctx]

   (let [conditions (map #( .. this (visitExpression %)) (merge-items (. ctx ifCondition) (. ctx elifExpression)))
-        results (map #(.. this (visitBlock %)) (merge-items (. ctx iftrue) (. ctx elifBlock)))
-        else (if (. ctx elseBlock) (.. this (visitBlock (. ctx elseBlock))) nil)
+        results (map #(wrap-in-do (.. this (visitBlock %))) (merge-items (. ctx iftrue) (. ctx elifBlock)))
+        else (if (. ctx elseBlock) (wrap-in-do (.. this (visitBlock (. ctx elseBlock)))) nil)
         single-if (= (. conditions size) 1)]

     (cond


auto-close dropdown draft

auto-close dropdown draft

--- src/cljs/re_form/inputs/date_input_impl.cljs
+++ src/cljs/re_form/inputs/date_input_impl.cljs
@@ -109,6 +109,8 @@
   (let [fmt (or (:format opts) "iso")
         fmt-obj (get formats fmt)
         state (r/atom {:lastValue (:value opts) :value (unparse fmt (:value opts))})
+        #_(doc-click-listener (fn [e]
+                                (js/console.log "clicklistener" (.-target e))))
         my-on-blur (fn [event on-blur]
                      #_(when-let [dropdown (aget (.. event
                                                      -target
@@ -137,7 +139,16 @@
                             (swap! state assoc :errors
                                    (str "The format is: " (:placeholder fmt-obj)))))))]
     (r/create-class
-     {:component-will-receive-props
+     {
+      #_(:component-did-mount
+         (fn [_]
+           (.addEventListener js/document "click" doc-click-listener))
+
+         :component-will-unmount
+         (fn [_]
+           (.removeEventListener js/document "click" doc-click-listener)))
+
+      :component-will-receive-props
       (fn [_ nextprops]
         (when-let [{v :value} (second nextprops)]
           (will-recv-props v)))


style

style

--- src/cljs/re_form/inputs/select_xhr_impl.cljs
+++ src/cljs/re_form/inputs/select_xhr_impl.cljs
@@ -90,7 +90,8 @@
                         (set! (.-textContent (:node @state)) "")
                         (when (:active @state) (.focus (:node @state))))}
            [:span.value {:style {:display (if (:active @state) "none" "inline")}} (match-fn value)]
-           [:span.choose-value {:contentEditable true}]
+           [:span.choose-value {:contentEditable true
+                                :style {:display "inline-block"}}]
            (when (:active @state)
              [:div.options
               (for [i (:suggestions @state)] ^{:key (label-fn i)}


return AsyncFuture. record from async-future*

--- src/cljx/jamesmacaulay/async_tools/core.cljx
+++ src/cljx/jamesmacaulay/async_tools/core.cljx
@@ -27,6 +27,16 @@
   [x]
   (if (readport? x) x (constant x)))

+(defrecord AsyncFuture [state-atom]
+  impl/ReadPort
+  (take! [_ handler]
+    (-> state-atom
+        (swap! (fn [state]
+                 (if (nil? (:boxed-value state))
+                   (update-in state [:handlers] conj handler)
+                   state)))
+        :boxed-value)))
+
 (defn async-future*
   [f]
   (let [state-atom (atom {:boxed-value nil
@@ -37,15 +47,7 @@
                          ((impl/commit handler) value))
                        (swap! state-atom assoc :handlers nil)))]
     (f resolve-fn)
-    (reify
-      impl/ReadPort
-      (take! [_ handler]
-        (-> state-atom
-            (swap! (fn [state]
-                     (if (nil? (:boxed-value state))
-                       (update-in state [:handlers] conj handler)
-                       state)))
-            :boxed-value)))))
+    (AsyncFuture. state-atom)))

 (defn async-future<
   [ch]


Start refactoring to-parent to new logging (WIP)

I'm taking a more incremental approach this time around. At least this
version passes my handshake test.

--- src/clojure/frereth_cp/message/to_parent.clj
+++ src/clojure/frereth_cp/message/to_parent.clj
@@ -7,6 +7,7 @@
             [frereth-cp.message.specs :as specs]
             [frereth-cp.shared :as shared]
             [frereth-cp.shared.constants :as shared-K]
+            [frereth-cp.shared.logging :as log2]
             [frereth-cp.util :as utils]
             [manifold.deferred :as dfrd])
   (:import [io.netty.buffer ByteBuf Unpooled]))
@@ -66,19 +67,20 @@
               ::specs/error K/eof-error))))

 (s/fdef build-message-block-description
-        :args (s/cat :message-loop-name ::specs/message-loop-name
+        :args (s/cat :log-state ::log2/state
                      :block-description ::specs/block)
-        :ret bytes?)
+        :ret {::specs/bs-or-eof
+              ::log2/state})
 (defn build-message-block-description
-  ^ByteBuf [message-loop-name
-            {^Long start-pos ::specs/start-pos
-             ^Integer next-message-id ::specs/message-id
-             ;; TODO: Switch this to either a bytes or a clojure
-             ;; vector of bytes.
-             ;; Then again...the bit about tracking the current
-             ;; read position seems pretty worthwhile.
-             ^ByteBuf buf ::specs/buf
-             :as block-to-send}]
+  [log-state
+   {^Long start-pos ::specs/start-pos
+    ^Integer next-message-id ::specs/message-id
+    ;; TODO: Switch this to either a bytes or a clojure
+    ;; vector of bytes.
+    ;; Then again...the bit about tracking the current
+    ;; read position seems pretty worthwhile.
+    ^ByteBuf buf ::specs/buf
+    :as block-to-send}]
   ;;; Lines 387-402

   ;; Note that we're messing around with mutable data.
@@ -106,14 +108,14 @@
           ;; TODO: That.
           send-buf (.order (Unpooled/buffer u)
                            java.nio.ByteOrder/LITTLE_ENDIAN)
-          flag-size (calculate-message-data-packet-length-flags block-to-send)]
-      (log/debug (utils/pre-log message-loop-name)
-                 (str "Building a Message Block byte array for message "
-                      next-message-id
-                      "\nTotal length: " u
-                      "\nSize | Flags: " flag-size
-                      "\nStart Position: " start-pos))
-
+          flag-size (calculate-message-data-packet-length-flags block-to-send)
+          log-state (log2/debug log-state
+                                ::build-message-block-description
+                                "Building a Message Block byte array for message"
+                                {::flags|size flag-size
+                                 ::total-length u
+                                 ::specs/message-id next-message-id
+                                 ::specs/start-pos start-pos})]
       ;; Q: Is this worth switching to shared/compose?
       (.writeInt send-buf next-message-id)

@@ -163,7 +165,8 @@
       (.resetReaderIndex buf)
       (let [result (byte-array (.readableBytes send-buf))]
         (.readBytes send-buf result)
-        result))))
+        {::log2/state log-state
+         ::specs/bs-or-eof result}))))

 (s/fdef mark-block-sent
         :args (s/cat :state ::specs/state)
@@ -229,11 +232,14 @@
             ::specs/send-buf-size]
      current-message-id ::specs/next-message-id
      :as outgoing} ::specs/outgoing
+    log-state ::log2/state
     :as state}]
-  (let [pre-log (utils/pre-log message-loop-name)]
-    ;; Really just for timing info
-    (log/debug pre-log
-               "Top of pre-calculate after-send")
+  (let [pre-log (utils/pre-log message-loop-name)
+        label ::pre-calculate-state-after-send
+        ;; Really just for timing info
+        log-state (log2/debug log-state
+                              label
+                              "Top of pre-calculate after-send")]
     (assert next-block-queue
             (str pre-log
                  "No next-block-queue to tell us what to send\nAvailable:\n"
@@ -255,112 +261,114 @@
 ;;;                the write to FD9 at offset +7, which is the
 ;;;                len/16 byte.
 ;;;                So everything else is shifted right by 8 bytes
-    (let [q (get-in state [::specs/outgoing next-block-queue])
-          current-message (first q)]
-      ;; This is where message correlation would be
-      ;; a good thing, at least for new messages.
-      ;; Really should pull pull all the bytes we can
-      ;; send (which depends on whether :client-waiting-on-response
-      ;; in :flow-control has been delivered) from q.
-      ;; Although that consolidation probably doesn't make a lot
-      ;; of sense here
-      ;; TODO: make that happen
-      (log/debug pre-log
-                 (str "Next message should come from "
-                      (count q)
-                      " block(s) in\n"
-                      next-block-queue
-                      "\ninside\n"
-                      (::specs/outgoing state)))
-      (let [transmission-count (::specs/transmissions current-message)]
-        (assert transmission-count
-                (str pre-log
-                     "Missing ::transmissions under "
-                     next-block-queue
-                     " for "
-                     current-message)))
-      ;; Q: How much time could I save right here and now by making
-      ;; state transient?
-      ;; (possibly using something like proteus)
-      (let [next-message-id (let [n' (inc current-message-id)]
-                              ;; Stupid unsigned math
-                              ;; Actually, this seems even more problematic
-                              ;; than it looks at first glance.
-                              ;; Really shouldn't be reusing IDs.
-                              ;; Q: Does that matter?
-                              (if (<= n' shared-K/max-32-int)
-                                (if (= 0 n')
-                                  1
-                                  n')
-                                (dec (- shared-K/max-32-int))))]
-        ;; It's tempting to pop that message off of whichever queue is its current home.
-        ;; That doesn't make sense here/yet.
-        ;; Either we're resending a previous message that never got ACK'd (in which
-        ;; case it must stay exactly where it is until we *do* get an ACK), or we're
-        ;; sending a new message.
-        ;; If it's the latter, it *does* need to move from the un-sent queue to the
-        ;; un-ackd queue.
-        ;; But that's an operation to handle elsewhere.
-        (assert current-message)
-        ;; It's tempting to try to re-use a previously sent message ID for a re-send.
-        ;; After all, if I send message 39, then resend it as message 50, then get
-        ;; an ACK for message 39, the only way I have to correlate that to message
-        ;; 50 is the stream address.
-        ;; Which should be good enough.
-        ;; And this seems like a better way to debug messages on the wire.
-        ;; And this is the way the reference implementation works.
-        (let [state' (assoc-in state [::specs/outgoing ::specs/next-message-id] next-message-id)
-              updated-message (-> current-message
-                                  (update ::specs/transmissions inc)
-                                  (assoc ::specs/time recent)
-                                  (assoc ::specs/message-id current-message-id))]
-          (log/debug pre-log
-                     (str "Getting ready to build message block for message "
-                          current-message-id
-                          "\nbased on:\n")
-                     #_(utils/pretty updated-message)
-                     updated-message)
-          (let [buf (build-message-block-description message-loop-name
-                                                     updated-message)
-                ;; Reference implementation waits until after the actual write before setting any of
-                ;; the next pieces. But it's a single-threaded process that's going to block at the write,
-                ;; and this part's purely functional anyway. So it should be safe enough to set up
-                ;; this transition here
-                result (update state'
-                               ::specs/outgoing
-                               (fn [cur]
-                                 (assoc cur
-                                        ;; Q: Is it really worth tracking this separately?
-                                        ;; A: Yes, absolutely.
-                                        ;; It *is* readily available in un-ackd-blocks,
-                                        ;; until the last block gets ACK'd.
-                                        ::specs/last-block-time recent
-                                        ;; Note that send-buf is just a byte-array that's
-                                        ;; ready to send to the parent.
-                                        ;; It's very tempting to make it a queue or set,
-                                        ;; and then buffer the sends. But that's half the
-                                        ;; point behind the message "package."
-                                        ;; This is the culmination of that buffer/send
-                                        ;; process.
-                                        ;; It cannot matter whether we send duplicates
-                                        ;; or a packet gets sent out of order:
-                                        ;; our "parent" does not care, and the other
-                                        ;; side has to cope with those problems anyway,
-                                        ;; since we're using UDP (that's the other half
-                                        ;; of the point)
-                                        ::specs/send-buf buf
-                                        ::specs/want-ping ::specs/false)))]
-            (log/debug pre-log
-                       "Next block built and control state updated to"
-                       result)
-            ;; It's tempting to split this part up to avoid the conditional.
-            ;; Maybe turn the call into a multimethod.
-            ;; The latter would be a mistake, since there are
-            ;; really only 2 possibilities (I'm sending a new block or
-            ;; resending one that had its ACK timeout)
-            (if (= ::specs/un-sent-blocks next-block-queue)
-              (mark-block-sent result updated-message)
-              (mark-block-resent result current-message updated-message))))))))
+    (let [q (next-block-queue outgoing)
+          current-message (first q)
+          ;; This is where message correlation would be
+          ;; a good thing, at least for new messages.
+          ;; Really should pull pull all the bytes we can
+          ;; send (which depends on whether :client-waiting-on-response
+          ;; in :flow-control has been delivered) from q.
+          ;; Although that consolidation probably doesn't make a lot
+          ;; of sense here
+          ;; TODO: make that happen
+          log-state (log2/debug log-state
+                                label
+                                "Next message source"
+                                {::next-block-queue-size (count q)
+                                 ::specs/next-block-queue next-block-queue
+                                 ::specs/outgoing outgoing})
+          transmission-count (::specs/transmissions current-message)
+          _ (assert transmission-count
+                    (str pre-log
+                         "Missing ::transmissions under "
+                         next-block-queue
+                         " for "
+                         current-message))
+          ;; Q: How much time could I save right here and now by making
+          ;; state transient?
+          ;; (possibly using something like proteus)
+          next-message-id (let [n' (inc current-message-id)]
+                            ;; Stupid unsigned math
+                            ;; Actually, this seems even more problematic
+                            ;; than it looks at first glance.
+                            ;; Really shouldn't be reusing IDs.
+                            ;; Q: Does that matter?
+                            (if (<= n' shared-K/max-32-int)
+                              (if (= 0 n')
+                                1
+                                n')
+                              (dec (- shared-K/max-32-int))))
+          ;; It's tempting to pop that message off of whichever queue is its current home.
+          ;; That doesn't make sense here/yet.
+          ;; Either we're resending a previous message that never got ACK'd (in which
+          ;; case it must stay exactly where it is until we *do* get an ACK), or we're
+          ;; sending a new message.
+          ;; If it's the latter, it *does* need to move from the un-sent queue to the
+          ;; un-ackd queue.
+          ;; But that's an operation to handle elsewhere.
+          _ (assert current-message)
+          ;; It's tempting to try to re-use a previously sent message ID for a re-send.
+          ;; After all, if I send message 39, then resend it as message 50, then get
+          ;; an ACK for message 39, the only way I have to correlate that to message
+          ;; 50 is the stream address.
+          ;; Which should be good enough.
+          ;; And this seems like a better way to debug messages on the wire.
+          ;; And this is the way the reference implementation works.
+          state' (assoc-in state [::specs/outgoing ::specs/next-message-id] next-message-id)
+          updated-message (-> current-message
+                              (update ::specs/transmissions inc)
+                              (assoc ::specs/time recent)
+                              (assoc ::specs/message-id current-message-id))
+          log-state (log2/debug log-state
+                                label
+                                "Getting ready to build message block for message"
+                                {::specs/next-message-id next-message-id
+                                 ::based-on updated-message})
+          {buf ::specs/bs-or-eof
+           log-state ::log2/state} (build-message-block-description log-state
+                                                                    updated-message)
+          ;; Reference implementation waits until after the actual write before setting any of
+          ;; the next pieces. But it's a single-threaded process that's going to block at the write,
+          ;; and this part's purely functional anyway. So it should be safe enough to set up
+          ;; this transition here
+          result (update state'
+                         ::specs/outgoing
+                         (fn [cur]
+                           (assoc cur
+                                  ;; Q: Is it really worth tracking this separately?
+                                  ;; A: Yes, absolutely.
+                                  ;; It *is* readily available in un-ackd-blocks,
+                                  ;; until the last block gets ACK'd.
+                                  ::specs/last-block-time recent
+                                  ;; Note that send-buf is just a byte-array that's
+                                  ;; ready to send to the parent.
+                                  ;; It's very tempting to make it a queue or set,
+                                  ;; and then buffer the sends. But that's half the
+                                  ;; point behind the message "package."
+                                  ;; This is the culmination of that buffer/send
+                                  ;; process.
+                                  ;; It cannot matter whether we send duplicates
+                                  ;; or a packet gets sent out of order:
+                                  ;; our "parent" does not care, and the other
+                                  ;; side has to cope with those problems anyway,
+                                  ;; since we're using UDP (that's the other half
+                                  ;; of the point)
+                                  ::specs/send-buf buf
+                                  ::specs/want-ping ::specs/false)))
+          result (assoc result
+                        ::log2/state
+                        (log2/debug log-state
+                                    label
+                                    "Next block built and control state updated to"
+                                    {::log2/state result}))]
+      ;; It's tempting to split this part up to avoid the conditional.
+      ;; Maybe turn the call into a multimethod.
+      ;; The latter would be a mistake, since there are
+      ;; really only 2 possibilities (I'm sending a new block or
+      ;; resending one that had its ACK timeout)
+      (if (= ::specs/un-sent-blocks next-block-queue)
+        (mark-block-sent result updated-message)
+        (mark-block-resent result current-message updated-message)))))

 (s/fdef check-for-previous-block-to-resend
         :args ::specs/state
@@ -584,14 +592,17 @@
       (check-for-new-block-to-send found?))))

 (s/fdef block->parent!
-        :args (s/cat :message-loop-name ::specs/message-loop-name
+        :args (s/cat :logger ::log2/logger
+                     :log-state ::log2/state
                      :->parent ::specs/->parent
                      :send-buf ::specs/buf)
-        :ret any?)
+        :ret ::log2/state)
 (defn block->parent!
   "Actually send the message block to the parent"
   ;; Corresponds to line 404 under the sendblock: label
   [message-loop-name
+   logger
+   log-state
    ->parent
    ^bytes send-buf]
   {:pre [send-buf]}
@@ -612,7 +623,8 @@
   ;; There used to be more involved in this
   (let [size (count send-buf)
         succeeded? (dfrd/future (->parent send-buf))
-        triggerer (utils/pre-log message-loop-name)]
+        triggerer (utils/pre-log message-loop-name)
+        [caller-log-state internal-log-state] (log2/fork log-state ::block->parent!)]
     (dfrd/on-realized succeeded?
                       (fn [succeeded]
                         ;; If I'm going to set send-eof-processed,
@@ -624,24 +636,27 @@
                         ;; instead.
                         ;; That destroys functional purity, so is not
                         ;; an option.
-                        (log/info (utils/pre-log message-loop-name)
-                                  (str size
-                                       " bytes in "
-                                       send-buf
-                                       " forwarded to parent, triggered by\n"
-                                       triggerer
-                                       succeeded)))
+                        (log2/flush-logs! logger
+                                          (log2/info internal-log-state
+                                                     ::succeeded
+                                                     "Forwarded"
+                                                     {::buffer-size size
+                                                      ::specs/send-buf send-buf
+                                                      ::send-from triggerer
+                                                      ::success succeeded})))
                       (fn [failed]
-                        (log/error failed
-                                   (utils/pre-log message-loop-name)
-                                   (str "Failed to forward "
-                                        size
-                                        " bytes in "
-                                        send-buf
-                                        " to parent.\n"
-                                        "Probably don't care.\n"
-                                        "Triggered by\n"
-                                        triggerer))))))
+                        (log2/flush-logs! logger
+                                          (log2/error internal-log-state
+                                                      ::failed
+                                                      ;; This will trigger again, won't
+                                                      ;; it? (i.e. we'll keep trying to
+                                                      ;; send until we get an ACK)
+                                                      "Forwarding. Q: Do we care?"
+                                                      {::buffer-size size
+                                                       ::specs/send-buf send-buf
+                                                       ::send-from triggerer
+                                                       ::failure failed}))))
+    caller-log-state))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Public
@@ -652,69 +667,93 @@
         :ret ::specs/state)
 (defn maybe-send-block!
   "Possibly send a block from child to parent"
-  [{:keys [::specs/->parent]
+  [{:keys [::log2/logger
+           ::specs/->parent]
     :as io-handle}
    {:keys [::specs/message-loop-name]
+    log-state ::log2/state
     :as state}]
-  (let [prelog (utils/pre-log message-loop-name)]
-    (log/debug prelog "Picking next block to possibly send")
-    (when-not message-loop-name
-      (log/warn "There's something strange about state:\n" state))
+  {:pre [log-state]}
+  (let [label ::maybe-send-block!
+        log-state (log2/debug log-state
+                              label
+                              "Picking next block to possibly send")
+        log-state (if message-loop-name
+                    log-state
+                    (log2/warn log-state
+                               label
+                               "There's something strange about state"
+                               {::specs/state state}))]
     (try
       (let [{{:keys [::specs/next-block-queue]} ::specs/outgoing
-             :as state'} (pick-next-block-to-send state)]
+             :as state'} (pick-next-block-to-send (assoc state
+                                                         ::log2/state
+                                                         log-state))]
+        (assert (::log2/state state'))
         (if next-block-queue
           (let [{{:keys [::specs/send-buf
                          ::specs/un-ackd-blocks]} ::specs/outgoing
+                 log-state ::log2/state
                  :as state''} (pre-calculate-state-after-send state')
-                n (count send-buf)]
-            (when-not (s/valid? ::specs/send-buf send-buf)
-              ;; Doing a spec test here seems worrisome from a
-              ;; performance perspective.
-              ;; But it really does need to happen (at least at dev
-              ;; time, and probably always).
-              ;; And this seems like the most obvious location.
-              (log/warn prelog
-                        "Illegal outgoing buffer\n"
-                        (s/explain-data ::specs/send-buf send-buf)))
-            (log/debug prelog
-                       "Sending"
-                       ;; Actually, calling count here tells the entire
-                       ;; story: I have either a byte-array or vector
-                       ;; rather than the ByteBuf that spec demands.
-                       ;; Actually, the spec is wrong.
-                       ;; I *want*
-                       ;; TODO: Fix the spec.
-                       ;; That probably means switching the key name.
-                       n
-                       "bytes to parent in"
-                       send-buf)
-            ;; TODO: This is one of the side-effects that I really should
-            ;; be accumulating rather than calling willy-nilly.
-            (block->parent! message-loop-name ->parent send-buf)
-            (log/debug prelog
-                       (str "Calculating earliest time among "
-                            (count un-ackd-blocks)
-                            " un-ACK'd block(s)"
-                            ".\nThose are very distinct from the "
-                            (count (get-in state'' [::specs/outgoing ::specs/un-sent-blocks]))
-                            " that is/are left in un-sent-blocks"))
-
+                ;; Actually, calling count here tells the entire
+                ;; story: I have either a byte-array or vector
+                ;; rather than the ByteBuf that spec demands.
+                ;; Actually, the spec is wrong.
+                ;; I *want*
+                ;; TODO: Fix the spec.
+                ;; That probably means switching the key name.
+                ;; FIXME: Comment rot. What did/do I want?
+                ;; This entire comment should probably just go away,
+                ;; since the code works
+                n (count send-buf)
+                ;; Doing a spec test here seems worrisome from a
+                ;; performance perspective.
+                ;; But it really does need to happen (at least at dev
+                ;; time, and probably always).
+                ;; And this seems like the most obvious location.
+                log-state (as-> (if (s/valid? ::specs/send-buf send-buf)
+                                  log-state
+                                  (log2/warn log-state
+                                             label
+                                             "Illegal outgoing buffer"
+                                             {::problem (s/explain-data ::specs/send-buf send-buf)}))
+                              log-state
+                            (log2/debug log-state
+                                        label
+                                        "Sending bytes to parent"
+                                        {::buffer-size n
+                                         ::specs/send-buf send-buf})
+                            ;; TODO: This includes one of the side-effects that I really should
+                            ;; be accumulating rather than calling willy-nilly.
+                            (block->parent! message-loop-name logger log-state ->parent send-buf)
+                            (log2/debug log-state
+                                        label
+                                        (str "Calculating earliest time among un-ACK'd block(s)"
+                                             "\n(totally distinct from un-sent)")
+                                        {::un-ackd-block-count (count un-ackd-blocks)
+                                         ::un-sent-block-count (count (get-in state''
+                                                                              [::specs/outgoing ::specs/un-sent-blocks]))}))]
 ;;;      408: earliestblocktime_compute()
-            (-> state''
+            (-> (assoc state'' ::log2/state log-state)
                 (assoc-in [::specs/outgoing ::specs/earliest-time]
                           (help/earliest-block-time message-loop-name un-ackd-blocks))
                 (update ::specs/outgoing dissoc ::specs/next-block-queue)))
-          (do
-            ;; To aid in traffic analysis, should intermittently send meaningless
-            ;; garbage when nothing else is available.
-            ;; TODO: Lots of research to make sure I do this correctly.
-            ;; (The obvious downside is increased bandwidth)
-            (log/debug prelog
-                       "Nothing to send")
-            state)))
+          ;; To make traffic analysis more difficult for bad guys, should intermittently
+          ;; send meaningless garbage when nothing else is available.
+          ;; TODO: Lots of research to make sure I do this correctly.
+          ;; (The obvious downside is increased bandwidth)
+          (update state
+                  ::log2/state
+                  #(log2/debug %
+                               label
+                               "Nothing to send"))))
       (catch Exception ex
-        (log/error ex prelog "Trying to send message block to parent")))))
+        (update state
+                ::log2/state
+                #(log2/exception %
+                                 ex
+                                 label
+                                 "Trying to send message block to parent"))))))

 (s/fdef send-eof-buffered?
         :args (s/cat :outgoing ::specs/outgoing)


one more fix for the close link in the overlay

--- src-cljs/frontend/components/overlay.cljs
+++ src-cljs/frontend/components/overlay.cljs
@@ -152,7 +152,8 @@
                               :role "button"}
             "Sign Up"]]
           [:div.menu-footer
-           [:a.menu-footer-link {:on-click #(cast! :overlay-closed)}
+           [:a.menu-footer-link {:on-click #(cast! :overlay-closed)
+                                 :role "button"}
             "No thanks."]]])))))

 (def overlay-components


Adding some needed rows.

Adding some needed rows.

--- src-cljs/kixi/hecuba/tabs/programmes.cljs
+++ src-cljs/kixi/hecuba/tabs/programmes.cljs
@@ -198,11 +198,11 @@
         (om/update! programmes :selected (:programmes active-components))))
     om/IRender
     (render [_]
-      (let [programmes (-> data :programmes)]
-        (html
-         [:div {:id "programmes-div"}
-          [:h1 "Programmes"]
-          (om/build programmes-table programmes)])))))
+      (html
+       [:div.row#programmes-div
+        [:div {:class "col-md-12"}
+         [:h1 "Programmes"]
+         (om/build programmes-table data)]]))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; projects
@@ -270,8 +270,8 @@
       (let [{:keys [programmes projects active-components]} data
             history (om/get-shared owner :history)]
         (html
-         [:div {:id "projects-div"}
-          [:div {:class (if (:programme-id projects) "" "hidden")}
+         [:div.row#projects-div
+          [:div {:class (str "col-md-12 " (if (:programme-id projects) "" "hidden"))}
            [:h2 "Projects"]
            [:ul {:class "breadcrumb"}
             [:li [:a
@@ -349,8 +349,8 @@
       (let [{:keys [programmes projects properties active-components]} data
             history (om/get-shared owner :history)]
         (html
-         [:div {:id "properties-div"}
-          [:div {:class (if (:project-id properties) "" "hidden")}
+         [:div.row#properties-div
+          [:div {:class (str "col-md-12 " (if (:project-id properties) "" "hidden"))}
            [:h2 "Properties"]
            [:ul {:class "breadcrumb"}
             [:li [:a
@@ -426,8 +426,8 @@
       (let [{:keys [programmes projects properties devices active-components]} data
             history (om/get-shared owner :history)]
         (html
-         [:div {:id "devices-div"}
-          [:div {:class (if (:property-id devices) "" "hidden")}
+         [:div.row#devices-id
+          [:div {:class (str "col-md-12 " (if (:property-id devices) "" "hidden"))}
            [:h2  "Devices"]
            [:ul {:class "breadcrumb"}
             [:li [:a
@@ -549,8 +549,8 @@
       (let [{:keys [programmes projects properties devices sensors active-components]} data
             history (om/get-shared owner :history)]
         (html
-         [:div {:id "sensors-div"}
-          [:div {:class (if (:device-id sensors) "" "hidden")}
+         [:div.row#sensors-div
+          [:div {:class (str "col-md-12 "  (if (:device-id sensors) "" "hidden"))}
            [:h2 {:id "sensors"} "Sensors"]
            [:ul {:class "breadcrumb"}
             [:li [:a


Make it easier to edit application name

Make it easier to edit application name

It was not so obvious before how to edit the name

--- idecode/myappshare/mainapp.cljs
+++ idecode/myappshare/mainapp.cljs
@@ -165,29 +165,34 @@
                                :aria-hidden "true"} ""))
                       (cond
                         (and (= (read-ui app [:submode]) "editappname") (= (<-- :id ) (read-ui app [:app-id])))
-                        (input-field {:style {:marginLeft "20px" :color "black"} :placeholder  (str (<-- :application_name))}
-                                     app
-                                     (fn [new-name]
-                                       (let [id (read-ui app [:app-id])]
-                                         (go
-                                           (sql "update  appshare_applications
-                                                set application_name = ?
-                                                where id = ?"
-                                                [new-name id ]  )
-                                           ;(js/alert (str new-name ":" id))
-                                           (write-ui app [:submode] nil)
-                                           ))))
+                        (span nil
+                              (input-field {:style {:marginLeft "20px" :color "black"} :placeholder  (str (<-- :application_name))}
+                                           app
+                                           (fn [new-name]
+                                             (let [id (read-ui app [:app-id])]
+                                               (go
+                                                 (sql "update  appshare_applications
+                                                      set application_name = ?
+                                                      where id = ?"
+                                                      [new-name id ]  )
+                                                 ;(js/alert (str new-name ":" id))
+                                                 (write-ui app [:submode] nil)
+                                                 ))))
+                              (span {:style {:marginLeft "20px" :color "white"} } "<<< Type new name and press Enter" ))

                         ; show the name of the app
                         :else
                         (do
+                          (span nil
                           (div {:onClick     #(go  (write-ui app [:submode] "editappname")
                                                    (write-ui app [:app-id] (<-- :id))
                                                    )

                                 :style {:display "inline-block" :fontFamily "Ubuntu" :fontWeight "700" :fontSize "1.3em"  :marginLeft "20px"}}
-                               (str (<-- :application_name)))))
+                               (str (<-- :application_name)))
+                          (span {:style {:marginLeft "20px" :color "white"} } "<<< Click to edit name" )
+                                )))
                       ))
        (textarea {:id "cm" :style {:display "inline-block" :width "100%" :height "800"}} "TEXT EDITOR")))

@@ -250,12 +255,14 @@
                       :else
                       (let [glyphicon (if (<-- :application_glyph)  (<-- :application_glyph) "glyphicon-align-left")]
                         (span {:className (str "glyphicon " glyphicon)
-                               :aria-hidden "true"}
-                              (span {:onClick     #(go  (write-ui app [:mode] "view")
+                               :aria-hidden "true"
+                               :onClick     #(go  (write-ui app [:mode] "view")
                                                        ;(write-ui app [:submode] "editappname")
                                                        (write-ui app [:app-id] (<-- :id))
                                                        (evalapp (<-- :id))
                                                        )
+                               }
+                              (span {

                                     :style {:display "inline-block" :fontFamily "Ubuntu" :fontWeight "700" :fontSize "1.3em" :marginTop "0.7em" :marginLeft "0.7em"}}
                                    (str   (<-- :application_name)))


Better css visible hack that works with the production compiler

--- frontend/components/project_settings.cljs
+++ frontend/components/project_settings.cljs
@@ -1246,24 +1246,6 @@

 (defn aws-codedeploy [project-data owner]
   (reify
-    ;; I am so sorry for this horrific hack.
-    ;;
-    ;; Without https://github.com/circleci/circle/pull/3466 going anywhere I'm
-    ;; left with the follow-status sidebar using horizontal whitespace that
-    ;; prevents the CodeDeploy help popovers from displaying correctly on
-    ;; smaller screens.
-    ;;
-    ;; overflow: visible doesn't work for the other project settings so toggle
-    ;; the overflow to visible when the codedeploy settings are shown and reset
-    ;; when selecting a different settings page.
-    om/IDidMount
-    (did-mount [_]
-      (-> (js/$ ".project-settings-inner")
-          (.css "overflow" "visible")))
-    om/IWillUnmount
-    (will-unmount [_]
-      (-> (js/$ ".project-settings-inner")
-          (.css "overflow" "auto")))
     om/IRender
     (render [_]
       (let [project (:project project-data)
@@ -1367,7 +1349,7 @@
            [:div.loading-spinner common/spinner]
            [:div#project-settings
             [:aside sidebar]
-            [:div.project-settings-inner
+            [:div.project-settings-inner {:style {:overflow (if (= :aws-codedeploy subpage) "visible" "auto")}}
              (om/build common/flashes (get-in data state/error-message-path))
              [:div#subpage
               (condp = subpage


refactored exercise acronym: upper-case result string instead of every char

--- exercises/acronym/src/example.clj
+++ exercises/acronym/src/example.clj
@@ -4,5 +4,5 @@
 (defn acronym [text]
   (->> (re-seq #"[A-Z]+[a-z]*|[a-z]+" text)
        (map first)
-       (map str/upper-case)
-       (apply str)))
+       (apply str)
+       str/upper-case))


:lipstick: Minor cosmetic changes on recent files component.

--- frontend/src/uxbox/main/ui/dashboard/recent_files.cljs
+++ frontend/src/uxbox/main/ui/dashboard/recent_files.cljs
@@ -42,36 +42,43 @@

 ;; --- Component: Drafts Page

+(mf/defc recent-project
+  [{:keys [project files first? locale] :as props}]
+  (let [project-id (:id project)]
+    [:div.recent-files-row
+     {:class-name (when first? "first")}
+     [:div.recent-files-row-title
+      [:h2.recent-files-row-title-name (:name project)]
+      [:span.recent-files-row-title-info (str (:file-count project) " files")]
+      (when files
+        (let [time (-> (first files)
+                       (:modified-at)
+                       (dt/timeago {:locale locale}))]
+          [:span.recent-files-row-title-info (str ", " time)]))]
+     [:& grid {:id (:id project)
+               :files (or files [])
+               :hide-new? true}]]))
+
+
 (mf/defc recent-files-page
   [{:keys [section team-id] :as props}]
   (mf/use-effect
-   {:fn #(st/emit! (dsh/initialize-team team-id))
+   {:fn #(st/emit! (dsh/initialize-recent team-id))
     :deps (mf/deps team-id)})
-  (let [projects (mf/deref projects-ref)
+  (let [projects (->> (mf/deref projects-ref)
+                      (vals)
+                      (filter #(pos? (:file-count %)))
+                      (sort-by :modified-at)
+                      (reverse))
+
         recent-files (mf/deref recent-files-ref)
         locale (i18n/use-locale)]
-    (if projects
+    (when (and projects recent-files)
       [:section.recent-files-page
-       (for [project (vals projects)]
-         [:div.recent-files-row
-          {:key (:id project)
-           :class-name (when (= project (first (vals projects))) "first")}
-          [:div.recent-files-row-title
-           [:h2.recent-files-row-title-name (:name project)]
-           [:span.recent-files-row-title-info (str (:file-count project) " files")]
-           (when (and recent-files (recent-files (:id project)))
-             (let [time (-> (project :id)
-                            (recent-files)
-                            (first)
-                            :modified-at
-                            (dt/timeago {:locale locale}))]
-               [:span.recent-files-row-title-info (str ", " time)]))]
-          [:& grid {:id (:id project)
-                    :files (or
-                            (and recent-files (recent-files (:id project)))
-                            [])
-                    :hide-new? true}]])]
-      [:section
-       [:p "empty"]])
-    ))
+       (for [project projects]
+         [:& recent-project {:project project
+                             :locale locale
+                             :key (:id project)
+                             :files (get recent-files (:id project))
+                             :first? (= project (first projects))}])])))


don't append schema_version to identity records during migrations

--- src/ctia/task/migrations.clj
+++ src/ctia/task/migrations.clj
@@ -28,7 +28,9 @@
        doc))))

 (defn append-version [version]
-  (map #(assoc % :schema_version version)))
+  (map #(if-not (seq (:capabilities %))
+          (assoc % :schema_version version)
+          %)))

 (def available-migrations
   {:__test (map #(assoc % :groups ["migration-test"]))


Fix critical bug with the hashchange router

--- src/keechma/app_state/hashchange_router.cljs
+++ src/keechma/app_state/hashchange_router.cljs
@@ -8,7 +8,7 @@

 (defn hashchange-listener [routes routes-chan e]
   ;; (subs (.-token e) 1) Removes ! from the start of the route
-  (let [clean-route (subs (.-token e) 1)
+  (let [clean-route (subs (.-token e) 1)
         route-params (router/url->map routes clean-route)]
     (put! routes-chan route-params)))

@@ -35,5 +35,5 @@
     (str "#!" (router/map->url (:routes this) params))))

 (defn constructor [routes routes-chan]
-  (let [listener (partial hashchange-listener routes routes-chan)]
+  (let [listener (partial hashchange-listener (router/expand-routes routes) routes-chan)]
     (core/start! (->HashchangeRouter (router/expand-routes routes) routes-chan listener))))


add key to fail-message-list component

add key to fail-message-list component

--- src/leiningen/new/reagent_liveedit/test.cljs
+++ src/leiningen/new/reagent_liveedit/test.cljs
@@ -12,12 +12,15 @@
    [:div.actual [:span.name "Actual: "]
     [:span {:class (if (= type :error) :stack :res)} (str actual)]]])

+(defn indexed [coll]
+  (map-indexed (fn [idx c] [idx c]) coll))
+
 (defn fail-message-list [msgs]
   (let [msgs @(cur [:test :fail-messages])]
     (when-not (empty? msgs)
       [:div.fail-message-list
-       (for [m msgs]
-         [fail-message m])])))
+       (for [[idx m] (indexed msgs)] ^{:key idx}
+            [fail-message m])])))

 (defn test-component []
   (let [{:keys [pass fail error fail-messages]} @(cur [:test])


Simplified the implementation of the memcache service.

--- src/appengine_magic/services/memcache.clj
+++ src/appengine_magic/services/memcache.clj
@@ -4,7 +4,7 @@
             MemcacheService$SetPolicy]))

-(defonce *default-memcache-service* (atom nil))
+(defonce *memcache-service* (atom nil))
 (defonce *namespaced-memcache-services* (atom {}))

@@ -14,20 +14,17 @@
    :replace-only MemcacheService$SetPolicy/REPLACE_ONLY_IF_PRESENT})

-(defn- get-memcache-service [& {:keys [service namespace]}]
-  (cond (and (nil? service) (nil? namespace))
-          (do (when (nil? @*default-memcache-service*)
-                (reset! *default-memcache-service* (MemcacheServiceFactory/getMemcacheService)))
-              @*default-memcache-service*)
-        (not (nil? service))
-          service
-        (not (nil? namespace))
-          (let [s (@*namespaced-memcache-services* namespace)]
-            (if-not (nil? s)
-                s
-                ((swap! *namespaced-memcache-services* assoc
-                        namespace (MemcacheServiceFactory/getMemcacheService namespace))
-                 namespace)))))
+(defn get-memcache-service [& {:keys [namespace]}]
+  (if (nil? namespace)
+      (do (when (nil? @*memcache-service*)
+            (reset! *memcache-service* (MemcacheServiceFactory/getMemcacheService)))
+          @*memcache-service*)
+      (let [s (@*namespaced-memcache-services* namespace)]
+        (if-not (nil? s)
+            s
+            ((swap! *namespaced-memcache-services* assoc
+                    namespace (MemcacheServiceFactory/getMemcacheService namespace))
+             namespace)))))

 (defrecord Statistics [bytes-returned-for-hits
@@ -38,9 +35,8 @@
                        total-item-bytes])

-(defn statistics [& {:keys [service namespace]}]
-  (let [service (get-memcache-service :service service :namespace namespace)
-        stats (.getStatistics service)]
+(defn statistics [& {:keys [namespace]}]
+  (let [stats (.getStatistics (get-memcache-service :namespace namespace))]
     (Statistics. (.getBytesReturnedForHits stats)
                  (.getHitCount stats)
                  (.getItemCount stats)
@@ -51,20 +47,18 @@

 (defn clear-all
   "Clears the entire cache. Does not respect namespaces!"
-  [& {:keys [service namespace]}]
-  (let [service (get-memcache-service :service service :namespace namespace)]
-    (.clearAll service)))
+  []
+  (.clearAll (get-memcache-service)))

-(defn contains? [key & {:keys [service namespace]}]
-  (let [service (get-memcache-service :service service :namespace namespace)]
-    (.contains service key)))
+(defn contains? [key & {:keys [namespace]}]
+  (.contains (get-memcache-service :namespace namespace) key))

 (defn delete
   "If (sequential? key), deletes in batch."
-  [key & {:keys [service namespace millis-no-readd]}]
-  (let [service (get-memcache-service :service service :namespace namespace)]
+  [key & {:keys [namespace millis-no-readd]}]
+  (let [service (get-memcache-service :namespace namespace)]
     (if millis-no-readd
         (if (sequential? key)
             (.deletAll service key millis-no-readd)
@@ -76,31 +70,31 @@

 (defn get
   "If (sequential? key), returns values as a map."
-  [key & {:keys [service namespace]}]
-  (let [service (get-memcache-service :service service :namespace namespace)]
+  [key & {:keys [namespace]}]
+  (let [service (get-memcache-service :namespace namespace)]
     (if (sequential? key)
         (into {} (.getAll service key))
         (.get service key))))

-(defn put [key value & {:keys [service namespace expiration policy]
+(defn put [key value & {:keys [namespace expiration policy]
                         :or {policy :always}}]
-  (let [service (get-memcache-service :service service :namespace namespace)
+  (let [service (get-memcache-service :namespace namespace)
         policy (*policy-type-map* policy)]
     (.put service key value expiration policy)))

-(defn put-map [values & {:keys [service namespace expiration policy]
+(defn put-map [values & {:keys [namespace expiration policy]
                          :or {policy :always}}]
-  (let [service (get-memcache-service :service service :namespace namespace)
+  (let [service (get-memcache-service :namespace namespace)
         policy (*policy-type-map* policy)]
     (.putAll service values expiration policy)))

 (defn increment
   "If (sequential? key), increment each key by the delta."
-  [key delta & {:keys [service namespace initial]}]
-  (let [service (get-memcache-service :service service :namespace namespace)]
+  [key delta & {:keys [namespace initial]}]
+  (let [service (get-memcache-service :namespace namespace)]
     (if initial
         (if (sequential? key)
             (.incrementAll service key delta (long initial))
@@ -110,8 +104,8 @@
             (.increment service key delta)))))

-(defn increment-map [values & {:keys [service namespace initial]}]
-  (let [service (get-memcache-service :service service :namespace namespace)]
+(defn increment-map [values & {:keys [namespace initial]}]
+  (let [service (get-memcache-service :namespace namespace)]
     (if initial
         (.incrementAll service values (long initial))
         (.incrementAll service values))))


Bind *tag-map* in example (vs. explicit param).

--- hyde-pallet-core/src/com/palletops/hyde_pallet/core.clj
+++ hyde-pallet-core/src/com/palletops/hyde_pallet/core.clj
@@ -84,29 +84,29 @@
   (hyde/write-data!
    root "api-doc"
    (clean-api (edn/read-string (slurp (file  "target/docudata.edn")))))
-  (hyde/write-collection!
-   root
-   "api"
-   {:index-key :my-index
-    :docs [{:path "doc-a.md"
-            :front-matter
-            {:title "doc a"
-             :layout "default"}
-            :content "this is doc *a*"}
-           {:path "doc-b.md"
-            :front-matter
-            {:title "doc b"
-             :layout "default"}
-            :content "this is verbatim *b* [* #pallet/project pallet *]"}]}
-   {'pallet/project #'->Project})
-  (hyde/write-document!
-   root
-   {:path "README.md"
-    :front-matter
-    {:title "lein-pallet-release"
-     :layout "doc"}
-    :content
-     "A Leiningen plugin to release PalletOps projects.
+  (binding [hyde/*tag-map* {'pallet/project #'->Project}]
+    (hyde/write-collection!
+     root
+     "api"
+     {:index-key :my-index
+      :docs [{:path "doc-a.md"
+              :front-matter
+              {:title "doc a"
+               :layout "default"}
+              :content "this is doc *a*"}
+             {:path "doc-b.md"
+              :front-matter
+              {:title "doc b"
+               :layout "default"}
+              :content "this is verbatim *b* [* #pallet/project pallet *]"}]})
+    (hyde/write-document!
+     root
+     {:path "README.md"
+      :front-matter
+      {:title "lein-pallet-release"
+       :layout "doc"}
+      :content
+      "A Leiningen plugin to release PalletOps projects.

 Releases are made by creating a local release branch which is pushed
@@ -244,5 +244,4 @@
 Copyright © 2014 Hugo Duncan, Antoni Batchelli

 Distributed under the Eclipse Public License either version 1.0 or (at
-your option) any later version."}
-    {'pallet/project #'->Project}))
+your option) any later version."})))


mock fn to avoid reading from disk

mock fn to avoid reading from disk

--- cimi-resources/test/com/sixsq/slipstream/ssclj/resources/external_object_report_lifecycle_test.clj
+++ cimi-resources/test/com/sixsq/slipstream/ssclj/resources/external_object_report_lifecycle_test.clj
@@ -26,8 +26,9 @@

 (deftest check-upload-and-download-operations
-  (eoltu/upload-and-download-operations (str p/service-context eot/resource-url "/" report/objectType)
-                                        fake-deployment-info))
+  (with-redefs [eo-utils/generate-url (constantly "https://s3.example.org/bucket")]
+    (eoltu/upload-and-download-operations (str p/service-context eot/resource-url "/" report/objectType)
+                                          fake-deployment-info)))

 (deftest bad-methods