Update identity definitions to cleanly separate things that should happen at start of game from behaviors that are in the card's text box. For Employee Strike/Cerebral Static behavior.

--- src/clj/game/cards-identities.clj
+++ src/clj/game/cards-identities.clj
@@ -10,19 +10,26 @@
    (let [titles #{"Safety First" "Always Be Running" "Neutralize All Threats"}
          one-of-each   (fn [cards] (->> cards (group-by :title) (map second) (map first)))
          get-directives (fn [source] (filter #(some #{(:title %)} titles) source))]
-   {:effect (req (let [directives (-> (:deck runner) (concat (:hand runner)) (get-directives) one-of-each)]
-                   (when (not= 3 (count directives))
-                     (toast state :runner
-                            "Your deck doesn't contain enough directives for Adam's ability. The deck needs to contain at least one copy of each directive. They are not counted against the printed decksize limit, so minimal Adam's decksize on this site is 48 cards."
-                            "warning"
-                            {:time-out 0 :close-button true}))
-                   (doseq [c directives]
-                     (runner-install state side c {:no-cost true
-                                                   :custom-message (str "starts with " (:title c) " in play")}))
-                   (draw state :runner (count (filter in-hand? directives)))))})
+   {:events {:pre-start-game
+             {:req (req (= side :runner))
+              :effect (req (let [directives (-> (:deck runner) (concat (:hand runner)) (get-directives) one-of-each)]
+                             (when (not= 3 (count directives))
+                               (toast state :runner
+                                      (str "Your deck doesn't contain enough directives for Adam's ability. The deck "
+                                           "needs to contain at least one copy of each directive. They are not counted "
+                                           "against the printed decksize limit, so minimal Adam's decksize on this site is 48 cards.")
+                                      "warning"
+                                      {:time-out 0 :close-button true}))
+                             (doseq [c directives]
+                               (runner-install state side c {:no-cost true
+                                                             :custom-message (str "starts with " (:title c) " in play")}))
+                             (draw state :runner (count (filter in-hand? directives)))))}}})

    "Andromeda: Dispossessed Ristie"
-   {:effect (effect (gain :link 1) (draw 4)) :mulligan (effect (draw 4))}
+   {:events {:pre-start-game {:req (req (= side :runner))
+                              :effect (effect (gain :link 1)
+                                              (draw 4))}}
+    :mulligan (effect (draw 4))}

    "Apex: Invasive Predator"
    (let [ability {:prompt "Select a card to install facedown"
@@ -46,13 +53,15 @@
                                  (system-msg state side "suffers 2 meat damage"))))}}}

    "Armand \"Geist\" Walker: Tech Lord"
-   {:effect (effect (gain :link 1))
-    :events {:runner-trash {:req (req (and (= side :runner) (= (second targets) :ability-cost)))
+   {:events {:pre-start-game {:req (req (= side :runner))
+                              :effect (effect (gain :link 1))}
+             :runner-trash {:req (req (and (= side :runner) (= (second targets) :ability-cost)))
                             :msg "draw a card"
                             :effect (effect (draw 1))}}}

    "Blue Sun: Powering the Future"
-   {:flags {:corp-phase-12 (req (some #(rezzed? %) (all-installed state :corp)))}
+   {:flags {:corp-phase-12 (req (and (not (:disabled card))
+                                     (some #(rezzed? %) (all-installed state :corp))))}
     :abilities [{:choices {:req #(:rezzed %)}
                  :effect (req (trigger-event state side :pre-rez-cost target)
                               (let [cost (rez-cost state side target)]
@@ -62,25 +71,27 @@
                                 (swap! state update-in [:bonus] dissoc :cost)))}]}

    "Boris \"Syfr\" Kovac: Crafty Veteran"
-   {:effect draft-points-target
-    :events (let [bor {:req (req (let [facs (frequencies (map :faction (all-installed state :runner)))
+   {:events (let [bor {:req (req (let [facs (frequencies (map :faction (all-installed state :runner)))
                                        an (get facs "Anarch" 0)
                                        sh (get facs "Shaper" 0)
                                        cr (get facs "Criminal" 0)]
                                    (and (> cr sh) (> cr an) (pos? (:tag runner)))))
                        :msg "remove 1 tag"
                        :effect (effect (lose :tag 1))}]
-              {:runner-turn-begins bor})}
+              {:runner-turn-begins bor
+               :pre-start-game {:effect draft-points-target}})}

    "Cerebral Imaging: Infinite Frontiers"
    {:effect (req (add-watch state :cerebral-imaging
                             (fn [k ref old new]
                               (let [credit (get-in new [:corp :credit])]
                                 (when (not= (get-in old [:corp :credit]) credit)
-                                  (swap! ref assoc-in [:corp :hand-size-base] credit))))))}
+                                  (swap! ref assoc-in [:corp :hand-size-base] credit))))))
+    :leave-play (effect (remove-watch state :cerebral-imaging))}

    "Chaos Theory: Wünderkind"
-   {:effect (effect (gain :memory 1))}
+   {:effect (effect (gain :memory 1))
+    :leave-play (effect (lose :runner :memory 1))}

    "Chronos Protocol: Selective Mind-mapping"
    {:events
@@ -109,11 +120,14 @@

    "Cybernetics Division: Humanity Upgraded"
    {:effect (effect (lose :hand-size-modification 1)
-                    (lose :runner :hand-size-modification 1))}
+                    (lose :runner :hand-size-modification 1))
+    :leave-play (effect (gain :hand-size-modification 1)
+                        (gain :runner :hand-size-modification 1))}

    "Edward Kim: Humanitys Hammer"
-   {:effect (effect (gain :link 1))
-    :events {:access {:once :per-turn
+   {:events {:pre-start-game {:req (req (= side :runner))
+                              :effect (effect (gain :link 1))}
+             :access {:once :per-turn
                       :req (req (and (is-type? target "Operation")
                                      (turn-flag? state side card :can-trash-operation)))
                       :effect (effect (trash target))
@@ -124,15 +138,15 @@
                                    :effect (effect (register-turn-flag! card :can-trash-operation (constantly false)))}}}

    "Exile: Streethawk"
-   {:effect (effect (gain :link 1))
-    :events {:runner-install {:req (req (and (is-type? target "Program")
+   {:events {:pre-start-game {:req (req (= side :runner))
+                              :effect (effect (gain :link 1))}
+             :runner-install {:req (req (and (is-type? target "Program")
                                              (some #{:discard} (:previous-zone target))))
                               :msg (msg "draw a card")
                               :effect (effect (draw 1))}}}

    "Fringe Applications: Tomorrow, Today"
-   {:effect draft-points-target
-    :events (let [fap {:req (req (let [facs (frequencies (map :faction (filter :rezzed (all-installed state :corp))))
+   {:events (let [fap {:req (req (let [facs (frequencies (map :faction (filter :rezzed (all-installed state :corp))))
                                        hb (get facs "Haas-Bioroid" 0)
                                        ji (get facs "Jinteki" 0)
                                        nb (get facs "NBN" 0)
@@ -142,34 +156,36 @@
                        :prompt "Choose a piece of ICE to place 1 advancement token on it" :player :corp
                        :choices {:req #(and (installed? %) (ice? %))}
                        :effect (req (add-prop state :corp target :advance-counter 1 {:placed true}))}]
-              {:runner-turn-begins fap})}
+              {:runner-turn-begins fap
+               :pre-start-game {:effect draft-points-target})}

    "Gabriel Santiago: Consummate Professional"
    {:events {:successful-run {:msg "gain 2 [Credits]" :once :per-turn
                               :effect (effect (gain :credit 2)) :req (req (= target :hq))}}}

    "Gagarin Deep Space: Expanding the Horizon"
-   {:flags {:slow-remote-access (req true)}
+   {:flags {:slow-remote-access (req (not (:disabled card)))}
     :events {:pre-access-card {:req (req (is-remote? (second (:zone target))))
                                :effect (effect (access-cost-bonus [:credit 1]))
-                               :msg  (msg (if
-                                      (= (get-in @state [:runner :credit]) 0)
-                                      "prevent access"
-                                      "make the Runner spend 1 [Credits] to access"
-                                      ))}}}
+                               :msg "make the Runner spend 1 [Credits] to access"}}}

    "GRNDL: Power Unleashed"
-   {:effect (effect (gain :credit 5 :bad-publicity 1))}
+   {:events {:pre-start-game {:req (req (= :corp side))
+                              :effect (req (gain state :corp :credit 5)
+                                           (when (= 0 (:bad-publicity corp))
+                                             (gain state :corp :bad-publicity 1)))}}}

    "Haarpsichord Studios: Entertainment Unleashed"
+   (let [haarp (fn [state side card]
+                 (if (is-type? card "Agenda")
+                   ((constantly false)
+                     (toast state :runner "Cannot steal due to Haarpsichord Studios." "warning"))
+                   true))]
    {:events {:agenda-stolen
-             {:effect (effect (register-turn-flag!
-                                card :can-steal
-                                (fn [state side card]
-                                  (if (is-type? card "Agenda")
-                                    ((constantly false)
-                                     (toast state :runner "Cannot steal due to Haarpsichord Studios." "warning"))
-                                    true))))}}}
+             {:effect (effect (register-turn-flag! card :can-steal haarp))}}
+    :effect (req (when-not (first-event state side :agenda-stolen)
+                   (register-turn-flag! state side card :can-steal haarp)))
+    :leave-play (effect (clear-turn-flag! card :can-steal))})

    "Haas-Bioroid: Engineering the Future"
    {:events {:corp-install {:once :per-turn :msg "gain 1 [Credits]"
@@ -180,7 +196,8 @@
                                 :effect (effect (ice-strength-bonus 1 target))}}}

    "Harmony Medtech: Biomedical Pioneer"
-   {:effect (effect (lose :agenda-point-req 1) (lose :runner :agenda-point-req 1))}
+   {:effect (effect (lose :agenda-point-req 1) (lose :runner :agenda-point-req 1))
+    :leave-play (effect (gain :agenda-point-req 1) (gain :runner :agenda-point-req 1))}

    "Hayley Kaplan: Universal Scholar"
    {:events {:runner-install
@@ -202,8 +219,9 @@
                   :msg "gain 2 [Credits]"
                   :effect (effect (gain :credit 2))}]
    {:flags {:drip-economy true}
-    :effect (effect (gain :link 1))
-    :events {:runner-turn-begins ability}
+    :events {:pre-start-game {:req (req (= side :runner))
+                              :effect (effect (gain :link 1))}
+             :runner-turn-begins ability}
     :abilities [ability]})

    "Industrial Genomics: Growing Solutions"
@@ -211,8 +229,7 @@
                                            (count (filter #(not (:seen %)) (:discard corp)))))}}}

    "Information Dynamics: All You Need To Know"
-   {:effect draft-points-target
-    :events (let [inf {:req (req (let [facs (frequencies (map :faction (filter :rezzed (all-installed state :corp))))
+   {:events (let [inf {:req (req (let [facs (frequencies (map :faction (filter :rezzed (all-installed state :corp))))
                                        hb (get facs "Haas-Bioroid" 0)
                                        ji (get facs "Jinteki" 0)
                                        nb (get facs "NBN" 0)
@@ -220,11 +237,11 @@
                                    (and (> nb ji) (> nb hb) (> nb we))))
                        :msg "give the Runner 1 tag"
                        :effect (effect (tag-runner :runner 1))}]
-              {:agenda-scored inf :agenda-stolen inf})}
+              {:agenda-scored inf :agenda-stolen inf
+               :pre-start-game {:effect draft-points-target}})}

    "Jamie \"Bzzz\" Micken: Techno Savant"
-   {:effect draft-points-target
-    :events (let [jam {:req (req (let [facs (frequencies (map :faction (all-installed state :runner)))
+   {:events (let [jam {:req (req (let [facs (frequencies (map :faction (all-installed state :runner)))
                                        an (get facs "Anarch" 0)
                                        sh (get facs "Shaper" 0)
                                        cr (get facs "Criminal" 0)]
@@ -232,7 +249,8 @@
                        :msg "draw 1 card"
                        :once :per-turn
                        :effect (effect (draw 1))}]
-              {:runner-install jam})}
+              {:runner-install jam
+               :pre-start-game {:effect draft-points-target}})}

    "Jesminder Sareen: Girl Behind the Curtain"
    {:events {:pre-tag {:once :per-run
@@ -251,7 +269,8 @@
      :run {:once :per-turn
            :req (req (is-central? (:server run)))
            :effect (req (apply enable-run-on-server
-                               state card (map first (get-remotes @state))))}}}
+                               state card (map first (get-remotes @state))))}}
+    :leave-play (req (apply enable-run-on-server state card (map first (get-remotes @state))))}

    "Jinteki Biotech: Life Imagined"
    {:events {:pre-first-turn {:req (req (= side :corp))
@@ -292,8 +311,9 @@
                                          :effect (effect (add-prop target :advance-counter 4 {:placed true}))} card nil)))))}]}

    "Kate \"Mac\" McCaffrey: Digital Tinker"
-   {:effect (effect (gain :link 1))
-    :events {:pre-install {:req (req (and (#{"Hardware" "Program"} (:type target))
+   {:events {:pre-start-game {:req (req (= side :runner))
+                              :effect (effect (gain :link 1))}
+             :pre-install {:req (req (and (#{"Hardware" "Program"} (:type target))
                                           (not (get-in @state [:per-turn (:cid card)]))))
                            :effect (effect (install-cost-bonus [:credit -1]))}
              :runner-install {:req (req (and (#{"Hardware" "Program"} (:type target))
@@ -345,13 +365,15 @@
                   :once :per-turn
                   :effect (effect (mill 2) (draw))}]
    {:flags {:runner-turn-draw true
-            :runner-phase-12 (req (some #(card-flag? % :runner-turn-draw true) (all-installed state :runner)))}
+            :runner-phase-12 (req (and (not (:disabled card))
+                                       (some #(card-flag? % :runner-turn-draw true) (all-installed state :runner))))}
     :events {:runner-turn-begins ability}
     :abilities [ability]})

    "Nasir Meidan: Cyber Explorer"
-   {:effect (effect (gain :link 1))
-    :events {:rez {:req (req (and (:run @state)
+   {:events {:pre-start-game {:req (req (= side :runner))
+                              :effect (effect (gain :link 1))}
+             :rez {:req (req (and (:run @state)
                                   ;; check that the rezzed item is the encountered ice
                                   (= (:cid target)
                                      (:cid (get-card state current-ice)))))
@@ -371,13 +393,15 @@
    {:recurring 2}

    "NBN: The World is Yours*"
-   {:effect (effect (gain :hand-size-modification 1))}
+   {:effect (effect (gain :hand-size-modification 1))
+    :leave-play (effect (lose :hand-size-modification 1))}

    "Near-Earth Hub: Broadcast Center"
    {:events {:server-created {:msg "draw 1 card" :once :per-turn :effect (effect (draw 1))}}}

    "Nero Severn: Information Broker"
-   {:effect (effect (gain :link 1))
+   {:events {:pre-start-game {:req (req (= side :runner))
+                              :effect (effect (gain :link 1))}}
     :abilities [{:req (req (has-subtype? current-ice "Sentry"))
                  :once :per-turn
                  :msg "jack out when encountering a sentry"
@@ -433,8 +457,9 @@
    {:abilities [{:once :per-turn :msg "break 1 barrier subroutine"}]}

    "Reina Roja: Freedom Fighter"
-   {:effect (effect (gain :link 1))
-    :events {:pre-rez {:req (req (and (ice? target) (not (get-in @state [:per-turn (:cid card)]))))
+   {:events {:pre-start-game {:req (req (= side :runner))
+                              :effect (effect (gain :link 1))}
+             :pre-rez {:req (req (and (ice? target) (not (get-in @state [:per-turn (:cid card)]))))
                        :effect (effect (rez-cost-bonus 1))}
              :rez {:req (req (and (ice? target) (not (get-in @state [:per-turn (:cid card)]))))
                               :effect (req (swap! state assoc-in [:per-turn (:cid card)] true))}}}
@@ -473,14 +498,15 @@
            :msg (msg "make the Runner lose 1 [Credits] by rezzing an advertisement")}}}

    "Strategic Innovations: Future Forward"
-   {:effect draft-points-target
-    :events {:runner-turn-ends
+   {:events {:pre-start-game {:effect draft-points-target}
+             :runner-turn-ends
              {:req (req (let [facs (frequencies (map :faction (filter :rezzed (all-installed state :corp))))
                               hb (get facs "Haas-Bioroid" 0)
                               ji (get facs "Jinteki" 0)
                               nb (get facs "NBN" 0)
                               we (get facs "Weyland Consortium" 0)]
-                          (and (> hb ji) (> hb nb) (> hb we) (pos? (count (:discard corp))))))
+                          (and (not (:disabled card))
+                               (> hb ji) (> hb nb) (> hb we) (pos? (count (:discard corp))))))
               :prompt "Choose a card in Archives to shuffle into R&D"
               :choices {:req #(and (card-is? % :side :corp) (= (:zone %) [:discard]))}
               :player :corp :show-discard true :priority true
@@ -490,7 +516,8 @@
                               (shuffle! :corp :deck))}}}

    "Sunny Lebeau: Security Specialist"
-   {:effect (effect (gain :link 2))}
+   {:events {:pre-start-game {:req (req (= side :runner))
+                              :effect (effect (gain :link 2))}}}

    "SYNC: Everything, Everywhere"
    {:events {:pre-first-turn {:req (req (= side :corp))
@@ -506,13 +533,14 @@
                  :msg (msg "flip their ID")}]}

    "Synthetic Systems: The World Re-imagined"
-   {:effect draft-points-target
+   {:events {:pre-start-game {:effect draft-points-target}}
     :flags {:corp-phase-12 (req (let [facs (frequencies (map :faction (filter :rezzed (all-installed state :corp))))
                                       hb (get facs "Haas-Bioroid" 0)
                                       ji (get facs "Jinteki" 0)
                                       nb (get facs "NBN" 0)
                                       we (get facs "Weyland Consortium" 0)]
-                                  (and (> ji hb) (> ji nb) (> ji we)
+                                  (and (not (:disabled (get-card state card)))
+                                       (> ji hb) (> ji nb) (> ji we)
                                        (> (count (filter #(ice? %) (all-installed state :corp))) 1))))}
     :abilities [{:prompt "Select two pieces of ICE to swap positions"
                  :choices {:req #(and (installed? %) (ice? %)) :max 2}
@@ -523,7 +551,8 @@
                            " and " (card-str state (second targets)))}]}

    "Tennin Institute: The Secrets Within"
-   {:flags {:corp-phase-12 (req (and (not= 1 (:turn @state)) (not (:successful-run runner-reg))))}
+   {:flags {:corp-phase-12 (req (and (not (:disabled (get-card state card)))
+                                     (not= 1 (:turn @state)) (not (:successful-run runner-reg))))}
     :abilities [{:msg (msg "place 1 advancement token on " (card-str state target))
                  :choices {:req installed?}
                  :req (req (not (:successful-run runner-reg)))
@@ -543,18 +572,20 @@
                                           (shuffle! :deck))}}}}}

    "The Masque: Cyber General"
-   {:effect draft-points-target}
+   {:events {:pre-start-game {:effect draft-points-target}}}

    "The Shadow: Pulling the Strings"
-   {:effect draft-points-target}
+   {:events {:pre-start-game {:effect draft-points-target}}}

    "Titan Transnational: Investing In Your Future"
    {:events {:agenda-scored {:msg (msg "add 1 agenda counter to " (:title target))
                              :effect (effect (add-prop target :counter 1))}}}

    "Valencia Estevez: The Angel of Cayambe"
-   {:req (req (zero? (get-in @state [:corp :bad-publicity])))
-    :effect (effect (gain :corp :bad-publicity 1))}
+   {:events {:pre-start-game
+             {:req (req (and (= side :runner)
+                             (zero? (get-in @state [:corp :bad-publicity]))))
+              :effect (effect (gain :corp :bad-publicity 1))}}}

    "Weyland Consortium: Because We Built It"
    {:recurring 1}
@@ -568,8 +599,7 @@
    {:recurring 3}

    "Wyvern: Chemically Enhanced"
-   {:effect draft-points-target
-    :events (let [wyv {:req (req (let [facs (frequencies (map :faction (all-installed state :runner)))
+   {:events (let [wyv {:req (req (let [facs (frequencies (map :faction (all-installed state :runner)))
                                        an (get facs "Anarch" 0)
                                        sh (get facs "Shaper" 0)
                                        cr (get facs "Criminal" 0)]
@@ -578,4 +608,5 @@
                        :msg (msg "shuffle " (:title (last (:discard runner))) " into their Stack")
                        :effect (effect (move :runner (last (:discard runner)) :deck)
                                        (shuffle! :runner :deck))}]
-              {:runner-trash wyv})}})
+              {:pre-start-game {:effect draft-points-target}
+               :runner-trash wyv})}})


dont make "see also" required for ns docs

--- src/cljs_api_gen/cljsdoc/lint.clj
+++ src/cljs_api_gen/cljsdoc/lint.clj
@@ -12,6 +12,7 @@
          [:see-also "see also:"]]
    :required?        #{:full-name :see-also}
    :syntax-required? #{:full-name :see-also :display}
+   :ns-required?     #{:full-name}
    :list?            #{:tags :see-also}})

 (def markdown-keys
@@ -42,10 +43,13 @@
   [[key title] m]
   (let [value (get m key)
         list? (:list? frontmatter-keys)
-        required? (if (string/starts-with? (:full-name m) "syntax/")
-                    (:syntax-required? frontmatter-keys)
-                    (:required? frontmatter-keys))]
-    (when (or value (required? key))
+        required?
+        (cond
+          (string/starts-with? (:full-name m) "syntax/") (:syntax-required? frontmatter-keys)
+          (not (string/includes? (:full-name m) "/"))    (:ns-required? frontmatter-keys)
+          :else                                          (:required? frontmatter-keys))]
+    (when (or (not (blank? value))
+              (required? key))
       (cond
         (blank? value)   (str title)
         (list? key)      (str title "\n" (yaml-list value))
@@ -65,7 +69,8 @@
         required? (if (string/includes? (:full-name m) "/")
                     (:required? markdown-keys)
                     (:ns-required? markdown-keys))]
-    (when (or value (required? key))
+    (when (or (not (blank? value))
+              (required? key))
       (cond
         (blank? value)   (str section-start title "\n")
         (list? key)      (str section-start title "\n" (string/join "\n" value) "\n")


fix delete

fix delete

--- src/clj/clj_money/models/transactions.clj
+++ src/clj/clj_money/models/transactions.clj
@@ -550,6 +550,12 @@
     (when (not (nil? last-index))
       (accounts/update storage (assoc account :quantity balance)))))

+(defn- extract-account-ids
+  [transaction]
+  (->> (:items transaction)
+       (map :account-id)
+       (into #{})))
+
 (defn create
   "Creates a new transaction"
   [storage-spec transaction]
@@ -561,9 +567,7 @@
                            before-save
                            (create-transaction s)
                            (link-lots s))
-              account-ids (->> (:items validated)
-                              (map :account-id)
-                              (into #{}))]
+              account-ids (extract-account-ids validated)]
           (doall (->> (:items validated)
                       (map #(assoc %
                                    :transaction-id (:id created)
@@ -759,12 +763,11 @@
   (with-storage [s storage-spec]
     (let [transaction (find-by-id s transaction-id transaction-date)
           _ (ensure-deletable transaction)
-          preceding-items (get-preceding-items s transaction)]
+          account-ids (extract-account-ids transaction)]
       (delete-transaction-items-by-transaction-id s transaction-id transaction-date)
       (delete-transaction s transaction-id transaction-date)
-      ; TODO use recalculate-account
-      #_(doseq [item preceding-items]
-        (recalculate-account-items s item)))))
+      (doseq [account-id (extract-account-ids transaction)]
+        (recalculate-account s account-id (:transaction-date transaction))))))

 (defn- find-last-item-before
   [storage-spec account-id date]


Align let bindings vertically

Align let bindings vertically

--- src/clj/collect_earth_online/db/users.clj
+++ src/clj/collect_earth_online/db/users.clj
@@ -49,20 +49,20 @@
         password-confirmation (:passwordConfirmation params)]
     (if-let [error-msg (get-register-errors email password password-confirmation)]
       (data-response error-msg)
-      (let [timestamp (-> (DateTimeFormatter/ofPattern "yyyy/MM/dd HH:mm:ss")
-                          (.format (LocalDateTime/now)))
-            email-msg (format (str "Dear %s,\n\n"
-                                   "Thank you for signing up for CEO!\n\n"
-                                   "Your Account Summary Details:\n\n"
-                                   "  Email: %s\n"
-                                   "  Created on: %s\n\n"
-                                   "  Click the following link to verify your email:\n"
-                                   "  %sverify-email?email=%s&passwordResetKey=%s\n\n"
-                                   "Kind Regards,\n"
-                                   "  The CEO Team")
-                              email email timestamp (get-base-url) (URLEncoder/encode email) reset-key)
+      (let [timestamp      (-> (DateTimeFormatter/ofPattern "yyyy/MM/dd HH:mm:ss")
+                               (.format (LocalDateTime/now)))
+            email-msg      (format (str "Dear %s,\n\n"
+                                        "Thank you for signing up for CEO!\n\n"
+                                        "Your Account Summary Details:\n\n"
+                                        "  Email: %s\n"
+                                        "  Created on: %s\n\n"
+                                        "  Click the following link to verify your email:\n"
+                                        "  %sverify-email?email=%s&passwordResetKey=%s\n\n"
+                                        "Kind Regards,\n"
+                                        "  The CEO Team")
+                                   email email timestamp (get-base-url) (URLEncoder/encode email) reset-key)
             auto-validate? (get-config :mail :auto-validate?)
-            user-id (sql-primitive (call-sql "add_user" {:log? false} email password reset-key))]
+            user-id        (sql-primitive (call-sql "add_user" {:log? false} email password reset-key))]
         (if auto-validate?
           (do (call-sql "user_verified" user-id)
               (data-response "You have successfully created an account"))


Fix misused :key to correct :react-key

Fix misused :key to correct :react-key

--- src/cljs/gtfve/components/side_panel.cljs
+++ src/cljs/gtfve/components/side_panel.cljs
@@ -43,7 +43,7 @@
                          [:i query]]]
          :else (into [:div.list-group]
                      (map (fn [stop]
-                            [:a.list-group-item {:key (:db/id stop)
+                            [:a.list-group-item {:react-key (:db/id stop)
                                                  :href "#"}
                              [:h5.list-group-item-heading (:stop/name stop)]
                              [:p.list-group-item-text (str (:stop/latitude stop)


Fix issue with caret position being reset

--- src/cljs/notifsta_clone/utils/inputs.cljs
+++ src/cljs/notifsta_clone/utils/inputs.cljs
@@ -82,10 +82,16 @@
         (-> moment-obj .toISOString)))))

 (defn extract-date [timestring]
-  (-> timestring js/moment. (.format "MM/DD/YYYY")))
+  (let [moment-obj (js/moment. timestring)]
+    (if (.isValid moment-obj)
+      (.format moment-obj "MM/DD/YYYY")
+      "")))

 (defn extract-time [timestring]
-  (-> timestring js/moment. (.format "h:mm A")))
+  (let [moment-obj (js/moment. timestring)]
+    (if (.isValid moment-obj)
+      (.format moment-obj "h:mm A")
+      "")))

 (defn on-time-change [parent-state edit-key  update-timestring-func update-value]
   (om/transact!
@@ -129,6 +135,11 @@
 (defn timepicker-input [[parent-state {:keys [className min-date placeholder-text edit-key]}] owner]
   {:pre [(some? parent-state)]}
   (reify
+
+    om/IInitState
+    (init-state [_]
+      {:caret-position 0})
+
     om/IDidMount
     (did-mount [_]
       (let
@@ -149,11 +160,23 @@
             (on-time-change parent-state edit-key update-timestring-time (.val timepicker))
             ))))

+    om/IShouldUpdate
+    (should-update [this [next-props _] next-state]
+      (let [cur-value (-> owner om/get-node .-value)
+            prev-value (-> next-props edit-key extract-time) ]
+        (and
+          (not (= prev-value cur-value))
+          (not (= prev-value (.join (.split cur-value ":") ":0"))))))
+    ;om/IDidUpdate
+    ;(did-update [_ _ prev-state]
+      ;(-> owner om/get-node js/$.  (.caret (:caret-position prev-state))))
+
     om/IRenderState
     (render-state [this state]
       (dom/input
         #js {:className className
-             :onChange #(on-time-change parent-state edit-key update-timestring-time (.. % -target -value))
+             :onChange #(do
+                          (on-time-change parent-state edit-key update-timestring-time (.. % -target -value)))
              :value (-> parent-state edit-key extract-time)
              :type "text" }))))


remove unused requires

remove unused requires

--- src/dev/plastic/dev/figwheel.cljs
+++ src/dev/plastic/dev/figwheel.cljs
@@ -1,13 +1,10 @@
 (ns plastic.dev.figwheel
   (:require-macros [plastic.logging :refer [log info warn error group group-end]])
   (:require [plastic.env]
-            [clojure.string :as string]
-            [figwheel.client :as figwheel]
-            [figwheel.client.socket :as socket]
-            [figwheel.client.utils :as utils]))
+            [figwheel.client :as figwheel]))

 (defonce ^:dynamic *inside-repl-plugin* false)
-(def ^:const repl-marker-style "color:white; background-color:black; padding:0px 2px; border-radius:1px;")
+(defonce ^:const repl-marker-style "color:white; background-color:black; padding:0px 2px; border-radius:1px;")

 (defn figwheel-repl-fix [code]
   (.replace code


Fix bug in reading contexts in CSV format

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

--- src/conexp/io/contexts.clj
+++ src/conexp/io/contexts.clj
@@ -327,8 +327,8 @@
 (add-context-input-format :csv
                           (fn [rdr]
                             (try
-                             (re-matches #"^[^,]+,[^,]+$" (read-line))
-                             (catch Exception _))))
+                              (re-matches #"^[^,]+,[^,]+$" (read-line))
+                              (catch Exception _))))

 (define-context-input-format :csv
   [file]
@@ -339,7 +339,7 @@
           (make-context-nc (set-of g [[g m] inz])
                            (set-of m [[g m] inz])
                            inz)
-          (let [[_ g m] (re-matches #"^([^,])+,([^,])+$" line)]
+          (let [[_ g m] (re-matches #"^([^,]+),([^,]+)$" line)]
             (recur (conj inz [g m]))))))))

 (define-context-output-format :csv


typos

typos

--- src/main/clojure/cljs/analyzer/macros.clj
+++ src/main/clojure/cljs/analyzer/macros.clj
@@ -34,11 +34,11 @@
      (catch :default err#
        (if (cljs.analyzer/analysis-error? err#)
          (throw err#)
-         (throw (error ~env (.-message err#) err#))))))
+         (throw (cljs.analyzer/error ~env (.-message err#) err#))))))

 (defmacro disallowing-recur [& body]
   `(binding [cljs.analyzer/*recur-frames*
-             (cons nil *cljs.analyzer/*recur-frames*)]
+             (cons nil cljs.analyzer/*recur-frames*)]
      ~@body))

 (defmacro allowing-redef [& body]


now have whales counted by ocean/year which should drill down into ocean/type/year (also present)

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -493,14 +493,11 @@

 ;; (?2 [(union "sum(weight)/ocean/type")(split :ocean nil [(pivot :type types (keyword (sum-value-key :weight)))(sum :weight)(split :type )])] all-whales)

-(?2
- [(split :ocean nil
-	 [
-	  ;;(sum :version)
-	  (union)(split :type nil [(pivot :time years (keyword (count-value-key nil)))(ccount)(split :time (fn [time] (list (or (.lower years time) time))))])]
-	 )]
- all-whales)
-
+(def subquery [(pivot :time years (keyword (count-value-key nil)))(ccount)(split :time (fn [time] (list (or (.lower years time) time))))])
+
+(?2 [(split :ocean nil [(union)(split :type nil subquery)])] all-whales)
+
+(?2 [(union)(split :ocean nil subquery)] all-whales)
 ;;--------------------------------------------------------------------------------

 ;; create some whales...


#21 delete testing code from defparser

#21 delete testing code from defparser

--- src/misaki/compiler/default/html/core.clj
+++ src/misaki/compiler/default/html/core.clj
@@ -57,10 +57,7 @@
   [name regexp result-fn]
   `(defn- ~name [arg#]
      (if (string? arg#)
-       (if (.startsWith arg# "<code class=\"prettyprint\"")
-         arg#
-         (str/replace arg# ~regexp ~result-fn)
-         )
+       (str/replace arg# ~regexp ~result-fn)
        arg#)))

 (defn- link-from-title? [s]


update record according to unique-keys acquired

--- src/er_cassandra/model/upsert.clj
+++ src/er_cassandra/model/upsert.clj
@@ -13,7 +13,7 @@
    [er-cassandra.record-either :as r]
    [er-cassandra.model.types :as t]
    [er-cassandra.model.util :refer [combine-responses create-lookup-record]]
-   [er-cassandra.model.unique-key :as uk])
+   [er-cassandra.model.unique-key :as unique-key])
   (:import [er_cassandra.model.types Model]))

 (defn delete-record
@@ -75,7 +75,7 @@
         (if coll
           (let [old-kvs (set (k/extract-key-value-collection key old-record))
                 new-kvs (set (k/extract-key-value-collection key new-record))
-                stale-kvs (filter identity (set/difference new-kvs old-kvs))]
+                stale-kvs (filter identity (set/difference old-kvs new-kvs))]
             (for [kv stale-kvs]
               (delete-record session model t kv)))

@@ -113,6 +113,15 @@
                                  key key-value)]
               [(upsert-record session model t lookup-record)]))))))))

+(defn copy-unique-keys
+  [^Model model from to]
+  (let [unique-key-tables (:unique-key-tables model)]
+    (reduce (fn [r t]
+              (let [key-col (last (:key t))]
+                (assoc r key-col (get from key-col))))
+            to
+            unique-key-tables)))
+
 (defn upsert
   "upsert a single instance, upserting primary, secondary, unique-key and
    lookup records as required and deleting stale secondary, unique-key and
@@ -121,33 +130,39 @@
   ([session ^Model model record]

    (m/with-monad dm/either-deferred-monad
-     (m/mlet [with-unique-keys (uk/acquire-unique-keys session model record)
+     (m/mlet [old-record-with-keys (unique-key/update-unique-keys
+                                    session
+                                    model
+                                    record)
+
+              new-record-with-keys (m/return
+                                    (copy-unique-keys
+                                     model
+                                     old-record-with-keys
+                                     record))

               stale-secondary-responses (delete-stale-secondaries
                                          session
                                          model
-                                         with-unique-keys
-                                         record)
+                                         old-record-with-keys
+                                         new-record-with-keys)

               stale-lookup-responses (delete-stale-lookups
                                       session
                                       model
-                                      with-unique-keys
-                                      record)
+                                      old-record-with-keys
+                                      new-record-with-keys)

-              secondary-reponses (combine-responses
-                                  (upsert-secondaries
-                                   session
-                                   model
-                                   record))
+              secondary-reponses (upsert-secondaries
+                                  session
+                                  model
+                                  new-record-with-keys)

-              lookup-responses (combine-responses
-                                (upsert-lookups
-                                 session
-                                 model
-                                 record))]
-             (m/return
-              (r/select-one session
-                             (get-in model [:primary-table :name])
-                             (get-in model [:primary-table :key])
-                             (t/extract-uber-key-value model record)))))))
+              lookup-responses (upsert-lookups
+                                session
+                                model
+                                new-record-with-keys)]
+             (r/select-one session
+                           (get-in model [:primary-table :name])
+                           (get-in model [:primary-table :key])
+                           (t/extract-uber-key-value model record))))))


listen to :truncate-on-close opt

listen to :truncate-on-close opt

--- src/er_cassandra/session/alia.clj
+++ src/er_cassandra/session/alia.clj
@@ -199,7 +199,7 @@
 ;; a test-session is just a spy-session which will initialise it's keyspace
 ;; if necesary and will truncate any used tables when closed
 (defnk create-test-session
-  [{contact-points nil} {port nil} {datacenter nil} keyspace :as args]
+  [{contact-points nil} {port nil} {datacenter nil} {truncate-on-close nil} keyspace :as args]
   (create-spy-session
    (merge
     args
@@ -216,4 +216,4 @@
            "   'replication_factor': '1'} "
            " AND durable_writes = true;")]

-     :truncate-on-close true})))
+     :truncate-on-close (when (nil? truncate-on-close) true)})))


change signature from read data

change signature from read data

--- src/hivewing_core/worker_data.clj
+++ src/hivewing_core/worker_data.clj
@@ -59,4 +59,4 @@
   [worker-uuid field-name]
   (let [data-name (clojure.core/name field-name)
         key-name (worker-data-key-name worker-uuid data-name)]
-    (hash-map field-name (apply hash-map (redis (car/zrange key-name 0 -1 :WITHSCORES))))))
+    (apply vector (map (partial zipmap [:value :at]) (partition 2 (redis (car/zrange key-name 0 -1 :WITHSCORES)))))))


fix -A handling when using deps.edn

fix -A handling when using deps.edn

--- src/main/shadow/cljs/npm/cli.cljs
+++ src/main/shadow/cljs/npm/cli.cljs
@@ -353,15 +353,16 @@
         inject?
         (not (false? inject))

+        ;; unparsed string arg
         opt-aliases
-        (-> []
+        (get-in opts [:options :aliases])
+
+        aliases
+        (-> (or aliases [])
             (into (:deps-aliases user-config))
-            (into (get-in opts [:options :aliases])))
-
-        aliases
-        (if-not inject?
-          aliases
-          (conj aliases :shadow-cljs-inject))
+            (cond->
+              inject?
+              (conj :shadow-cljs-inject)))

         extra-deps-vec
         (-> []
@@ -383,7 +384,6 @@
             "-Sdeps"
             (pr-str {:aliases
                      {:shadow-cljs-inject
-                      ;; :extra-paths ["target/shadow-cljs/aot"]
                       (-> {:extra-deps extra-deps}
                           (cond->
                             (seq jvm-opts)


fix typo.

fix typo.

--- src/metabase/cmd/load_from_h2.clj
+++ src/metabase/cmd/load_from_h2.clj
@@ -9,7 +9,7 @@
                              [card-favorite :refer [CardFavorite]]
                              [dashboard :refer [Dashboard]]
                              [dashboard-card :refer [DashboardCard]]
-                             [dashboard-card-series] :refer [DashboardCardSeries]
+                             [dashboard-card-series :refer [DashboardCardSeries]]
                              [database :refer [Database]]
                              [dependency :refer [Dependency]]
                              [field :refer [Field]]


Forcing openGL to use core profile.

Forcing openGL to use core profile.

--- src/opengl_sandbox/basic/tut1.clj
+++ src/opengl_sandbox/basic/tut1.clj
@@ -1,5 +1,5 @@
 (ns opengl-sandbox.basic.tut1
-   (:import [org.lwjgl.opengl DisplayMode Display]))
+   (:import [org.lwjgl.opengl DisplayMode Display PixelFormat ContextAttribs GL11]))

 (defn game-loop []
   (while (not (Display/isCloseRequested))
@@ -9,5 +9,9 @@
   (println "Running tutorial 1")
   (Display/setDisplayMode (DisplayMode. 800 600))
   (Display/setTitle "Tutorial 1")
-  (Display/create)
+  (Display/create (PixelFormat.) (-> (ContextAttribs. 3 2)
+                                     (.withForwardCompatible true)
+                                     (.withProfileCore true)))
+  (println "OpenGL version: "  (GL11/glGetString GL11/GL_VERSION))
+  (println "OpenGL renderer: " (GL11/glGetString GL11/GL_RENDERER))
   (game-loop))


Update test case

Update test case

--- test/clojure_fabric/core_test.clj
+++ test/clojure_fabric/core_test.clj
@@ -226,7 +226,6 @@
              (count (user/query-installed-chaincodes user (chaincode/get-random-node mychannel :peers))))))

 (expect true
-        ;; FIXME: how to remove the existing channel????
         (let [orderer-admin (core/get-user "Orderer" "admin")
               org1-admin (core/get-user "Org1MSP" "admin")
               org2-admin (core/get-user "Org2MSP" "admin")
@@ -244,22 +243,24 @@
                                                          channel-name
                                                          orderer
                                                          [org1-admin org2-admin orderer-admin]))
-
+
           (user/new-channel! org1-admin {:name channel-name
                                          :orderers [orderer]
                                          :peers org1-peers})
-
-          (let [org1-admin (core/get-user "Org1MSP" "admin")
-                genesis-block (channel/get-genesis-block (get-in org1-admin [:channels channel-name]))]
-            (channel/join-channel (user/get-channel org1-admin channel-name) org1-peers genesis-block))

           (user/new-channel! org2-admin {:name channel-name
                                          :orderers [orderer]
                                          :peers org2-peers})

-          (let [org2-admin (core/get-user "Org2MSP" "admin")
-                genesis-block (channel/get-genesis-block (get-in org2-admin [:channels channel-name]))]
-            (channel/join-channel (user/get-channel org2-admin channel-name) org2-peers genesis-block))))
+          (let [org1-admin (core/get-user "Org1MSP" "admin")
+                org2-admin (core/get-user "Org2MSP" "admin")
+                genesis-block (channel/get-genesis-block (get-in org1-admin [:channels channel-name]))]
+            (every? (fn [resp]
+                      (-> (.getResponse resp)
+                          (.getStatus)
+                          (= 200)))
+                    (concat (channel/join-channel (user/get-channel org1-admin channel-name) org1-peers genesis-block)
+                            (channel/join-channel (user/get-channel org2-admin channel-name) org2-peers genesis-block))))))
 #_
 (expect true
         (let [org1-admin (core/get-user "Org1MSP" "admin")


Code cleaing on draw area.

Code cleaing on draw area.

--- src/uxbox/main/ui/workspace/drawarea.cljs
+++ src/uxbox/main/ui/workspace/drawarea.cljs
@@ -63,9 +63,6 @@
 (declare on-init-draw-icon)
 (declare on-init-draw-path)
 (declare on-init-draw-generic)
-(declare on-draw-start)
-(declare on-draw)
-(declare on-draw-complete)

 (defn- watch-draw-actions
   []
@@ -162,7 +159,6 @@

             (on-end []
               (let [shape (normalize-shape @drawing-shape)]
-                (println "on-end" shape)
                 (rs/emit! (uds/add-shape shape)
                           (udw/select-for-drawing nil)
                           (uds/select-first-shape))
@@ -192,30 +188,22 @@
                     (rx/skip-while #(nil? @drawing-shape))
                     (rx/with-latest-from vector wb/mouse-ctrl-s))]

-    (rx/subscribe firstpos (fn [{:keys [x y] :as pt}]
-                             (let [shape (geom/setup shape {:x1 x :y1 y
-                                                            :x2 x :y2 y})]
-                               (reset! drawing-shape shape))))
-    (rx/subscribe stream on-draw nil on-draw-complete)))
-
-;; (defn- on-draw-start
-;;   [shape {:keys [x y] :as pt}]
-;;   (let [shape (geom/setup shape {:x1 x :y1 y :x2 x :y2 y})]
-;;     (reset! drawing-shape shape)))
-
-(defn- on-draw
-  [[pt ctrl?]]
-  (let [pt (gpt/divide pt @wb/zoom-ref)]
-    (reset! drawing-position (assoc pt :lock ctrl?))))
-
-(defn- on-draw-complete
-  []
-  (let [shape @drawing-shape
-        shpos @drawing-position
-        shape (geom/resize shape shpos)]
-    (rs/emit! (uds/add-shape shape)
-              (udw/select-for-drawing nil)
-              (uds/select-first-shape))
-    (reset! drawing-position nil)
-    (reset! drawing-shape nil)
-    (rlocks/release! :ui/draw)))
+    (letfn [(on-start [{:keys [x y] :as pt}]
+              (let [shape (geom/setup shape {:x1 x :y1 y :x2 x :y2 y})]
+                (reset! drawing-shape shape)))
+
+            (on-draw [[pt ctrl?]]
+              (let [pt (gpt/divide pt @wb/zoom-ref)]
+                (reset! drawing-position (assoc pt :lock ctrl?))))
+            (on-end []
+              (let [shape @drawing-shape
+                    shpos @drawing-position
+                    shape (geom/resize shape shpos)]
+                (rs/emit! (uds/add-shape shape)
+                          (udw/select-for-drawing nil)
+                          (uds/select-first-shape))
+                (reset! drawing-position nil)
+                (reset! drawing-shape nil)
+                (rlocks/release! :ui/draw)))]
+      (rx/subscribe firstpos on-start)
+      (rx/subscribe stream on-draw nil on-end))))


update test

update test

--- test/desdemona/ui/table_test.cljs
+++ test/desdemona/ui/table_test.cljs
@@ -28,7 +28,10 @@

 (deftest table-component-test
   (let [state {:results [{:a 1 :b 2}
-                         {:a 4 :b 2}]}
+                         {:a 4 :b 2}]
+               :table-toggled-ks [:a :b]
+               :all-table-ks [:a :b]
+               :columns-toggler-open? false}
         results-count (count (:results state))
         component [table/table-component]]
     (session/swap! merge state)


Making apply-contract accept zero args

Making apply-contract accept zero args

--- test/fogus/me/invariant_tests.clj
+++ test/fogus/me/invariant_tests.clj
@@ -53,6 +53,7 @@
 (deftest test-constrained-record-with-map-spec
   (is (= (:a (->Buzz 42 108)) 42))
   (is (= (:b (->Buzz 42 108)) 108))
+  (is (nil? (merge)))
   (is (thrown? Exception (->Buzz)))
   (is (thrown? Exception (->Buzz 12))))


make a demo app that shows components and subcomponents

Nice, so shows things easily

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -1900,6 +1900,9 @@

 (defn !newapp []
   (do
-    (sql "insert into coils_applications (application_name,application_code) values (?,?)" ["name"      "(defn-ui-component     main-to-do-app   [app] {} (div nil \"demo\"))"])
+    (sql "insert into coils_applications (application_name,application_code) values (?,?)"
+         ["name"
+          "(defn-ui-component     sub-component   [app] {} (div nil \"... sub component\"))\r\n\r\n
+(defn-ui-component     main   [app] {}\r\n  (div nil\r\n     (component sub-component app []) \r\n     (component sub-component app []) \r\n \"New app\"))"])
     {}))


Allow same table names in different apps

There was a bug before as the apps have their data in different database
schemas, but the triggers did not check the for the schema, only the
table name

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -1147,7 +1147,7 @@
         (record_timestamp,  record_table_schema, record_table_name,  record_id, record_id_type, record_operation)
         VALUES
         ( now(),   TG_TABLE_SCHEMA , TG_TABLE_NAME ,  NEW.id,
-        (select data_type from information_schema.columns where column_name='id' and table_name = TG_TABLE_NAME),
+        (select data_type from information_schema.columns where column_name='id' and table_name = TG_TABLE_NAME and table_schema = TG_TABLE_SCHEMA),
         'INSERT');
         RETURN NULL;
         END;
@@ -1195,7 +1195,7 @@
         (record_timestamp,  record_table_schema, record_table_name,  record_id, record_id_type,  record_operation)
         VALUES
         ( now(),   TG_TABLE_SCHEMA ,TG_TABLE_NAME ,  NEW.id,
-        (select data_type from information_schema.columns where column_name='id' and table_name = TG_TABLE_NAME),
+        (select data_type from information_schema.columns where column_name='id' and table_name = TG_TABLE_NAME and table_schema = TG_TABLE_SCHEMA),
         'UPDATE');
         RETURN NULL;
         END;
@@ -1239,7 +1239,7 @@
         (record_timestamp,  record_table_schema, record_table_name,  record_id, record_id_type,  record_operation)
         VALUES
         ( now(),   TG_TABLE_SCHEMA, TG_TABLE_NAME ,  OLD.id,
-        (select data_type from information_schema.columns where column_name='id' and table_name = TG_TABLE_NAME),
+        (select data_type from information_schema.columns where column_name='id' and table_name = TG_TABLE_NAME and table_schema = TG_TABLE_SCHEMA),
         'DELETE');
         RETURN NULL;
         END;


Allow :serialize-format "bencode" to be specified by clients

so that client software which cannot interpret clojure can still
interact with the bencode data

--- src/refactor_nrepl/middleware.clj
+++ src/refactor_nrepl/middleware.clj
@@ -35,6 +35,13 @@
   `(with-errors-being-passed-on ~transport ~msg
      (transport/send ~transport (response-for ~msg ~(apply hash-map kv)))))

+(defn serialize-response [{:keys [serialization-format] :as msg} response]
+  (condp = serialization-format
+    "edn" (pr-str response)
+    "bencode" response
+    (pr-str response) ; edn as default
+    ))
+
 (defn resolve-missing-reply [{:keys [transport] :as msg}]
   (reply transport msg :candidates (resolve-missing msg) :status :done))

@@ -42,7 +49,7 @@
   (with-errors-being-passed-on transport msg
     (let [occurrences (find-symbol msg)]
       (doseq [occurrence occurrences
-              :let [response (pr-str (apply create-result-alist occurrence))]]
+              :let [response (serialize-response msg (apply create-result-alist occurrence))]]
         (transport/send transport
                         (response-for msg :occurrence response)))
       (transport/send transport (response-for msg :count (count occurrences)
@@ -77,7 +84,7 @@

 (defn- stubs-for-interface-reply [{:keys [transport] :as msg}]
   (reply transport msg :status :done
-         :functions (pr-str (stubs-for-interface msg))))
+         :functions (serialize-response msg (stubs-for-interface msg))))

 (defn- extract-definition-reply [{:keys [transport] :as msg}]
   (reply transport msg :status :done :definition (pr-str (extract-definition msg))))


Can process dependencyManagement section of pom

--- src/descent/pom_parser.clj
+++ src/descent/pom_parser.clj
@@ -52,36 +52,26 @@

 (defn- pom-has-properties?
   [pom]
-  (some? (filter #(tag-equals? % :properties) (:content pom))))
+  (-> (filter #(tag-equals? % :properties) (:content pom))
+      count
+      (> 0)))

 (defn- pom-has-dependencyManagement?
   [pom]
-  (some? (filter #(tag-equals? % :dependencyManagement) (:content pom))))
+  (-> (filter #(tag-equals? % :dependencyManagement) (:content pom))
+      count
+      (> 0)))

 (defn- pom-has-dependencies?
   [pom]
-  (some? (filter #(tag-equals? % :dependencies) (:content pom))))
+  (-> (filter #(tag-equals? % :dependencies) (:content pom))
+      count
+      (> 0)))

 ;;; Functions to process the properties section
-
-(defn- filter-out-properties-without-version
-  "Returns only those properties that are a version number."
-  [coll]
-  (filter contains-version? coll))
-
-
-(defn- get-properties-from-pom
-  "Given a pom, extract the properties and see if they contain dependency version data."
-  [pom]
-  (-> (filter #(tag-equals? % :properties) (:content pom))
-      first
-      :content
-      filter-out-properties-without-version))
-
-;(get-properties-from-pom pom)

 (defn- contains-version?
   "Checks a given member of the pom properties to see if it contains version number."
@@ -94,6 +84,21 @@
     has-version?))

+(defn- filter-out-properties-without-version
+  "Returns only those properties that are a version number."
+  [coll]
+  (filter contains-version? coll))
+
+
+(defn- get-properties-from-pom
+  "Given a pom, extract the properties and see if they contain dependency version data."
+  [pom]
+  (-> (filter #(tag-equals? % :properties) (:content pom))
+      first
+      :content
+      filter-out-properties-without-version))
+
+
 (defn- parse-name
   [name]
   (-> (clojure.string/split (str name) #"\.")
@@ -101,17 +106,97 @@
       (subs 1)))

-(defn- get-dep-version-map
+(defn get-dependencies-from-properties
   "Given the properties portion of a pom, return a seq of "
-  [properties]
-  (let [properties-map (transient {})]
-    (doseq [p properties]
-      (assoc! properties-map (keyword (parse-name (:tag p))) (first (:content p))))
-    (persistent! properties-map)))
-
-(get-dep-version-map (get-properties-from-pom pom))
+  [pom]
+  (if (pom-has-properties? pom)
+    (let [properties (get-properties-from-pom pom)
+          properties-map (transient {})]
+      (doseq [p properties]
+        (assoc! properties-map (keyword (parse-name (:tag p))) (first (:content p))))
+      (persistent! properties-map))
+    nil))
+
+(get-dependencies-from-properties pom)

 ;;; Functions to process dependencyManagement

+(defn- get-deps-from-dependency-management
+  "Given a pom, extract the dependencies from dependencyManagement."
+  [pom]
+  (-> (filter #(tag-equals? % :dependencyManagement) (:content pom))
+      first :content first :content))
+
+(get-deps-from-dependency-management pom)
+
+
+(defn- first-char-is-$? [s] (= "$" (subs s 0 1)))
+
+
+(defn- parse-version-variable
+  [version]
+  (let [length (count version)]
+    (if (first-char-is-$? version)
+      (-> (subs version 2)
+          (subs 0 (- length 3))
+          (clojure.string/split #"\.")
+          first
+          keyword))))
+
+(parse-version-variable "${dep1.version}")
+
+(defn- parse-group-id
+  [gid]
+  (-> (clojure.string/split gid #"\.")
+      last keyword))
+
+(parse-group-id "a.b.c")
+
+(defn- make-dependency-version-pair
+  [m properties]
+  (let [{:keys [tag attrs content]} m
+        group-id-map (first (filter #(tag-equals? % :groupId) content))
+        group-id (first (:content group-id-map))
+        version-map (first (filter #(tag-equals? % :version) content))
+        version (first (:content version-map))]
+    [(parse-group-id group-id)
+     (if (first-char-is-$? version)
+       (get properties (parse-version-variable version))
+       version)]))
+
+
+(def x {:tag :dependency
+        :attrs nil
+        :content [{:tag :groupId
+                   :attrs nil
+                   :content ["com.company.dep1"]}
+
+                  {:tag :artifactId
+                   :attrs nil
+                   :content ["dep1-core"]}
+
+                  {:tag :version
+                   :attrs nil
+                   :content ["${dep1.version}"]}
+
+                  {:tag :type
+                   :attrs nil
+                   :content ["tar.gz"]}]})
+
+(make-dependency-version-pair x {:dep1 "1.0.0-SNAPSHOT"})
+
+(defn process-dependency-management
+  [pom]
+  (if (pom-has-dependencyManagement? pom)
+    (let [properties (get-dependencies-from-properties pom)
+          deps (get-deps-from-dependency-management pom)
+          deps-seq (map #(make-dependency-version-pair % properties) deps)]
+      (into {} deps-seq))
+    nil))
+
+(process-dependency-management pom)
+
+
 ;;; Functions to process dependencies
+


Доработка транзита. вывод диалога при ошибках

--- radiolamp-6P3S/src/ixinfestor/net.cljs
+++ radiolamp-6P3S/src/ixinfestor/net.cljs
@@ -31,14 +31,17 @@

 (defn get-data [uri params success-fn & [error-fn complete-fn disable-progress-element?]]
-  (letfn [(print-error [s ee]
+  (letfn [(print-error [s ee]
             (println "ERROR IN " s "\n"
                      "LastErrorCode: " (.getLastErrorCode ee) "\n"
                      "Status: " (.getStatus ee) " - " (.getStatusText ee) "\n"
                      "Content-Type: " (.getResponseHeader ee "Content-Type") "\n"
                      "---------------------------------------------------------\n"
                      (.getResponseText ee)
-                     "\n---------------------------------------------------------\n\n"))
+                     "\n---------------------------------------------------------\n\n")
+            (js/alert (str
+                       "ERROR IN [" s "]\n"
+                       "Status: " (.getStatus ee) " - " (.getStatusText ee))))

           ;; (redirect-to-root-when-not-transit [ee]
           ;;   (let [ct (.getResponseHeader ee "Content-Type")]
@@ -91,7 +94,7 @@

                          (let [])

-                         (if complete-fn (complete-fn (t/read r (.getResponseText ee)))))))
+                         (if complete-fn (complete-fn e)))))

       (events/listen req goog.net.EventType.SUCCESS


Example tseitin

Example tseitin

--- src/examples/logelei_2.clj
+++ src/examples/logelei_2.clj
@@ -63,9 +63,20 @@
         '(impl beutelaffen-oinken  ohrhörner-surren)
         ))

+fml
+
+(def fml '(or p (and (not p) q)))
+(truth-table fml)
+
+(def solution
 (let [tseit (transform-tseitin fml)
       result (-> (:tseitin-formula tseit) generate-dimacs-clauses sat-solve)]
-  (retransform-tseitin result tseit))
+  (retransform-tseitin result tseit)))
+
+(sort solution)
+; Ergebnis ist falsch
+
+(transform-tseitin fml)

 #_(-> fml
      transform-tseitin


properly display progress

properly display progress

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -99,18 +99,30 @@
                  "Not yet started: "
                  (:filename data))))

+(defn file-hash-progress [file-hash-info]
+  (dom/div #js {:className "track-view"}
+           (:name file-hash-info)
+           " - "
+           (/ (:current-chunk file-hash-info)
+              (:chunks file-hash-info))
+           "%"))
+
 (defn build-upload-id-view [upload-data owner]
   (reify
     om/IRender
     (render [this]
       (println upload-data)
       (let [upload (first upload-data)
-            upload-info (second upload-data)]
+            upload-info (second upload-data)
+            file-hash-info (last upload-data)]
         (cond
           (not (nil? upload-info))
             (user-upload-progress upload-data)
-          (nil? upload-info)
-            (uninitialized-upload upload))))))
+          (and (nil? upload-info)
+               (nil? file-hash-info))
+            (uninitialized-upload upload)
+          (not (nil? file-hash-info))
+            (file-hash-progress file-hash-info))))))

 (defn users-upload-progress-view [data owner]
   (reify
@@ -122,7 +134,7 @@
                                       client-id (when-not (nil? upload-info)
                                                   (.-clientid upload-info))
                                       file-hash-info ((:room-file-hashes data) id)]
-                                  [((:uploads data) client-id) upload-info]))
+                                  [((:uploads data) client-id) upload-info file-hash-info]))
                               (:room-uploads-order data))]
         (apply dom/div nil
           (om/build-all build-upload-id-view


Fix formatting issues

Fix formatting issues

Signed-off-by: ivermac <cd640042a8f3b0ff08bacdf4feae34fdd495051d@gmail.com>

--- src/hatti/views/table.cljs
+++ src/hatti/views/table.cljs
@@ -371,7 +371,8 @@
                             row (js/parseInt (.. grid
                                                  (getCellFromEvent e)
                                                  -row))]
-                        (update-instance-ids-of-selected-rows-vector checked? data-id)
+                        (update-instance-ids-of-selected-rows-vector
+                         checked? data-id)
                         (set! (.-checked select-unselect-all-records-chkbox)
                               (check-select-unselect-all-records-element?))
                         (transact! shared/app-state


Upgrade karma to 4.3.0

Upgrade karma to 4.3.0

--- src/deps.cljs
+++ src/deps.cljs
@@ -1,5 +1,5 @@
 {:npm-dev-deps {"shadow-cljs" "2.8.52"
-                "karma" "4.2.0"
+                "karma" "4.3.0"
                 "karma-chrome-launcher" "3.1.0"
                 "karma-cljs-test" "0.1.0"
                 "karma-junit-reporter" "1.2.0"}}


V minor tweak to use seq instead of vector for parent generation, no impact on bench

Evaluation count : 600 in 60 samples of 10 calls.
             Execution time mean : 112.504997 ms
    Execution time std-deviation : 8.407792 ms
   Execution time lower quantile : 108.038164 ms ( 2.5%)
   Execution time upper quantile : 142.168437 ms (97.5%)
                   Overhead used : 3.376706 ns

Found 6 outliers in 60 samples (10.0000 %)
	low-severe	 1 (1.6667 %)
	low-mild	 5 (8.3333 %)
 Variance from outliers : 55.1694 % Variance is severely inflated by outliers

--- src/lonelyplanet/model.clj
+++ src/lonelyplanet/model.clj
@@ -64,7 +64,7 @@

 (defn gen-route [loc]
   "Merge the parent route and the child route"
-  (concat (gen-route-parent loc []) (rest (gen-route-child loc []))))
+  (concat (gen-route-parent loc '()) (rest (gen-route-child loc []))))

 (defn gen-meta
   "Generate destination meta-info for the view"


Add hiccup dep

Add hiccup dep

--- webapp/project.clj
+++ webapp/project.clj
@@ -6,6 +6,7 @@
                  [com.stuartsierra/component "0.3.0"]
                  [compojure "1.4.0"]
                  [duct "0.5.6"]
+                 [hiccup "1.0.5"]
                  [environ "1.0.1"]
                  [meta-merge "0.1.1"]
                  [ring "1.4.0"]


cljs.env.macros not cljs.env

cljs.env.macros not cljs.env

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -7,7 +7,7 @@
 ;   You must not remove this notice, or any other, from this software.

 (ns cljs.js
-  (:require-macros [cljs.env :as env])
+  (:require-macros [cljs.env.macros :as env])
   (:require [cljs.env :as env]
             [cljs.analyzer :as ana]
             [cljs.compiler :as comp]


add new param to test calls

add new param to test calls

--- test/vignette/http/route_helpers_test.clj
+++ test/vignette/http/route_helpers_test.clj
@@ -11,24 +11,24 @@
   (:import java.io.FileNotFoundException))

 (facts :handle-thumbnail
-  (handle-thumbnail ..system.. ..params..) => ..response..
+  (handle-thumbnail ..system.. ..params.. ..request..) => ..response..
   (provided
     (u/get-or-generate-thumbnail ..system.. ..params..) => ..thumb..
     (create-image-response ..thumb.. ..params..) => ..response..)

-  (handle-thumbnail ..system.. ..params..) => ..error..
+  (handle-thumbnail ..system.. ..params.. ..request..) => ..error..
   (provided
     (u/get-or-generate-thumbnail ..system.. ..params..) => nil
     (error-response 404 ..params..) => ..error..))

 (facts :handle-original
-  (handle-original ..system.. ..params..) => ..response..
+  (handle-original ..system.. ..params.. ..request..) => ..response..
   (provided
     (store ..system..) => ..store..
     (sp/get-original ..store.. ..params..) => ..original..
     (create-image-response ..original.. ..params..) => ..response..)

-  (handle-original ..system.. ..params..) => ..error..
+  (handle-original ..system.. ..params.. ..request..) => ..error..
   (provided
     (store ..system..) => ..store..
     (sp/get-original ..store.. ..params..) => nil


Implement some factorization tests.

Implement some factorization tests.

--- test/com/hypirion/primes_test.clj
+++ test/com/hypirion/primes_test.clj
@@ -23,3 +23,9 @@
   (dorun
    (map #(is (= %1 %2))
         (p/primes) hundred-thousand)))
+
+(deftest proper-factorization
+  (Primes/clear)
+  (dotimes [n 100000]
+    (let [factorized (Primes/factorize n)]
+      (is (= n (reduce * factorized))))))


refactoring

refactoring

--- test/desdemona/ui/table_test.cljs
+++ test/desdemona/ui/table_test.cljs
@@ -6,8 +6,10 @@
    [reagent.session :as session]
    [cljs.core.match :refer-macros [match]]))

-(def isClient (not (nil? (try (.-document js/window)
-                              (catch js/Object e nil)))))
+(def isClient?
+  "Are we running in a browser?"
+  (some? (try (.-document js/window)
+              (catch js/Object e nil))))

 (def rflush r/flush)

@@ -19,7 +21,7 @@
     div))

 (defn with-mounted-component [comp f]
-  (when isClient
+  (when isClient?
     (let [div (add-test-div "_testreagent")]
       (let [comp (r/render-component comp div #(f comp div))]
         (r/unmount-component-at-node div)


Check nil on viewed-by privatize

Check nil on viewed-by privatize

--- test/obb_rules/privatize_test.clj
+++ test/obb_rules/privatize_test.clj
@@ -33,6 +33,11 @@
     (is (board/empty-board? privatized :p1))
     (is (board/empty-board? privatized :p2))))

+(deftest privatize-hides-elements-handles-nil
+  (let [privatized (privatize/game partial-deploy-game nil)]
+    (is (board/empty-board? privatized :p1))
+    (is (board/empty-board? privatized :p2))))
+
 (deftest privatize-hides-elements-except-p1
   (let [privatized (privatize/game partial-deploy-game :p1)
         stash1 (game/get-stash privatized :p1)


add endpoint for GET /:query-id

add endpoint for GET /:query-id

--- src/metabase/api/query.clj
+++ src/metabase/api/query.clj
@@ -71,11 +71,13 @@
     (query-create body)))

-;(defendpoint GET "/:id" [id]
-;  ;; TODO - permissions check
-;  (->404 (sel :one Org :id id)))
-;
-;
+(defendpoint GET "/:id" [id]
+  ;; TODO - permissions check
+  (->404 (sel :one Query :id id)
+         ;; TODO - hydrate :can_read and :can_write
+         (hydrate :creator :database)))
+
+
 ;(defendpoint PUT "/:id" [id :as {body :body}]
 ;  ;; TODO - permissions check
 ;  ;; TODO - validations (email address must be unique)


svg pictures now loaded from file in backend

--- src/noteServer/handler.clj
+++ src/noteServer/handler.clj
@@ -12,6 +12,7 @@
             [hiccup.core :refer :all]
             [hiccup.page :refer :all]
             [other.call :refer :all]
+            [clojure.java.io :as io]
             [clojure.string :as str]))

 (defroutes app-routes
@@ -29,6 +30,10 @@

            ;; This is for debugging, at least for now
            (GET "/page" []
+                (let [edit-img (slurp (io/resource "icons/edit.svg"))
+                      remove-img (slurp (io/resource "icons/remove.svg"))
+                      list-img (slurp (io/resource "icons/list.svg"))
+                      new-img (slurp (io/resource "icons/new.svg"))]
                 (html5
                   {:lang "en"}
                   [:head
@@ -47,7 +52,8 @@
                       [:button.module-btn.text-module-btn   {:name "text"  } "T"]
                       [:button.module-btn.list-module-btn   {:name "list"  }
                        ;; this image might make the animations lag...
-                       [:object { :type "image/svg+xml" :data "icons/list.svg"}]]
+                       ;[:object { :type "image/svg+xml" :data "icons/list.svg"}]
+                       list-img]
                       [:button.module-btn.image-module-btn  {:name "image" } "I"]
                       [:button.module-btn.cancel-module-add-btn  {:name "cancel" } "C"]]]
                    ;[:template#remove-confirm-template
@@ -63,11 +69,11 @@
                     ;; TODO call this module something better
                     [:div.meta-module.meta-control-module {:role "module"}
                      [:div.button-spacer
-                      [:button.edit-module-btn   [:object { :type "image/svg+xml" :data "icons/edit.svg"}]]
-                      [:button.new-module-btn    [:object { :type "image/svg+xml" :data "icons/new.svg"}]]
-                      [:button.remove-module-btn [:object { :type "image/svg+xml" :data "icons/delete.svg"}]]]]]
+                      [:button.edit-module-btn edit-img]
+                      [:button.new-module-btn new-img]
+                      [:button.remove-module-btn remove-img]]]]

-                   [:section#note-container (html/format-notes (db/query-notes))]]))
+                   [:section#note-container (html/format-notes (db/query-notes))]])))

            ; TODO filter?
            (GET "/all" [type]


Switch HQ record name.

Switch HQ record name.

--- src/onyx/queue/hornetq.clj
+++ src/onyx/queue/hornetq.clj
@@ -43,7 +43,11 @@
         gdc (DiscoveryGroupConfiguration. cluster-name refresh-timeout discovery-timeout jgroups)]
     (HornetQClient/createServerLocatorWithHA gdc)))

-(defrecord HornetQClusteredConnection [opts]
+(defn cluster-name [opts]
+  (let [k (first (filter #(= (keyword (name %)) :cluster-name) (keys opts)))]
+    (get opts k)))
+
+(defrecord HornetQConnection [opts]
   component/Lifecycle

   (start [component]
@@ -54,7 +58,8 @@
           session-factory (.createSessionFactory locator)]
       (assoc component
         :locator locator
-        :session-factory session-factory)))
+        :session-factory session-factory
+        :cluster-name (cluster-name opts))))

   (stop [{:keys [locator session-factory] :as component}]
     (taoensso.timbre/info "Stopping HornetQ clustered connection")
@@ -65,9 +70,9 @@
     component))

 (defn hornetq [opts]
-  (map->HornetQClusteredConnection {:opts opts}))
-
-(defmethod extensions/optimize-concurrently HornetQClusteredConnection
+  (map->HornetQConnection {:opts opts}))
+
+(defmethod extensions/optimize-concurrently HornetQConnection
   [queue event]
   (if (= (:onyx/consumption (:onyx.core/task-map event)) :concurrent)
     (do (.close (:session-factory queue))
@@ -77,24 +82,24 @@
           (assoc queue :locator locator :session-factory (.createSessionFactory locator))))
     queue))

-(defmethod extensions/create-tx-session HornetQClusteredConnection
+(defmethod extensions/create-tx-session HornetQConnection
   [queue]
   (let [session-factory (:session-factory queue)
         session (.createTransactedSession session-factory)]
     (.start session)
     session))

-(defmethod extensions/create-producer HornetQClusteredConnection
+(defmethod extensions/create-producer HornetQConnection
   [queue session queue-name]
   (extensions/create-queue-on-session queue session queue-name)
   (.createProducer session queue-name))

-(defmethod extensions/create-consumer HornetQClusteredConnection
+(defmethod extensions/create-consumer HornetQConnection
   [queue session queue-name]
   (extensions/create-queue-on-session queue session queue-name)
   (.createConsumer session queue-name))

-(defmethod extensions/create-queue HornetQClusteredConnection
+(defmethod extensions/create-queue HornetQConnection
   [queue task]
   (let [session (extensions/create-tx-session queue)
         ingress-queue (:ingress-queues task)
@@ -103,7 +108,7 @@
       (extensions/create-queue-on-session queue session queue-name))
     (.close session)))

-(defmethod extensions/create-queue-on-session HornetQClusteredConnection
+(defmethod extensions/create-queue-on-session HornetQConnection
   [queue session queue-name]
   (try
     (.createQueue session queue-name queue-name true)
@@ -111,12 +116,12 @@
     (catch Exception e
       (info e))))

-(defmethod extensions/n-messages-remaining HornetQClusteredConnection
+(defmethod extensions/n-messages-remaining HornetQConnection
   [queue session queue-name]
   (let [query (.queueQuery session (SimpleString. queue-name))]
     (.getMessageCount query)))

-(defmethod extensions/n-consumers HornetQClusteredConnection
+(defmethod extensions/n-consumers HornetQConnection
   [queue queue-name]
   (let [session (.createSession (:session-factory queue))
         requestor (ClientRequestor. session "jms.queue.hornetq.management")
@@ -149,7 +154,7 @@
       (doall (map #(.close %) locators))
       (apply + consumer-counts))))

-(defmethod extensions/bootstrap-queue HornetQClusteredConnection
+(defmethod extensions/bootstrap-queue HornetQConnection
   [queue task]
   (let [session (extensions/create-tx-session queue)
         producer (extensions/create-producer queue session (:ingress-queues task))]
@@ -158,7 +163,7 @@
     (extensions/commit-tx queue session)
     (extensions/close-resource queue session)))

-(defmethod extensions/produce-message HornetQClusteredConnection
+(defmethod extensions/produce-message HornetQConnection
   ([queue producer session msg]
      (let [message (.createMessage session true)]
        (.writeBytes (.getBodyBuffer message) msg)
@@ -169,23 +174,23 @@
        (.writeBytes (.getBodyBuffer message) msg)
        (.send producer message))))

-(defmethod extensions/consume-message HornetQClusteredConnection
+(defmethod extensions/consume-message HornetQConnection
   [queue consumer]
   (.receive consumer))

-(defmethod extensions/read-message HornetQClusteredConnection
+(defmethod extensions/read-message HornetQConnection
   [queue message]
   (fressian/read (.toByteBuffer (.getBodyBuffer message))))

-(defmethod extensions/ack-message HornetQClusteredConnection
+(defmethod extensions/ack-message HornetQConnection
   [queue message]
   (.acknowledge message))

-(defmethod extensions/commit-tx HornetQClusteredConnection
+(defmethod extensions/commit-tx HornetQConnection
   [queue session]
   (.commit session))

-(defmethod extensions/close-resource HornetQClusteredConnection
+(defmethod extensions/close-resource HornetQConnection
   [queue resource]
   (.close resource))


Removed some old (unsupported) functions.

--- src/petulant_life/main.clj
+++ src/petulant_life/main.clj
@@ -14,11 +14,6 @@
   (Display/setDisplayMode (DisplayMode. width height))
   (Display/create)
   (Display/setTitle "Petulant Life")
-
-  (GL11/glMatrixMode GL11/GL_PROJECTION)
-  (GL11/glLoadIdentity)
-  (GL11/glOrtho 0 width height 0 -1 1)
-  (GL11/glMatrixMode GL11/GL_MODELVIEW)

   (GL11/glClearColor 0.9 0.9 0.9 1))


Change underlying model to new-val.

Change underlying model to new-val.

This enforces the minimum in the output model immediately as opposed to
being reliant on focus/defocus before updating. Since we do not rely on
validation in the interim user input states, there is no concern about
partial input.

--- src/re_com/input_time.cljs
+++ src/re_com/input_time.cljs
@@ -263,7 +263,8 @@
         ;; other than that we want to keep the current text, because the user is probably typing
         (when (not= @previous-model new-val)
           (reset! text-model (time->text-12h new-val))
-          (reset! previous-model new-val))
+          (reset! previous-model new-val)
+          (reset! model new-val))

         [h-box
          :class    "rc-input-time"


better formatitng of API docstings

better formatitng of API docstings

--- src/reagent_mvsa/core.cljs
+++ src/reagent_mvsa/core.cljs
@@ -4,27 +4,34 @@

 ;;;;;;;;;;;;;;;;;;;;;;;; Core
 (defn app
-  "Constructs an app from a spec.
+  "Constructs an app from a spec map with keys:
+  :initial-model - Initial model value, must be a map.

-  Spec is a map with keys:
-  :initial-model - initial model value, must be a map
-  :control - function of args: [model-value signal dispatch-action];
-  it performs side effects, can dispatch actions using dispatch-action (which returns the updated model value)
-  :reconcile - pure function of args: [model-value action];
-  given an action it must return the new model value
-  :on-start - function of args: [model-reaction dispatch-signal]; will be called on starting the app
-  :on-stop - function of args: [model-reaction dispatch-signal]; will be called on stopping the app
+  :control- Function of args: [model-value signal dispatch-action].
+  It performs side effects, can dispatch actions using dispatch-action (which returns the updated model value)

-  App is a map with keys:
-  :model - a readonly ratom (or, in Reagent terms, a reaction which returns model value)
-  :dispatch-signal - function with a single arg: a signal to be sent to an app; returns nil
-  :start - argless function for bootstrapping an app, e.g. app can start listening to browser history here
-  :stop - argless function for shutting an app down, e.g. app can stop listening to browser events here
-  :-model - model ratom (exposed for debugging only)
-  :-dispatch-action - function with which dispatches an action (exposed for debugging only); returns updated model value
+  :reconcile - Pure function of args: [model-value action].
+  Given an action, it must return the new model value.
+
+  :on-start - Function of args: [model-reaction dispatch-signal]. Will be called on starting the app.
+
+  :on-stop - Function of args: [model-reaction dispatch-signal]. Will be called on stopping the app.
+
+  Returned app is a map with keys:
+  :model - A model reaction.
+
+  :dispatch-signal - Function with a single arg: a signal to be sent to an app. Returns nil.
+
+  :start - Argless function for bootstrapping an app, e.g. app can start listening to browser history here.
+
+  :stop - Argless function for shutting an app down, e.g. app can stop listening to browser events here.
+
+  :-model - Model ratom (exposed for debugging only).
+
+  :-dispatch-action - Function with which dispatches an action (exposed for debugging only); returns updated model value.

   Data flow:
-  -dispatch-signal-> (control) -dispatch-action-> (reconcile) -update-> model"
+  -dispatch-signal-> (control) -dispatch-action-> (reconcile)"
   [{:keys [initial-model control reconcile on-start on-stop] :as _spec}]
   {:pre [(map? initial-model) (fn? control) (fn? reconcile) (fn? on-start) (fn? on-stop)]}
   (let [model-ratom (r/atom initial-model)
@@ -43,7 +50,7 @@
 (defn connect-ui
   "Arguments:
   app - the app for which UI should be created
-  view-model - function which, given a model ratom, returns Reagent reactions; inspired by re-frame
+  view-model - function which, given a model reaction, returns Reagent reactions; inspired by re-frame
   subscriptions, see: https://github.com/Day8/re-frame#subscribe; returned value will be passed to a view:
   view - Reagent compoment function with args: [view-model-return-value dispatch-signal]


Minor Cleanup

Minor Cleanup

--- src/riemann/prometheus.clj
+++ src/riemann/prometheus.clj
@@ -44,9 +44,17 @@
 (defn generate-labels
   "Generates the Prometheus labels from Riemann event attributes."
   [opts event]
-  (let [instance  (str "/instance/" (:host opts))
-        tags      (if-not (empty? (:tags event))(str "/tags/" (str/join (:separator opts) (:tags event))))
-        labels    (create-label (filter-event event))]
+  (let [instance  (->> opts
+                       :host
+                       (str "/instance/"))
+        tags      (if-not (-> event
+                              :tags
+                              empty?) (->> (:tags event)
+                                           (str/join (:separator opts))
+                                           (str "/tags/")))
+        labels    (-> event
+                      filter-event
+                      create-label)]
     (str instance tags labels)))

 (defn generate-url


fix static example on doc site

fix static example on doc site

--- dev/snippets/input/types.cljs
+++ dev/snippets/input/types.cljs
@@ -20,4 +20,4 @@
           (d/option {:value "select"} "select")
           (d/option {:value "other"} "..."))
  (i/input {:type "textarea" :default-value "textarea"})
- (i/input {:type "static"} "static"))
+ (i/input {:type "static" :value "Static Text"}))


add helpful comments

add helpful comments

--- dev/user.clj
+++ dev/user.clj
@@ -42,6 +42,11 @@
   (pprint (apply touch-that query data-sources)))

 (comment
+
+  (navigator/create-competency (:db-conn nt-config/system) "I will keep typing" "v1" :comp.status/active :comp/id-sk "jeep")
+  (ptouch-that '[:find ?e :where [?e :comp/name]])
+
+
   ;; Utility fns
   ;; -----------------------
   (defn html->hiccup [html]


We have photos for Kim, Conor and Peter. Let's use them.

--- src-cljs/frontend/components/about.cljs
+++ src-cljs/frontend/components/about.cljs
@@ -147,19 +147,19 @@
     :github "appplemac"
     :bio "Alexey joins Circle from the sunny coasts of Spain. In between mountain biking, partying at art galleries and doing martial arts, he helps to ensure that Circle’s customers get the smoothest experience possible."}
    {:name "Hirokuni Kim"
-    :img-path (scaled-image-path "")
+    :img-path (scaled-image-path "kim")
     :role "Support Engineer"
     :github ""
     :email ""
     :bio "Hirokuni has a bit strange background. He studied political science in college to become a lawyer, but suddenly realized that what he truly loves is computer things, not law. He's been doing ops, devs, and devops in his previous jobs. He loves cooking and playing Shogi (Japanese chess) when he is not busy."}
    {:name "Conor McDermottroe"
-    :img-path (scaled-image-path "")
+    :img-path (scaled-image-path "conor")
     :role ""
     :github ""
     :email ""
     :bio "Bio coming soon!"}
    {:name "Peter Jaros"
-    :img-path (scaled-image-path "")
+    :img-path (scaled-image-path "peter")
     :role "Developer"
     :github ""
     :email ""


Rm debugging

Rm debugging

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -330,7 +330,6 @@
             [:a.close-menu {:href "./"} ; This may need to change if we drop hashtags from url structure
              (common/ico :fail-light)]]
            [:div.aside-user-options
-            (js/console.debug ">>>" (pr-str subpage))
             (expand-menu-items (admin-settings-nav-items) subpage)]])))))

 (defn redirect-org-settings-subpage


Reset managed-button status on mount

Reset managed-button status on mount

--- src-cljs/frontend/components/forms.cljs
+++ src-cljs/frontend/components/forms.cljs
@@ -65,6 +65,10 @@
     (init-state [_]
       {:status :idle})

+    om/IWillMount
+    (will-mount [_]
+      (om/set-state! owner :status :idle))
+
     om/IRenderState
     (render-state [_ {:keys [status]}]
       (let [[tag attrs & body] hiccup-form


Fix blocked groups selection

Fix blocked groups selection

--- src/uxbox/data/shapes.cljs
+++ src/uxbox/data/shapes.cljs
@@ -14,7 +14,6 @@
             [uxbox.state.shapes :as stsh]
             [uxbox.schema :as sc]
             [uxbox.xforms :as xf]
-            [uxbox.shapes :as sh]
             [uxbox.data.pages :as udp]
             [uxbox.util.geom.point :as gpt]
             [uxbox.util.data :refer (index-of)]))
@@ -305,7 +304,8 @@
             xf (comp
                 (filter #(= (:page %) pageid))
                 (remove :hidden)
-                (remove :blocked)
+                (remove #(and (not (:blocked %)) (= (:type %) :builtin/group)))
+                (remove #(and (not= % (sh/resolve-parent %)) (:blocked (sh/resolve-parent %))))
                 (map sh/outer-rect')
                 (filter #(sh/contained-in? % selrect))
                 (map :id))]


Minor code reorg on util/mixins.

Minor code reorg on util/mixins.

--- src/uxbox/util/mixins.cljs
+++ src/uxbox/util/mixins.cljs
@@ -44,9 +44,9 @@

 (def static rum/static)
 (def ref-node rum/ref-node)
+(def dom-node rum/dom-node)
 (def react rum/react)
 (def reactive rum/reactive)
-(def dom-node rum/dom-node)
 (def with-key rum/with-key)
 (def render-html server/render)
 (def render-static-html server/render-static)


Add source

Add source

--- src/clj_simple_chart/ssb/petroskatt.clj
+++ src/clj_simple_chart/ssb/petroskatt.clj
@@ -1,6 +1,9 @@
 ;;; To be honest I find this spectacularly difficult to fetch this data ...
 ;;; But that's how it goes ... for now.
 ;;; I'm open to improvements! ==> refsdal.ivar@gmail.com
+
+;;; Human friendly source for table 07022:
+;;; https://www.ssb.no/statistikkbanken/SelectVarVal/Define.asp?MainTable=InnbetSkatt2&KortNavnWeb=skatteregn&PLanguage=0&checked=true

 (ns clj-simple-chart.ssb.petroskatt
   (:require [clojure.data.json :as json]


bleep

bleep

--- src/cljs/defender_cljs/actors/ship.cljs
+++ src/cljs/defender_cljs/actors/ship.cljs
@@ -17,7 +17,7 @@
    :name "ship"
    :type "ship"))

-(physics/add-damped-actor! ship 0.8)
+(physics/add-damped-actor! ship damping)


clean code

clean code

--- src/cljs/salava/core/ui/badge_grid.cljs
+++ src/cljs/salava/core/ui/badge_grid.cljs
@@ -76,8 +76,8 @@
                                    [:div.media-heading
                                     [:p.heading-link name]]
                                    [:div.media-issuer
-                                    [:p issuer_content_name]]]
-                                  ]]
+                                    [:p issuer_content_name]]]]]
+
                                 [:div {:class (str "media-content " (if expired? "media-expired") (if revoked " media-revoked"))}
                                  [:a {:href "#" :on-click #(do
                                                              (.preventDefault %)
@@ -87,8 +87,8 @@
                                                                                (if (clojure.string/includes? (str js/window.location.href) (path-for (str "/badge?id=" id)))
                                                                                (.replaceState js/history {} "Badge modal" (path-for "/badge"))
                                                                                (navigate-to (current-route-path)))
-                                                                                (init-data state)))
-                                                                                }))}
+                                                                                (init-data state)))}))}
+
                                   [:div.icons
                                    [:div.visibility-icon.inline
                                     (case visibility
@@ -114,8 +114,8 @@
                                    [:div.media-heading
                                     [:p.heading-link name]]
                                    [:div.media-issuer
-                                    [:p issuer_content_name]]]
-                                  ]])
+                                    [:p issuer_content_name]]]]])
+

        (= "profile" badge-type) [:div
                                  [:a {:href "#" :on-click #(mo/open-modal [:badge :info] {:badge-id id})}
@@ -124,15 +124,15 @@
                                    [:div.icons.col-xs-12 {:style {:min-height "15px" :padding "0px"}}
                                     [:div.visibility-icon.inline
                                      ;(if metabadge-icon-fn [:div.pull-right [metabadge-icon-fn id]])
-                                     (when (or (pos? user_endorsements_count) (pos? endorsement_count)) [:span.badge-view [:i.fa.fa-handshake-o]])
-
-                                     ]]
+                                     (when (or (pos? user_endorsements_count) (pos? endorsement_count)) [:span.badge-view [:i.fa.fa-handshake-o]])]]
+
+
                                    [:div.media-left
                                     (if image_file  [:img {:src (str "/" image_file) :alt name}])
                                     [:div.media-body
                                      [:div.media-heading name]
-                                     [:div.media-issuer [:p issuer_content_name]]]
-                                    ]]]]
+                                     [:div.media-issuer [:p issuer_content_name]]]]]]]
+

        (= "gallery" badge-type) [:div
                                  [:a {:href "#" :on-click #(mo/open-modal [:gallery :badges] {:badge-id badge_id})
@@ -154,8 +154,8 @@
                                                         (t :gallery/recipients))])
                                     [:div.media-description description]]]]
                                  [:div.media-bottom
-                                  [:div {:class "pull-left"}
-                                   ]
+                                  [:div {:class "pull-left"}]
+
                                   (admin-gallery-badge badge_id "badges" state init-data)]]
        (= "selectable" badge-type)  [:div
                                      [:a {:href "#" :on-click #(mo/open-modal [:badge :info] {:badge-id id})}
@@ -163,15 +163,15 @@
                                        [:div.icons.col-xs-12 {:style {:min-height "15px" :padding "0px"}}
                                         [:div.visibility-icon.inline
                                          ;(if metabadge-icon-fn [:div.pull-right [metabadge-icon-fn id]])
-                                         (when (or (pos? user_endorsements_count) (pos? endorsement_count)) [:span.badge-view [:i.fa.fa-handshake-o]])
-
-                                         ]]
+                                         (when (or (pos? user_endorsements_count) (pos? endorsement_count)) [:span.badge-view [:i.fa.fa-handshake-o]])]]
+
+
                                        [:div.media-left
                                         (if image_file  [:img {:src (str "/" image_file) :alt name}])
                                         [:div.media-body
                                          [:div.media-heading name]
-                                         [:div.media-issuer [:p issuer_content_name]]]
-                                        ]]]
+                                         [:div.media-issuer [:p issuer_content_name]]]]]]
+
                                      [:div {:class "media-bottom"}
                                       [:div.row
                                        [:div.col-xs-9
@@ -200,51 +200,48 @@
                                                                 (cond
                                                                   (= "badge" type)(do
                                                                                (swap! new-field-atom merge {:badge {:id id :image_file image_file :type "badge" :name name :description description}})
-                                                                                (if (:index @state)(f/add-field-atomic (:block-atom @state) (:new-field-atom @state) (:index @state)) (f/add-field-atomic (:block-atom @state)(:new-field-atom @state)))
-                                                                                )
+                                                                                (if (:index @state)(f/add-field-atomic (:block-atom @state) (:new-field-atom @state) (:index @state)) (f/add-field-atomic (:block-atom @state)(:new-field-atom @state))))
+
                                                                   (= "showcase" type) (do
                                                                                (when-not  (some (fn [b] (= id (:id b))) badges)
                                                                                ;(swap! new-field-atom assoc :badges (conj badges {:id id :image_file image_file :type "badge" :name name :description description}))
                                                                                (as-> (:function @state) f (f {:id id :image_file image_file :type "badge" :name name :description description}) #_(f @new-field-atom))))
                                                                   :else nil)
-                                                                (m/close-modal!)))
-                                       }
+                                                                (m/close-modal!)))}
+
                                    [:div.media-content

                                     [:div.icons.col-xs-12 {:style {:min-height "15px" :padding "0px"}}
                                      [:div.visibility-icon.inline
                                       ;(if metabadge-icon-fn [:div.pull-right [metabadge-icon-fn id]])
-                                      (when (or (pos? user_endorsements_count) (pos? endorsement_count)) [:span.badge-view [:i.fa.fa-handshake-o]])
-
-                                      ]]
+                                      (when (or (pos? user_endorsements_count) (pos? endorsement_count)) [:span.badge-view [:i.fa.fa-handshake-o]])]]
+
+
                                     [:div.media-left
                                      (if image_file  [:img {:src (str "/" image_file) :alt name}])
                                      [:div.media-body
                                       [:div.media-heading name]
-                                      [:div.media-issuer [:p issuer_content_name]]]
-                                     ]]]]
+                                      [:div.media-issuer [:p issuer_content_name]]]]]]]
+
        (= "showcase" badge-type) [:div
                                   [:a {:href "#" :on-click #(do
                                                               (.preventDefault %)
-                                                              (mo/open-modal [:badge :info] {:badge-id id})
-
-                                                              )}
+                                                              (mo/open-modal [:badge :info] {:badge-id id}))}
+
+
                                    [:div.media-content
                                     [:div.media-left
                                      (if image_file  [:img {:src (str "/" image_file) :alt name}])
                                      [:div.media-body
-                                      [:div.media-heading name]
+                                      [:div.media-heading name]]]]]
                                       ;[:div.media-issuer [:p issuer_content_name]]
-                                      ]
-                                     ]]]
+
+
                                   [:div.delete-button
                                    [:a {:href "#" :on-click #(do
                                                                (.preventDefault %)
                                                                (let [block-atom @state]
-                                                                 (init-data id (:badges block-atom)))
-
-                                                               )}
-                                    [:i.fa.fa-trash]]
-
-                                   ]]
-       )]))
+                                                                 (init-data id (:badges block-atom))))}
+
+
+                                    [:i.fa.fa-trash]]]])]))


Report GSS Exceptions as 403 errors (not 500) (#863)

--- waiter/src/waiter/auth/spnego.clj
+++ waiter/src/waiter/auth/spnego.clj
@@ -31,7 +31,7 @@
   (:import (org.apache.commons.codec.binary Base64)
            (org.eclipse.jetty.client.api Authentication$Result Request)
            (org.eclipse.jetty.http HttpHeader)
-           (org.ietf.jgss GSSManager GSSCredential GSSContext GSSName Oid)
+           (org.ietf.jgss GSSManager GSSCredential GSSContext GSSException GSSName Oid)
            (java.net URI)
            (java.util.concurrent ThreadPoolExecutor)))

@@ -120,6 +120,13 @@
                               (gss-get-principal gss-context))]
               (async/>!! response-chan {:principal principal
                                         :token token}))
+            (catch GSSException ex
+              (log/error ex "gss exception during kerberos auth")
+              (async/>!! response-chan
+                         {:error (ex-info "Error during Kerberos authentication"
+                                          {:details (.getMessage ex)
+                                           :status 403}
+                                          ex)}))
             (catch Throwable th
               (log/error th "error while performing kerberos auth")
               (async/>!! response-chan {:error th}))


fix atom_counts

fix atom_counts

--- src/atom_finder/script/atom_counts.clj
+++ src/atom_finder/script/atom_counts.clj
@@ -14,9 +14,9 @@
    )
   )

-(->> "~/opt/src/linux"
+'(->> "~/opt/src/linux"
       expand-home
-      (pmap-dir-asts
+      (pmap-dir-trees
        (fn [root]
          {:file (str/replace-first (.getFilePath root) #".*(?=linux)" "")
           :atom-counts (map-values #(count ((:finder %) root)) atom-lookup)}))
@@ -26,7 +26,7 @@
       time
       )

-(->> "linux-atom-counts_2017-07-06_01.edn"
+'(->> "linux-atom-counts_2017-07-06_01.edn"
      read-data
      (map :atom-counts)
      (reduce (partial merge-with +))