better idea

better idea

--- src/timsg/scene_var.clj
+++ src/timsg/scene_var.clj
@@ -1,4 +1,5 @@
 (ns timsg.scene-var
+  (:refer-clojure :exclude [def])
   (:use [arcadia.core])
   (:require [clojure.spec :as s]
             [clojure.core :as c]
@@ -62,17 +63,20 @@
           (str "Zero-argument arity of def-entity, if present, must return a GameObject; instead getting a " (type ent)))))
     ent))

+;; ==================================================
+;; never mind, just use a fucking var

-(defn init-entity [{:keys [name init update] :as init-spec}]
-  (-> (or (find-entity name)
-          (and init (run-init init name)))
+(defn init-entity [{:keys [kw init update] :as init-spec}]
+  (-> (or (find-entity kw)
+          (and init (run-init init kw)))
       (as-> ent
             (if update (update ent) ent)
-            (register-name ent name))))
-
+            (register-name ent kw))))

 ;; ============================================================
 ;; def-entity
+
+;; TODO: support for docs

 (s/def ::tail-impl
   (s/cat
@@ -90,7 +94,9 @@
   :args ::def-entity-args
   :ret any?)

-(defmacro def-entity [& args]
+(def pdf-log (atom nil))
+
+(defn- parse-def-form [args]
   (as/qwik-conform [{:keys [name tails] :as spec} ::def-entity-args args]
     (let [qualified-name  (symbol
                             (c/name (ns-name *ns*))
@@ -105,12 +111,40 @@
                              0 :init
                              1 :update)]
                      [k `(fn ~args ~@tail)])))
-          init-spec (assoc fmap :name qualified-kw)]
-      `(do (init-entity ~init-spec)
-           (defn ~name ^GameObject []
-             (find-entity ~qualified-kw))))))
+          init-spec (assoc fmap
+                      :kw qualified-kw
+                      :name qualified-name)]
+      init-spec)))

+(defmacro def-entity [& args]
+  (let [{:keys [name qualified-kw] :as init-spec} (parse-def-form args)]
+    `(do (init-entity ~init-spec)
+         (defn ~name ^GameObject []
+           (find-entity ~qualified-kw)))))

+;; ============================================================
+;; much simpler way, just uses def and vars
+
+(defn init-def
+  "Returns nil if the referenced object is destroyed. Maybe that's not a great idea."
+  [{:keys [name init update]
+    :as init-spec}]
+  (-> (or (when-let [v (resolve name)] ;; name is fully qualified
+            (and (bound? v)
+                 (when-let [v (var-get v)]
+                   (if (instance? UnityEngine.Object v)
+                     (obj-nil v)
+                     v))))
+          (and init (init)))
+      (as-> ent
+            (if update (update ent) ent))))
+
+(defmacro def [& args]
+  (let [{:keys [name] :as init-spec} (parse-def-form args)]
+    `(let [x# (init-def  ~(update init-spec :name #(list 'quote %)))]
+       (def ~name x#))))
+
+;; ============================================================
 ;; desired:

 (comment


making some privates public

making some privates public

--- src/timsg/scene_var.clj
+++ src/timsg/scene_var.clj
@@ -49,7 +49,7 @@
   (hook-replace obj :on-destroy ::scene-var #'handle-obj-destroy)
   (swap! name-registry #(put-name-obj % name obj)))

-(defn- find-entity [name]
+(defn find-entity [name]
   (-> @name-registry
       (get ::names->objs)
       (get name)))
@@ -63,7 +63,7 @@
     ent))

-(defn- init-entity [{:keys [name init update] :as init-spec}]
+(defn init-entity [{:keys [name init update] :as init-spec}]
   (-> (or (find-entity name)
           (and init (run-init init name)))
       (as-> ent


Fix time transit read handler.

Fix time transit read handler.

--- src/uxbox/util/time.clj
+++ src/uxbox/util/time.clj
@@ -24,8 +24,7 @@

 (def ^:private read-handler
   (t/read-handler
-   (fn [v] (-> (Long/parseLong v)
-               (Instant/ofEpochMilli)))))
+   (fn [v] (Instant/ofEpochMilli v))))

 (def +read-handlers+
   {"m" read-handler})


[#123] refresh takes too long

[#123] refresh takes too long

Moving to future

--- api/src/clojure/org/akvo/flow_api/endpoint/config_refresh.clj
+++ api/src/clojure/org/akvo/flow_api/endpoint/config_refresh.clj
@@ -6,7 +6,7 @@

 (defn endpoint* [akvo-flow-server-config]
   (POST "/config-refresh" _
-    (server-config-component/refresh! akvo-flow-server-config)
+    (future (server-config-component/refresh! akvo-flow-server-config))
     (response "ok")))

 (defn endpoint [{:keys [akvo-flow-server-config]}]


oops again

oops again

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@7232 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- sandbox/refs/src/refs/core.clj
+++ sandbox/refs/src/refs/core.clj
@@ -63,4 +63,4 @@
     para))

 (defn doi-to-pmcid [doi]
-  (-> doi doi-to-pmid pmid-to-pmcid doi))
+  (-> doi doi-to-pmid pmid-to-pmcid))


remove dead code

remove dead code

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -55,14 +55,6 @@
   (doseq [[nml key] gets]
     (let [val (nml-get tree nml key)]
       (println (if no-prefix val (str nml ":" key "=" val))))))
-
-;;(defn- nml-map [tree]
-;; (let [q  #(str "\"" % "\"")
-;;       f0 (fn [& nvsubseqs   ] (into {} nvsubseqs))
-;;       f1 (fn [dataref values] { (q (nml-str dataref)) (q (nml-str values)) })
-;;       f2 (fn [& stmts       ] (into {} stmts))
-;;       f3 (fn [name nvseq    ] { (q (nml-str name)) nvseq })]
-;;   (insta/transform {:nvseq f0 :nvsubseq f1 :s f2 :stmt f3 } tree)))

 (defn- nml-map [tree]
   (let [f0 (fn [& nvsubseqs   ] (into {} nvsubseqs))


Fast method for getting job-state when current-replica is cached (#889)

--- src/onyx/api.clj
+++ src/onyx/api.clj
@@ -474,10 +474,9 @@
   (fn [connector tenancy-id job-id]
     (type connector)))

-(defmethod job-state org.apache.curator.framework.imps.CuratorFrameworkImpl
-  [conn tenancy-id job-id]
-  (let [{:keys [alive? replica]} (onyx.log.zookeeper/current-replica conn tenancy-id job-id)
-        job-running? (and alive? (some #{job-id} (:jobs replica)))
+(defmethod job-state :default
+  [{:keys [alive? replica]} tenancy-id job-id]
+  (let [job-running? (and alive? (some #{job-id} (:jobs replica)))
         job-allocations (get-in replica [:allocations job-id])
         allocated-peers (reduce into [] (vals job-allocations))]
     (onyx.peer.log-version/check-compatible-log-versions! (:log-version replica))
@@ -493,14 +492,18 @@

       job-running?
       (assoc :job-state (if (empty? job-allocations)
-                           :unallocated
-                           :running))
+                          :unallocated
+                          :running))

       (boolean (some #{job-id} (:killed-jobs replica)))
       (assoc :job-state :killed)

       (boolean (some #{job-id} (:completed-jobs replica)))
       (assoc :job-state :completed))))
+
+(defmethod job-state org.apache.curator.framework.imps.CuratorFrameworkImpl
+  [conn tenancy-id job-id]
+  (job-state (onyx.log.zookeeper/current-replica conn tenancy-id job-id) tenancy-id job-id))

 (defmethod job-state OnyxClient
   [client tenancy-id job-id]


allow s3 snapshotting to be skipped for testing

--- src/wb_es/bulk/core.clj
+++ src/wb_es/bulk/core.clj
@@ -112,7 +112,7 @@
 (defn- scheduler-retry! [& args] (apply dq/retry! args))

-(defn run [& {:keys [db index-revision-number index-id]
+(defn run [& {:keys [db index-revision-number index-id skip-create-snapshot]
               :or {db (d/db datomic-conn)
                    index-revision-number 0
                    index-id (format "%s_v%s" release-id index-revision-number)}}]
@@ -335,11 +335,12 @@
           )
         )

-      (let [repository-name "s3_repository"]
-        (do
-          (connect-snapshot-repository repository-name)
-          (let [snapshot-id (get-next-snapshot-id repository-name release-id)]
-            (save-snapshot index-id repository-name snapshot-id))))
+      (if-not skip-create-snapshot
+        (let [repository-name "s3_repository"]
+          (do
+            (connect-snapshot-repository repository-name)
+            (let [snapshot-id (get-next-snapshot-id repository-name release-id)]
+              (save-snapshot index-id repository-name snapshot-id)))))
       )))


Removed superfluous :title parameter from balance sheet nav menu option.

--- src/wealthpulse/web.clj
+++ src/wealthpulse/web.clj
@@ -122,7 +122,7 @@
 (defn handle-nav
   "Handle Nav api request. No possible parameters."
   [journal]
-  {:reports [{:key "Balance Sheet" :title "Balance Sheet" :report "balance" :query "accountsWith=assets+liabilities&excludeAccountsWith=units&title=Balance+Sheet"}
+  {:reports [{:key "Balance Sheet" :title "Balance Sheet" :report "balance" :query "accountsWith=assets+liabilities&excludeAccountsWith=units"}
              {:key "Net Worth" :title "Net Worth" :report "networth" :query ""}
              {:key "Income Statement - Current Month" :title "Income Statement - Current Month" :report "balance" :query "accountsWith=income+expenses&period=this+month&title=Income+Statement"}
              {:key "Income Statement - Previous Month" :title "Income Statement - Previous Month" :report "balance" :query "accountsWith=income+expenses&period=last+month&title=Income+Statement"}]


TLD name transfer fix in Manage names section

--- src/name_bazaar/ui/events.cljs
+++ src/name_bazaar/ui/events.cljs
@@ -194,19 +194,19 @@
   :name/transfer-ownership
   interceptors
   (fn [{:keys [:db]} [name owner]]
-    {:dispatch
-     (if (top-level-name? name)
-       [:name-bazaar-registrar/transfer {:ens.record/label (name-label name)
-                                         :ens.record/owner owner}
-        {:result-href (path-for :route.ens-record/detail {:ens.record/name name})
-         :on-tx-receipt-n [[:ens.records/load [(namehash name)]
-                            {:load-resolver? true}]
-                           [:district0x.snackbar/show-message
-                            (gstring/format "Ownership of %s was transferred to %s"
-                                            name
-                                            (truncate owner 10))]]}]
-       [:ens/set-owner {:ens.record/name name
-                        :ens.record/owner owner}])}))
+    {:dispatch-n
+      [[:ens/set-owner {:ens.record/name name
+                        :ens.record/owner owner}]
+       (if (top-level-name? name)
+         [:name-bazaar-registrar/transfer {:ens.record/label (name-label name)
+                                           :ens.record/owner owner}
+          {:result-href (path-for :route.ens-record/detail {:ens.record/name name})
+           :on-tx-receipt-n [[:ens.records/load [(namehash name)]
+                             {:load-resolver? true}]
+                             [:district0x.snackbar/show-message
+                              (gstring/format "Ownership of %s was transferred to %s"
+                                              name
+                                              (truncate owner 10))]]}])]}))

 (reg-event-fx
   :saved-searches/add


update video info only if it is missing.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -46,7 +46,9 @@
   (bot/send-share-entry-trigger! (bot/->share-entry-trigger org board entry share-request user))))

 (defn- handle-video-data [conn entry]
-  (when (:video-id entry)
+  (when (and (:video-id entry)
+             (or (nil? (:video-processed entry))
+                 (nil? (:video-transcript entry))))
     (ziggeo/video (:video-id entry)
       (fn [video] (entry-res/update-video-data conn video entry)))))
 ;; ----- Validations -----


better checks for entry resource.

better checks for entry resource.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -91,9 +91,7 @@
     true)) ; no existing entry, so this will fail existence check later

 (defn- valid-entry-revert? [entry-props]
-  (if (:revision-id entry-props)
-    true
-    false))
+  (lib-schema/valid? schema/Int (:revision-id entry-props)))

 (defn- valid-share-requests? [conn entry-uuid share-props]
   (if-let* [existing-entry (entry-res/get-entry conn entry-uuid)
@@ -274,9 +272,7 @@
     :delete true})

   ;; Existentialism
-  :exists? (fn [ctx] (if-let* [_slugs? (and (slugify/valid-slug? org-slug)
-                                            (slugify/valid-slug? board-slug))
-                               org (or (:existing-org ctx)
+  :exists? (fn [ctx] (if-let* [org (or (:existing-org ctx)
                                        (org-res/get-org conn org-slug))
                                org-uuid (:uuid org)
                                board (or (:existing-board ctx)


Create solo group for inst solo butons and update state-atom on selection.

 TODO: (1) implement solo. solo button still has no effect on playback.
       (2) clear solo selection when clicking active solo button.

--- src/overtone/gui/sequencer.clj
+++ src/overtone/gui/sequencer.clj
@@ -21,6 +21,7 @@
                     {:inst  i
                      :param (-> i :params first :name)
                      :mute  false
+                     :solo  false
                      :value i-vals})))
    })

@@ -69,6 +70,14 @@
 (defn- toggle-row-mute
   [state row]
   (update-in state [:rows row :mute] not))
+
+(defn- toggle-row-solo
+  [state row]
+  (update-in state [:rows row :solo] not))
+
+(defn- get-row-solo
+  [state row]
+  (get-in state [:rows row :solo]))

 (defn- get-row-param
   [state row]
@@ -246,6 +255,11 @@
   (let [r (inst->index (:rows state) inst)]
     (toggle-row-mute state r)))

+(defn- on-solo-toggle
+  [state inst e]
+  (let [r (inst->index (:rows state) inst)]
+    (toggle-row-solo state r)))
+
 (defn- step-grid
   [state-atom]
   (let [state @state-atom
@@ -290,6 +304,9 @@
             :selection #(swap! state-atom on-param-selection inst %))
     (listen (select panel [:.mute])
             :selection #(swap! state-atom on-mute-toggle inst %))
+    (listen (select panel [:.solo])
+            :selection #(swap! state-atom on-solo-toggle inst %))
+
     panel))

 (defn step-sequencer
@@ -323,6 +340,9 @@
       (bind/bind bpm-spinner (bind/b-do [v] (metro :bpm v)))
       (bind/bind state-atom (bind/b-do [v] (repaint! grid)))

+      (swap! state-atom assoc-in [:solo-bg]
+             (button-group :buttons (select f [:.solo])))
+
       (listen play-btn :action
               (fn [e]
                 (let [playing? (:playing? (swap! state-atom toggle-playing))]


cache states after each indentation point to correctly determine when to stop processing after changed lines

--- src/parinfer/format/infer.cljc
+++ src/parinfer/format/infer.cljc
@@ -19,11 +19,14 @@
 (def initial-state
   "An initial state of our running state."
   {:lines []                           ;; final lines containing the inferenced closing delimiters.
-   :postline-states []
+   :postline-states []                 ;; state cache after each line
+   :postindent-states []               ;; state cache after each line's indentation point (nil if none)
+   :insert {:line-dy nil :x-pos nil}   ;; the place to insert closing delimiters whenever we hit appropriate indentation.
    :line-no -1                         ;; current line number we are processing.
+
+   ;; transient line vars
    :track-indent? false                ;; "true" when we are looking for the first char on a line to signify indentation.
    :delim-trail {:start nil :end nil}  ;; track EOL delims since we replace them wholesale with inferred delims.
-   :insert {:line-dy nil :x-pos nil}   ;; the place to insert closing delimiters whenever we hit appropriate indentation.
    :stack []                           ;; the delimiter stack, maps of [:x-pos :ch :indent-delta]
    :backup []})                          ;; trailing delims that are pushed back onto the stack at EOL

@@ -57,8 +60,7 @@
          line-no (+ (:line-no state) line-dy)
          state (-> state
                     (update-in [:lines line-no] insert-string x-pos delims)
-                    (assoc :track-indent? false
-                           :stack stack))]
+                    (assoc :stack stack))]
      state)))

 (defn update-delim-trail
@@ -210,6 +212,16 @@
     (cond-> state
       insert (assoc :insert insert))))

+(defn get-cached-state
+  [state]
+  (select-keys state [:stack :insert]))
+
+(defn commit-cached-state
+  "Cache a subset of the state after some event.
+  This is used by process-text-change."
+  [state key-]
+  (update state key- conj (get-cached-state state)))
+
 (defn process-indent
   "Update the state by handling a possible indentation trigger.

@@ -233,8 +245,13 @@
         skip? (and check-indent? (closing-delim? ch))
         at-indent? (and check-indent? (not skip?))
         state (assoc state :process? (not skip?))]
-    (cond-> state
-      at-indent? (close-delims x-pos))))
+    (if at-indent?
+      (-> state
+          (close-delims x-pos)
+          (commit-cached-state :postindent-states)
+          (assoc :track-indent? false
+                 :processed-indent? true))
+      state)))

 (defn update-line
   "Update the state by adding processed character to the line."
@@ -249,13 +266,6 @@
   (cond-> state
     (= 0 (:line-dy insert))
     (assoc-in [:insert :line] (get lines line-no))))
-
-(defn cache-postline-state
-  "Cache a subset of the state after the current line has been processed.
-  This is used by process-text-change."
-  [state]
-  (let [cached (select-keys state [:stack :insert])]
-    (update state :postline-states conj cached)))

 (defn process-char*
   [state]
@@ -285,6 +295,7 @@
                   :cursor-in-comment? false
                   :delim-trail {:start nil :end nil}
                   :track-indent? (and (seq stack) (not (in-str? stack)))
+                  :processed-indent? false
                   :lines (conj lines "")
                   :line-no line-no
                   :removed-delims [])
@@ -294,7 +305,13 @@
                    block-delim-trail
                    remove-delim-trail
                    save-preinsert-line
-                   cache-postline-state)]
+                   (commit-cached-state :postline-states))
+
+         ;; if this did not have an indentation trigger point,
+         ;; pad postindent-states with a nil.
+         state (cond-> state
+                 (not (:processed-indent? state))
+                 (update :postindent-states conj nil))]
      state)))

 (defn finalize-state
@@ -349,6 +366,7 @@
                   (update :lines pop) ;; to restore the version of the line _with_ its trailing delims
                   (update :lines into (safe-subvec (:lines prev-state) last-i))
                   (update :postline-states into (safe-subvec (:postline-states prev-state) (inc last-i)))
+                  (update :postindent-states into (safe-subvec (:postindent-states prev-state) (inc last-i)))
                   (merge (last (:postline-states prev-state))))
         state (-> state
                   (assoc :line-no (dec (count (:lines state))))
@@ -360,9 +378,9 @@
   'reduced' will halt further processing."
   [prev-state state [old-i line cache]]
   (let [state (process-line state line)
-        new-cache (last (:postline-states state))
+        new-cache (last (:postindent-states state))
         more? (< (inc old-i) (count (:lines prev-state)))
-        can-skip? (= new-cache cache)]
+        can-skip? (and new-cache (= new-cache cache))]
     (if (and can-skip? more?)
       (reduced (fill-rest-with-cache prev-state state old-i))
       state)))
@@ -374,12 +392,13 @@
           (map vector
                (iterate inc start-i) ;; old line numbers
                (safe-subvec (:lines prev-state) start-i) ;; old lines
-               (safe-subvec (:postline-states prev-state) start-i))))
+               (safe-subvec (:postindent-states prev-state) start-i))))

 (defn initial-cached-state
   "build an initial state based on our starting line and previous cache."
-  [{:keys [lines postline-states] :as prev-state} overrides i]
+  [{:keys [lines postline-states postindent-states] :as prev-state} overrides i]
   (let [line-data {:lines (subvec lines 0 i)
+                   :postindent-states (subvec postindent-states 0 i)
                    :postline-states (subvec postline-states 0 i)
                    :line-no (dec i)}
         last-cache (get postline-states (dec i))]


Make tiled-map-cell consistent with the other macros

--- src/play_clj/core_graphics.clj
+++ src/play_clj/core_graphics.clj
@@ -119,23 +119,24 @@
 (defn tiled-map-cell*
   ([]
     (TiledMapTileLayer$Cell.))
-  ([screen layer x y]
-    (.getCell ^TiledMapTileLayer (tiled-map-layer screen layer) x y)))
+  ([^TiledMapTileLayer layer x y]
+    (.getCell layer x y)))

 (defmacro tiled-map-cell
   "Returns a [TiledMapTileLayer.Cell](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/maps/tiled/TiledMapTileLayer.Cell.html)
-from the tiled map in `screen` from the given `layer` and position `x` and `y`.
-
-    (tiled-map-cell screen \"water\" 0 0)"
-  [screen layer x y & options]
-  `(let [^TiledMapTileLayer$Cell object# (tiled-map-cell* ~screen ~layer ~x ~y)]
+from the `layer` at position `x` and `y`.
+
+    (tiled-map-cell (tiled-map-layer screen \"water\") 0 0)"
+  [layer x y & options]
+  `(let [^TiledMapTileLayer$Cell object# (tiled-map-cell* ~layer ~x ~y)]
      (u/calls! object# ~@options)))

 (defmacro tiled-map-cell!
   "Calls a single method on a `tiled-map-cell`.

-    (tiled-map-cell! (tiled-map-cell screen \"water\" 0 0)
-                     :set-rotation 90)"
+    (-> (tiled-map-layer screen \"water\")
+        (tiled-map-cell 0 0)
+        (tiled-map-cell! :set-rotation 90))"
   [object k & options]
   `(u/call! ^TiledMapTileLayer$Cell ~object ~k ~@options))


indenting

indenting

--- test/celestial/test/actions.clj
+++ test/celestial/test/actions.clj
@@ -7,34 +7,21 @@
     [celestial.fixtures.core :refer (with-m?)]
     remote.capistrano)
   (:use midje.sweet)
-  (:import clojure.lang.ExceptionInfo)
-  )
+  (:import clojure.lang.ExceptionInfo))

 (fact "actions to remoter construction"
-      (let [cap (rconstruct redis-deploy {:target "192.168.5.31"})]
-        cap  => (contains  {:args ["deploy" "-s" "hostname=192.168.5.31"]
-                            :src  "git://github.com/narkisr/cap-demo.git"})))
-
+  (rconstruct redis-deploy {:target "192.168.5.31"}) =>
+    (contains {:args ["deploy" "-s" "hostname=192.168.5.31"]
+               :src  "git://github.com/narkisr/cap-demo.git"}))

 (fact "action validations"
-      (with-redefs [type-exists? (fn [_] true)]
+  (with-redefs [type-exists? (fn [_] true)]
+    (validate-action redis-deploy)  => truthy
+    (validate-action (assoc-in redis-deploy [:capistrano :args] nil)) =>
+    (throws ExceptionInfo (with-m? {:args '("must be present")}))
+    (validate-action (assoc-in redis-deploy [:actions :stop :supernal :args] nil)) => truthy)

-        (validate-action redis-deploy)  => truthy
-
-        (validate-action (assoc-in redis-deploy [:capistrano :args] nil)) =>
-        (throws ExceptionInfo (with-m? {:args '("must be present")}))
-
-        (validate-action (assoc-in redis-deploy [:actions :stop :supernal :args] nil)) => truthy
-
-        )
-
-      (fact "missing type"
-            (validate-action (assoc redis-deploy :operates-on "foo")) =>
-            (throws ExceptionInfo (with-m? {:operates-on  '("type not found, create it first")}))
-            (provided
-              (type-exists? anything)  => false
-              )
-            )
-
-
-      )
+   (fact "missing type"
+     (validate-action (assoc redis-deploy :operates-on "foo")) =>
+     (throws ExceptionInfo (with-m? {:operates-on  '("type not found, create it first")}))
+     (provided (type-exists? anything)  => false)))


Test parse-float

Test parse-float

--- test/clj_mrazik/config_test.clj
+++ test/clj_mrazik/config_test.clj
@@ -32,3 +32,8 @@
     (testing "if the clj-mrazik.config/parse-int definition exists."
         (is (callable? 'clj-mrazik.config/parse-int))))

+(deftest test-parse-float-existence
+    "Check that the clj-mrazik.config/parse-float definition exists."
+    (testing "if the clj-mrazik.config/parse-float definition exists."
+        (is (callable? 'clj-mrazik.config/parse-float))))
+


Hooked up silhouette for picking optimal K value

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -62,6 +62,7 @@
                           :pca-iters 10
                           :base-iters 10
                           :base-k 50
+                          :max-k 12
                           :group-iters 10}
                     opts))

@@ -110,7 +111,15 @@
                         (take 7
                           (sort-by (comp - second) user-vote-counts)))
                       in-conv)))
-                         })
+  ; End of base conv update
+  })
+
+
+(defn max-k-fn
+  [data max-max-k]
+  (min max-max-k
+    (max 2
+      (int (/ (count (rownames data)) 3)))))

 (def small-conv-update-graph
@@ -146,26 +155,60 @@
                       :last-clusters (:base-clusters conv)
                       :cluster-iters (:base-iters opts')))))))

-       :group-clusters
-            (plmb/fnk [conv rating-mat base-clusters opts']
-              (time2 "group-clusters"
-                (greedy
-                (sort-by :id
-                  (kmeans (xy-clusters-to-nmat2 base-clusters)
-                    (choose-group-k base-clusters)
-                    :last-clusters (:group-clusters conv)
-                    :cluster-iters (:group-iters opts'))))))
-
-       :bid-to-pid (plmb/fnk [base-clusters]
+      :base-clusters-proj
+            (plmb/fnk [base-clusters]
+              (xy-clusters-to-nmat2 base-clusters))
+
+      :bucket-dists
+            (plmb/fnk [base-clusters-proj]
+              (time2 "bucket-dists"
+                (named-dist-matrix base-clusters-proj)))
+
+      ; Compute group-clusters for multiple k values
+      :group-clusterings
+            (plmb/fnk [conv base-clusters-proj opts']
+              (into {}
+                ; XXX - should test pmap out
+                (map
+                  (fn [k]
+                    [k
+                      (sort-by :id
+                        (time2 (str "group-clusters-k=" k)
+                        (kmeans base-clusters-proj k
+                          :last-clusters
+                            ; A little pedantic here in case no clustering yet for this k
+                            (let [last-clusterings (:group-clusterings conv)]
+                              (if last-clusterings
+                                (last-clusterings k)
+                                last-clusterings))
+                          :cluster-iters (:group-iters opts'))))])
+                  (range 2 (inc (max-k-fn base-clusters-proj (:max-k opts')))))))
+
+      ; Compute silhouette values for the various clusterings
+      :group-clusterings-silhouettes
+            (plmb/fnk [group-clusterings bucket-dists]
+              (into {}
+                (map
+                  (fn [[k clsts]]
+                    [k (silhouette bucket-dists clsts)])
+                  group-clusterings)))
+
+      ; Here we just pick the best K value, based on silhouette
+      :group-clusters
+            (plmb/fnk [group-clusterings group-clusterings-silhouettes]
+              (get group-clusterings
+                (max-key group-clusterings-silhouettes (keys group-clusterings))))
+
+      :bid-to-pid (plmb/fnk [base-clusters]
                      (time2 "bid-to-pid"
                       (greedy
                        (map :members (sort-by :id base-clusters)))))

-       ;;; returns {tid {
-       ;;;           :agree [0 4 2 0 6 0 0 1]
-       ;;;           :disagree [3 0 0 1 0 23 0 ]}
-       ;;; where the indices in the arrays are bids
-       :votes-base (plmb/fnk [bid-to-pid rating-mat]
+      ;; returns {tid {
+      ;;           :agree [0 4 2 0 6 0 0 1]
+      ;;           :disagree [3 0 0 1 0 23 0 ]}
+      ;; where the indices in the arrays are bids
+      :votes-base (plmb/fnk [bid-to-pid rating-mat]
                      (time2 "votes-base"
                        (->> rating-mat
                           colnames
@@ -175,8 +218,8 @@
                               :D (agg-bucket-votes-for-tid bid-to-pid rating-mat disagree? tid)}))
                           (reduce (fn [o entry] (assoc o (:tid entry) (dissoc entry :tid)))))))

-       ; End of large-update
-       }))
+     ; End of large-update
+     }))

@@ -220,6 +263,7 @@
   "Same as small-conv-update-graph, but uses mini-batch PCA"
   (merge small-conv-update-graph
     {:pca (plmb/fnk [conv mat opts']
+            (time2 "mb-pca"
             (let [n-ptpts (matrix/dimension-count mat 0)
                   sample-size (sample-size n-ptpts)]
               (loop [pca (:pca conv) iter (:pca-iters opts')]
@@ -227,7 +271,7 @@
                       pca          ((partial-pca mat pca rand-indices) pca)]
                   (if (= iter 0)
                     (recur pca (dec iter))
-                    pca)))))}))
+                    pca))))))}))

 (def small-conv-update (graph/eager-compile small-conv-update-graph))
@@ -238,7 +282,7 @@
   "This function dispatches to either small- or large-conv-update, depending on the number
   of participants (as decided by call to sample-size-fn)."
   [conv votes & {:keys [med-cutoff large-cutoff]
-                                 :or {med-cutoff 100 large-cutoff 1000}
+                                 :or {med-cutoff 100 large-cutoff 10000}
                                  :as opts}]
   (println "\nStarting new conv update!")
   (try
@@ -247,7 +291,7 @@
       (println "N-ptpts:" n-ptpts)
       ; dispatch to the appropriate function
       ((cond
-         (> n-ptpts 999)   large-conv-update
+         (> n-ptpts large-cutoff)   large-conv-update
          :else             small-conv-update)
             {:conv conv :votes votes :opts opts}))
     (catch Exception e


fixing card api unit test to account for the fact that we are now hydrating :creator on card api fetches.

--- test/metabase/api/card_test.clj
+++ test/metabase/api/card_test.clj
@@ -80,6 +80,15 @@
          :organization_id nil
          :name card-name
          :creator_id (user->id :rasta)
+         :creator (match-$ (fetch-user :rasta)
+                    {:common_name "Rasta Toucan",
+                     :is_superuser false,
+                     :last_login $,
+                     :last_name "Toucan",
+                     :first_name "Rasta",
+                     :date_joined $,
+                     :email "rasta@metabase.com",
+                     :id $})
          :updated_at $
          :dataset_query {:type "query"
                          :query {:source_table (table->id :categories)


Use correct builder fn

Use correct builder fn

--- test/onyx/plugin/input_test.clj
+++ test/onyx/plugin/input_test.clj
@@ -73,7 +73,7 @@
     :onyx/batch-size 100}

    {:onyx/name :out
-    :onyx/plugin :onyx.plugin.core-async/write-messages
+    :onyx/plugin :onyx.plugin.core-async/output
     :onyx/type :output
     :onyx/medium :core.async
     :onyx/batch-size 100


modified core.cljs to use bootstrap in dynamic html

--- src/saved_for_reddit/core.cljs
+++ src/saved_for_reddit/core.cljs
@@ -31,25 +31,28 @@
   value)

 (defn error-html []
-  [:div [:h4 "Error"]
-   [:pre @error-msg]
-   [:input {:type "button" :value "Clear app LocalStorage and refresh!"
-            :on-click (fn [] (alandipert.storage-atom/remove-local-storage! :saved-for-reddit-app-state)
-                        (set! (.-location js/window) "/"))}]])
+  [:div {:class "row"}
+   [:div {:class "col-md-12"}
+    [:h4 "Error"]
+    [:div {:class "alert alert-danger" :role "alert"}
+     [:pre @error-msg]]
+    [:input {:type "button" :value "Clear app LocalStorage and refresh!"
+             :on-click (fn [] (alandipert.storage-atom/remove-local-storage! :saved-for-reddit-app-state)
+                         (set! (.-location js/window) "/"))}]]])

 (defn post-html [p]
-  [:li
-   [:a {:href (if (nil? (:title p)) (:link_url p) (:url p))}
-    [:span (if (nil? (:title p)) (:link_title p) (:title p))]]
-   [:ul
-    [:li [:span (:subreddit p)]]
-    [:li [:span (:author p)]]]
-   (if (nil? (:title p)) (map hickory/as-hiccup (hickory/parse-fragment (gstring/unescapeEntities (:body_html p)))))])
+  [:div {:class "panel panel-default" :href (if (nil? (:title p)) (:link_url p) (:url p))}
+   [:div {:class "panel-heading"}
+    [:h4 {:class "panel-title"}
+     (if (nil? (:title p)) (:link_title p) (:title p)) " "
+     [:a {:href (str "https://www.reddit.com/r/" (:subreddit p))} [:span {:class "badge"} (:subreddit p)]]]]
+   [:div {:class "panel-body"}
+    [:small  [:a {:href (str "https://www.reddit.com/user/" (:author p))} [:small (:author p)]]]]])

 (defn main-html []
-  [:div
+  [:div {:class "col-md-12"}
    [:h4 "Saved Posts"]
-   [:ol
+   [:div {:class "list-group"}
     (for [p @saved-posts]
       [post-html p])]
    [:p "Reddit API Token: "
@@ -131,7 +134,7 @@
       (if (and (nil? code) (clojure.string/blank? (:token @app-state))) ;; code query param is not present or the token is blank in HTML5 localStorage
         (set! (.-location js/window) (gen-reddit-auth-url client-id redirect-uri "abcdef")) ;; redirect to reddit for requesting authorization
         (do
-          (r/render-component [main-html] (dommy/sel1 :#status))
+          (r/render-component [main-html] (dommy/sel1 :#app))
           (if (not (clojure.string/blank? (:token @app-state)))
             (do
               (process-after-token-acquire))


adding valid email test

adding valid email test

--- resources/leiningen/new/closp/integtest/clj/web/setup.clj
+++ resources/leiningen/new/closp/integtest/clj/web/setup.clj
@@ -6,7 +6,8 @@
             [{{ns}}.components.server :refer [new-web-server new-web-server-prod]]
             [{{ns}}.components.handler :refer [new-handler]]
             [{{ns}}.components.config :as c]
-            [{{ns}}.components.db :refer [new-db]]))
+            [{{ns}}.components.db :refer [new-db]]
+            [joplin.core :as j]))

 (def db-uri "jdbc:sqlite:./db/{{name}}-integ-test.sqlite")
 (def migrators "resources/migrators/sqlite")


Added five tests into file_utils_test.clj

--- test/emender_jenkins/file_utils_test.clj
+++ test/emender_jenkins/file_utils_test.clj
@@ -23,3 +23,35 @@
     [function-name]
     (clojure.test/function? function-name))

+
+(deftest test-print-slurp-exception-existence
+    "Check that the emender-jenkins.file-utils/print-slurp-exception definition exists."
+    (testing "if the emender-jenkins.file-utils/print-slurp-exception definition exists."
+        (is (callable? 'emender-jenkins.file-utils/print-slurp-exception))))
+
+
+(deftest test-slurp--existence
+    "Check that the emender-jenkins.file-utils/slurp- definition exists."
+    (testing "if the emender-jenkins.file-utils/slurp- definition exists."
+        (is (callable? 'emender-jenkins.file-utils/slurp-))))
+
+
+(deftest test-silent-slurp-existence
+    "Check that the emender-jenkins.file-utils/silent-slurp definition exists."
+    (testing "if the emender-jenkins.file-utils/silent-slurp definition exists."
+        (is (callable? 'emender-jenkins.file-utils/silent-slurp))))
+
+
+(deftest test-new-file-existence
+    "Check that the emender-jenkins.file-utils/new-file definition exists."
+    (testing "if the emender-jenkins.file-utils/new-file definition exists."
+        (is (callable? 'emender-jenkins.file-utils/new-file))))
+
+
+(deftest test-make-temporary-log-file-name-existence
+    "Check that the emender-jenkins.file-utils/make-temporary-log-file-name definition exists."
+    (testing "if the emender-jenkins.file-utils/make-temporary-log-file-name definition exists."
+        (is (callable? 'emender-jenkins.file-utils/make-temporary-log-file-name))))
+
+
+


(PE-3909) Remove unnecessary try/catch blocks in a couple of tests

This commit removes some unnecessary error handling in catch blocks for
tests which are not expected to throw any exceptions.

--- test/puppetlabs/master/services/jruby/jruby_pool_test.clj
+++ test/puppetlabs/master/services/jruby/jruby_pool_test.clj
@@ -93,12 +93,7 @@
              background."
       (is (= (free-instance-count pool production-pool-desc) 0)))

-    (try
-      (prime-pools! pool)
-      (catch Throwable t
-        (.printStackTrace t)
-        (throw t)))
-
+    (prime-pools! pool)

     (testing "Borrowing all instances from a pool while it is being primed and
              returning them."
@@ -169,13 +164,7 @@
         test-size 2
         config (testutils/jruby-puppet-config-with-prod-test-env prod-size test-size)
         pool (create-pool-context config)]
-
-    (try
-      (prime-pools! pool)
-      (catch Throwable t
-        (.printStackTrace t)
-        (throw t)))
-
+    (prime-pools! pool)
     (testing "Borrowing all instances from each pool"
       (let [all-prod-instances (drain-pool pool production-pool-desc prod-size)
             all-test-instances (drain-pool pool test-pool-desc       test-size)]


Unused import in clojure code

Unused import in clojure code

--- atlasdb-jepsen-tests/src/jepsen/atlasdb/timelock.clj
+++ atlasdb-jepsen-tests/src/jepsen/atlasdb/timelock.clj
@@ -2,8 +2,7 @@
   (:require [clojure.tools.logging :refer :all]
             [jepsen.control :as c]
             [jepsen.db :as db]
-            [jepsen.os.debian :as debian])
-  (:import com.palantir.atlasdb.http.TimelockUtils))
+            [jepsen.os.debian :as debian]))

 (defn create-db
   "Creates an object that implements the db/DB protocol.


Some coloring and moving of initial setup

--- src/main/clj/clojure_club/stateful_apps/wmatson/core.clj
+++ src/main/clj/clojure_club/stateful_apps/wmatson/core.clj
@@ -26,24 +26,26 @@
 (defrecord LanternaIO [screen]
   gs/IODevice
   (get-input [{:keys [screen]}]
-    (input->axis (ls/get-key-blocking screen)))
+    (input->axis (ls/get-key-blocking screen {:interval 100 :timeout 1000})))
   (display [{:keys [screen]} game]
     (let [size (ls/get-size screen)
           [player-x player-y] (map #(/ % 2) size)
           enemies-xy (enemies->xyg (:enemies game) player-x player-y)]
       (ls/clear screen)
-      (ls/put-string screen player-x player-y "+")
+      (ls/put-string screen player-x player-y "+" {:fg :green :bg :black})
       (ls/move-cursor screen player-x player-y)
       (doseq [[x y g] enemies-xy]
-        (ls/put-string screen x y (str g)))
+        (ls/put-string screen x y (str g) {:bg :red :fg :yellow}))
       (ls/redraw screen))))

 (def test-game
   (gs/->Game []
-             [(gs/->Enemy 0 5 \A)
-              (gs/->Enemy 1 4 \W)
-              (gs/->Enemy 2 3 \D)
-              (gs/->Enemy 3 2 \S)]))
+             [(gs/->Enemy 0 10 \A)
+              (gs/->Enemy 0 9 \A)
+              (gs/->Enemy 0 8 \A)
+              (gs/->Enemy 1 8 \W)
+              (gs/->Enemy 2 6 \D)
+              (gs/->Enemy 3 4 \S)]))

 (defn main- []
   (let [scr (ls/get-screen)


Enable loading of single submission OSM data

--- src/hatti/ona/post_process.cljs
+++ src/hatti/ona/post_process.cljs
@@ -56,16 +56,21 @@
   (let [osm-fields (filter forms/osm? form)]
     (when-not (empty? osm-fields)
       (let [data (get-in app-state [:map-page :data])
-            osm-id->osm-data (osm-id->osm-data data form osm-xml)
+            osm-data (osm-id->osm-data data form osm-xml)
             osm-val->osm-id #(re-find #"[-]?[0-9]+" %)
             osm-val->osm-data (fn [osm-val]
-                                (when osm-val
-                                  (osm-id->osm-data
-                                   (osm-val->osm-id osm-val))))
+                                ;; The OSM-val can be either a string or a
+                                ;; precomputed osm-data value. This condition
+                                ;; ensures only strings are parsed for OSM ids
+                                (if (string? osm-val)
+                                  (osm-data
+                                   (osm-val->osm-id osm-val))
+                                  osm-val))
             updater (fn [osm-key]
                       (fn [data]
                         (for [datum data]
                           (update-in datum [osm-key] osm-val->osm-data))))]
+
         (doseq [osm-field osm-fields]
           (shared/transact-app-data! app-state (updater (:full-name osm-field))))))))


Fixing reasoning

Fixing reasoning

--- src/helda/listeners/invoker.clj
+++ src/helda/listeners/invoker.clj
@@ -35,7 +35,7 @@
           (keys action-ctx)
           (->> action-ctx vals (mapv #(save-entity db %)))
           )
-        :reasoning-msg (:reasoning-msg handler-response)
+        :reasoning-msg (get-in handler-response [:body :reasoning-msg])
         }
       )
     )


Clear amount when switching assets

Clear amount when switching assets

Signed-off-by: Igor Mandrigin <042dc4512fa3d391c5170cf3aa61e6a638f84342@mandrigin.ru>

--- src/status_im/ui/screens/wallet/choose_recipient/events.cljs
+++ src/status_im/ui/screens/wallet/choose_recipient/events.cljs
@@ -35,16 +35,20 @@
       (when (ethereum/address? s)
         {:address s :chain-id chain-id})))

-(defn changed-asset-warning [cofx old-symbol new-symbol]
-  (assoc-in cofx [:db :wallet :send-transaction :asset-error]
-            (i18n/label :t/changed-asset-warning {:old old-symbol :new new-symbol})))
+;; NOTE(janherich) - whenever changing assets, we want to clear the previusly set amount/amount-text
+(defn changed-asset [fx old-symbol new-symbol]
+  (-> fx
+      (assoc-in [:db :wallet :send-transaction :amount] nil)
+      (assoc-in [:db :wallet :send-transaction :amount-text] nil)
+      (assoc-in [:db :wallet :send-transaction :asset-error]
+                (i18n/label :t/changed-asset-warning {:old old-symbol :new new-symbol}))))

-(defn changed-amount-warning [cofx old-amount new-amount]
-  (assoc-in cofx [:db :wallet :send-transaction :amount-error]
+(defn changed-amount-warning [fx old-amount new-amount]
+  (assoc-in fx [:db :wallet :send-transaction :amount-error]
             (i18n/label :t/changed-amount-warning {:old old-amount :new new-amount})))

-(defn use-default-eth-gas [cofx]
-  (assoc-in cofx [:db :wallet :send-transaction :gas]
+(defn use-default-eth-gas [fx]
+  (assoc-in fx [:db :wallet :send-transaction :gas]
             ethereum/default-transaction-gas))

 (handlers/register-handler-fx
@@ -64,7 +68,7 @@
               :dispatch   [:navigate-back]}
        (and address (= :choose-recipient view-id)) (assoc :dispatch [:navigate-back])
        (and address valid-network?) (update :db #(fill-request-details % details))
-       (and old-symbol new-symbol (not= old-symbol new-symbol)) (changed-asset-warning old-symbol new-symbol)
+       (and old-symbol new-symbol (not= old-symbol new-symbol)) (changed-asset old-symbol new-symbol)
        (and old-amount new-amount (not= old-amount new-amount)) (changed-amount-warning old-amount new-amount)
        ;; NOTE(goranjovic) - the next line is there is because QR code scanning switches the amount to ETH
        ;; automatically, so we need to update the gas limit accordingly. The check for origin screen is there


Oops!

Oops!

--- support/build-support/src/main/clojure/fnbox/build/tools.clj
+++ support/build-support/src/main/clojure/fnbox/build/tools.clj
@@ -73,7 +73,7 @@
       (io/copy file to-file))))

 (defn increase-deployment-timeout [loc]
-  (zip/edit loc #(assoc-in % [:attrs :deployment-timeout] "false")))
+  (zip/edit loc #(assoc-in % [:attrs :deployment-timeout] "1200")))

 (defn add-extension [loc name]
   (let [module-name (str "org.fnbox." name)]


updated docstring;

updated docstring;

--- src/untangled/client/core.cljs
+++ src/untangled/client/core.cljs
@@ -114,14 +114,21 @@
    (get (uri-params url) param-name)))

 (defn merge-state!
-  "Merge a (sub)tree of application state into the application.
+  "Normalize and merge a (sub)tree of application state into the application using a known UI component's query and ident.
+
+  This utility function obtains the ident of the incoming object-data using the UI component's ident function. Once obtained,
+  it uses the component's query and ident to normalize the data and place the resulting objects in the correct tables.
+  It is also quite common to want those new objects to be linked into lists in other spot in app state, so this function
+  supports optional named parameters for doing this. WARNING: API UNSTABLE. I plan to make it possible to do more than
+  one append/replace/prepend. Still deciding on the desired API.

   - app-or-reconciler: The Untangled application or Om reconciler
   - component: The class of the component that corresponsds to the data. Must have an ident.
   - object-data: A map (tree) of data to merge. Will be normalized for you.
   - append-to: Named parameter. A vector (path) to a list in your app state where this new object's ident should be appended.
   - prepend-to: Named parameter. A vector (path) to a list in your app state where this new object's ident should be prepended.
-  - replace: Named parameter. A vector (path) to the specific element of an app-state vector where this objects ident should be placed. MUST ALREADY EXIST.
+  - replace: Named parameter. A vector (path) to a specific locaation in app-state where this object's ident should be placed. Can target a to-one or to-many.
+   If the target is a vector element then that element must already exist.
   "
   [app-or-reconciler component object-data & {:keys [append-to replace prepend-to]}]
   (assert (implements? om/Ident component) "Component must implement Ident")


add args to main

add args to main

--- src/usedbooks_search/core.cljs
+++ src/usedbooks_search/core.cljs
@@ -3,7 +3,15 @@

 (nodejs/enable-util-print!)

-(defn -main []
+(defn print-args [args]
+  (if (first args)
+    (do
+      (println (first args))
+      (print-args (rest args)))
+    (println "-- end of args --")))
+
+(defn -main [& args]
+  (print-args args)
   (println "Hello world!"))

 (set! *main-cli-fn* -main)


removing unnecessary dependency

removing unnecessary dependency

--- Clojure-Websockets/src/clj/birdwatch/twitter_client.clj
+++ Clojure-Websockets/src/clj/birdwatch/twitter_client.clj
@@ -13,7 +13,6 @@
    [clojure.tools.logging :as log]
    [http.async.client :as ac]
    [twitter.oauth :as oauth]
-   [twitter-streaming-client.core :as client]
    [clojure.core.async :as async :refer [<! <!! >! >!! chan put! alts! timeout go go-loop close!]]
    [com.stuartsierra.component :as component])
   (:import


(maint) Pin facter to 2.5.7

(maint) Pin facter to 2.5.7

--- src-gems/puppetlabs/puppetdb/integration/install_gems.clj
+++ src-gems/puppetlabs/puppetdb/integration/install_gems.clj
@@ -11,7 +11,7 @@
     (jruby-core/cli-run! jruby-config "gem" args)))

 (defn install-gems [gem-list-name config _]
-  (gem-run! config "install" "facter")
+  (gem-run! config "install" "facter" "-v" "2.5.7")
   (gem-run! config "install" "hiera")

   ;; Install the puppetserver vendored gems listed inside its jar; this is where


Moved start code to function.

Moved start code to function.

--- twitter-producer/src/twitter_producer/core.clj
+++ twitter-producer/src/twitter_producer/core.clj
@@ -79,10 +79,12 @@
    ;; just print exceptions to the console when there's an exception
    handlers/exception-print))

+(defn start []
+    (streaming/statuses-sample :oauth-creds my-creds
+                               :callbacks async-streaming-callback))
+
 (defn -main
   "I don't do a whole lot ... yet."
   [& args]
   (create-stream *stream-name*)
-  (streaming/statuses-sample :oauth-creds my-creds
-                             :callbacks async-streaming-callback
-                             :params {:stall-warnings "true"}))
+  (start))


change edit navigation

change edit navigation

--- src/cljs/early_vote_site/early_vote_site_form/events.cljs
+++ src/cljs/early_vote_site/early_vote_site_form/events.cljs
@@ -30,10 +30,11 @@

 ; change active panel on success
 (defn get-evs-data-success
-  [{:keys [db]} [_ result]]
+  [db [_ result]]
   (let [form (early-vote-site-json->form (first result))]
-    {:db (assoc db :early-vote-site-form form)
-     :dispatch [:navigate/early-vote-site-form]}))
+    (-> db
+        (assoc :early-vote-site-form form)
+        (assoc :active-panel :early-vote-site-form/main))))

 (defn navigate
   [db _]
@@ -96,11 +97,11 @@

 (def events
   {:db {:early-vote-site-form/update form-update
-        :navigate/early-vote-site-form navigate}
+        :navigate/early-vote-site-form navigate
+        :get-early-vote-site-data/success get-evs-data-success}
    :fx {:navigate/edit-early-vote-site-form navigate-edit
         :early-vote-site-form/save form-submit
         :early-vote-site-save/success save-success
-        :get-early-vote-site-data/success get-evs-data-success
         :get-early-vote-site-data/failure
         (utils/flash-error-with-results "Error retrieving early vote site")
         :early-vote-site-save/failure


:bug: Add missing page parameter on sidebar options.

--- frontend/src/uxbox/main/ui/workspace/sidebar/options.cljs
+++ frontend/src/uxbox/main/ui/workspace/sidebar/options.cljs
@@ -67,7 +67,9 @@
          [:& align-options]
          (case (count shapes)
            0 [:& page/options {:page page}]
-           1 [:& shape-options {:shape (first shapes) :shapes-with-children shapes-with-children}]
+           1 [:& shape-options {:shape (first shapes)
+                                :page page
+                                :shapes-with-children shapes-with-children}]
            [:& multiple/options {:shapes shapes-with-children}])]]

        [:& tab-element {:id :prototype


pipe- and sub for multiple components at once; cleanup

--- Clojure-Websockets/MainApp/src/cljs/birdwatch/core.cljs
+++ Clojure-Websockets/MainApp/src/cljs/birdwatch/core.cljs
@@ -1,5 +1,4 @@
 (ns birdwatch.core
-  (:require-macros [cljs.core.async.macros :refer [go-loop]])
   (:require [birdwatch.charts.ts-chart :as ts-c]
             [birdwatch.charts.wordcount-chart :as wc-c]
             [birdwatch.charts.cloud-chart :as cloud]
@@ -13,40 +12,29 @@
             [com.matthiasnehlsen.systems-toolbox.core :as toolbox]
             [com.matthiasnehlsen.systems-toolbox.reagent :as toolbox-r]
             [com.matthiasnehlsen.systems-toolbox.sente :as toolbox-ws]
-            [cljs.core.async :refer [chan pub sub <! >! buffer sliding-buffer pipe]]))
+            [cljs.core.async :refer [sub]]))

 (enable-console-print!)

 ;;;; Main file of the BirdWatch client-side application.

-(def state-comp (toolbox/make-component c/make-state c/handle-incoming nil))
-(def wc-comp (toolbox/make-component cloud/make-state nil cloud/state-pub-handler {:sliding-in-timeout 5000}))
-(def wc-c-comp (toolbox/make-component wc-c/make-state nil wc-c/state-pub-handler {:sliding-in-timeout 1000}))
-(def ts-comp (toolbox/make-component ts-c/make-state nil ts-c/state-pub-handler {:sliding-in-timeout 1000}))
-(def ws-comp (toolbox-ws/component))
-(def count-comp (toolbox-r/component cv/count-view "tweet-count"))
-(def users-count-comp (toolbox-r/component cv/users-count-view "users-count"))
-(def search-comp (toolbox-r/component sv/search-view "search"))
-(def sort-comp (toolbox-r/component st/sort-view "sort-buttons"))
-(def pag-comp (toolbox-r/component pag/pagination-view "pagination"))
-(def ttc-comp (toolbox-r/component cv/total-count-view "total-tweet-count"))
+(def state (toolbox/make-component c/make-state c/handle-incoming nil))
+(def wc (toolbox/make-component cloud/make-state nil cloud/state-pub-handler {:sliding-in-timeout 5000}))
+(def wc-c (toolbox/make-component wc-c/make-state nil wc-c/state-pub-handler {:sliding-in-timeout 1000}))
+(def ts (toolbox/make-component ts-c/make-state nil ts-c/state-pub-handler {:sliding-in-timeout 1000}))
+(def ws (toolbox-ws/component))
+(def count-c (toolbox-r/component cv/count-view "tweet-count"))
+(def users-count (toolbox-r/component cv/users-count-view "users-count"))
+(def search (toolbox-r/component sv/search-view "search"))
+(def sort-c (toolbox-r/component st/sort-view "sort-buttons"))
+(def pag (toolbox-r/component pag/pagination-view "pagination"))
+(def ttc (toolbox-r/component cv/total-count-view "total-tweet-count"))

 (def tweets-comp (toolbox/single-in-single-out tw/init-component))

-(sub (:state-pub state-comp) :app-state (:sliding-in-chan wc-c-comp))
-(sub (:state-pub state-comp) :app-state (:sliding-in-chan ts-comp))
-(sub (:state-pub state-comp) :app-state (:sliding-in-chan wc-comp))
-(sub (:state-pub state-comp) :app-state (:sliding-in-chan count-comp))
-(sub (:state-pub state-comp) :app-state (:sliding-in-chan users-count-comp))
-(sub (:state-pub state-comp) :app-state (:sliding-in-chan search-comp))
-(sub (:state-pub state-comp) :app-state (:sliding-in-chan sort-comp))
-(sub (:state-pub state-comp) :app-state (:sliding-in-chan pag-comp))
-(sub (:state-pub state-comp) :app-state (:sliding-in-chan ttc-comp))
+(def reagent-comps [wc-c ts wc count-c users-count search sort-c pag ttc])
+(toolbox/state-snapshot-subscribe state :app-state reagent-comps)

-(sub (:state-pub state-comp) :app-state (:in-chan tweets-comp))
+(sub (:state-pub state) :app-state (:in-chan tweets-comp))

-(pipe (:out-chan wc-c-comp)   (:in-chan state-comp))
-(pipe (:out-chan wc-comp)     (:in-chan state-comp))
-(pipe (:out-chan state-comp)  (:in-chan ws-comp))
-(pipe (:out-chan ws-comp)     (:in-chan state-comp))
-(pipe (:out-chan tweets-comp) (:in-chan state-comp))
+(toolbox/pipe-multiple [[wc-c state] [wc state] [state ws] [ws state] [tweets-comp state]])


finally I figured out how to only render the cell needed

--- src-cljs/minesweeper/core.cljs
+++ src-cljs/minesweeper/core.cljs
@@ -277,7 +277,7 @@
     (= state :hide) "@"))

 (defn cell [end? x y mine state surround]
-;  (println "rending cell " x y)
+  (println "rending cell " x y)
   [:span.cell
    { :on-click #(click! x y)
      :on-context-menu  #(do (mark! x y ) false)
@@ -290,7 +290,7 @@
 (defn game-row [end? x mines states surrounds]
 ;  (println "rending row " x)
   (into [:div.game-row ]
-        (map cell (repeat end?) (repeat x) (range) mines states surrounds)));
+        (map vector (repeat cell) (repeat end?) (repeat x) (range) mines states surrounds)));

 (defn format [n]
   (let [s (str (max 0 n))]
@@ -323,7 +323,7 @@
         end? (game :end) ]
     (into
       [:div.board-panel ]
-      (map game-row (repeat end? ) (range) (game :board) (game :states) (game :counts)))))
+      (map vector (repeat game-row) (repeat end? ) (range) (game :board) (game :states) (game :counts)))))

 ;; Render the root component
 (defn ^:export start []


Changed around how shaders are loaded.

Changed around how shaders are loaded.

--- src/petulant_life/rendering.clj
+++ src/petulant_life/rendering.clj
@@ -64,28 +64,41 @@
       (do (GL20/glShaderSource sid content)
           (GL20/glCompileShader sid)
           sid))
-    (catch Exception e (.exit System 1)))) ;; So very unsafe.
+    (catch Exception e (.exit System 1))))
+
+;; Loading each type of shader from a given path.
+(defn load-each-shader [path]
+  (let [vert (if (.exists (as-file (str path ".vert")))
+               (load-shader (str path ".vert") GL20/GL_VERTEX_SHADER)
+               nil)
+
+        frag (if (.exists (as-file (str path ".frag")))
+               (load-shader (str path ".frag") GL20/GL_FRAGMENT_SHADER)
+               nil)
+
+        geom (if (.exists (as-file (str path ".geom")))
+               (load-shader (str path ".geom") GL32/GL_GEOMETRY_SHADER)
+               nil)]
+    {:vert vert :frag frag :geom geom}))

 ;; Loading a shader. It loads all possible extensions for the shader. If there is
 ;; a .vert, it'll load it. If there's a .frag, it'll load it, etc.
 (defn load-shader-program [path]
-  (let [sp (GL20/glCreateProgram)]
-    (do ;; Loading the vertex shader - if it exists.
-        (if (.exists (as-file (str path ".vert")))
-          (GL20/glAttachShader sp (load-shader (str path ".vert")
-                                               GL20/GL_VERTEX_SHADER))
+  (let [ss (load-each-shader path)
+        sp (GL20/glCreateProgram)]
+    (do (if (get ss :vert)
+          (GL20/glAttachShader sp (get ss :vert))
           nil)

-        ;; Loading the fragment shader - if it exists.
-        (if (.exists (as-file (str path ".frag")))
-          (GL20/glAttachShader sp (load-shader (str path ".frag")
-                                               GL20/GL_FRAGMENT_SHADER))
+        (if (get ss :frag)
+          (GL20/glAttachShader sp (get ss :frag))
           nil)

-        ;; Loading the geometry shader - if it exists.
-        (if (.exists (as-file (str path ".geom")))
-          (GL20/glAttachShader sp (load-shader (str path ".geom")
-                                               GL32/GL_GEOMETRY_SHADER)))
+        (if (get ss :geom)
+          (GL20/glAttachShader sp (get ss :geom))
+          nil)
+
+        (GL20/glLinkProgram sp)

         sp)))


Function to generate random code that doesnt exist already

--- src/wishlistd/models/redis.clj
+++ src/wishlistd/models/redis.clj
@@ -3,3 +3,12 @@
   (:use wishlistd.code))

 (def db {:host "127.0.0.1" :port 6379 :db 0})
+
+(defn new-code []
+  "Generates random codes until it finds one that doesn't exist."
+  (r/with-server db
+    (let [code (random-code)]
+      (if (r/exists code)
+        code
+        (new-code)))))
+


feat(sre-default-config): Add efficient join impl

--- sre/src/ingraph/sre/config.clj
+++ sre/src/ingraph/sre/config.clj
@@ -201,17 +201,14 @@
 (deftask
   Join
   (let [[v e w] bindings
-        ^IngraphVertex source (variables v)
-        ^IngraphVertex target (variables w)
-        ;; TODO No indexer support so we'll fall back to filtering :(
-        ^Iterator iterator (.edgesInJavaIterator target)]
-    (->> (iterator-seq iterator)
-         ;; filter for matches and map to lookup in one function
-         (mapcat #(let [^IngraphEdge edge %
-                        ^IngraphVertex src (.sourceVertex edge)]
-                    (if (= src source)
-                      (list (assoc variables e edge v src))
-                      ()))))))
+        ^Indexer indexer (:indexer ^IPersistentMap ctx)
+        ^IngraphVertex source (variables v)
+        ^IngraphVertex target (variables w)
+        ^Iterator iterator (.edgesBySourceAndTargetJava indexer source target)]
+    (->> (iterator-seq iterator)
+         (map #(let [^IngraphEdge edge %]
+                 (assoc variables e edge))))))
+

 (defop
   JoinByType [source edge target type]
@@ -221,18 +218,16 @@
 (deftask
   JoinByType
   (let [[v e w t] bindings
-        ^IngraphVertex source (variables v)
-        ^IngraphVertex target (variables w)
-        ^String type (variables t)
-        ;; No indexer support so will fall back to filtering :(
-        ^Iterator iterator (.edgesInByTypeJavaIterator target type)]
+        ^Indexer indexer (:indexer ^IPersistentMap ctx)
+        ^IngraphVertex source (variables v)
+        ^IngraphVertex target (variables w)
+        ^String type (variables t)
+        ^Iterator iterator (.edgesBySourceAndTargetAndTypeJava indexer source target type)]
     (->> (iterator-seq iterator)
          ;; filter for matches and map to lookup in one function
-         (mapcat #(let [^IngraphEdge edge %
-                        ^IngraphVertex src (.sourceVertex edge)]
-                    (if (= src source)
-                      (list (assoc variables e edge v src))
-                      ()))))))
+         (->> (iterator-seq iterator)
+              (map #(let [^IngraphEdge edge %]
+                      (assoc variables e edge)))))))

 ;; Does this make any sense at all?
 (defop


Create component without create-react-class

--- src/reagent/impl/component.cljs
+++ src/reagent/impl/component.cljs
@@ -1,5 +1,5 @@
 (ns reagent.impl.component
-  (:require [create-react-class :as create-react-class]
+  (:require [goog.object :as gobj]
             [react :as react]
             [reagent.impl.util :as util]
             [reagent.impl.batching :as batch]
@@ -149,9 +149,10 @@
     :getDefaultProps
     (throw (js/Error. "getDefaultProps not supported"))

+    ;; In ES6 React, this is now part of the constructor
     :getInitialState
-    (fn getInitialState []
-      (this-as c (reset! (state-atom c) (.call f c c))))
+    (fn getInitialState [c]
+      (reset! (state-atom c) (.call f c c)))

     :componentWillReceiveProps
     (fn componentWillReceiveProps [nextprops]
@@ -250,7 +251,6 @@
                         {} fmap)]
     (assoc fmap
            :displayName name
-           :autobind false
            :cljsLegacyRender legacy-render
            :reagentRender render-fun
            :render (:render static-fns))))
@@ -265,14 +265,44 @@
   (-> body
       camelify-map-keys
       add-obligatory
-      wrap-funs
-      map-to-js))
+      wrap-funs))
+
+;; Credits to Paulus Esterhazy, Thomas Heller
+;; https://gist.github.com/pesterhazy/2a25c82db0519a28e415b40481f84554
+;; https://gist.github.com/thheller/7f530b34de1c44589f4e0671e1ef7533#file-es6-class-cljs-L18
+(defn make-component
+  "Creates a React Component class
+  `m` is a js-obj of class methods
+  `s` is a js-obj of static methods"
+  ([display-name m s] (make-component display-name nil m s))
+  ([display-name construct m s]
+   (let [cmp (fn [props context updater]
+               (cljs.core/this-as this
+                 (.call react/Component this props context updater)
+                 (when construct
+                   (construct this))
+                 this))]
+     (gobj/extend (.-prototype cmp) (.-prototype react/Component) m)
+     (gobj/extend cmp react/Component s)
+
+     (when display-name
+       (set! (.-displayName cmp) display-name)
+       (set! (.-cljs$lang$ctorStr cmp) display-name)
+       (set! (.-cljs$lang$ctorPrWriter cmp)
+             (fn [this writer opt]
+               (cljs.core/-write writer display-name))))
+     (set! (.-cljs$lang$type cmp) true)
+     (set! (.. cmp -prototype -constructor) cmp))))

 (defn create-class [body]
   {:pre [(map? body)]}
-  (->> body
-       cljsify
-       create-react-class))
+  (let [body (cljsify body)
+        m (dissoc body :displayName :getInitialState :contextTypes :childContextTypes)
+        s (select-keys body [:childContextTypes :contextTypes])]
+    (make-component (:displayName body)
+                    (:getInitialState body)
+                    (map-to-js m)
+                    (map-to-js s))))

 (defn fiber-component-path [fiber]
   (let [name (some-> fiber


insights: handle <a> clicks originating in SVG

--- src-cljs/frontend/history.cljs
+++ src-cljs/frontend/history.cljs
@@ -9,7 +9,7 @@
             [secretary.core :as sec])
   (:import [goog.history Html5History]
            [goog.events EventType Event BrowserEvent]
-           [goog History]))
+           [goog History Uri]))

 ;; see this.transformer_ at http://goo.gl/ZHLdwa
@@ -82,29 +82,57 @@
       (and (.-platformModifierKey event)
            (.isButton event goog.events.BrowserEvent.MouseButton.LEFT))))

+(defn closest-tag [element tag]
+  "Handle SVG element properly."
+  (let [dom-helper (goog.dom.DomHelper.)
+        tag (string/upper-case tag)
+        lower-tag (string/lower-case tag) ; SVG is case-sensitive
+        ]
+    (or (when (= (.-tagName element) tag) element)
+        (.getAncestorByTagNameAndClass dom-helper element tag)
+        (when (= (instance? js/SVGElement element))
+          (loop [e element]
+            (let [e-tag (.-tagName e)]
+              (condp = e-tag
+                lower-tag e
+                "svg" nil
+                (recur (.-parentElement e)))))))))
+
 (defn setup-link-dispatcher! [history-imp top-level-node]
-  (let [dom-helper (goog.dom.DomHelper.)]
-    (events/listen top-level-node "click"
-                   #(let [-target (.. % -target)
-                          target (if (= (.-tagName -target) "A")
-                                   -target
-                                   (.getAncestorByTagNameAndClass dom-helper -target "A"))
-                          location (when target (str (.-pathname target) (.-search target) (.-hash target)))
-                          new-token (when (seq location) (subs location 1))]
-                      (when (and (seq location)
-                                 (= (.. js/window -location -hostname)
-                                    (.-hostname target))
-                                 (not (or (new-window-click? %) (= (.-target target) "_blank"))))
-                        (.preventDefault %)
-                        (if (and (route-fragment location)
-                                 (path-matches? (.getToken history-imp) new-token))
+  (events/listen top-level-node "click"
+                 #(let [-target (.. % -target)
+                        target (closest-tag -target "A")
+                        location (when target
+                                   (or (let [path (str (.-pathname target) (.-search target) (.-hash target))]
+                                         (if-not (empty? path)
+                                           path))
+                                       ;; SVG
+                                       (-> target (.-href) (.-baseVal))))
+                        new-token (when (seq location) (subs location 1))
+                        attr-target (or (.-target target)
+                                        (-> target ; SVG
+                                            (.-target)
+                                            (.-baseVal)))
+                        host-name (or (.-hostname target)
+                                      (let [uri-info (goog.Uri.parse location) ; SVG
+                                            domain (.getDomain uri-info)]
+                                        (if (empty? domain)
+                                          (.. js/window -location -hostname)
+                                          domain)))]
+                    (when (and (seq location)
+                               (= (.. js/window -location -hostname)
+                                  host-name)
+                               (not (or (new-window-click? %) (= attr-target "_blank"))))
+                      (.preventDefault %)
+                      (if (and (route-fragment location)
+                               (path-matches? (.getToken history-imp) new-token))

-                          (do (utils/mlog "scrolling to hash for" location)
-                              ;; don't break the back button
-                              (.replaceToken history-imp new-token))
+                        (do (utils/mlog "scrolling to hash for" location)
+                            ;; don't break the back button
+                            (.replaceToken history-imp new-token))

-                          (do (utils/mlog "navigating to" location)
-                              (.setToken history-imp new-token))))))))
+                        (do (utils/mlog "navigating to" location)
+                            (.setToken history-imp new-token)))))))

 (defn new-history-imp [top-level-node]
   ;; need a history element, or goog will overwrite the entire dom


add namespace to tag view

add namespace to tag view

--- src/semtag_web/client/view.cljs
+++ src/semtag_web/client/view.cljs
@@ -29,6 +29,17 @@
    [:td [:a {:href (str "/" model)} model]])

 ;;; partials
+(defpartial default-row [row fields]
+  [:tr
+    (map #(vec [:td (% row)]) fields)
+   ])
+
+(defpartial generate-rows [data {:keys [fields row-partial] :or {row-partial default-row}}]
+  [:tbody
+    (map
+      #(row-partial % fields)
+      data)])
+
 (defpartial generate-table [table-id data & {:keys [fields] :as options}]
   (let [headers (or
                   (:headers options)
@@ -68,21 +79,11 @@
     [:tr
      [:td attr]
      (case attr
+       :namespace (td-model (:value row))
        :url (td-url (:value row))
        :tags (td-tags (string/join ";" (:value row)))
        [:td (str (:value row))])
      ]))
-
-(defpartial default-row [row fields]
-  [:tr
-    (map #(vec [:td (% row)]) fields)
-   ])
-
-(defpartial generate-rows [data {:keys [fields row-partial] :or {row-partial default-row}}]
-  [:tbody
-    (map
-      #(row-partial % fields)
-      data)])

 (defpartial generate-datalist [tags]
   [:datalist#tags (map #(vec [:option {:value %} ]) tags)])


Typo fix.

Typo fix.

--- src/active/clojure/record.cljc
+++ src/active/clojure/record.cljc
@@ -20,7 +20,7 @@
   (when-not (even? (count (remove seq? ?field-specs)))
     (throw (IllegalArgumentException. (str "odd number of elements in field specs in " *ns* " " (meta &form)))))
   (when-not (every? true? (map #(= 3 (count %1)) (filter seq? ?field-specs)))
-    (throw (IllegalArgumentException. (str "wrong number of elements in field specs with lense in " *ns* " " (meta &form)))))
+    (throw (IllegalArgumentException. (str "wrong number of elements in field specs with lens in " *ns* " " (meta &form)))))

   (let [?field-pairs (partition 2 (flatten (map #(if (seq? %1) (butlast %1) %1) ?field-specs)))
         ?field-pairs-lense (filter seq? ?field-specs)


Support new QLC+ xml schema URL.

Support new QLC+ xml schema URL.


remove println

remove println

--- backend/test/lambdaui/old_api_test.clj
+++ backend/test/lambdaui/old_api_test.clj
@@ -5,8 +5,7 @@
             [lambdaui.core :refer [pipeline-routes]]
             [lambdaui.fixtures.pipelines :refer :all]
             [clojure.data.json :refer [read-json]]
-            [lambdaui.test-server :refer :all]
-            ))
+            [lambdaui.test-server :refer :all]))

@@ -17,11 +16,9 @@
   (with-server simple-success-pipeline
                (testing "availability of legacy /api/builds"
                  (let [{:keys [status headers body error] :as resp} @(http/get (url "/api/builds/"))]
-                    (println resp)
                    (is (= 200 status))
                    (is (= {:build-number 1 :status "success"}
-                          (select-keys (get-build 1 (read-json body)) [:build-number :status :out]))))))
-  )
+                          (select-keys (get-build 1 (read-json body)) [:build-number :status :out])))))))


CMR-1097: Changed atom inherited element to echo:inherited.

--- search-app/src/cmr/search/results_handlers/atom_results_handler.clj
+++ search-app/src/cmr/search/results_handlers/atom_results_handler.clj
@@ -297,7 +297,7 @@
   [atom-link]
   (x/element :link (atom-link->attribute-map atom-link)
              (when (:inherited atom-link)
-               (x/element :inherited))))
+               (x/element :echo:inherited))))

 (defn- orbit-parameters->attribute-map
   "Convert orbit parameters into attributes for an XML element"


Fix per https://github.com/MastodonC/kixi.hecuba/pull/638#discussion_r39143801

--- src/cljs/kixi/hecuba/widgets/datetimepicker_small.cljs
+++ src/cljs/kixi/hecuba/widgets/datetimepicker_small.cljs
@@ -97,7 +97,7 @@
              :id "raw-data-get-dates"
              :style {:margin-top "10px"}
              :on-click (fn [e _]
-                         (if-not (nil? date)
+                         (when date
                            (put! event-chan {:event :fetch-data :value date}))
                          (.preventDefault e))}
             "Get Data"]]]


Remove autofill for password

Remove autofill for password

--- src/cljs/wombats_web_client/components/text-input.cljs
+++ src/cljs/wombats_web_client/components/text-input.cljs
@@ -24,6 +24,7 @@
      [:label.label {:for name} label]
      [:input.input {:class (when error-val "field-error")
                     :type (if is-password "password" "text")
+                    :auto-complete (when is-password "new-password")
                     :name name
                     :value (when val val)
                     :on-blur #(check-for-valid-text-content state error-key (get-value %))


fix typo: meant to use symbol (subject-agr) but was using keyword instead (:subject-age)

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -2827,8 +2827,8 @@
        (let [subject-agr (atom :top)]
          {:synsem {:sem {:reflexive true}
                    :cat :verb
-                   :subcat {:1 {:agr :subject-agr}
-                            :2 {:agr :subject-agr}}}}))
+                   :subcat {:1 {:agr subject-agr}
+                            :2 {:agr subject-agr}}}}))
       (default
        {:synsem {:cat :verb
                  :subcat {:2 {:subcat '()}}}})


add comments

add comments

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -142,14 +142,13 @@
                                            :case :nom ;; TODO: this should be a general lexical post-processing step -
                                            ;; call it subject-is-nominative or similar.
                                            :agr subj-agr
-                                           :sem {:pred :name
+                                           :sem {:pred :name  ;; "My name" in "My name is John"
                                                  :subj the-real-subj}
-
                                            }
                                        :2 {:cat :noun
                                            :agr subj-agr
                                            :sem the-obj
-                                           :propernoun true ;; "I am John"
+                                           :propernoun true ;; "John" in "My name is John"
                                            }
                                        } ;; subcat {
                               } ;; synsem {


+Jean

+Jean

--- src/babel/francais/lexicon.clj
+++ src/babel/francais/lexicon.clj
@@ -379,6 +379,13 @@
      (unify gender-pronoun-agreement
             common
             {:synsem {:agr {:gender :masc}}})])
+
+   "Jean" {:synsem {:sem {:pred :Jean
+                          :human true}
+                    :propernoun true
+                    :agr {:number :sing
+                          :person :3rd
+                          :gender :masc}}}

    "Juan" {:synsem {:sem {:pred :Juan
                           :human true}


Fix wpml/word-document-xml

Fix wpml/word-document-xml

--- src/bakyeono/litedocx/wpml.clj
+++ src/bakyeono/litedocx/wpml.clj
@@ -290,7 +290,7 @@
                                     :w:right 720
                                     :w:bottom 720
                                     :w:left 720
-                                    :w:herader 0
+                                    :w:header 0
                                     :w:footer 0})))))

 (defn- ppr


define decode

define decode

--- src/synthesis_crawlers/core.clj
+++ src/synthesis_crawlers/core.clj
@@ -1,7 +1,7 @@
 (ns synthesis-crawlers.core
   (:require [clojure.spec :as s]
             [synthesis-crawlers.page :as page]
-            [clojure.string :refer [starts-with? ends-with?]]
+            [clojure.string :refer [starts-with? ends-with? join]]
             [org.httpkit.client :as http]
             [clojure.data :refer [diff]])
   (:import (org.jsoup Jsoup)
@@ -268,12 +268,17 @@
             []
             (into [node] (.parents node)))))

-#_(s/fdef decode-node-path
+(s/fdef decode-node-path
         :args (s/cat :encoded-node
-                     (s/coll-of (s/keys :req [:tag :class :id]))))
+                     (s/coll-of (s/keys :req-un [::tag ::class ::id]))))
 (defn decode-node-path
   [encoded-node]
-  nil)
+  (join " > " (map (fn [{:keys [tag class id]}]
+                     (str tag
+                          (when (seq id) (str "#" id))
+                          (when (seq class)
+                            (str "." (join "." (sort (vec class)))))))
+                   encoded-node)))

 (defn create-relative-path
   ([prefix node]


fixing find-reachable-attrs

fixing find-reachable-attrs

--- src/synthesis_crawlers/core.clj
+++ src/synthesis_crawlers/core.clj
@@ -203,16 +203,22 @@
   (println "given: " attr-nodes)
   (let [result (for [[url attr-nodes] attr-nodes
                      [attr nodes] attr-nodes
-                     node (set (flatten (map reachable-elements nodes)))]
-                 [url [node attr]])]
-    (println "result: " result)
-    (println "--")
-    (reduce (fn [acc [url [node attr]]]
-              (let [node-attr (get acc url {})
-                    attrs (get node-attr node #{})]
-                (assoc acc url (assoc node-attr node (conj attrs attr)))))
-            {}
-            result)))
+                     node (set (map #(.cssSelector %)
+                                    (flatten (map reachable-elements nodes))))]
+                 [url [node attr]])
+        url-root (zipmap (keys attr-nodes) (map #(.ownerDocument (first (second (first %))))
+                                                (vals attr-nodes)))
+        reachable-attrs (reduce (fn [acc [url [node attr]]]
+                                  (let [node-attr (get acc url {})
+                                        attrs (get node-attr node #{})]
+                                    (assoc acc url (assoc node-attr node (conj attrs attr)))))
+                                {}
+                                result)
+        ]
+    (println "url-root: " url-root)
+    (println "reachable-attrs: " reachable-attrs)
+    #_(println "vals:" (map #(.cssSelector %) (keys (reachable-attrs "http://example.com/1"))))
+    reachable-attrs))

 (s/fdef find-support-nodes
         :args (s/cat :attr-nodes ::attributed-nodes-in-pages))


Tundra: sanity check DataStore's `fetch-keys` result

--- src/taoensso/carmine/tundra.clj
+++ src/taoensso/carmine/tundra.clj
@@ -147,7 +147,16 @@
         (let [;;; [] e/o #{<dumpval> <throwable>}:
               throwable?    #(instance? Throwable %)
               dvals-missing (try (fetch-keys-delayed datastore ks-missing)
-                              (catch Throwable t (mapv (constantly t) ks-missing)))
+                                 (catch Throwable t (mapv (constantly t) ks-missing)))
+              _ ; Sanity-check the fetch result
+              (when-not (= (count dvals-missing)
+                           (count ks-missing))
+                (-> (format (str "Bad `fetch-keys` result:"
+                                 " unexpected val count (got %s, expected %s)."
+                                 " Bad DataStore implementation?")
+                            (count dvals-missing)
+                            (count ks-missing))
+                    (Exception.) (throw)))
               dvals-missing (if (nil? freezer) dvals-missing
                                 (->> dvals-missing
                                      (mapv #(if (throwable? %) %


improve build task description

improve build task description

Signed-off-by: Gregg Reynolds <d0f77bc71a9867acdcb4f62f012b858edad79160@norc.org>

--- tasklib/src/migae/boot_gae.clj
+++ tasklib/src/migae/boot_gae.clj
@@ -413,7 +413,7 @@
           )))

 (boot/deftask build
-  "dev build, source only"
+  "assemble, configure, and build app"
   [k keep bool "keep intermediate .clj and .edn files"
    p prod bool "production build, without reloader"
    v verbose bool "verbose"]


Add instanceof to given

Add instanceof to given

--- test/yada/test/util.clj
+++ test/yada/test/util.clj
@@ -47,4 +47,9 @@
                :!> `(is (not (set/superset? (set ((as-test-function ~a) ~t)) (set ~c))))
                ;; Is subset?
                :< `(is (set/subset? (set ((as-test-function ~a) ~t)) (set ~c)))
-               :!< `(is (not (set/subset? (set ((as-test-function ~a) ~t)) (set ~c))))))))))
+               :!< `(is (not (set/subset? (set ((as-test-function ~a) ~t)) (set ~c))))
+
+               ;; Is instanceof
+               :instanceof `(is (instance? ~c ((as-test-function ~a) ~t)))
+               :!instanceof `(is (not (instance? ~c ((as-test-function ~a) ~t))))
+               ))))))


New tests: parse-float-zero, parse-float-positive-values, and parse-float-negative-values

--- test/zg/config_test.clj
+++ test/zg/config_test.clj
@@ -52,8 +52,8 @@
 ;

 (deftest test-parse-int-zero
-    "Check the behaviour of function zg.config/parse int."
-    (are [x y] (= x y)
+    "Check the behaviour of function zg.config/parse-int."
+    (are [x y] (== x y)
         0 (parse-int "0")
         0 (parse-int "00")
         0 (parse-int "000")
@@ -62,8 +62,8 @@
         0 (parse-int "-000")))

 (deftest test-parse-int-positive-int
-    "Check the behaviour of function zg.config/parse int."
-    (are [x y] (= x y)
+    "Check the behaviour of function zg.config/parse-int."
+    (are [x y] (== x y)
         1          (parse-int "1")
         2          (parse-int "2")
         42         (parse-int "42")
@@ -72,8 +72,8 @@
         2147483646 (parse-int "2147483646")))

 (deftest test-parse-int-negative-int
-    "Check the behaviour of function zg.config/parse int."
-    (are [x y] (= x y)
+    "Check the behaviour of function zg.config/parse-int."
+    (are [x y] (== x y)
         -1          (parse-int "-1")
         -2          (parse-int "-2")
         -42         (parse-int "-42")
@@ -82,23 +82,58 @@
         -2147483647 (parse-int "-2147483647")))

 (deftest test-parse-int-min-int
-    "Check the behaviour of function zg.config/parse int."
-    (is (= Integer/MIN_VALUE (parse-int "-2147483648"))))
+    "Check the behaviour of function zg.config/parse-int."
+    (is (== Integer/MIN_VALUE (parse-int "-2147483648"))))

 (deftest test-parse-int-max-int
-    "Check the behaviour of function zg.config/parse int."
-    (is (= Integer/MAX_VALUE (parse-int "2147483647"))))
+    "Check the behaviour of function zg.config/parse-int."
+    (is (== Integer/MAX_VALUE (parse-int "2147483647"))))

 (deftest test-parse-int-overflow
-    "Check the behaviour of function zg.config/parse int."
+    "Check the behaviour of function zg.config/parse-int."
     (are [x] (thrown? NumberFormatException x)
         (parse-int "2147483648")
         (parse-int "-2147483649")))

 (deftest test-parse-int-bad-input
-    "Check the behaviour of function zg.config/parse int."
+    "Check the behaviour of function zg.config/parse-int."
     (are [x] (thrown? NumberFormatException x)
         (parse-int "")
         (parse-int "xyzzy")
         (parse-int "+1")))

+(deftest test-parse-float-zero
+    "Check the behaviour of function zg.config/parse-float."
+    (are [x y] (== x y)
+        0.0 (parse-float "0")
+        0.0 (parse-float "00")
+        0.0 (parse-float "000")
+        0.0 (parse-float "-0")
+        0.0 (parse-float "-00")
+        0.0 (parse-float "-000")))
+
+(deftest test-parse-float-positive-values
+    "Check the behaviour of function zg.config/parse-float."
+    (are [x y] (== x y)
+        0.5 (parse-float "0.5")
+        1.0 (parse-float "1.0")
+        1.5 (parse-float "1.5")
+        2.0 (parse-float "2")
+        1000.0 (parse-float "1000")
+        10000.0 (parse-float "10000")
+        1e10 (parse-float "10000000000")
+        1e10 (parse-float "1e10")))
+
+(deftest test-parse-float-negative-values
+    "Check the behaviour of function zg.config/parse-float."
+    (are [x y] (== x y)
+        -0.5 (parse-float "-0.5")
+        -1.0 (parse-float "-1.0")
+        -1.5 (parse-float "-1.5")
+        -2.0 (parse-float "-2")
+        -1000.0 (parse-float "-1000")
+        -10000.0 (parse-float "-10000")
+        -1e10 (parse-float "-10000000000")
+        -1e10 (parse-float "-1e10")))
+
+


fix github client secret assertion

fix github client secret assertion

I was reading through the code and noticed that this parentheses were in a wrong place :)

--- src/clj/cljsfiddle/handler.clj
+++ src/clj/cljsfiddle/handler.clj
@@ -27,7 +27,7 @@
 (assert (env :session-secret) "SESSION_SECRET environment variable not set")
 (assert (env :cljsfiddle-version) "CLJSFIDDLE_VERSION environment variable not set")
 (assert (env :github-client-id) "GITHUB_CLIENT_ID environment variable not set")
-(assert (env :github-client-secret "GITHUB_CLIENT_SECRET environment variable not set"))
+(assert (env :github-client-secret) "GITHUB_CLIENT_SECRET environment variable not set")

 (defn ensure-jscache-dir []
   (let [p (str "resources/jscache/" (:cljsfiddle-version env) "/")


Stub out fn for getting page urls

Stub out fn for getting page urls

--- src/clj/comic_reader/sites.clj
+++ src/clj/comic_reader/sites.clj
@@ -24,6 +24,11 @@
         {:url comic-url
          :selector [:div#chapters :ul.chlist
                     :li :div #{:h3 :h4} :a]
+         :normalize link->map})
+      :page-list-data-for-comic-chapter
+      (fn [chapter-url]
+        {:url chapter-url
+         :selector [:div]
          :normalize link->map})})

    (let [canonical-url "http://www.mangareader.net"
@@ -38,4 +43,9 @@
       (fn [chapter-url]
         {:url chapter-url
          :selector [:div#chapterlist :tr :td :a]
+         :normalize link->map})
+      :page-list-data-for-comic-chapter
+      (fn [chapter-url]
+        {:url chapter-url
+         :selector [:div]
          :normalize link->map})})])


Don't cleanup domains if nothing was downloaded/updated.

--- src/clj/elephantdb/service.clj
+++ src/clj/elephantdb/service.clj
@@ -58,7 +58,7 @@
          (.mostRecentVersion remote-vs))))

 (defn use-cache-or-update
-  ([domain domains-info global-config local-config open-if-no-update ^DownloadState state]
+  ([domain domains-info global-config local-config update? ^DownloadState state]
      (let [fs (filesystem (:hdfs-conf local-config))
            lfs (local-filesystem)
            local-dir (:local-dir local-config)
@@ -78,7 +78,8 @@
          (do
            ;; signal all shards of domain are done loading
            (swap! (:finished-loaders state) + (count ((:shard-states state) domain)))
-           (if open-if-no-update
+           (if update?
+             :no-update
              (open-domain local-config
                           (str (path local-dir domain))
                           (domain/host-shards (domains-info domain))))))))
@@ -87,7 +88,7 @@
                           domains-info
                           global-config
                           local-config
-                          true
+                          false
                           (mk-loader-state { domain
                                             (domain/host-shards (domains-info domain)) }))))

@@ -192,10 +193,12 @@
     info ))

 (defn- close-if-updated [domain domains-info local-config new-data]
-  (if new-data
-    (close-domain domain domains-info))
-  (cleanup-domain domain domains-info local-config)
-  new-data)
+  (if (= new-data :no-update)
+    nil
+    (do (if new-data
+          (close-domain domain domains-info))
+        (cleanup-domain domain domains-info local-config)
+        new-data)))

 (defn- update-domains [all-domains domains-info global-config local-config]
   (let [max-kbs 8192
@@ -219,7 +222,7 @@
              (close-if-updated domain
                                domains-info
                                local-config
-                               (use-cache-or-update domain domains-info global-config local-config false state))))
+                               (use-cache-or-update domain domains-info global-config local-config true state))))
           (log-message "Finished updating all domains from remote")
           (catch Throwable t (log-error t "Error when syncing data") (throw t)))))))


Add pom dependency version matcher (commented)

--- src/cljs_api_gen/repo_cljs.clj
+++ src/cljs_api_gen/repo_cljs.clj
@@ -4,6 +4,7 @@
     [clojure.data :refer [diff]]
     [clojure.data.json :as json]
     [clojure.java.shell :refer [sh]]
+    [clojure.xml :as xml]
     [me.raynes.fs :refer [exists? mkdir base-name]]
     [clojure.string :refer [trim split split-lines ends-with?]]
     [cljs-api-gen.config :refer [repos-dir]]
@@ -323,11 +324,46 @@
 ;; Checkout
 ;;--------------------------------------------------------------------------------

+(defn pom-deps
+  "Create a map of keywordized artifactId to map like:
+    {:clojure
+      {:groupId \"org.clojure\", :artifactId \"clojure\", :version\"1.8.0\"}
+     ...}"
+  [cljs-tag]
+  (let [result (sh "git" "show"
+                 (str cljs-tag ":pom.template.xml")
+                 :dir (str repos-dir "/clojurescript"))]
+    (when (zero? (:exit result))
+      (let [xml (xml/parse (java.io.ByteArrayInputStream. (.getBytes (:out result))))
+            parse-dep (fn
+                        ;; "Convert to map like
+                        ;;   {:groupId \"org.clojure\", :artifactId \"clojure\", :version\"1.8.0\"}"
+                        [{:keys [content]}]
+                        (zipmap (map :tag content)
+                                (map (comp first :content) content)))
+            deps (->> xml
+                      (:content)
+                      (filter #(= :dependencies (:tag %)))
+                      (first)
+                      (:content)
+                      (map parse-dep))]
+        (zipmap (map (comp keyword :artifactId) deps) deps)))))
+
+(defn verify-pom-dep-match!
+  [dep bootstrap pom]
+  (when-not (= bootstrap pom)
+    (println)
+    (println dep "versions differ:")
+    (println " boostrap:" bootstrap)
+    (println "      pom:" pom)))
+
 (defn cljs-tag->dep-releases
   [cljs-tag]
   (let [bootstrap (:out (sh "git" "show"
                           (str cljs-tag ":script/bootstrap")
                           :dir (str repos-dir "/clojurescript")))
+        pom (pom-deps cljs-tag)
+
         clojure
         (cond
           (cljs-cmp >= cljs-tag "0.0-1847") (second (re-find #"(?m)^CLOJURE_RELEASE=\"(.*)\"" bootstrap))
@@ -350,6 +386,10 @@
           (cljs-cmp >= cljs-tag "0.0-1853") (second (re-find #"tools\.reader-(.*).jar" bootstrap))
           :else                             nil)] ;; `clojure.lang/LispReader` used instead of tools.reader

+    ;(verify-pom-dep-match! "clojure" clojure (:version (:clojure pom)))
+    ;(verify-pom-dep-match! "tools.reader" treader (:version (:tools.reader pom)))
+    ;(verify-pom-dep-match! "closure compiler" gclosure-com (:version (:closure-compiler-unshaded pom)))
+    ;(verify-pom-dep-match! "closure library" gclosure-lib (:version (:google-closure-library pom)))

     {:clj-version clojure
      :clj-tag (str "clojure-" clojure)


[n.find-view] Don't require find-view to return a View

--- src/clojure/neko/find_view.clj
+++ src/clojure/neko/find_view.clj
@@ -7,11 +7,6 @@
   (:import android.view.View
            android.app.Activity))

-(defn- nil-or-view?
-  [x]
-  (or (nil? x)
-      (instance? android.view.View x)))
-
 (defprotocol ViewFinder
   "Protocol for finding child views by their `:id` trait."
   (find-view [container id]))
@@ -19,12 +14,10 @@
 (extend-protocol ViewFinder
   View
   (find-view [^View view, id]
-    {:post [(nil-or-view? %)]}
     (get (.getTag view) id))

   Activity
   (find-view [^Activity activity, id]
-    {:post [(nil-or-view? %)]}
     (find-view (get-decor-view activity) id)))

 (defn find-views


fixed documentation

fixed documentation

--- src/clojure/sparkling/conf.clj
+++ src/clojure/sparkling/conf.clj
@@ -82,11 +82,18 @@
   Make sure to require sparkling.serialization namespace in your code, as otherwise the sparkling.serialization.Registrator class will not be available under special circumstances (REPL, dependency checkout in leiningen)...

   If you need to add your own registrations either create your own registrator or extend the Sparkling registrator with something like
-  (extend-type sparkling.serialization.Registrator
-             sparkling.serialization/RegistrationProtocol
-             (register-classes [#^KryoRegistrator _ #^Kryo kryo]
-             ;; register your classes here!
-             ))
+(deftype Registrator []
+  KryoRegistrator
+  (#^void registerClasses [#^KryoRegistrator this #^Kryo kryo]
+    (try
+      (.setInstantiatorStrategy kryo (StdInstantiatorStrategy.))
+      ; (.setRegistrationRequired kryo true)
+      (standard-registrator/register-base-classes kryo)
+      (standard-registrator/register kryo sparkling.testutils.records.domain.tweet :serializer tweet-serializer)
+      (standard-registrator/register-array-type kryo sparkling.testutils.records.domain.tweet)
+
+      (catch Exception e
+        (RuntimeException. \"Failed to register kryo!\" e)))))
   "
   [conf]
   (set conf "spark.kryo.registrator" "sparkling.serialization.Registrator"))


New sessions are now always written, whether or not they have data

--- src/compojure/http/session.clj
+++ src/compojure/http/session.clj
@@ -147,10 +147,9 @@
 (defn- set-session-cookie
   "Set the session cookie on the response."
   [request response session]
-  (let [new? (:new-session? request)]
-    (if-let [cookie (session-cookie new? session)]
-      (update-response {} response (set-cookie :session cookie))
-      response)))
+  (if-let [cookie (session-cookie (:new-session? request) session)]
+    (update-response request response (set-cookie :session cookie))
+    response))

 (defn with-session
   "Wrap a handler in a session."
@@ -162,7 +161,7 @@
           response (handler request)
           session  (get-response-session request response)]
       (when response
-        (if (:session response)
+        (if (or (:session response) (:new-session? request))
           (write-session session)
           (if (not-empty (:flash request))
             (write-session (:session request))))


Made session removable by returning a response where :session is nil.

Signed-off-by: James Reeves <9dadf8ecafa226c8f7c16002bdcb090267879343@weavejester.com>

--- src/compojure/http/session.clj
+++ src/compojure/http/session.clj
@@ -33,12 +33,12 @@
 (defmulti create-session
   "Create a new session map. Should not attempt to save the session."
   (fn [] (repository-type *session-repo*)))
-
+
 (defmulti read-session
   "Read in the session using the supplied data. Usually the data is a key used
   to find the session in a store."
   (fn [data] (repository-type *session-repo*)))
-
+
 (defmulti write-session
   "Write a new or existing session to the session store."
   (fn [session] (repository-type *session-repo*)))
@@ -135,7 +135,7 @@
   session."
   [request]
   (let [session (:session request)]
-    (-> request
+    (-> request
       (assoc :flash   (session :flash {}))
       (assoc :session (dissoc session :flash)))))

@@ -152,10 +152,13 @@
 (defn- save-handler-session
   "Save the session for a handler if required."
   [request response session]
-  (when (or (:session response)
+  (cond (and (contains? response :session)
+             (nil? (response :session)))
+        (destroy-session session)
+        (or (:session response)
             (:new-session? request)
             (not-empty (:flash request)))
-    (write-session session)))
+        (write-session session)))

 (defn with-session
   "Wrap a handler in a session of the specified type. Session type defaults to


use more expensive encryption for IMAP desktop->mobile

--- src/cljs/meins/electron/main/utils/encryption.cljs
+++ src/cljs/meins/electron/main/utils/encryption.cljs
@@ -89,7 +89,7 @@
         cipher-hex2 (time (encrypt-aes-hex-2 s secret))
         decrypted (decrypt-aes-hex-2 cipher-hex2 secret)]
     (info :decrypted decrypted)
-    cipher-hex))
+    cipher-hex2))

 (defn decrypt-aes-hex [hex-cipher secret]
   (try (let [ciphertext (hex-to-utf8 hex-cipher)


first crack at histogram, doesn't work.

first crack at histogram, doesn't work.

--- statspop/src/statspop/core.cljs
+++ statspop/src/statspop/core.cljs
@@ -1,7 +1,8 @@
 (ns statspop.core
-  (:require [reagent.core :as reagent]
+  (:require [reagent.core :as r]
             [statspop.charts.core :as c]
-            [statspop.charts.scatter :as sp]))
+            [statspop.charts.scatter :as sp]
+            [statspop.charts.hist :as hist]))

 (def test-mini (js/jStat (clj->js [[1 2] [3 4] [5 6]])))
@@ -30,13 +31,14 @@
    [:p [:button {:on-click #(reset! c/chart-datom c/test-data-1)} "load data 1"]]
    [:p [:button {:on-click #(reset! c/chart-datom c/test-data-2)} "load data 2"]]
    [:p [:button {:on-click #(reset! c/chart-datom (sp/make-scatterplot sp/test-data))} "scatterplot"]]
+   [:p [:button {:on-click #(reset! c/chart-datom (hist/make-histogram sp/tv 5))} "histogram"]]
    [c/chart-component c/chart-datom]])

 ;; -------------------------
 ;; Initialize app

 (defn mount-root []
-  (reagent/render [home-page] (.getElementById js/document "app")))
+  (r/render [home-page] (.getElementById js/document "app")))

 (defn init! []
   (mount-root))


need to get values as getNodes returns a map.

--- jar-prslib/src/clj/sixsq/slipstream/prs/javawrapper.clj
+++ jar-prslib/src/clj/sixsq/slipstream/prs/javawrapper.clj
@@ -35,7 +35,7 @@
   "
   [app]
   (let [comps []]
-    (for [node (.getNodes app)
+    (for [node (vals (.getNodes app))
           :let [comp (.getImage node)]]
       (into comps (comp-to-map comp)))
     comps))


DM & RS | #145 | Stonecutter 26 | Update configure in stonecutter

--- src/objective8/front_end/workflows/stonecutter.clj
+++ src/objective8/front_end/workflows/stonecutter.clj
@@ -23,12 +23,12 @@
                                                                       :client_secret (:client-secret stonecutter-config)}})]
       (-> token-response :body (json/parse-string keyword))))

-(defn configure [authorisation-provider-url
+(defn configure [auth-provider-url
                  client-id
                  client-secret
                  callback-uri]
-  (if (and authorisation-provider-url client-id client-secret callback-uri)
-    {:authorisation-provider-url authorisation-provider-url
+  (if (and auth-provider-url client-id client-secret callback-uri)
+    {:auth-provider-url auth-provider-url
      :client-id client-id
      :client-secret client-secret
      :callback-uri callback-uri}