Add branching factor helpers to index ns.

--- src/merkle_db/index.clj
+++ src/merkle_db/index.clj
@@ -24,9 +24,6 @@
   "Value of `:data/type` that indicates an index tree node."
   :merkle-db/index)

-(def default-branching-factor
-  "The default number of children to limit each index node to."
-  256)

 ;; The branching factor determines the number of children an index node in the
 ;; data tree can have.
@@ -54,6 +51,28 @@
     #(= data-type (:data/type %))
     #(= (count (::children %))
         (inc (count (::keys %))))))
+
+
+
+;; ## Branching Factor
+
+(def default-branching-factor
+  "The default number of children to limit each index node to."
+  256)
+
+
+(defn max-branches
+  "Return the maximum number of children a valid index node can have given the
+  parameters."
+  [params]
+  (::branching-factor params default-branching-factor))
+
+
+(defn min-branches
+  "Return the minimum number of children a valid index node must have given the
+  parameters."
+  [params]
+  (int (Math/ceil (/ (max-branches params) 2))))

@@ -93,9 +112,7 @@
          height 1]
     (if (<= (count layer) 1)
       (first layer)
-      (let [index-groups (part/partition-limited
-                           (::branching-factor params default-branching-factor)
-                           layer)]
+      (let [index-groups (part/split-limited (max-branches params) layer)]
         (recur (mapv (fn store-index
                        [children]
                        (->> (index-children height children)
@@ -253,7 +270,6 @@
           ; Result elements are a carry.
           :else
             (recur outputs result (next inputs))))
-
       ; No more input nodes.
       (if (seq outputs)
         (let [outputs (if carry
@@ -261,9 +277,9 @@
                           (part/carry-back store params outputs carry)
                           ('carry-back store params outputs carry))
                         outputs)]
-          (if (<= ('min-limit params) (count outputs))
+          (if (<= (min-branches params) (count outputs))
             ; Build one or more valid index nodes from the outputs.
-            [height (mapv index-children ('split-limited ('max-limit params) outputs))]
+            [height (mapv index-children (part/split-limited (max-branches params) outputs))]
             ; Not enough outputs to make a valid node - return for carrying.
             [(dec height) outputs]))
         ; No outputs, so return nil or direct carry.
@@ -271,6 +287,9 @@

 (defn- update-index-node!
+  "Updates the given index node by applying the changes. Returns a tuple
+  containing the resulting height and a sequence of updated and valid (but
+  unpersisted) index nodes at that height."
   [store params carry index changes]
   (if (and (nil? carry) (empty? changes))
     ; No carry or changes to apply, pass-through node.


fix typo

fix typo

--- src/clj/com/rpl/specter/impl.cljx
+++ src/clj/com/rpl/specter/impl.cljx
@@ -1324,7 +1324,7 @@
                 :else
                 (magic-fail! "Var " (:sym op) " must be either a parameterized "
                   "navigator, a higher order pathed constructor function, "
-                  "or a nav consructor")
+                  "or a nav constructor")
                 )))
           (magic-fail! "Code at " (extract-original-code p) " is in "
             "function invocation position and must be either a parameterized "


minor adjustments on develop branch to tilesets (sorry)

--- src/clj/forma/source/tilesets.clj
+++ src/clj/forma/source/tilesets.clj
@@ -1,6 +1,5 @@
 (ns forma.source.tilesets
   (:use forma.source.modis))
-

 (def country-tile
   ^{:doc "MODIS tiles for the selected countries, identified by their ISO3 codes


implement Localized Product Line

implement Localized Product Line

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -315,6 +315,21 @@
                                       :msg (msg (corp-install-msg target))}
                                       card nil))}

+   "Localized Product Line"
+   {:prompt "Choose a card"
+    :choices (req (cancellable (:deck corp) :sorted))
+    :effect (req (let [c (:title target)
+                       cs (filter #(= (:title %) c) (:deck corp))]
+                   (resolve-ability
+                    state side
+                    {:prompt "How many copies?"
+                     :choices {:number (req (count cs))}
+                     :msg (msg "add " target " cop" (if (= target 1) "y" "ies") " of " c " to HQ")
+                     :effect (req (doseq [c (take target cs)]
+                                    (move state side c :hand))
+                                  (shuffle! state :corp :deck))}
+                    card nil)))}
+
    "Manhunt"
    {:events {:successful-run {:req (req (first-event state side :successful-run))
                               :trace {:base 2 :msg "give the Runner 1 tag"


fix 24/7 News Cycle again

fix 24/7 News Cycle again

--- src/clj/game/cards-operations.clj
+++ src/clj/game/cards-operations.clj
@@ -3,10 +3,13 @@
 (def cards-operations
   {"24/7 News Cycle"
    {:req (req (> (count (:scored corp)) 1)) :additional-cost [:forfeit]
-    :prompt "Choose an agenda to trigger its \"when scored\" ability"
-    :choices (req (filter #(= (:type %) "Agenda") (:scored corp)))
-    :msg (msg "trigger the \"when scored\" ability of " (:title target))
-    :effect (effect (card-init target))}
+    :effect (req (let [agendas (get-in @state [:corp :scored])]
+                   (resolve-ability state side
+                     {:prompt "Choose an agenda to trigger its \"when scored\" ability"
+                      :choices (req (filter #(= (:type %) "Agenda") agendas))
+                      :msg (msg "trigger the \"when scored\" ability of " (:title target))
+                      :effect (effect (card-init target))}
+                    card nil)))}

    "Aggressive Negotiation"
    {:req (req (:scored-agenda corp-reg)) :prompt "Choose a card" :choices (req (:deck corp))


Fixes cards being draggable for spectators.

--- src/cljs/netrunner/gameboard.cljs
+++ src/cljs/netrunner/gameboard.cljs
@@ -276,7 +276,8 @@
    (when code
      (sab/html
       [:div.card-frame
-       [:div.blue-shade.card {:class (when selected "selected") :draggable true
+       [:div.blue-shade.card {:class (when selected "selected")
+                              :draggable (when (#{(get-in @game-state [:corp :user]) (get-in @game-state [:runner :user])} (:user @app-state)) true)
                               :on-drag-start #(handle-dragstart % cursor)
                               :on-drag-end #(-> % .-target js/$ (.removeClass "dragged"))
                               :on-mouse-enter #(when (or (not (or flipped facedown))


Improved title matching for files

Improved title matching for files

--- src/video_server/file.clj
+++ src/video_server/file.clj
@@ -130,10 +130,11 @@
 (defn title-filter
   "Returns a filename filter that matches the video title and
   extensions."
-  [title exts] ; TODO: should be based on video key
-  (reify FilenameFilter
-    (accept [this dir name]
-      (and (= title (:title (title-info (file-base name)))) (ends-with? name exts)))))
+  [title exts]
+  (let [title (str/lower-case (clean-title title))]
+    (reify FilenameFilter
+      (accept [this dir name]
+        (and (= title (str/lower-case (:title (title-info (file-base name))))) (ends-with? name exts))))))

 (defn- file-with-ext?
   "Returns whether the file or filename ends with one of the given


Fix issue with prompt at end of run

Fix issue with prompt at end of run

--- src/node/game/core.cljs
+++ src/node/game/core.cljs
@@ -260,7 +260,7 @@
           (when once (swap! state assoc-in [once (or once-key cid)] true)))))))

 (defn handle-end-run [state side]
-  (if-not (and (empty? (get-in @state [:runner :prompt])) (empty? (get-in @state [:corp :prompt])))
+  (if-not (empty? (get-in @state [:runner :prompt]))
     (swap! state assoc-in [:run :ended] true)
     (do (let [server (get-in @state [:run :server])]
           (trigger-event state side :run-ends (first server))
@@ -294,8 +294,7 @@
     (swap! state update-in [side :prompt] rest)
     ((:effect prompt) (or choice card))
     (when-let [run (:run @state)]
-      (when (and (:ended run)
-                 (empty? (get-in @state [:runner :prompt])) (empty? (get-in @state [:corp :prompt])))
+      (when (and (:ended run) (empty? (get-in @state [:runner :prompt])))
         (handle-end-run state :runner)))))

 (defn trash-no-cost [state side]
@@ -303,8 +302,7 @@
     (trash state side card)
     (swap! state update-in [side :prompt] rest)
     (when-let [run (:run @state)]
-      (when (and (:ended run)
-                 (empty? (get-in @state [:runner :prompt])) (empty? (get-in @state [:corp :prompt])))
+      (when (and (:ended run) (empty? (get-in @state [:runner :prompt])) )
         (handle-end-run state :runner)))))

 (defn select [state side {:keys [card] :as args}]


Fix reflection warnings

Fix reflection warnings

--- src/zaffre/glterminal.clj
+++ src/zaffre/glterminal.clj
@@ -397,75 +397,82 @@
      :vao-id vao-id}))

 (defn- fill-glyph-fg-bg-buffers [layer-id->character-map character->col-row character->transparent texture-columns texture-rows rows layer-size cursor-xy glyph-image-data fg-image-data bg-image-data]
-  (.clear glyph-image-data)
-  (.clear fg-image-data)
-  (.clear bg-image-data)
-  (loop-with-index layer [[layer-id character-map] layer-id->character-map]
-    ;;(doseq [[layer-id character-map] layers-character-map]
-    ;;  (doseq [[row line] (map-indexed vector (reverse @character-map))
-    ;;          [col c]    (map-indexed vector line)]
-        ;;(log/info "row" row "col" col "c" c)
-    ;(log/info layer-id)
-    ;; Set buffer positions to beginning
-    (loop-with-index row [line (reverse @character-map)]
-      (loop-with-index col [c line]
-        (let [chr        (or (get c :fx-character) (get c :character))
-              highlight  (= @cursor-xy [col (- rows row 1)])
-              [fg-r fg-g fg-b] (if highlight
-                                 (or (get c :fx-bg-color)  (get c :bg-color))
-                                 (or (get c :fx-fg-color)  (get c :fg-color)))
-              [bg-r bg-g bg-b] (if highlight
-                                 (or (get c :fx-fg-color)  (get c :fg-color))
-                                 (or (get c :fx-bg-color)  (get c :bg-color)))
-              ;s         (str (get c :character))
-              style     (get c :style)
-              i         (+ (* 4 (+ (* texture-columns row) col)) (* layer-size layer))
-              [x y]     (get character->col-row chr)
-              transparent (get character->transparent chr)]
-          ;(log/info "Drawing " layer-id "at col row" col row "character from atlas col row" x y c "(index=" i ") transparent" transparent )
-          (when (zero? col)
-            ;(log/info "glyph texture" glyph-texture-width glyph-texture-height)
-            ;(log/info "resetting position to start of line" layer row col i)
-            (.position glyph-image-data i)
-            (.position fg-image-data i)
-            (.position bg-image-data i))
-          (if (not= chr (char 0))
-            (do
-              (assert (or (not (nil? x)) (not (nil? y)))
-                      (format "X/Y nil - glyph not found for character %s %s"
-                        (or (str chr) "nil")
-                        (or (cond
-                              (nil? chr) "nil"
-                              (char? chr) (format "%x" (int chr))
-                              :else (str chr)))))
-              (.put glyph-image-data (unchecked-byte x))
-              (.put glyph-image-data (unchecked-byte y))
-              ;; TODO fill with appropriate type
-              (.put glyph-image-data (unchecked-byte (cond
-                                                       transparent 2
-                                                       :else 1)))
-              (.put glyph-image-data (unchecked-byte 0))
-              (.put fg-image-data    (unchecked-byte fg-r))
-              (.put fg-image-data    (unchecked-byte fg-g))
-              (.put fg-image-data    (unchecked-byte fg-b))
-              (.put fg-image-data    (unchecked-byte 0))
-              (.put bg-image-data    (unchecked-byte bg-r))
-              (.put bg-image-data    (unchecked-byte bg-g))
-              (.put bg-image-data    (unchecked-byte bg-b))
-              (.put bg-image-data    (unchecked-byte 0)))
-            ;; space ie empty, skip forward
-            (do
-              (.put glyph-image-data (byte-array 4))
-              (.put fg-image-data (byte-array 4))
-              (.put bg-image-data (byte-array 4)))))))
-      #_(log/info "At pos" (.position glyph-image-data))
-      #_(log/info "Setting layer" layer "new pos" (* texture-columns texture-height 4 (inc layer)))
-      (.position glyph-image-data (* texture-columns texture-rows 4 (inc layer)))
-      (.position fg-image-data    (* texture-columns texture-rows 4 (inc layer)))
-      (.position bg-image-data    (* texture-columns texture-rows 4 (inc layer))))
-    (.flip glyph-image-data)
-    (.flip fg-image-data)
-    (.flip bg-image-data))
+  (let [^long texture-columns texture-columns
+        ^long texture-rows texture-rows
+        ^long rows rows
+        ^long layer-size layer-size
+        ^ByteBuffer glyph-image-data glyph-image-data
+        ^ByteBuffer fg-image-data fg-image-data
+        ^ByteBuffer bg-image-data bg-image-data]
+    (.clear glyph-image-data)
+    (.clear fg-image-data)
+    (.clear bg-image-data)
+    (loop-with-index layer [[layer-id character-map] layer-id->character-map]
+      ;;(doseq [[layer-id character-map] layers-character-map]
+      ;;  (doseq [[row line] (map-indexed vector (reverse @character-map))
+      ;;          [col c]    (map-indexed vector line)]
+          ;;(log/info "row" row "col" col "c" c)
+      ;(log/info layer-id)
+      ;; Set buffer positions to beginning
+      (loop-with-index row [line (reverse @character-map)]
+        (loop-with-index col [c line]
+          (let [chr        (or (get c :fx-character) (get c :character))
+                highlight  (= @cursor-xy [col (- rows row 1)])
+                [fg-r fg-g fg-b] (if highlight
+                                   (or (get c :fx-bg-color)  (get c :bg-color))
+                                   (or (get c :fx-fg-color)  (get c :fg-color)))
+                [bg-r bg-g bg-b] (if highlight
+                                   (or (get c :fx-fg-color)  (get c :fg-color))
+                                   (or (get c :fx-bg-color)  (get c :bg-color)))
+                ;s         (str (get c :character))
+                style     (get c :style)
+                i         (+ (* 4 (+ (* texture-columns row) col)) (* layer-size layer))
+                [x y]     (get character->col-row chr)
+                transparent (get character->transparent chr)]
+            ;(log/info "Drawing " layer-id "at col row" col row "character from atlas col row" x y c "(index=" i ") transparent" transparent )
+            (when (zero? col)
+              ;(log/info "glyph texture" glyph-texture-width glyph-texture-height)
+              ;(log/info "resetting position to start of line" layer row col i)
+              (.position glyph-image-data i)
+              (.position fg-image-data i)
+              (.position bg-image-data i))
+            (if (not= chr (char 0))
+              (do
+                (assert (or (not (nil? x)) (not (nil? y)))
+                        (format "X/Y nil - glyph not found for character %s %s"
+                          (or (str chr) "nil")
+                          (or (cond
+                                (nil? chr) "nil"
+                                (char? chr) (format "%x" (int chr))
+                                :else (str chr)))))
+                (.put glyph-image-data (unchecked-byte x))
+                (.put glyph-image-data (unchecked-byte y))
+                ;; TODO fill with appropriate type
+                (.put glyph-image-data (unchecked-byte (cond
+                                                         transparent 2
+                                                         :else 1)))
+                (.put glyph-image-data (unchecked-byte 0))
+                (.put fg-image-data    (unchecked-byte fg-r))
+                (.put fg-image-data    (unchecked-byte fg-g))
+                (.put fg-image-data    (unchecked-byte fg-b))
+                (.put fg-image-data    (unchecked-byte 0))
+                (.put bg-image-data    (unchecked-byte bg-r))
+                (.put bg-image-data    (unchecked-byte bg-g))
+                (.put bg-image-data    (unchecked-byte bg-b))
+                (.put bg-image-data    (unchecked-byte 0)))
+              ;; space ie empty, skip forward
+              (do
+                (.put glyph-image-data (byte-array 4))
+                (.put fg-image-data (byte-array 4))
+                (.put bg-image-data (byte-array 4)))))))
+        #_(log/info "At pos" (.position glyph-image-data))
+        #_(log/info "Setting layer" layer "new pos" (* texture-columns texture-height 4 (inc layer)))
+        (.position glyph-image-data (* texture-columns texture-rows 4 (inc layer)))
+        (.position fg-image-data    (* texture-columns texture-rows 4 (inc layer)))
+        (.position bg-image-data    (* texture-columns texture-rows 4 (inc layer))))
+      (.flip glyph-image-data)
+      (.flip fg-image-data)
+      (.flip bg-image-data)))

 ;; Normally this would be a record, but until http://dev.clojure.org/jira/browse/CLJ-1224 is fixed
 ;; it is not performant to memoize records because hashCode values are not cached and are recalculated


Add a mechanism for a schema script search path.

--- src/sql_file/core.clj
+++ src/sql_file/core.clj
@@ -28,30 +28,28 @@
             [clojure.java.jdbc :as jdbc]
             [sql-file.script :as script]))

-(defn- locate-resource-script [ resource-name ]
-  "Locates the resource with the given name, either returning a URL to
-the resource if it's found or throwing an exception if not."
-  (or (clojure.java.io/resource resource-name)
-      (throw (Exception. (str "Cannot find resource script: " resource-name)))))
+(defn- locate-schema-script [ conn basename ]
+  (or (some identity
+            (map (fn [ prefix ]
+                   (let [ script-path (format "%s%s" prefix basename)]
+                     (log/debug "Checking for script:" script-path)
+                     (clojure.java.io/resource script-path)))
+                 (conj (get conn :script-prefixes []) "")))
+      (throw (Exception. (str "Cannot find resource script: " basename)))))

-;;; TODO: Add a directory/ -like prefix that allows schema files to be
-;;; confined to directories.
-
-(defn- schema-install-script [ schema ]
+(defn- schema-install-script [ conn schema ]
   "Locate the schema script to install the given schema name and
 version. If there is no such script, throws an exception."
-  (let [ [ schema-name schema-version ] schema]
-    (locate-resource-script
-     (format "schema-%s-%s.sql" schema-name schema-version))))
+  (let [[ schema-name schema-version ] schema]
+    (locate-schema-script conn (format "schema-%s-%s.sql" schema-name schema-version))))

-(defn- schema-migrate-script [ schema ]
+(defn- schema-migrate-script [ conn schema ]
   "Locate the schema migration script for the given schema name and
 to-version. If there is no such script, throws an exception. The
 migration script is expected to migrate the schema from version n-1 to
 version n, where n=to-version."
   (let [ [ schema-name schema-to-version ] schema ]
-    (locate-resource-script
-     (format "schema-%s-migrate-to-%s.sql" schema-name schema-to-version))))
+    (locate-schema-script conn (format "schema-%s-migrate-to-%s.sql" schema-name schema-to-version))))

 (defn- run-script [ conn script-url ]
   "Run the database script at the given URL against a specific
@@ -106,7 +104,7 @@
 schema in the target database instance."
   (log/info "Installing schema:" schema)
   (let [ [schema-name schema-version ] schema ]
-    (safe-run-script conn (schema-install-script schema))
+    (safe-run-script conn (schema-install-script conn schema))
     (set-schema-version! conn schema-name schema-version)))

 (defn- migrate-schema [ conn schema-name cur-schema-version req-schema-version ]
@@ -115,7 +113,7 @@
   (log/info "Upgrading schema" schema-name "from version" cur-schema-version "to" req-schema-version)
   (doseq [ from-version (range cur-schema-version req-schema-version )]
     (let [ to-version (+ from-version 1) ]
-      (safe-run-script conn (schema-migrate-script [ schema-name to-version ]))
+      (safe-run-script conn (schema-migrate-script conn [ schema-name to-version ]))
       (set-schema-version! conn schema-name to-version))))

 (defn- ensure-schema [ conn schema ]


add stop-event helper to replace returning false

--- src-cljs/frontend/utils.cljs
+++ src-cljs/frontend/utils.cljs
@@ -191,3 +191,7 @@
     (if-not (identical? sentinel (get-in m ks sentinel))
       (apply update-in m ks f args)
       m)))
+
+(defn stop-event [e]
+  (.stopPropagation e)
+  (.preventDefault e))


Adjust datomic :where query whitespace

Adjust datomic :where query whitespace

--- src/overseer/status.clj
+++ src/overseer/status.clj
@@ -8,9 +8,8 @@
   [db status]
   (->> (d/q '[:find ?jid
               :in $ ?status
-              :where
-              [?e :job/status ?status]
-              [?e :job/id ?jid]]
+              :where [?e :job/status ?status]
+                     [?e :job/id ?jid]]
             db
             status)
        (map first)
@@ -20,10 +19,9 @@
   "Find all job IDs that are not yet complete."
   [db]
   (->> (d/q '[:find ?jid
-              :where
-              [?e :job/status ?s]
-              [((comp not contains?) #{:finished :aborted :failed} ?s)]
-              [?e :job/id ?jid]]
+              :where [?e :job/status ?s]
+                     [((comp not contains?) #{:finished :aborted :failed} ?s)]
+                     [?e :job/id ?jid]]
             db)
        (map first)
        (into #{})))
@@ -38,12 +36,11 @@
       unfinished
       (->> (d/q '[:find ?jid
                   :in $ [?unfinished-jids ...]
-                  :where
-                  [?j :job/id ?unfinished-jids]
-                  [?j :job/id ?jid]
-                  [?j :job/dep ?dj]
-                  [?dj :job/status ?djs]
-                  [(not= :finished ?djs)]]
+                  :where [?j :job/id ?unfinished-jids]
+                         [?j :job/id ?jid]
+                         [?j :job/dep ?dj]
+                         [?dj :job/status ?djs]
+                         [(not= :finished ?djs)]]
                 db
                 unfinished)
            (map first)


Augmented and diminished are qualities, not transformations.

--- src/overtunes/pitch.clj
+++ src/overtunes/pitch.clj
@@ -64,11 +64,11 @@
 ; Qualities
 (def major (select-keys major-scale [:i :iii :v]))
 (def minor (update-in major [:iii] flat))
+(def augmented (update-in major [:v] sharp))
+(def diminished (update-in minor [:v] flat))
 (def power (select-keys major-scale [:i :v :viii]))

 ; Modifications
-(def augmented #(update-in % [:v] sharp))
-(def diminished #(update-in % [:v] flat))
 (def suspended-second #(assoc % :iii (:ii major-scale)))
 (def suspended-fourth #(assoc % :iii (:iv major-scale)))
 (def sixth #(assoc % :vi (:vi major-scale)))


set up job to clear closed channels while we wait for a fix

https://issues.jboss.org/browse/IMMUTANT-564

--- src/pc/http/talaria.clj
+++ src/pc/http/talaria.clj
@@ -14,6 +14,8 @@
 (defonce talaria-state (ref {:connections {}
                              :stats {}}))

+(declare clear-closed)
+
 (defn init [& {:keys [ws-delay ajax-delay ping-ms]
                :or {ws-delay 30
                     ajax-delay 150
@@ -26,7 +28,8 @@
                                     :ws-delay ws-delay
                                     :ajax-delay ajax-delay
                                     :ping-ms ping-ms
-                                    :stats {}})))
+                                    :stats {}}))
+    (delay/repeat-fn async-pool (* 1000 60 5) clear-closed))
   talaria-state)

 (defn shutdown [tal-state]
@@ -390,3 +393,4 @@
   (let [close-fn (ws-close-handler talaria-state)]
     (doseq [ch (remove ajax-channel? (closed-channels))]
       (close-fn ch {}))))
+


Fixed dance-qty in couple node

Fixed dance-qty in couple node

--- src/tango/export2.clj
+++ src/tango/export2.clj
@@ -132,6 +132,10 @@
 (def a-couple-data (first a-result-array))
 (def a-marks (:marks a-couple-data))

+(defn get-dance-count-from-class-node [class-node]
+  (let [dance-list-node (first (filter #(= (:tag %) :DanceList) (:content class-node)))]
+    (count (:content dance-list-node))))
+
 (defn make-mark-node [mark seq]
   (xml/element :Mark
                {:Seq seq
@@ -155,13 +159,13 @@
                (make-mark-list-node (:marks couple-data))
                ))

-(defn make-result-node [result-array seq adj-qty]
+(defn make-result-node [result-array seq dance-qty adj-qty]
   (xml/element :Result
                {:Seq seq
                 :Round "Awsome3"
                 :AdjQty adj-qty
                 :D3 "0"}
-               (reduce #(conj %1 (make-couple-node %2 (count %1) 666 adj-qty)) [] result-array)))
+               (reduce #(conj %1 (make-couple-node %2 (count %1) dance-qty adj-qty)) [] result-array)))

 (defn fix-class [class class-result]
   (clojure.walk/postwalk
@@ -171,7 +175,11 @@
                                               ;; TODO - ML fixar och noterar saknad data
                                               :content (conj (vec (:content form))
                                                              ;(xml/element :Foo {})
-                                                             (make-result-node (get-in class-result [:result :result-array] ) (count (:content form)) 3)
+                                                             (make-result-node
+                                                              (get-in class-result [:result :result-array] )
+                                                              (count (:content form))
+                                                              (get-dance-count-from-class-node class)
+                                                              3)
                                                              )
                                               })
         :else form))
@@ -188,6 +196,19 @@
                                  form)
         :else form))
     raw-xml-2))
+
+(def class-node
+  (xml/element :Class {}
+               (xml/element :Foo {})
+               (xml/element :DanceList {}
+                            (xml/element :Dance {})
+                            (xml/element :Dance {})
+                            (xml/element :Dance {}))
+               (xml/element :Bar {})))
+
+(get-dance-count-from-class-node class-node)
+
+

 (xml/parse (java.io.FileInputStream. "test/tango/examples/real-example-kungsor.xml"))


remove hardcoded SSL cert for grafana

remove hardcoded SSL cert for grafana

--- src/terraboot/vpc.clj
+++ src/terraboot/vpc.clj
@@ -97,7 +97,8 @@
            azs
            subnet-cidr-blocks
            default-ami
-           vpc-cidr-block]} ]
+           vpc-cidr-block
+           cert-name]}]
   (let [vpc-unique (vpc-unique-fn vpc-name)
         vpc-resource (partial resource vpc-unique)
         vpc-id-of (id-of-fn vpc-unique)
@@ -154,7 +155,9 @@
                                                      :target "HTTP:80/status"
                                                      :timeout 5
                                                      :interval 30}
-                                      :listeners [(elb-listener {:lb-port 443 :lb-protocol "https" :port 80 :protocol "http" :cert-name "StartMastodoncNet"})]
+                                      :listeners [(elb-listener (if cert-name
+                                                                  {:lb-port 443 :lb-protocol "https" :port 80 :protocol "http" :cert-name cert-name}
+                                                                  {:port 80 :protocol "http"}))]
                                       :instances [(id-of "aws_instance" "influxdb")]
                                       :subnets (mapv #(id-of "aws_subnet" (stringify  vpc-name "-public-" %)) azs)
                                       :security-groups (mapv #(id-of "aws_security_group" %) [(vpc-unique "all-servers")


private ip DNS for icinga server

private ip DNS for icinga server

--- src/terraboot/vpc.clj
+++ src/terraboot/vpc.clj
@@ -153,6 +153,8 @@
              (private_route53_record "influxdb" vpc-name {:records [(output-of "aws_instance" "influxdb" "private_ip")]})

              (private_route53_record "logstash" vpc-name {:records [(vpc-output-of "aws_eip" "logstash" "private_ip")]})
+
+             (private_route53_record "alerts" vpc-name {:records [(vpc-output-of "aws_instance" "alerts" "private_ip")]})

              (route53_record "chronograf" {:type "CNAME"
                                            :records [(output-of "aws_elb" "chronograf" "dns_name")]})


end of line

end of line

--- src/vignette/util.clj
+++ src/vignette/util.clj
@@ -55,4 +55,4 @@
       (and (store-prot/save-thumbnail store thumb thumb-map)
            (io/delete-file thumb)
            (store-prot/get-thumbnail store thumb-map))
-      nil)))+      nil)))


further style tweaks

further style tweaks

--- src/prais2/content.cljs
+++ src/prais2/content.cljs
@@ -6,7 +6,7 @@

 (def table1-data
   [(Row. (Header. "Hospital"                    true       true    200   50)
-         (Header. "Hospital Code"               true       true    105   50)
+         (Header. "Hospital Code"               true       false    105   50)
          (Header. "Number of Operations"        true       true    105   50)
          (Header. "Number of Deaths"            true       true    100   50)
          (Header. "Number of Survivors"         true       true    100   50)


line added back

line added back

--- src/ws_intro/core.clj
+++ src/ws_intro/core.clj
@@ -78,7 +78,7 @@
     (let [message (-> json-message json/read-json (get-in [:data :message]))
           type (-> json-message json/read-json (get-in [:data :type]))
           ]
-;      (sendMessage type message)
+      (sendMessage type message)
       ))

   (defn -main []


Prefer Schema coercions for resource properties

Still some remaining protocol usages, especially in yada.service, which
will hopefully be replaced entirely with Schema coercions.

--- src/yada/resource.clj
+++ src/yada/resource.clj
@@ -3,11 +3,14 @@
 (ns yada.resource
   (:require
    [schema.core :as s]
+   [schema.coerce :as sc]
+   [schema.utils :as su]
    yada.charset
    yada.media-type
    [yada.protocols :as p])
   (:import [yada.charset CharsetMap]
-           [yada.media_type MediaTypeMap]))
+           [yada.media_type MediaTypeMap]
+           [java.util Date]))

 (s/defschema MediaTypeSchema
   (s/either String MediaTypeMap))
@@ -15,25 +18,84 @@
 (s/defschema CharsetSchema
   (s/either String CharsetMap))

-(s/defn resource-properties
-  :- {(s/optional-key :allowed-methods)
-      (s/either [s/Keyword] #{s/Keyword})
+(s/defschema QualifiedKeyword
+  (s/both s/Keyword (s/pred namespace)))

-      (s/optional-key :representations)
-      [{(s/optional-key :media-type) (s/either MediaTypeSchema #{MediaTypeSchema})
-        (s/optional-key :charset) (s/either CharsetSchema #{CharsetSchema})
-        (s/optional-key :encoding) (s/either String #{String})
-        (s/optional-key :language) (s/either String #{String})}]}
+(s/defschema MediaTypeSchemaSet
+  #{MediaTypeSchema})
+
+(s/defschema CharsetSchemaSet
+  #{CharsetSchema})
+
+(s/defschema StringSet
+  #{String})
+
+(s/defschema ResourceProperties
+  {(s/optional-key :allowed-methods)
+   (s/either [s/Keyword] #{s/Keyword})
+
+   (s/optional-key :parameters)
+   {s/Keyword ;; method
+    {(s/optional-key :query) {s/Keyword s/Any}
+     (s/optional-key :path) {s/Keyword s/Any}
+     (s/optional-key :header) {s/Keyword s/Any}
+     (s/optional-key :form) {s/Keyword s/Any}
+     (s/optional-key :body) s/Any}}
+
+   (s/optional-key :representations)
+   [{(s/optional-key :media-type) MediaTypeSchemaSet
+     (s/optional-key :charset) CharsetSchemaSet
+     (s/optional-key :encoding) StringSet
+     (s/optional-key :language) StringSet}]
+
+   QualifiedKeyword s/Any})
+
+(defn as-set [x] (if (coll? x) x (set [x])))
+
+(def +resource-properties-coercions+
+  {Date #(condp instance? %
+           java.lang.Long (Date. %)
+           %)
+   MediaTypeSchemaSet as-set
+   CharsetSchemaSet as-set
+   StringSet as-set})
+
+(def coerce-resource-properties
+  (sc/coercer ResourceProperties +resource-properties-coercions+))
+
+(coerce-resource-properties {:representations [{:media-type "foo"}]})
+
+(s/defn resource-properties :- ResourceProperties
   [r]
-  (p/resource-properties r))
+  (let [res
+        (coerce-resource-properties
+         (try
+           (p/resource-properties r)
+           (catch AbstractMethodError e
+             {})))]
+    (when (su/error? res)
+      (throw (ex-info "Resource properties are not valid" {:error res})))
+    res))
+
+;; ---
+
+(s/defschema ResourcePropertiesOnRequest
+  {:exists? s/Bool
+   (s/optional-key :last-modified) Date
+   (s/optional-key :version) s/Any
+   QualifiedKeyword s/Any})
+
+(def coerce-resource-properties-on-request
+  (sc/coercer ResourcePropertiesOnRequest +resource-properties-coercions+))

 ;; The reason we can't have multiple arities is that s/defn has a
 ;; limitation that 'all arities must share the same output schema'.
-(s/defn resource-properties-on-request
-  :- {:exists? s/Bool
-      (s/optional-key :last-modified) java.util.Date
-      (s/optional-key :version) s/Any}
+(s/defn resource-properties-on-request :- ResourcePropertiesOnRequest
   [r ctx]
-  (merge
-   {:exists? true}
-   (p/resource-properties r ctx)))
+  (coerce-resource-properties-on-request
+   (merge
+    {:exists? true}
+    (try
+      (p/resource-properties r ctx)
+      (catch AbstractMethodError e
+        nil)))))


update security-headers to correctly fetch from resource-model

--- src/yada/security.clj
+++ src/yada/security.clj
@@ -191,13 +191,15 @@
     (cond-> ctx
       https? (assoc-in [:response :headers "strict-transport-security"]
                        (format
-                        "max-age=%s; includeSubdomains"
-                        (get-in ctx [:strict-transport-security :max-age] 31536000)))
-      https? (assoc-in [:response :headers "content-security-policy"]
-                       (get-in ctx [:content-security-policy] "default-src https: data: 'unsafe-inline' 'unsafe-eval'"))
+                         "max-age=%s; includeSubdomains"
+                         (get-in ctx [:strict-transport-security :max-age] 31536000)))
+      (or https? (contains? (:resource ctx) :content-security-policy))
+      (assoc-in [:response :headers "content-security-policy"]
+                (get-in ctx [:resource :content-security-policy]
+                        "default-src https: data: 'unsafe-inline' 'unsafe-eval'"))
       true (assoc-in [:response :headers "x-frame-options"]
-                     (get ctx :x-frame-options "SAMEORIGIN"))
+                     (get-in ctx [:resource :x-frame-options] "SAMEORIGIN"))
       true (assoc-in [:response :headers "x-xss-protection"]
-                     (get ctx :xss-protection "1; mode=block"))
+                     (get-in ctx [:resource :xss-protection] "1; mode=block"))
       true (assoc-in [:response :headers "x-content-type-options"]
                      "nosniff"))))


Fixed the attrs->map problem.

Fixed the attrs->map problem.

--- src/rapscallion/xml.clj
+++ src/rapscallion/xml.clj
@@ -89,6 +89,25 @@

 (defn- parse-error [& messages]
   (throw (IllegalArgumentException. (apply str messages))))
+
+
+(defn attrs->map
+  [^Attributes attrs namespaces]
+  (let [attr-key
+        (if namespaces
+          (fn [^Attributes attrs ^Long i]
+            (let [uri (.getURI attrs i)
+                  q-name (.getQName attrs i)]
+              (if (.isEmpty uri)
+                (keyword q-name)
+                (let [[prefix _] (string/split q-name #":" 2)]
+                  (with-meta
+                    [(keyword (.getLocalName attrs i)) uri]
+                    {:prefix prefix})))))
+          (fn [^Attributes attrs ^Long i]
+            (keyword (.getQName attrs i))))]
+    (into {} (for [^Long i (range (.getLength attrs))]
+               [(attr-key attrs i) (.getValue attrs i)]))))

 (defn sax-handler
@@ -109,44 +128,45 @@
     [:comment text]
   "
   [f & [opts]]
-  (proxy [DefaultHandler2] []
+  (let [{:keys [namespaces]} opts]
+    (proxy [DefaultHandler2] []

-    ;; Elements
-    (startElement [uri local-name q-name attrs]
-      (f [:start-element uri local-name q-name attrs]))
-    (endElement [uri local-name q-name]
-      (f [:end-element uri local-name q-name]))
-
-    ;; Text
-    (characters [^chars ch ^long start ^long length]
-      (f [:text (String. ch start length)]))
+      ;; Elements
+      (startElement [uri local-name q-name attrs]
+        (f [:start-element uri local-name q-name (attrs->map attrs namespaces)]))
+      (endElement [uri local-name q-name]
+        (f [:end-element uri local-name q-name]))
+
+      ;; Text
+      (characters [^chars ch ^long start ^long length]
+        (f [:text (String. ch start length)]))

-    ;; As far as I can tell, ignorableWhitespace never gets called.
-    ;; does anyone ever need this?
-    #_(ignorableWhitespace [^chars ch ^long start ^long length]
-        (f [:whitespace (String. ch start length)]))
+      ;; As far as I can tell, ignorableWhitespace never gets called.
+      ;; does anyone ever need this?
+      #_(ignorableWhitespace [^chars ch ^long start ^long length]
+          (f [:whitespace (String. ch start length)]))

-    ;; Keep track of which text came from a CDATA section
-    (startCDATA []
-      (f [:start-cdata]))
-    (endCDATA []
-      (f [:end-cdata]))
-
-    ;; Processing Instructions
-    (processingInstruction [target data]
-      (f [:processing-instruction target data]))
-
-    ;; Mapping prefixes to namespace URIs
-    (startPrefixMapping [prefix uri]
-      (f [:start-prefix-mapping prefix uri]))
-    (endPrefixMapping [prefix]
-      (f [:end-prefix-mapping prefix]))
-
-    ;; Comments
-    (comment [^chars ch ^long start ^long length]
-             (f [:comment (String. ch start length)]))
+      ;; Keep track of which text came from a CDATA section
+      (startCDATA []
+        (f [:start-cdata]))
+      (endCDATA []
+        (f [:end-cdata]))
+
+      ;; Processing Instructions
+      (processingInstruction [target data]
+        (f [:processing-instruction target data]))
+
+      ;; Mapping prefixes to namespace URIs
+      (startPrefixMapping [prefix uri]
+        (f [:start-prefix-mapping prefix uri]))
+      (endPrefixMapping [prefix]
+        (f [:end-prefix-mapping prefix]))
+
+      ;; Comments
+      (comment [^chars ch ^long start ^long length]
+               (f [:comment (String. ch start length)]))

-    ))
+      )))

 (defprotocol AsInputSource
@@ -252,25 +272,6 @@
   ;; TODO - this function is way too busy
   (let [{:keys [namespaces]} opts

-        attr-key
-        (if namespaces
-          (fn [^Attributes attrs ^Long i]
-            (let [uri (.getURI attrs i)
-                  q-name (.getQName attrs i)]
-              (if (.isEmpty uri)
-                (keyword q-name)
-                (let [[prefix _] (string/split q-name #":" 2)]
-                  (with-meta
-                    [(keyword (.getLocalName attrs i)) uri]
-                    {:prefix prefix})))))
-          (fn [^Attributes attrs ^Long i]
-            (keyword (.getQName attrs i))))
-
-        attrs->map
-        (fn [^Attributes attrs]
-          (into {} (for [^Long i (range (.getLength attrs))]
-                     [(attr-key attrs i) (.getValue attrs i)])))
-
         make-element
         (if namespaces
           (fn [[_ uri local-name q-name attrs] content ns-map]
@@ -278,7 +279,7 @@
                   prefix (if tag prefix nil)]
               (with-meta
                 (Element. (keyword local-name)
-                          (attrs->map attrs)
+                          attrs
                           content
                           uri)
                 (if prefix
@@ -286,7 +287,7 @@
                   ns-map))))
           (fn [[_ _ _ q-name attrs] content _]
             (Element. (keyword q-name)
-                      (attrs->map attrs)
+                      attrs
                       content
                       nil)))


Only require reagent.ratom in CLJS context

Reagent has a reagent.ratom CLJ file, but it is a macro file intended
for use from CLJS, not from a Clojure program.

Fixes #285

--- src/re_frame/utils.cljc
+++ src/re_frame/utils.cljc
@@ -1,7 +1,7 @@
 (ns re-frame.utils
   (:require
     [re-frame.loggers :refer [console]]
-    [reagent.ratom :as ratom]))
+    #?(:cljs [reagent.ratom :as ratom])))

 (defn dissoc-in
   "Dissociates an entry from a nested associative structure returning a new


Working installation dispatch for deployed and interactive application modes.

--- src/appengine_magic/core.clj
+++ src/appengine_magic/core.clj
@@ -1,10 +1,14 @@
 (ns appengine-magic.core)

-(defn- in-appengine-dev-mode? []
-  false)
+(defn- in-appengine-interactive-mode? []
+  (try
+    (let [stack-trace (.getStackTrace (Thread/currentThread))]
+      (some #(.contains (.toString %) "swank.core") stack-trace))
+    (catch java.security.AccessControlException ace
+      false)))

-(if (in-appengine-dev-mode?)
+(if (in-appengine-interactive-mode?)
     (load "core_local")
     (load "core_google"))


fix logging of quotes

fix logging of quotes

--- src/babel/english/writer.clj
+++ src/babel/english/writer.clj
@@ -53,8 +53,9 @@
                                                     " from language: '" source-language-short-name
                                                     "' with predicate: '"
                                                     (strip-refs (get-in source-expression [:structure :synsem :sem :pred]))
-                                                    "' into English; subj:'"
+                                                    "' into English; subj:"
                                                     "'" (get-in source-expression [:structure :synsem :sem :subj :pred])
+                                                    "; source semantics:'" (strip-refs (get-in source-expression [:structure :synsem :sem]))
                                                     "'"))
                                     false
                                     (throw e))))))))))


more diagnostics about specifics of generation within (todos)

--- src/babel/espanol/writer.clj
+++ src/babel/espanol/writer.clj
@@ -58,7 +58,7 @@

     ;; for debugging, change (pmap) to (map) so logging is easier to read: in-order rather than interleaved by multiple workers.
     (.size (pmap (fn [verb]
-                   (log/trace (str "verb: " (strip-refs verb)))
+                   (log/debug (str "verb: " (strip-refs verb)))
                    (let [root-form (get-in verb [:espanol :espanol])]
                      (log/info (str "generating with verb: '" root-form "'"))
                      (.size (pmap (fn [tense]
@@ -68,17 +68,37 @@
                                       (map (fn [gender]
                                              (let [spec (unify/unify spec
                                                                      {:comp {:synsem {:agr gender}}})]
-                                               (log/trace (str "generating from gender: " gender))
+                                               (log/debug (str "generating from gender: " gender))
                                                (.size
                                                 (map (fn [person]
-                                                       (let [spec (unify/unify spec
-                                                                               {:comp {:synsem {:agr {:person person}}}})]
-                                                         (log/trace (str "generating from person: " person))
+                                                       (let [debug (log/debug (str "generating from spec(pre-person):" spec))
+                                                             unify-with {:comp {:synsem {:agr {:person person}}}}
+                                                             unified (unify/unify spec unify-with)
+
+                                                             spec
+                                                             (if (fail? unified)
+                                                               (let [message
+                                                                     (log/warn (str "could not unify " spec " with person specification:" unify-with "."))]
+                                                                 (if true
+                                                                   (do
+                                                                     (log/warn message)
+                                                                     (log/warn (str "Ignoring and continuing."))
+                                                                     unified)
+                                                                   (do
+                                                                     (log/error message)
+                                                                     (log/error "Stopping further processing now.")
+                                                                     (throw (Exception. message)))))
+                                                               unified)
+
+                                                             ]
+                                                         (log/debug (str "generating from person: " person))
+                                                         (log/debug (str "generating from spec+person: " spec))
                                                          (.size
                                                           (map (fn [number]
-                                                                 (let [spec (unify/unify spec
+                                                                 (let [debug (log/debug (str "generating from spec(1): " spec))
+                                                                       spec (unify/unify spec
                                                                                {:comp {:synsem {:agr {:number number}}}})]
-                                                                   (log/debug (str "generating from spec: " spec))
+                                                                   (log/debug (str "generating from spec(2): " spec))
                                                                    (try
                                                                      (process [{:fill-one-language
                                                                                {:count 1
@@ -96,7 +116,11 @@
                                         ;
                                                                          ;; The spec was :fail.
                                                                          (= spec :fail)
-                                                                         (log/warn (str "ignoring spec: :fail : can't generate anything from that."))
+                                                                         (if true
+                                                                           (log/warn (str "ignoring spec: :fail : can't generate anything from that."))
+                                                                           (let [message "spec is fail!"]
+                                                                             (log/error message)
+                                                                             (throw (Exception. message))))

                                                                          ;; The verb is "funzionare" (which takes a non-human
                                                                          ;; subject), but we're trying to generate with
@@ -140,6 +164,7 @@
                                                                    ))
                                                                [:sing :plur]))))
                                                      [:1st :2nd :3rd]))))
+                                           ;; TODO: why is this check disabled with (or true ..)?
                                            (cond (or true (= tense
                                                              {:synsem {:sem {:aspect :perfect
                                                                              :tense :past}}}))


Send stdout to socket

Send stdout to socket

--- src/replme/web/repl.clj
+++ src/replme/web/repl.clj
@@ -25,6 +25,7 @@
   []
   {:Image "edpaget/lein"
    :Tty true
+   :Memory "256M"
    :Cmd ["/opt/lein" "repl" ":headless" ":host" "0.0.0.0" ":port" "8081"]})

 (defn- start-docker
@@ -46,6 +47,10 @@
   [client id]
   (container/stop client id))

+(defn- vectorize
+  [msg]
+  (pr-str (vector msg)))
+
 (defn- docker-repl
   [client in-chan out-chan]
   (let [[id [stdout http-client]] (start-docker client)
@@ -55,16 +60,16 @@
       (if (re-find nrepl-sentinel msg)
         (do
           (log/info (str "Connecting to docker nrepl at" ip ":" port))
-          (>! out-chan "REPL OK")
+          (>! out-chan (vectorize "REPL OK"))
           (go-loop [repl-conn (repl/connect :host ip :port port)
                     client (repl/client repl-conn 1000)
                     command (<! in-chan)]
             (->> (repl/message client {:op :eval :code command})
                  repl/response-values
                  prn-str
-                 (>! out-chan)))
-          (recur repl-conn (<! in-chan) client))
-        (do (>! out-chan msg)
+                 (>! out-chan))
+            (recur repl-conn client (<! in-chan))))
+        (do (>! out-chan (vectorize msg))
             (recur (<! stdout)))))
     [id http-client]))


Remove dead code

Remove dead code

--- src/circle/backend/build.clj
+++ src/circle/backend/build.clj
@@ -83,8 +83,7 @@
                      node         ;; Map containing keys required by ec2/start-instance
                      lb-name      ;; name of the load-balancer to use
                      continue?    ;; if true, continue running the build. Failed actions will set this to false
-                     start_time
-                     stop_time]
+                     ]
               :as args}]
   (let [project (project/get-by-url! vcs_url)
         build_num (or build_num (project/next-build-num project))]


add auth middleware

add auth middleware

--- src/clj/lesezeichen/core.clj
+++ src/clj/lesezeichen/core.clj
@@ -76,7 +76,8 @@
                          tag-table)
                         store
                         (comp (partial publish-on-request store)
-                              (partial fetch store)))))
+                              (partial fetch store)
+                              (partial auth store auth-fn cred-fn (atom #{}))))))
   state)

 (defroutes handler


restore leading '/' in pathes

restore leading '/' in pathes

--- src/cljs/clj_money/data.cljs
+++ src/cljs/clj_money/data.cljs
@@ -14,9 +14,9 @@

 (defn- path
   [& segments]
-  (->> (concat [:api] segments)
-       (map stringify)
-       (string/join "/")))
+  (str "/" (->> (concat [:api] segments)
+                (map stringify)
+                (string/join "/"))))

 (defn get-entities
   [callback]


added some modification

added some modification

--- src/cljs/fractals/about.cljs
+++ src/cljs/fractals/about.cljs
@@ -27,42 +27,52 @@
   (let [fw (if (= wsize :swall) "1rem" "1.4rem")
         align (if (= wsize :swall) :left :center)]
     [:div {:style {:grid-column 1
+                   :display :flex
+                   :flex-direction :column
+                   :justify-content :space-between
                    :color "#fff"
                    :font-size fw
                    :padding "15px"
                    :backgroundColor "#333"}}
-     (r-link2 "#/about"  "Show Demo" fw align)
-     [:div {:style {:font-size (if (= wsize :swall) "1.4rem" "2.5rem")
-                    :font-family "'Slabo 27px', serif"
-                    :text-align align
-                    :padding "10px"}} "MD. ASHIK"]
-     (svg/cover-photo)
-
-     [:div {:style {:background-color :white
-                    :height "1px"}
-            } ]
-     [:div {:style {:text-align align}} "+8801717018083"]
-     [:div {:style {:background-color :white
-                    :height "1px"}
-            }]
-     [:div {:style {:text-align align
-                    :font-size "12px"}} "aryabhatiya.algebra@gmail.com"]
-     [:div {:style {:background-color :white
-                    :height "1px"}
-            } ]
-     [:div {:style {:padding-top "50px"
-                    :font-size fw
-                    :line-height "1.1rem"
-                    :font-family "'Slabo 27px', serif"
-                    }}
-      [:div {:style {:display :grid
-                     :grid-gap "20px"}}
-       [:div
-        [:span {:style {:font-size "3rem"}} "“F"]
-        "ullstack developeing experience on mobile & IOT."]
-       [:div "Rapid developement with great reliability"]
-
-       [:div "Devops.. friendl" [:span {:style {:font-size "3rem"}} "y”"] ] ]]]))
+     [:div {:style (if  (= wsize :swall ) {} {:height "100px"})}
+      (r-link2 "#/about"  "Show Demo" fw align)
+      [:div {:style {:font-size (if (= wsize :swall) "1.4rem" "2.5rem")
+                     :font-family "'Slabo 27px', serif"
+                     :text-align align
+                     :padding "10px"}} "MD. ASHIK"]
+      (svg/cover-photo)
+      [:div {:style {:background-color :white
+                     :height "1px"}
+             } ]
+      [:div {:style {:text-align align}} "+8801717018083"]
+      [:div {:style {:background-color :white
+                     :height "1px"}
+             }]
+      [:div {:style {:text-align align
+                     :font-size "12px"}} "aryabhatiya.algebra@gmail.com"]
+      [:div {:style {:background-color :white
+                     :height "1px"}
+             } ]
+      [:div {:style {:padding-top "50px"
+                     :font-size fw
+                     :line-height "1.1rem"
+                     :font-family "'Slabo 27px', serif"
+                     }}
+       [:div {:style {:display :grid
+                      :grid-gap "20px"}}
+        [:div
+         [:span {:style {:font-size "3rem"}} "“F"]
+         "ullstack developeing experience on mobile & IOT."]
+        [:div "Rapid developement with great reliability"]
+
+        [:div "Devops.. friendl" [:span {:style {:font-size "3rem"}} "y”"] ] ]]]
+
+
+     [:div {:style  {:padding-top "50px"
+                     :font-size fw
+                     :line-height "1.1rem"
+                     :font-family "'Slabo 27px', serif"
+                     }} "H# 192, R# 5, Mirpur DOHS, Dhaka - 1216"]]))

 (rum/defc right-site [state]
   [:div {:style {:color "#fff"


add new options (after manual diffing) and sort

--- src/cljs_api_gen/options.clj
+++ src/cljs_api_gen/options.clj
@@ -9,73 +9,66 @@
 ;; $ git log -S :emit-constants --source --all

 (def compiler-options
-  {;; Common options
-   :output-to {:added "0.0-971"}
-   :output-dir {:added "0.0-971"}
-   :optimizations {:added "0.0-971"}
-   :main {:added "0.0-971"}
+  {:anon-fn-naming-policy {:added "0.0-2411"}
    :asset-path {:added "0.0-2727"}
-   :source-map {:added "0.0-1798"}
-   :verbose {:added "0.0-971"}
-   :pretty-print {:added "0.0-971"}
-   :target {:added "0.0-971"}
+   :browser-repl {:added "1.9.183"}
+   :cache-analysis {:added "0.0-2511"}
+   :cache-analysis-format {:added "1.9.456"}
+   :closure-defines {:added "0.0-2120"}
+   :closure-extra-annotations {:added "0.0-2814"}
+   :closure-generate-exports {:added "1.9.473"}
+   :closure-module-roots {:added "1.9.456"}
+   :closure-warnings {:added "0.0-2120"}
+   :compiler-stats {:added "0.0-2629"}
+   :dump-core {:added "1.7.10"}
+   :elide-asserts {:added "0.0-2156"}
+   :emit-constants {:added "0.0-2014"}
+   :externs {:added "0.0-971"}
    :foreign-libs {:added "0.0-971"}
-   :externs {:added "0.0-971"}
-   :modules {:added "0.0-2911"}
-   :preloads {:added "1.9.85"}
-
-   ;; Less Common Options
-   :source-map-path {:added "0.0-2060"}
-   :source-map-asset-path {:added "1.9.90"}
-   :source-map-timestamp {:added "0.0-2505"}
-   :cache-analysis {:added "0.0-2511"}
-   :recompile-dependents {:added "0.0-2814"}
-   :static-fns {:added "0.0-1424"}
-   :warnings {:added "0.0-1443"}
-   :elide-asserts {:added "0.0-2156"}
-   :pseudo-names {:added "0.0-2227"}
-   :print-input-delimiter {:added "0.0-971"}
-   :output-wrapper {:added "0.0-1513"}
-   :libs {:added "0.0-971"}
-   :preamble {:added "0.0-2127"}
    :hashbang {:added "0.0-2197"}
-   :compiler-stats {:added "0.0-2629"}
+   :infer-externs {:added "1.9.456"}
    :language-in {:added "0.0-2197"}
    :language-out {:added "0.0-2197"}
-   :closure-warnings {:added "0.0-2120"}
-   :closure-defines {:added "0.0-2120"}
-   :closure-extra-annotations {:added "0.0-2814"}
-   :anon-fn-naming-policy {:added "0.0-2411"}
+   :libs {:added "0.0-971"}
+   :main {:added "0.0-971"}
+   :modules {:added "0.0-2911"}
+   :npm-deps {:added "r1.9.518"}
+   :optimizations {:added "0.0-971"}
    :optimize-constants {:added "0.0-1877"}
+   :output-dir {:added "0.0-971"}
+   :output-to {:added "0.0-971"}
+   :output-wrapper {:added "0.0-1513"}
    :parallel-build {:added "1.7.189"}
-   :watch-fn {:added "0.0-3030"}
-   :watch-error-fn {:added "1.9.456"}
-   :npm-deps {:added "r1.9.518"}
-
-   ;; undocumented
-   :dump-core {:added "1.7.10"}
+   :preamble {:added "0.0-2127"}
+   :preloads {:added "1.9.85"}
+   :pretty-print {:added "0.0-971"}
+   :print-input-delimiter {:added "0.0-971"}
+   :pseudo-names {:added "0.0-2227"}
+   :recompile-dependents {:added "0.0-2814"}
+   :rewrite-polyfills {:added "1.9.562"}
+   :source-map {:added "0.0-1798"}
+   :source-map-asset-path {:added "1.9.90"}
+   :source-map-inline {:added "0.0-2911"}
+   :source-map-path {:added "0.0-2060"}
+   :source-map-timestamp {:added "0.0-2505"}
+   :static-fns {:added "0.0-1424"}
+   :target {:added "0.0-971"}
    :ups-externs {:added "0.0-993"}
    :ups-foreign-libs {:added "0.0-993"}
    :ups-libs {:added "0.0-993"}
+   :use-only-custom-externs {:added "0.0-971"}
+   :verbose {:added "0.0-971"}
    :warning-handlers {:added "1.7.10"}
-   :browser-repl {:added "1.9.183"}
-   :cache-analysis-format {:added "1.9.456"}
-   :infer-externs {:added "1.9.456"}
-   :closure-generate-exports {:added "1.9.473"}
-   :emit-constants {:added "0.0-2014"}
-   :use-only-custom-externs {:added "0.0-971"}})
+   :warnings {:added "0.0-1443"}
+   :watch-error-fn {:added "1.9.456"}
+   :watch-fn {:added "0.0-3030"}})

 (def repl-options
   {:analyze-path {:added "0.0-1552"}
-   :def-emits-var {:added "1.7.10"}
-   :repl-requires {:added "0.0-3115"}
-   :repl-verbose {:added "0.0-2719"}
-   :watch {:added "0.0-2850"}
-
-   ;; undocumented
    :bind-err {:added "0.0-3148"}
    :caught {:added "0.0-2911"}
    :compiler-env {:added "0.0-3148"}
+   :def-emits-var {:added "1.7.10"}
    :eval {:added "0.0-2911"}
    :flush {:added "0.0-2911"}
    :init {:added "0.0-2911"}
@@ -86,7 +79,10 @@
    :quit-prompt {:added "0.0-3148"}
    :read {:added "0.0-2911"}
    :reader {:added "0.0-2911"}
+   :repl-requires {:added "0.0-3115"}
+   :repl-verbose {:added "0.0-2719"}
    :source-map-inline {:added "0.0-2911"}
+   :watch {:added "0.0-2850"}
    :wrap {:added "0.0-2985"}})

 ;; Sub-options can complicate things. To keep it simple, we just assign a


Lookup the appropriate digest method once

Looking up the multimethod caused up to 10x slower performance for the
digest operation. Since we don't ever call it with different types of
arguments anyway, we can exploit that for a significant performance gain
(given that we call this function once per resource) by fetching the
appropriate method once, and then using that.

--- src/com/puppetlabs/utils.clj
+++ src/com/puppetlabs/utils.clj
@@ -180,12 +180,14 @@

 ;; ## Hashing

-(defn utf8-string->sha1
-  "Compute a SHA-1 hash for the UTF-8 encoded version of the supplied
-  string"
-  [s]
-  {:pre  [(string? s)]
-   :post [(string? %)]}
-  (-> s
-      (.getBytes "UTF-8")
-      (digest/sha-1)))
+;; This method lookup is surprisingly expensive (on the order of 10x slower),
+;; so we pay the cost once, and define our own digest in terms of it.
+(let [digest-func (get-method digest/digest :default)]
+  (defn utf8-string->sha1
+    "Compute a SHA-1 hash for the UTF-8 encoded version of the supplied
+    string"
+    [s]
+    {:pre [(string? s)]
+     :post [(string? %)]}
+    (let [bytes (.getBytes s "UTF-8")]
+      (digest-func "sha-1" [bytes]))))


Fixed bug, but it found the end game case

--- src/twentyfortyeight/logic.cljs
+++ src/twentyfortyeight/logic.cljs
@@ -51,7 +51,7 @@
   []
   (gen/fmap
    (fn [positions] (map (fn [p]{::position p ::value (gen/generate (s/gen ::value))}) positions))
-      (gen/set (gen/elements all-positions))))
+      (gen/set (gen/elements all-positions) {:min-elements 3})))

 (s/def ::game-board (s/with-gen
                       (s/and
@@ -121,8 +121,8 @@
   [direction tiles]
   (case direction
     ::up (map-indexed (fn [i t] (assoc-in t [::position ::y] i)) tiles)
-    ::down (map-indexed (fn [i t] (assoc-in t [::position ::y] board-size i )) tiles)
-    ::right (map-indexed (fn [i t] (assoc-in t [::position ::x] board-size )) (reverse tiles))
+    ::down (map-indexed (fn [i t] (assoc-in t [::position ::y] (- board-size (inc i) ))) tiles)
+    ::right (map-indexed (fn [i t] (assoc-in t [::position ::x] (- board-size (inc i) ))) (reverse tiles))
     ::left (map-indexed (fn [i t] (assoc-in t [::position ::x] i)) (reverse tiles))))

 (s/fdef random-open-position


Remove all instances of println

Remove all instances of println

--- src/monkey_music/wrapper.cljs
+++ src/monkey_music/wrapper.cljs
@@ -15,7 +15,6 @@
   (filter (comp nil? descendants) (descendants entity)))

 (defn str->entity [entity s]
-  (println entity s)
   (let [parsed-entity (keyword "monkey-music.core" s)]
     (if (isa? parsed-entity entity)
       parsed-entity


shutdown-agents

shutdown-agents

--- src/cyanite_fetcher/core.clj
+++ src/cyanite_fetcher/core.clj
@@ -97,22 +97,25 @@
   [session fetch! paths tenant rollup period from to]
   (let [futures
         (doall (map #(future
-                       (->> (alia/execute
-                             session fetch!
-                             {:values [% tenant (int rollup)
-                                       (int period)
-                                       from to]
-                              :fetch-size Integer/MAX_VALUE})
-                            (map detect-aggregate)
-                            (doall)
-                            (seq)))
+                       (try
+                         (->> (alia/execute
+                               session fetch!
+                               {:values [% tenant (int rollup)
+                                         (int period)
+                                         from to]
+                                :fetch-size Integer/MAX_VALUE})
+                              (map detect-aggregate)
+                              (doall)
+                              (seq))
+                         (catch Exception e
+                           (shutdown-agents)
+                           (throw e))))
                     paths))]
     (map deref futures)))

 (defn par-fetch-pmap
   "Fetch data in parallel fashion using pmap."
   [session fetch! paths tenant rollup period from to]
-
   (pmap (fn [path] (->> (alia/execute
                          session fetch!
                          {:values [path tenant (int rollup)
@@ -126,19 +129,15 @@
 (defn c-get-data
   "Get data from C*."
   [host paths tenant rollup period from to]
-  (try
-    (println "Connecting to Cassandra...")
-    (let [session (-> (alia/cluster {:contact-points [host]})
-                      (alia/connect keyspace))
-          fetch! (fetchq session)]
-      (println "Getting data form Cassandra...")
-      (let [data (time (doall (par-fetch-pmap session fetch! paths tenant
-                                              rollup period from to)))]
-        (newline)
-        data))
-    (catch Exception e
-      (shutdown-agents)
-      (throw e))))
+  (println "Connecting to Cassandra...")
+  (let [session (-> (alia/cluster {:contact-points [host]})
+                    (alia/connect keyspace))
+        fetch! (fetchq session)]
+    (println "Getting data form Cassandra...")
+    (let [data (time (doall (par-fetch session fetch! paths tenant
+                                       rollup period from to)))]
+      (newline)
+      data)))

 ;;------------------------------------------------------------------------------
 ;; ElasticSearch
@@ -376,7 +375,11 @@
   [chost eshost path tenant from to]
   (println "Start time:" (tl/format-local-time (tl/local-now) :rfc822))
   (newline)
-  (time (bench-itself chost eshost path tenant from to))
+  (try
+    (time (bench-itself chost eshost path tenant from to))
+    (catch Exception e
+      (shutdown-agents)
+      (throw e)))
   (newline)
   (println "Finish time:" (tl/format-local-time (tl/local-now) :rfc822)))


Use html form in login form

Use html form in login form

--- src/discuss/views/login.cljs
+++ src/discuss/views/login.cljs
@@ -19,19 +19,21 @@
                    (vlib/view-header (t :common :login))
                    (valerts/error-alert (om/props this))
                    [:p.text-center (t :login :hhu-ldap)]
-                   [:div.input-group
-                    [:span.input-group-addon (vlib/fa-icon "fa-user fa-fw")]
-                    [:input.form-control {:onChange #(om/update-state! this assoc :nickname (.. % -target -value))
-                                          :value nickname
-                                          :placeholder (t :login :nickname)}]]
-                   [:div.input-group
-                    [:span.input-group-addon (vlib/fa-icon "fa-key fa-fw")]
-                    [:input.form-control {:onChange #(om/update-state! this assoc :password (.. % -target -value))
-                                          :value password
-                                          :type :password
-                                          :placeholder (t :login :password)}]]
-                   [:button.btn.btn-default {:onClick #(auth/login nickname password)
-                                             :disabled (or (empty? nickname)
-                                                           (empty? password))}
-                    (t :common :login)]]))))
+                   [:form {:onSubmit #(do (.preventDefault %)
+                                          (auth/login nickname password))}
+                    [:div.input-group
+                     [:span.input-group-addon (vlib/fa-icon "fa-user fa-fw")]
+                     [:input.form-control {:onChange #(om/update-state! this assoc :nickname (.. % -target -value))
+                                           :value nickname
+                                           :placeholder (t :login :nickname)}]]
+                    [:div.input-group
+                     [:span.input-group-addon (vlib/fa-icon "fa-key fa-fw")]
+                     [:input.form-control {:onChange #(om/update-state! this assoc :password (.. % -target -value))
+                                           :value password
+                                           :type :password
+                                           :placeholder (t :login :password)}]]
+                    [:button.btn.btn-default {:type :submit
+                                              :disabled (or (empty? nickname)
+                                                            (empty? password))}
+                     (t :common :login)]]]))))
 (def login-form (om/factory LoginForm))


Fix bookmark toggle url.

Fix bookmark toggle url.

--- src/oc/storage/urls/entry.clj
+++ src/oc/storage/urls/entry.clj
@@ -21,7 +21,7 @@

 (defn bookmark
    [org-slug board-slug entry-uuid]
-   (str (entry org-slug board-slug entry-uuid) "/bookmark/"))
+   (str (entry org-slug board-slug entry-uuid) "/bookmark"))

 (defn revert
   [org-slug board-slug entry-uuid]


teach glob how to resolve tilde in paths

--- src/overtone/helpers/file.clj
+++ src/overtone/helpers/file.clj
@@ -34,7 +34,7 @@
   [parts]
   (apply str (interpose (file-separator) parts)))

-(defn resolve-abs-path
+(defn resolve-tilde-path
   [path]
   (cond
    (= "~" path)
@@ -50,7 +50,7 @@
   "Given a path to a directory, returns a seq of java.io.File objects
   representing the directory contents"
   [path]
-  (let [path (resolve-abs-path path)
+  (let [path (resolve-tilde-path path)
         f    (file path)]
     (if (.isDirectory f)
       (seq (.listFiles f))
@@ -102,4 +102,5 @@

   Examples: (glob \"*.{jpg,gif}\") (glob \".*\") (glob \"/usr/*/se*\")"
   [pattern]
-  (satta-glob/glob pattern))
+  (let [pattern (resolve-tilde-path pattern)]
+    (satta-glob/glob pattern)))


Specify that tap freq is in Hertz

Specify that tap freq is in Hertz

--- src/overtone/sc/cgens/tap.clj
+++ src/overtone/sc/cgens/tap.clj
@@ -10,7 +10,7 @@
 (defcgen tap
   "Tap the hell out of ugens for great win"
   [label {:doc "String label for this tap. Must be unique to a given synth."}
-   freq  {:doc "Frequency of tap value updates"}
+   freq  {:doc "Frequency of tap value updates in Hertz"}
    src   {:doc "Ugen to tap"}]
   "Allows you to tap arbitrary ugens within a given synth. The
   containing synth then automatically gets atoms for each ugen you tap


free schroeder-reverb synth on completion

--- src/overtone/examples/synthesis/fx.clj
+++ src/overtone/examples/synthesis/fx.clj
@@ -89,7 +89,7 @@
 ;; From Designing Sound in SuperCollider
 (defsynth schroeder-reverb
   [rate 1]
-  (let [input    (pan2 (play-buf 1 count-down rate) -0.5)
+  (let [input    (pan2 (play-buf 1 count-down rate :action FREE) -0.5)
         delrd    (local-in 4)
         output   (+ input [(first delrd) (second delrd)])
         sig      [(+ (first output) (second output)) (- (first output) (second output))


Associative结束

Associative结束

--- src/learnclojure/chapt3/core4.clj
+++ src/learnclojure/chapt3/core4.clj
@@ -67,6 +67,14 @@
 ;;我们可以使用find，它返回的是键值对如果map里包含指定的key的话，返回nil如果不包含这个key
 (find {:ethl nil} :ethl)
 (find {:ethl nil} :r)
+;;find也很容易和解构形式if-let，when-let一起用
+(if-let [e (find {:a 5 :b 6} :a)]
+  (format "found %s=>%s" (key e) (val e))
+  "not found")
+(if-let [[k v] (find {:a 5 :b 6} :a)]
+  (format "found %s=>%s" k v)
+  "not found")
+;;当被用在条件判断中的时候，false在关系型集合中和nil有同样的问题，解决方法和nil一样


Revert "Fixed test failure." to resolve merge conflict.

This reverts commit aa0a2d211cf0a1f67dae71ba2407465a9b067b44.

--- system-int-test/test/cmr/system_int_test/ingest/granule_parent_dependency_test.clj
+++ system-int-test/test/cmr/system_int_test/ingest/granule_parent_dependency_test.clj
@@ -102,7 +102,7 @@
         gran-for-iso-smap-coll (dg/granule iso-smap-coll gran-data)]
     (are [exp-errors gran]
          (= exp-errors
-            (flatten (keep (fn [error] (:errors error))
+            (flatten (map (fn [error] (:errors error))
                           (:errors (d/ingest "PROV1" gran {:format :echo10 :allow-failure? true})))))

          []
@@ -177,7 +177,7 @@

     (are [metadata-format]
          (= []
-            (flatten (keep (fn [error] (:errors error))
+            (flatten (map (fn [error] (:errors error))
                           (:errors (d/ingest "PROV1" coll {:format metadata-format
                                                            :allow-failure? true})))))
          :dif


(TK-33) Remove unused macro

(TK-33) Remove unused macro

Remove unused `with-target-and-proxy-servers-redirect` macro.

--- test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_proxy_test.clj
+++ test/clj/puppetlabs/trapperkeeper/services/webserver/jetty9_service_proxy_test.clj
@@ -69,29 +69,6 @@
          target-webserver#
          ~ring-handler
          "/hello"))
-     (with-app-with-config proxy-app#
-       [jetty9-service]
-       {:webserver ~proxy}
-       (let [proxy-webserver# (get-service proxy-app# :WebserverService)]
-         (if ~proxy-opts
-           (add-proxy-route proxy-webserver# ~proxy-config "/hello-proxy" ~proxy-opts)
-           (add-proxy-route proxy-webserver# ~proxy-config "/hello-proxy")))
-       ~@body)))
-
-(defmacro with-target-and-proxy-servers-redirect
-  [{:keys [target proxy proxy-config proxy-opts ring-handler-target ring-handler-redirect]} & body]
-  `(with-app-with-config proxy-target-app#
-     [jetty9-service]
-     {:webserver ~target}
-     (let [target-webserver# (get-service proxy-target-app# :WebserverService)]
-       (add-ring-handler
-         target-webserver#
-         ~ring-handler-target
-         "/hello")
-       (add-ring-handler
-         target-webserver#
-         ~ring-handler-redirect
-         "/redirect"))
      (with-app-with-config proxy-app#
        [jetty9-service]
        {:webserver ~proxy}


Fix #12, a regression when using default watcher.

--- src/main/clojure/hawk/watcher.clj
+++ src/main/clojure/hawk/watcher.clj
@@ -96,4 +96,5 @@

 (defmethod new-watcher :default [_]
   (new-watcher
-    (if (= "Mac OS X" (System/getProperty "os.name")) :barbary :java)))
+    {:watcher
+     (if (= "Mac OS X" (System/getProperty "os.name")) :barbary :java)}))


CMR-1765: Fix sorting test for keyword searches

--- system-int-test/test/cmr/system_int_test/search/collection_keyword_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_keyword_search_test.clj
@@ -231,13 +231,7 @@
            "?aser" [coll5 coll7 coll9 coll14]
            "p*ace" [coll6]
            "NEAR?REAL?TIME" [coll22]
-           "near?real?time" [coll22]
-
-           ;; sorted search by keywords
-           "Laser spoonA" [coll14 coll9]
-           "La?er spoonA" [coll14 coll9]
-           "L*er spo*A" [coll14 coll9]
-           "L?s* s?o*A" [coll14 coll9]))
+           "near?real?time" [coll22]))

     (testing "Boost on fields"
       (are [keyword-str scores] (= (map #(/ % 2.0) scores)
@@ -276,6 +270,19 @@

            ;; science-keywords
            (:category sk1) [k2e/science-keywords-boost]))
+
+    (testing "sorted search by keywords."
+      (are [keyword-str items]
+           (let [refs (search/find-refs :collection {:keyword keyword-str})
+                 matches? (d/refs-match-order? items refs)]
+             (when-not matches?
+               (println "Expected:" (map :entry-title items))
+               (println "Actual:" (map :name (:refs refs))))
+             matches?)
+           "Laser spoonA" [coll14 coll9]
+           "La?er spoonA" [coll14 coll9]
+           "L*er spo*A" [coll14 coll9]
+           "L?s* s?o*A" [coll14 coll9]))

     (testing "sorted search by keywords with sort keys."
       (are [keyword-str sort-key items]


find-ns and find-macros-ns should not return anything if ns doesn't exist

--- src/main/cljs/cljs/core.cljs
+++ src/main/cljs/cljs/core.cljs
@@ -9926,13 +9926,15 @@
    (Namespace. ns-obj sym)))

 (defn find-ns [ns]
-  (create-ns ns (find-ns-obj ns)))
+  (when-let [ns-obj (find-ns-obj ns)]
+    (create-ns ns ns-obj)))

 (defn find-macros-ns [ns]
   (let [ns (cond-> ns
              (not (gstring/contains (str ns) "$macros"))
              (-> (str "$macros") symbol))]
-    (create-ns ns (find-ns-obj ns))))
+    (when-let [ns-obj (find-ns-obj ns)]
+      (create-ns ns ns-obj))))

 (defn ns-name [ns-obj]
   (.-name ns-obj))


fix tests

fix tests

--- src/test/shadow/build/ns_form_test.clj
+++ src/test/shadow/build/ns_form_test.clj
@@ -161,7 +161,7 @@
            '{something {"react" alias$react}}})]

     (is (= 'alias$react (get-in ast-resolved [:requires 'react])))
-    (is (= '[goog shadow.cljs_helpers cljs.core alias$react] (:deps ast-resolved)))
+    (is (= '[goog #_ shadow.cljs_helpers cljs.core alias$react] (:deps ast-resolved)))
     ;; (pprint ast)
     ;; (pprint ast-resolved)
     ))
@@ -180,7 +180,7 @@
            '{react alias$react}})]

     (is (= 'alias$react (get-in ast-resolved [:requires 'react])))
-    (is (= '[goog shadow.cljs_helpers cljs.core alias$react] (:deps ast-resolved)))
+    (is (= '[goog #_ shadow.cljs_helpers cljs.core alias$react] (:deps ast-resolved)))
     ;; (pprint ast)
     ;; (pprint ast-resolved)
     ))


We now want the real core to be analyzed when hacking in the REPL, this is a hack that allows us to reuse the analyzer output.

--- test/cljs/go_test.clj
+++ test/cljs/go_test.clj
@@ -16,15 +16,24 @@
   (binding [pp/*print-right-margin* 80]
     (pp/pprint x)))

+(def core-env nil)
+
+(defn cache-core! []
+  (def core-env (env/ensure
+                 (cljs.compiler/with-core-cljs
+                   env/*compiler*))))
+
 (defmacro tdd [& body]
-  `(env/ensure
-    (with-fresh-ids
-      (def *ast (cljs->ast '[~@body]))
-      (def *go (s/trim (goimports (ast->go *ast))))
-      (def *ns (ana/get-namespace ana/*cljs-ns*))
-      (pp *ast)
-      (println)
-      (println *go))))
+  `(binding [env/*compiler* core-env]
+     (env/ensure
+      (cljs.compiler/with-core-cljs
+        (with-fresh-ids
+          (def *ast (cljs->ast '[~@body]))
+          (def *go (s/trim (goimports (ast->go *ast))))
+          (def *ns (ana/get-namespace ana/*cljs-ns*))
+          (pp *ast)
+          (println)
+          (println *go))))))

 (defn combined-output [out err]
   (s/replace (s/replace (str err out) "\r" "\n") "\n\t\t" ""))


Update for new lifecycle names

Update for new lifecycle names

--- test/onyx/plugin/bench_plugin_test.clj
+++ test/onyx/plugin/bench_plugin_test.clj
@@ -49,7 +49,6 @@

 (def counter (atom 0))
 (def retry-counter (atom 0))
-

 (defn my-inc [{:keys [n] :as segment}]
   (assoc segment :n (inc n)))
@@ -116,15 +115,16 @@
 (def start-time-millis (System/currentTimeMillis))

 (def bench-calls
-  {:lifecycle/before-task (fn inject-counter-before-task [event lifecycle]
-                            {:counter counter
-                             :retry-counter retry-counter})
+  {:lifecycle/before-task-start (fn inject-counter-before-task [event lifecycle]
+                                  {:counter counter
+                                   :retry-counter retry-counter})
    :lifecycle/after-batch (fn after-batch [event lifecycle]
                             (swap! (:counter event) + (count (:onyx.core/batch event)))
                             {})})

-(def in-calls {:lifecycle/before-task (fn inject-no-op-ch [event lifecycle]
-                                        {:core.async/chan (chan (dropping-buffer 1))})})
+(def in-calls
+  {:lifecycle/before-task-start (fn inject-no-op-ch [event lifecycle]
+                                  {:core.async/chan (chan (dropping-buffer 1))})})

 (def lifecycles
   [{:lifecycle/task :no-op
@@ -166,7 +166,8 @@

 (Thread/sleep bench-length)
-(println "Done at " start-time (java.util.Date.) @counter (float (* 1000 (/ @counter bench-length))) "/sec")
+(println "Done at " start-time (java.util.Date.) @counter
+         (float (* 1000 (/ @counter bench-length))) "/sec")

 (doseq [v-peer v-peers]
   (onyx.api/shutdown-peer v-peer))


minterms

minterms

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -1127,27 +1127,37 @@
           (map #(apply str %))))))

 ;;Veitch
-(defn torus [m]
-  (let [double-x (map #(vec (concat % %)) m)]
-    (vec (concat double-x double-x))))
-
-(defn get-in-tor [t [y x]]
-  (let [base (quot (count t) 2)]
-    (get-in t [(+ base y) (+ base x)])))
-
+(def mp [[1  1  1  1]
+         [5  6  7  8]
+         [9  10 11 12]
+         [1 14 15 16]])
+
 (defn divs [len x]
   (for [i (range 1 (inc len)) j (range 1 (inc len)) :when (= x (* i j))] [i j]))

 (defn pows [lim]
   (for [i (iterate #(* 2 %) 1) :while (< i lim)] i))

-(defn zone [ktor [start-y start-x] [y x]]
-  (for [dy (range y) dx (range x)]
-    (get-in-tor ktor [(- start-y dy) (- start-x dx)])))
-
-(defn zones [kmap point]
-  (let [ktor (torus kmap)
-        len (count kmap)
+(defn term [kmap [start-y start-x] [y x]]
+  (let [len (count kmap)]
+    (for [dy (range y) dx (range x)
+          :let [i (mod (+ start-y dy) len) j (mod (+ start-x dx) len)]]
+      [(get-in kmap [i j]) [i j]])))
+
+(defn minterm? [zone]
+  (every? #{1} (map first zone)))
+
+(defn minterms-iter [kmap point]
+  (let [len (count kmap)
         corners (mapcat #(divs len %) (pows (* len len)))]
-    (map #(zone ktor point %) corners)))
-
+    (->> (map #(term kmap point %) corners)
+         (filter #(minterm? %))
+         (map #(set (map second %))))))
+
+(defn minterms [kmap]
+  (let [len (count kmap)
+        ones (for [i (range len) j (range len)
+                   :when (= 1 (get-in kmap [i j]))] [i j])]
+    (mapcat #(minterms-iter kmap %) ones)))
+
+


That's not the thing that returns lists of tuples


Refactor, improve readability

Refactor, improve readability

--- test/greenyet/status_test.clj
+++ test/greenyet/status_test.clj
@@ -34,6 +34,9 @@
     :color "color"
     :components component-config}])

+(defmacro with-fake-resource [url resp-func & body]
+  `(fake/with-fake-routes-in-isolation {~url ~resp-func} ~@body))
+
 (defn- json-response [body]
   (fn [_]
     {:status 200
@@ -42,87 +45,87 @@

 (deftest test-with-status
   (testing "should return red for 500"
-    (fake/with-fake-routes-in-isolation {"http://the_host/not_found" (fn [_] {:status 500
-                                                                              :body ""})}
+    (with-fake-resource "http://the_host/not_found" (fn [_] {:status 500
+                                                             :body ""})
       (is (= :red
              (:color (sut/with-status a-host (a-url-config "http://%host%/not_found")))))))

   (testing "should return green for 200"
-    (fake/with-fake-routes-in-isolation {"http://the_host/found" (fn [_] {:status 200
-                                                                          :body ""})}
+    (with-fake-resource "http://the_host/found" (fn [_] {:status 200
+                                                         :body ""})
       (is (= :green
              (:color (sut/with-status a-host (a-url-config "http://%host%/found")))))))

   (testing "should return red for color red"
-    (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (json-response {:color "red"})}
+    (with-fake-resource "http://the_host/status.json" (json-response {:color "red"})
       (is (= :red
              (:color (sut/with-status a-host (a-url-config-with-color "http://%host%/status.json" "color")))))))

   (testing "should return yellow for color yellow"
-    (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (json-response {:color "yellow"})}
+    (with-fake-resource "http://the_host/status.json" (json-response {:color "yellow"})
       (is (= :yellow
              (:color (sut/with-status a-host (a-url-config-with-color "http://%host%/status.json" "color")))))))

   (testing "should return green for color green"
-    (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (json-response {:status "green"})}
+    (with-fake-resource "http://the_host/status.json" (json-response {:status "green"})
       (is (= :green
              (:color (sut/with-status a-host (a-url-config-with-color "http://%host%/status.json" "status")))))))

   (testing "should fail if status key is configured but no JSON is provided"
-    (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (fn [_] {:status 200
-                                                                                :body "some body"})}
+    (with-fake-resource "http://the_host/status.json" (fn [_] {:status 200
+                                                               :body "some body"})
       (is (= :red
              (:color (sut/with-status a-host (a-url-config-with-color "http://%host%/status.json" "status")))))))

   (testing "should only evaluate JSON if configured"
-    (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (json-response {:color "red"})}
+    (with-fake-resource "http://the_host/status.json" (json-response {:color "red"})
       (is (= :green
              (:color (sut/with-status a-host (a-url-config "http://%host%/status.json")))))))

   (testing "should return status from json-path config"
-    (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (json-response {:complex ["some garbage" {:color "yellow"}]})}
+    (with-fake-resource "http://the_host/status.json" (json-response {:complex ["some garbage" {:color "yellow"}]})
       (is (= :yellow
              (:color (sut/with-status a-host (a-url-config-with-color "http://%host%/status.json" {:json-path "$.complex[1].color"})))))))

   (testing "should return status with specific color for green status"
-    (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (json-response {:happy true})}
+    (with-fake-resource "http://the_host/status.json" (json-response {:happy true})
       (is (= :green
              (:color (sut/with-status a-host (a-url-config-with-color "http://%host%/status.json" {:json-path "$.happy"
                                                                                :green-value true})))))))

   (testing "should return status with specific color for yellow status"
-    (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (json-response {:status "pending"})}
+    (with-fake-resource "http://the_host/status.json" (json-response {:status "pending"})
       (is (= :yellow
              (:color (sut/with-status a-host (a-url-config-with-color "http://%host%/status.json" {:json-path "$.status"
                                                                                :yellow-value "pending"})))))))

   (testing "messages"
     (testing "simple 200 check"
-      (fake/with-fake-routes-in-isolation {"http://the_host/found" (fn [_] {:status 200
-                                                                            :body ""})}
+      (with-fake-resource "http://the_host/found" (fn [_] {:status 200
+                                                           :body ""})
         (is (= "OK"
                (:message (sut/with-status a-host (a-url-config "http://%host%/found")))))))

     (testing "for 500"
-      (fake/with-fake-routes-in-isolation {"http://the_host/error" (fn [_] {:status 500
-                                                                            :body "Internal Error"})}
+      (with-fake-resource "http://the_host/error" (fn [_] {:status 500
+                                                           :body "Internal Error"})
         (is (= "Status 500: Internal Error"
                (:message (sut/with-status a-host (a-url-config "http://%host%/error")))))))

     (testing "for 302"
-      (fake/with-fake-routes-in-isolation {"http://the_host/redirect" (fn [_] {:status 302
-                                                                               :body "Found"})}
+      (with-fake-resource "http://the_host/redirect" (fn [_] {:status 302
+                                                              :body "Found"})
         (is (= "Status 302: Found"
                (:message (sut/with-status a-host (a-url-config "http://%host%/redirect")))))))

     (testing "for internal exception"
-      (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (fn [_] {:status 200
-                                                                                :body "some body"})}
+      (with-fake-resource "http://the_host/status.json" (fn [_] {:status 200
+                                                                 :body "some body"})
         (is (some? (:message (sut/with-status a-host (a-url-config-with-color "http://%host%/status.json" "status")))))))

     (testing "should return message if configured"
-      (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (json-response {:status "green"
-                                                                                :message "up and running"})}
+      (with-fake-resource "http://the_host/status.json" (json-response {:status "green"
+                                                                        :message "up and running"})
         (is (= "up and running"
                (:message (sut/with-status a-host (a-url-config-with-status-and-message "http://%host%/status.json"
                                                                                "status"
@@ -130,25 +133,25 @@

   (testing "package-version"
     (testing "should extract value"
-      (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (json-response {:color "green"
-                                                                                :version "the-package-1.0.0"
-                                                                                :body ""})}
+      (with-fake-resource "http://the_host/status.json" (json-response {:color "green"
+                                                                        :version "the-package-1.0.0"
+                                                                        :body ""})
         (is (= "the-package-1.0.0"
                (:package-version (sut/with-status a-host (a-url-config-with-package-version "http://%host%/status.json"
                                                                                "version")))))))

     (testing "should handle missing value"
-      (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (json-response {:color "green"
-                                                                                :body ""})}
+      (with-fake-resource "http://the_host/status.json" (json-response {:color "green"
+                                                                        :body ""})
         (is (nil? (:package-version (sut/with-status a-host (a-url-config-with-package-version "http://%host%/status.json"
                                                                                "package-version"))))))))

   (testing "components"
     (testing "return all statuses"
-      (fake/with-fake-routes-in-isolation {"http://the_host/with_components.json" (json-response {:color "yellow"
-                                                                                :components [{:status "green"}
-                                                                                {:status "red"}
-                                                                                {:status "yellow"}]})}
+      (with-fake-resource "http://the_host/with_components.json" (json-response {:color "yellow"
+                                                                                :components [{:status "green"}
+                                                                                {:status "red"}
+                                                                                {:status "yellow"}]})
         (is (= [:green :red :yellow]
                (->> (sut/with-status a-host (a-url-config-with-components "http://the_host/with_components.json"
                                                                           {:json-path "$.components[*]"
@@ -156,10 +159,10 @@
                     :components
                     (map :color))))))
     (testing "handles complex color config"
-      (fake/with-fake-routes-in-isolation {"http://the_host/with_components.json" (json-response {:color "yellow"
-                                                                                :components [{:status "healthy"}
-                                                                                {:status "whatever"}
-                                                                                {:status "warning"}]})}
+      (with-fake-resource "http://the_host/with_components.json" (json-response {:color "yellow"
+                                                                                :components [{:status "healthy"}
+                                                                                {:status "whatever"}
+                                                                                {:status "warning"}]})
         (is (= [:green :red :yellow]
                (->> (a-url-config-with-components "http://the_host/with_components.json"
                                                   {:json-path "$.components[*]"
@@ -170,19 +173,19 @@
                     :components
                     (map :color))))))
     (testing "handles name"
-      (fake/with-fake-routes-in-isolation {"http://the_host/with_components.json" (json-response {:color "green"
-                                                                                :components [{:status "green"
-                                                                                :description "child 1"}]})}
+      (with-fake-resource "http://the_host/with_components.json" (json-response {:color "green"
+                                                                                :components [{:status "green"
+                                                                                :description "child 1"}]})
         (is (= [{:color :green :name "child 1" :message nil}]
                (:components (sut/with-status a-host (a-url-config-with-components "http://the_host/with_components.json"
                                                                                {:json-path "$.components[*]"
                                                                                :color "status"
                                                                                :name "description"})))))))
     (testing "handles message"
-      (fake/with-fake-routes-in-isolation {"http://the_host/with_components.json" (json-response {:color "green"
-                                                                                :components [{:status "green"
-                                                                                :description "child 1"
-                                                                                :textualStatus "swell"}]})}
+      (with-fake-resource "http://the_host/with_components.json" (json-response {:color "green"
+                                                                                :components [{:status "green"
+                                                                                :description "child 1"
+                                                                                :textualStatus "swell"}]})
         (is (= [{:color :green :name "child 1" :message "swell"}]
                (:components (sut/with-status a-host (a-url-config-with-components "http://the_host/with_components.json"
                                                                                {:json-path "$.components[*]"
@@ -191,6 +194,6 @@
                                                                                :message "textualStatus"}))))))))

   (testing "should return status url"
-    (fake/with-fake-routes-in-isolation {"http://the_host/status.json" (json-response {:color "red"})}
+    (with-fake-resource "http://the_host/status.json" (json-response {:color "red"})
       (is (= "http://the_host/status.json"
              (:status-url (sut/with-status a-host (a-url-config-with-color "http://%host%/status.json" "color"))))))))


Update tests for recent changes.

Update tests for recent changes.

--- test/cgdata/core_test.clj
+++ test/cgdata/core_test.clj
@@ -43,22 +43,22 @@
 (ct/deftest test-mutation-header
   (ct/is (=
           [:chrom :chromStart :chromEnd]
-          (cgdata/columns-from-header " chrom\tstart\tend" cgdata/mutation-columns)))
+          (cgdata/columns-from-header cgdata/mutation-columns " chrom\tstart\tend" [])))
   (ct/is (=
           [:genes :ref :alt]
-          (cgdata/columns-from-header "genes \tref\talternate" cgdata/mutation-columns)))
+          (cgdata/columns-from-header cgdata/mutation-columns "genes \tref\talternate" [])))
   (ct/is (=
           [:effect :dna-vaf :rna-vaf]
-          (cgdata/columns-from-header " effect \tDNA-VAF\tRNAVAF" cgdata/mutation-columns))))
+          (cgdata/columns-from-header cgdata/mutation-columns " effect \tDNA-VAF\tRNAVAF" []))))

 (ct/deftest test-pick-header
   (ct/is (=
-          " foo bar"
+          [2 " # foo bar"]
           (cgdata/pick-header [" " " \t" " # foo bar"]))))

 (ct/deftest test-pick-header-empty
   (ct/is (=
-          nil
+          [2 "12\t4.4"]
           (cgdata/pick-header [" " "\t" "12\t4.4"]))))

 (ct/deftest test-find-position-field


Place disabled class on li element rather than a element in nav-item

--- src/om_bootstrap/button.cljs
+++ src/om_bootstrap/button.cljs
@@ -52,9 +52,8 @@
                        {:active (:active? bs)
                         :btn-block (:block? bs)})]
     (cond
-     (:nav-item? bs) (d/li {:class (d/class-set {:active (:active? bs)})}
+     (:nav-item? bs) (d/li {:class (d/class-set {:active (:active? bs) :disabled? (:disabled? bs)})}
                            (render-anchor {:props props
-                                           :disabled? (:disabled? bs)
                                            :classes klasses}
                                           children))
      (or (:href props)