fix last commit

fix last commit

--- src/angelic/scripts/thesis.clj
+++ src/angelic/scripts/thesis.clj
@@ -481,8 +481,8 @@
                    :size (inc (util/expt 2 (+ 2 si))))))
    ds))

-
-(defn make-dd-charts
+(comment
+ (defn make-dd-charts
    ([] (make-dd-charts "/Users/w01fe/Projects/phdthesis/graphs/"))
    ([dir]
       (doseq [[t data] (group-fs @dd-results)]
@@ -493,14 +493,14 @@
                [:alg] :sol-length field
                {:term "dashed size 4.0,3.0"
                 :ylog  "t"  :xlog "t"
-                ;:xrange "[5:500]"
+                                        ;:xrange "[5:500]"
                 :yrange "[0.01:100]"
                 :title (str "dd problems" t) :key "bottom right" #_"at 2.6, 445"
                 :xlabel "size" :ylabel ylabel}
                (constantly {:lw 3}) #_ (let [c (util/counter-from 0)] (fn [& args] (let [v ([1 2 3 6] (c))]  {:lw 3 :pt v :lt v})))
                (comp keyword first)
                identity #_(fn [l] (sort-by #(if (=  "UCS" (:title %)) "Q" (:title  %)) l)))
-              (charts/plot #_ (str dir "dd-" t ".pdf")))))))
+              (charts/plot #_ (str dir "dd-" t ".pdf"))))))))

 ;; Note: right factoring is crucial! (hsould also sub-factor tla refs?)
 ;; hierarchical hurts here.


Correct docs

Correct docs

--- src/exploud/deployment.clj
+++ src/exploud/deployment.clj
@@ -32,10 +32,12 @@
      created ASG are passing their healthchecks (by showing a 200 status)
    - __enable-asg__ - enable traffic to the newly-created ASG
    - __wait-for-elb-health__ - if adding instances to any ELBs, wait until
-     __all__ instances in the newly-created ASG are listed as healthy in the
-     ELBs, if not adding instances to any ELBs this is a no-op
-   - __disable-asg__ - disable traffic to the old ASG
-   - __delete-asg__ - delete the old ASG, terminating any instances within it"
+     the minimum number of instances in the newly-created ASG are listed as
+     healthy in the ELBs, if not adding instances to any ELBs this is a no-op
+   - __disable-asg__ - disable traffic to the old ASG, if there was no previous
+     ASG this is a no-op
+   - __delete-asg__ - delete the old ASG, terminating any instances within it,
+     if there was no previous ASG this is a no-op"
   []
   [(new-task :create-asg)
    (new-task :wait-for-instance-health)


fixed bug where play/pause wont sync

fixed bug where play/pause wont sync

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -225,10 +225,10 @@
     (render [this]
       (if (:paused? data)
         (dom/img #js {:src "/images/player/play.svg"
-                      :onClick player/resume
+                      :onClick core/resume
                       :title "Resume Track"})
         (dom/img #js {:src "/images/player/pause.svg"
-                      :onClick player/pause
+                      :onClick core/pause
                       :title "Pause Track"})))))

 (defn previous-track-button [data owner]


add leading 0

add leading 0

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -191,9 +191,14 @@
             duration-minutes (Math.floor (/ (mod duration 3600) 60))
             duration-seconds (Math.floor (mod duration 60))
             duration-str (str (if (> duration-hours 0)
-                                       (str duration-hours ":"))
-                                     duration-minutes ":"
-                                     duration-seconds)
+                                (do
+                                  (if (> 10 duration-minutes)
+                                    "0")
+                                  (str duration-hours ":")))
+                              duration-minutes ":"
+                              (if (> 10 duration-seconds)
+                                "0")
+                              duration-seconds)
             username (tracks/get-uploader-from-id track-id)
             current-track-id (:current-track-id @app-state/app-state)
             mime-type (.-mime data)


+ comments

+ comments

--- src/jasons_game/routes.clj
+++ src/jasons_game/routes.clj
@@ -7,8 +7,7 @@
             [compojure.route :as route]
             [ring.middleware.format-response :refer [wrap-clojure-response]]))

-(defn something-to-say []
-  (pr-str (edn/read-string (slurp "server-resources/things-to-say.edn"))))
+;; Load/Save world state

 (defn load-world []
   (with-open [in (java.io.PushbackReader. (reader "server-resources/world.edn"))]
@@ -22,6 +21,9 @@
     (spit "server-resources/world.edn" writer)
     "Saved"))

+
+;; Media resources
+
 (defn get-resource
   [kind type encoding id]
   (let [r (str id "." type)
@@ -32,14 +34,27 @@
       (slurp f))))

+;; Conversation resources
+
+(defn something-to-say []
+  (pr-str (edn/read-string (slurp "server-resources/things-to-say.edn"))))
+
+
 ;; Routes

 (defroutes app-routes
-  (GET "/something-to-say" [] (something-to-say))
+  ; load/save world state
   (GET "/world" [] (load-world))
   (POST "/save-world" [world] (save-world world))
+
+  ; media resources
   (GET "/:kind/:type/:id" [kind type encoding id] (get-resource kind type nil id))
   (GET "/:kind/:type/:encoding/:id" [kind type encoding id] (get-resource kind type encoding id))
+
+  ; conversation resources
+  (GET "/something-to-say" [] (something-to-say))
+
+  ; default routes
   (route/resources "/")
   (route/not-found "Not Found"))


style

style

--- src/java_time/temporal.clj
+++ src/java_time/temporal.clj
@@ -169,9 +169,8 @@
              res (transient {})]
         (if f
           (recur (first r) (rest r)
-                 (if (jt.c/supports? o f)
-                   (assoc! res k f)
-                   res))
+                 (cond-> res
+                   (jt.c/supports? o f) (assoc! k f)))
           (persistent! res)))))

   jt.c/HasProperties
@@ -256,7 +255,7 @@
   jt.c/HasUnits
   (unit* [o k]
     (when-let [u (jt.p/get-unit k)]
-      (first (filter #(= u %) (.getUnits o)))))
+      (some #{u} (.getUnits o))))

   (units [o]
     (let [[u & us] (.getUnits o)]


Use location.replace after register so user can't go back.

--- src/cljs/elevent_client/pages/events/id/register.cljs
+++ src/cljs/elevent_client/pages/events/id/register.cljs
@@ -55,7 +55,7 @@
                                #(do
                                   (callback)
                                   (swap! state/session dissoc :stripe-token)
-                                  (js/location.assign (routes/event-schedule event)))
+                                  (js/location.replace (routes/event-schedule event)))
                                callback))
                       callback)
                     (api/attendees-endpoint
@@ -64,7 +64,7 @@
                        :EventId event-id}
                       #(do
                          (callback)
-                         (js/location.assign (routes/event-schedule event)))
+                         (js/location.replace (routes/event-schedule event)))
                       callback)))))]
         (when (seq event)
           (when (and (:HasLogo event)


Updating sample code based on changes to proto repl lib.

--- proto-repl-charts/scratch_draw.clj
+++ proto-repl-charts/scratch_draw.clj
@@ -17,7 +17,8 @@

 (defn draw-line
   [x1 y1 x2 y2]
-  (proto-repl.extension-comm/request
+  (proto-repl.extension-comm/send-command
+   proto-repl.extension-comm/saved-extension-comm-state
    "proto-repl-charts"
    {:type "canvas"
     :name "Test"
@@ -28,43 +29,41 @@

 (defn width
   []
-  (proto-repl.extension-comm/request-and-wait
+  (proto-repl.extension-comm/send-command
+   proto-repl.extension-comm/saved-extension-comm-state
    "proto-repl-charts"
    {:type "canvas"
     :name "Test"
-    :data [[:width]]}))
+    :data [[:width]]}
+   {:wait-for-response? true}))

 (defn height
   []
-  (proto-repl.extension-comm/request-and-wait
+  (proto-repl.extension-comm/send-command
+   proto-repl.extension-comm/saved-extension-comm-state
    "proto-repl-charts"
    {:type "canvas"
     :name "Test"
-    :data [[:height]]}))
+    :data [[:height]]}
+   {:wait-for-response? true}))

-(proto-repl.extension-comm/request-and-wait
+(proto-repl.extension-comm/send-command
+ proto-repl.extension-comm/saved-extension-comm-state
  "proto-repl-charts"
  {:type "canvas"
   :name "Test"
   ;; TODO figure out how to get things from the canvas itself and not the context
   ;; There are definitely times when we'll want either. Or maybe just width and height
   ;; as specific commands.
-  :data [[:get [:lineWidth]]]})
+  :data [[:get [:lineWidth]]]}
+ {:wait-for-response? true})

-
-
-
-(proto-repl.extension-comm/request-and-wait
- "proto-repl-charts"
- {:type "canvas"
-  :name "Test"
-  ;; TODO figure out how to set things from the canvas itself and not the context
-  :data [[:set [:lineWidth 20]]]})

 (defn clear
   []
-  (proto-repl.extension-comm/request
+  (proto-repl.extension-comm/send-command
+   proto-repl.extension-comm/saved-extension-comm-state
    "proto-repl-charts"
    {:type "canvas"
     :name "Test"


Use /tasks as the landing URI after login

--- src/rest/core.clj
+++ src/rest/core.clj
@@ -25,6 +25,7 @@
       app-routes
       {:allow-anon? true
        :login-url "/login"
+       :default-landing-uri "/tasks"
        :unauthorized-handler #(-> unauthorized
                                   resp/response
                                   (resp/status 401))


errln in with-timeout

errln in with-timeout

--- src/atom_finder/atom_patch.clj
+++ src/atom_finder/atom_patch.clj
@@ -29,7 +29,7 @@
   `(try (thunk-timeout (fn [] ~@body) ~time :seconds)
         (catch java.util.concurrent.TimeoutException e#
           (do
-            (println (str "Killed operation when it exceded max duration of " ~time ", body: " '~@body))
+            (errln (str "Killed operation when it exceded max duration of " ~time ", body: " '~@body))
             nil))))

 (def AtomFinder (s/=> IASTTranslationUnit [IASTTranslationUnit]))


fix typo in "stop"

fix typo in "stop"

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -2033,7 +2033,11 @@
                                   :2 {:agr subject-agr
                                       :pronoun true
                                       :reflexive true
-                                      :sem subject-semantics}}}})])
+                                      :sem subject-semantics}}}})
+             ;; 2. intransitive sense of "stop"
+             {:unify [common]
+              :synsem {:sem {:pred :stop
+                             :subcat {:2 '()}}}}])

    "strike" {:english {:past "struck"}
              :synsem {:cat :verb


remove {:mass false} from "the"; since it can be used with mass=true nouns ; e.g. "the music"

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1359,8 +1359,7 @@
                     :sem {:pred :tell}}}
    "the" (map #(unify %
                       {:synsem {:cat :det
-                                :def :def
-                                :mass false}})
+                                :def :def}})
               [{:synsem {:agr {:number :sing}}}
                {:synsem {:agr {:number :plur}}}])


remove redundant pronoun entries

remove redundant pronoun entries

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -2287,30 +2287,6 @@
               :sem {:human true
                     :pred :tu}
               :subcat '()}}]
-
-   "you (♂)"
-   {:synsem {:cat :noun
-             :pronoun true
-             :reflexive false
-             :case :top ;; see comment in "it" about :case.
-             :agr {:person :2nd
-                   :gender :masc
-                   :number :sing}
-             :sem {:human true
-                   :pred :tu}
-             :subcat '()}}
-
-   "you (♀)"
-   {:synsem {:cat :noun
-             :pronoun true
-             :reflexive false
-             :case :top ;; see comment in "it" about :case.
-             :agr {:person :2nd
-                   :gender :fem
-                   :number :sing}
-             :sem {:human true
-                   :pred :tu}
-             :subcat '()}}

    "you all"
    [{:english {:note "♂"}
@@ -2338,32 +2314,6 @@
                    :pred :voi}
              :subcat '()}}]

-   "you all (♂)"
-   {:synsem {:cat :noun
-             :pronoun true
-             :reflexive false
-             :case :top ;; see comment in "it" about :case.
-             :agr {:person :2nd
-                   :gender :masc
-                   :number :plur}
-             :sem {:human true
-                   :reflexive false
-                   :pred :voi}
-             :subcat '()}}
-
-   "you all (♀)"
-   {:synsem {:cat :noun
-             :pronoun true
-             :reflexive false
-             :case :top ;; see comment in "it" about :case.
-             :agr {:person :2nd
-                   :gender :fem
-                   :number :plur}
-             :sem {:human true
-                   :reflexive false
-                   :pred :voi}
-             :subcat '()}}
-
    "your"
    (map #(unify %
                 {:synsem {:cat :det
@@ -2394,30 +2344,6 @@
               :sem {:human true
                     :pred :tu}
               :subcat '()}}]
-
-   "yourself (♀)"
-   {:synsem {:cat :noun
-             :pronoun true
-             :case :acc
-             :reflexive true
-             :agr {:person :2nd
-                   :number :sing
-                   :gender :fem}
-             :sem {:human true
-                   :pred :tu}
-             :subcat '()}}
-
-   "yourself (♂)"
-   {:synsem {:cat :noun
-             :pronoun true
-             :case :acc
-             :reflexive true
-             :agr {:person :2nd
-                   :number :sing
-                   :gender :masc}
-             :sem {:human true
-                   :pred :tu}
-             :subcat '()}}

    "yourselves"
    [{:synsem {:cat :noun


changed eo to ēre

changed eo to ēre

--- src/babel/latin/morphology.clj
+++ src/babel/latin/morphology.clj
@@ -2,37 +2,37 @@
   )

 (def replace-patterns
-  {:p [#"^(.)eo$" "$1eo"]
+  {:p [#"^(.)eo$" "$1ēre"]
    :g [#"^(.)eo$" "$1eo"]
    :u {:synsem {:infl :present
                 :sem {:tense :present}
                 :subcat {:1 {:agr {:number :sing
                                    :person :1st}}}}}}
-  {:p [#"^(.)as$" "$1eo"]
+  {:p [#"^(.)as$" "$1ēre"]
    :g [#"^(.)eo$" "$1as"]
    :u {:synsem {:infl :present
                 :sem {:tense :present}
                 :subcat {:1 {:agr {:number :sing
                                    :person :2nd}}}}}}
-  {:p [#"^(.)at$" "$1eo"]
+  {:p [#"^(.)at$" "$1ēre"]
    :g [#"^(.)eo$" "$1at"]
    :u {:synsem {:infl :present
                 :sem {:tense :present}
                 :subcat {:1 {:agr {:number :sing
                                    :person :3rd}}}}}}
-  {:p [#"^(.)amus$" "$1eo"]
+  {:p [#"^(.)amus$" "$1ēre"]
    :g [#"^(.)eo$" "$1amus"]
    :u {:synsem {:infl :present
                 :sem {:tense :present}
                 :subcat {:1 {:agr {:number :plur
                                    :person :1st}}}}}}
-  {:p [#"^(.)atis$" "$1eo"]
+  {:p [#"^(.)atis$" "$1ēre"]
    :g [#"^(.)eo$" "$1atis"]
    :u {:synsem {:infl :present
                 :sem {:tense :present}
                 :subcat {:1 {:agr {:number :plur
                                    :person :2nd}}}}}}
-  {:p [#"^(.)ant$" "$1eo"]
+  {:p [#"^(.)ant$" "$1ēre"]
    :g [#"^(.)eo$" "$1ant"]
    :u {:synsem {:infl :present
                 :sem {:tense :present}


Be strict on inputs schema now that the implementation requires it. #8

--- src/buildviz/build_results.clj
+++ src/buildviz/build_results.clj
@@ -6,7 +6,10 @@
                                 :end {:type "integer"}
                                 :outcome {:enum ["pass" "fail"]}
                                 :inputs {:type "array"
-                                         :items {:type "object"}}}
+                                         :items {:type "object"
+                                                 :properties {:revision {:type ["string" "integer"]}
+                                                              :source_id {:type ["string" "integer"]}}
+                                                 :additionalProperties false}}}
                    :additionalProperties false})

 (defn build-data-validation-errors [build-data]


Stop using the email as a primary key to avoid seeing exceptions.

--- src/circleci/db/migrations.clj
+++ src/circleci/db/migrations.clj
@@ -30,9 +30,12 @@
   (println "alter-table: beta checkbox")
   (jdbc/do-commands "ALTER TABLE beta_notify ADD contact boolean"))

-; Since we don't authenticate a user's info/email, we can't just say "it looks like you signed up before, here's your info", so we use their session. I'm not sure how to make the session info DB based, so I'll just use the session/email as the primary key.
+; Since we don't authenticate a user's info/email, we can't just say "it looks like you signed up before, here's your info", so we use their session. I'm not sure how to make the session info DB based, so I'll just store the session alongside.
 (defmigration "add session key"
   (println "alter-table: add session-key")
   (jdbc/do-commands "ALTER TABLE beta_notify ADD session_key text"))

+(defmigration "signup twice"
+  (println "alter-table: remove primary key constraint")
+  (jdbc/do-commands "ALTER TABLE beta_notify DROP CONSTRAINT beta_notify_pkey"))


Still passing.

Still passing.

--- src/clj/elephantdb/service.clj
+++ src/clj/elephantdb/service.clj
@@ -46,11 +46,10 @@
          (.mostRecentVersion remote-vs))))

 (defn mk-local-vs
-  [remote-fs remote-path local-path]
-  (let [remote-vs (DomainStore. remote-fs remote-path)]
-    (DomainStore. (local-filesystem)
-                  local-path
-                  (.getSpec remote-vs))))
+  [remote-vs local-path]
+  (DomainStore. (local-filesystem)
+                local-path
+                (.getSpec remote-vs)))

 (defn cleanup-domain!
   [domain-path]
@@ -100,24 +99,28 @@
 (defn load-and-sync-status!
   "TODO: Only note success for non-failed domains. check thrift status."
   [edb-config rw-lock domains-info & {:keys [state]}]
-  (let [{remote-path-map :domains
-         local-dir :local-dir} edb-config
-         status (thrift/ready-status :loading? true)
-         domain-names (keys domains-info)
-         loaders (p-dofor [[domain info] domains-info]
-                          (try (domain/set-domain-status! info status)
-                               (let [remote-path (get remote-path-map domain)
-                                     loader-state (or state (mk-loader-state
-                                                             {domain (domain/host-shards info)}))]
-                                 (when-let [new-data (use-cache-or-update domain
-                                                                          remote-path
-                                                                          edb-config
-                                                                          loader-state)]
-                                   (domain/set-domain-data! rw-lock domain info new-data)))
-                               (domain/set-domain-status! info (thrift/ready-status))
-                               (catch Throwable t
-                                 (log-error t "Error when loading domain " domain)
-                                 (domain/set-domain-status! info (thrift/failed-status t)))))]
+  (let [{:keys [hdfs-conf local-dir local-db-conf]} edb-config
+        remote-fs (filesystem hdfs-conf)
+        remote-path-map (:domains edb-config)
+        status (thrift/ready-status :loading? true)
+        domain-names (keys domains-info)
+        loaders (p-dofor [[domain info] domains-info]
+                         (try (domain/set-domain-status! info status)
+                              (let [remote-path (get remote-path-map domain)
+                                    remote-vs (DomainStore. remote-fs remote-path)
+                                    local-domain-root (str (path local-dir domain))
+                                    local-vs (mk-local-vs remote-vs local-domain-root)
+                                    loader-state (or state (mk-loader-state
+                                                            {domain (domain/host-shards info)}))]
+                                (when-let [new-data (use-cache-or-update domain
+                                                                         remote-path
+                                                                         edb-config
+                                                                         loader-state)]
+                                  (domain/set-domain-data! rw-lock domain info new-data)))
+                              (domain/set-domain-status! info (thrift/ready-status))
+                              (catch Throwable t
+                                (log-error t "Error when loading domain " domain)
+                                (domain/set-domain-status! info (thrift/failed-status t)))))]
     (with-ret loaders
       (try (log-message "Removing all old versions of updated domains!")
            (cleanup-domains! domain-names local-dir)
@@ -129,15 +132,15 @@
   [edb-config rw-lock domains-info]
   (let [{:keys [hdfs-conf local-dir local-db-conf]} edb-config
         remote-path-map (:domains edb-config)
+        remote-fs (filesystem hdfs-conf)
         status (thrift/loading-status)
         domain-names (keys domains-info)
         loaders (p-dofor [[domain info] domains-info]
                          (try (domain/set-domain-status! info status)
                               (let [remote-path  (get remote-path-map domain)
+                                    remote-vs (DomainStore. remote-fs remote-path)
                                     local-domain-root (str (path local-dir domain))
-                                    local-vs (mk-local-vs (filesystem hdfs-conf)
-                                                          remote-path
-                                                          local-domain-root)]
+                                    local-vs (mk-local-vs remote-vs local-domain-root)]
                                 (when-let [new-data (and (domain-has-data? local-vs)
                                                          (open-domain local-db-conf
                                                                       local-domain-root


Better logging for update-domains

Better logging for update-domains

--- src/clj/elephantdb/service.clj
+++ src/clj/elephantdb/service.clj
@@ -215,9 +215,8 @@

 (defn- update-domains [service-handler download-supervisor all-domains domains-info global-config local-config]
   (if (service-updating? service-handler download-supervisor)
-    (log-message "Updater process: Not updating as update process still in progress.")
+    (log-message "UPDATER - Not updating as update process still in progress.")
     (do
-      (log-message "Updater process: Updating all domains via updateAll().")
       (let [max-kbs 8192
             all-shards (domain/all-shards domains-info)
             domain-shards (into {} (map (fn [domain]
@@ -225,7 +224,7 @@
                                         all-domains))
             shard-amount (reduce + 0 (map #(count %) (vals all-shards)))]

-        (log-message "Updating domains: " (str-utils/str-join ", " all-domains))
+        (log-message "UPDATER - Updating domains: " (str-utils/str-join ", " all-domains))

         (let [^DownloadState state (mk-loader-state domain-shards)
               shard-amount (reduce + 0 (map #(count %) (vals (:shard-states state))))]


parse assertion endorsment

parse assertion endorsment

--- src/clj/salava/badge/parse.clj
+++ src/clj/salava/badge/parse.clj
@@ -83,6 +83,17 @@
                        :audience (s/maybe s/Str)
                        :ctime s/Int
                        :mtime s/Int})
+
+(s/defschema UserEndorsement [{:id (s/maybe s/Int)
+                            :issuer_id (s/maybe s/Int)
+                            :issuer_name (s/maybe s/Str)
+                            :issuer_url (s/maybe s/Str)
+                            :user_badge_id (s/maybe s/Int)
+                            :external_id (s/maybe s/Str)
+                            :content s/Str
+                            :mtime s/Int
+                            :ctime s/Int
+                            }])

 (s/defschema UserBadge {:id (s/maybe s/Int)
@@ -106,7 +117,8 @@
                         :issuer_verified (s/enum 0 1)
                         :show_evidence   (s/enum 0 1)
                         :last_checked (s/maybe s/Int)
-                        :old_id (s/maybe s/Int)})
+                        :old_id (s/maybe s/Int)
+                        :endorsement (s/maybe UserEndorsement)})

 (def valid-badge (s/validator UserBadge))
@@ -264,6 +276,32 @@
                                    http/json-get
                                    (get-endorsement (dec depth))))
                      (assoc-in e [:issuer :endorsement] [])))))))))
+
+(defn- get-assertion-endorsement [assertion]
+  (let [endorsement (:endorsement assertion)]
+    (if (empty? endorsement)
+      []
+      (->> endorsement
+           (map #(if (map? %) {:id nil
+                               :external_id (:id %)
+                               :user_badge_id nil
+                               :issuer_id nil
+                               :issuer_name (get-in % [:issuer :name] nil)
+                               :issuer_url (get-in % [:issuer :id] nil)
+                               :content (get-in % [:claim :endorsementComment])
+                               :ctime (u/str->epoch (:issuedOn %))
+                               :mtime (u/str->epoch (:issuedOn %))}
+
+                   (http/json-get %)))
+           (map (fn [e] {:id nil
+                         :external_id (:id e)
+                         :user_badge_id nil
+                         :issuer_id nil
+                         :issuer_name (get-in e [:issuer :name] nil)
+                         :issuer_url (get-in e [:issuer :id] nil)
+                         :content (get-in e [:claim :endorsementComment])
+                         :ctime (u/str->epoch (:issuedOn e))
+                         :mtime (u/str->epoch (:issuedOn e))}))))))

 (defn- get-alignment [badge]
   (map (fn [a]
@@ -371,34 +409,33 @@
                      (map #(http/json-get (:id %)))
                      (remove #(nil? ((keyword "@language") %))))
         default-language (get badge (keyword "@language") "")
-        endorsement (cond
-                      (map? (:endorsement assertion)) [{:id nil
-                                                        :external_id (get-in assertion [:endorsement :id])
-                                                        :user_badge_id nil
-                                                        :issuer_id nil
-                                                        :issuer_name (get-in assertion [:endorsement :issuer :name])
-                                                        :issuer_url (get-in assertion [:endorsement :issuer :id])
-                                                        :content (get-in assertion [:endorsement :claim :endorsementComment])
-                                                        :status "accepted"
-                                                        :ctime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
-                                                        :mtime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
-                                                        }]
-
-                      (coll? (:endorsement assertion)) (mapv (fn [e]
-                                                              {:id nil
-                                                               :external_id (get-in assertion [:endorsement :id])
-                                                               :user_badge_id nil
-                                                               :issuer_id nil
-                                                               :issuer_name (get-in assertion [:endorsement :issuer :name])
-                                                               :issuer_url (get-in assertion [:endorsement :issuer :id])
-                                                               :content (get-in assertion [:endorsement :claim :endorsementComment])
-                                                               :status "accepted"
-                                                               :ctime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
-                                                               :mtime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
-                                                               }) (:endorsement assertion))
-                      :else []
-                      ) ]
-
+        endorsement (get-assertion-endorsement assertion) #_(cond
+                                                    (map? (:endorsement assertion)) [{:id nil
+                                                                                :external_id (get-in assertion [:endorsement :id])
+                                                                                :user_badge_id nil
+                                                                                :issuer_id nil
+                                                                                :issuer_name (get-in assertion [:endorsement :issuer :name])
+                                                                                :issuer_url (get-in assertion [:endorsement :issuer :id])
+                                                                                :content (get-in assertion [:endorsement :claim :endorsementComment])
+                                                                                :status "accepted"
+                                                                                :ctime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
+                                                                                :mtime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
+                                                                                }]
+
+                                                    (coll? (:endorsement assertion)) (mapv (fn [e]
+                                                                                {:id nil
+                                                                                :external_id (get-in assertion [:endorsement :id])
+                                                                                :user_badge_id nil
+                                                                                :issuer_id nil
+                                                                                :issuer_name (get-in assertion [:endorsement :issuer :name])
+                                                                                :issuer_url (get-in assertion [:endorsement :issuer :id])
+                                                                                :content (get-in assertion [:endorsement :claim :endorsementComment])
+                                                                                :status "accepted"
+                                                                                :ctime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
+                                                                                :mtime (u/str->epoch (get-in assertion [:endorsement :issuedOn]))
+                                                                                }) (:endorsement assertion))
+                                                    :else []
+                                                    ) ]
     (assoc initial
       :badge (merge {:id ""
                      :remote_url nil
@@ -593,7 +630,7 @@
                          (and (string? input) (re-find #".+\..+\..+" input)) :jws)))

 (defmethod str->badge :json [user input]
-  (let [content (json/read-str input :key-fn keyword)
+  (let [content (-> (json/read-str input :key-fn keyword) (dissoc :endorsement))
         kind (get-in content [:verify :type] (get-in content [:verification :type]))]
     (if (or (= kind "hosted") (= kind "HostedBadge"))
       (str->badge user (get-in content [:verify :url] (:id content))))))


Cleaning up requires

Cleaning up requires

--- src/clj/zetawar/views/site.clj
+++ src/clj/zetawar/views/site.clj
@@ -1,6 +1,5 @@
 (ns zetawar.views.site
   (:require
-   [clojure.pprint :refer [pprint]]
    [zetawar.views.common :refer [footer head kickstarter-alert navbar]]
    [hiccup.page :refer [html5 include-js]]
    [zetawar.site :as site])


don't show +/- buttons on report rows w/o commodity

--- src/clj_money/web/accounts.clj
+++ src/clj_money/web/accounts.clj
@@ -217,22 +217,23 @@
    [:td {:class (format "text-right %s" (if (<= 0 gain) "gain" "loss"))}
     (format-number gain)]
    [:td
-    [:div.btn-group
-     (glyph-button :plus-sign
-                   (format "/accounts/%s/purchases/new?commodity-id=%s"
-                           (:id account)
-                           commodity-id)
-                   {:size :extra-small
-                    :level :success
-                    :title "Click here to purchase more shares of this commodity."})
-     (glyph-button :minus-sign
-                   (format "/accounts/%s/sales/new?commodity-id=%s&shares=%s"
-                           (:id account)
-                           commodity-id
-                           shares)
-                   {:size :extra-small
-                    :level :danger
-                    :title "Click here to sell shares of this commodity."})]]])
+    (when (= :data style)
+      [:div.btn-group
+       (glyph-button :plus-sign
+                     (format "/accounts/%s/purchases/new?commodity-id=%s"
+                             (:id account)
+                             commodity-id)
+                     {:size :extra-small
+                      :level :success
+                      :title "Click here to purchase more shares of this commodity."})
+       (glyph-button :minus-sign
+                     (format "/accounts/%s/sales/new?commodity-id=%s&shares=%s"
+                             (:id account)
+                             commodity-id
+                             shares)
+                     {:size :extra-small
+                      :level :danger
+                      :title "Click here to sell shares of this commodity."})])]])

 (defmethod show-account :commodities
   [account params]


Enable user to reorder items in new docs-lb listbox by drag and drop

--- src/clj_ns_browser/browser.clj
+++ src/clj_ns_browser/browser.clj
@@ -601,7 +601,27 @@
     (config! (id :ns-lb) :selection-mode :multi-interval) ;; experimental...
     (config! (id :vars-lb) :model [])
     (config! (id :ns-entries-lbl) :text "0")
-    (config! (id :doc-lb) :model doc-lb-value-list)
+    (config! (id :doc-lb)
+             :model doc-lb-value-list
+             :drag-enabled? true
+             :drop-mode :insert
+             :transfer-handler
+             (seesaw.dnd/default-transfer-handler
+               :import [seesaw.dnd/string-flavor
+                        (fn [{:keys [target data drop? drop-location] :as m}]
+                          ;; Ignore anything dropped onto the list that is
+                          ;; not in the original set of list elements.
+                          (if (and drop?
+                                   (:insert? drop-location)
+                                   (:index drop-location)
+                                   (doc-lb-value-set data))
+                            (let [new-order (list-with-elem-at-index
+                                              @doc-lb-cur-order data
+                                              (:index drop-location))]
+                              (reset! doc-lb-cur-order new-order)
+                              (config! target :model new-order))))]
+               :export {:actions (constantly :copy)
+                        :start   (fn [c] [seesaw.dnd/string-flavor (selection c)])}))
     (config! (id :edit-btn) :enabled? false)
     (config! (id :browse-btn) :enabled? false)
     (config! (id :clojuredocs-online-rb) :selected? true)


Added pagination support to notes renderer

Pagination UI is missing, but console works...

--- src/cljs/modern_cljs/core.cljs
+++ src/cljs/modern_cljs/core.cljs
@@ -3,6 +3,10 @@
   (:require [foo.bar]
             [m]
             [ajax.core :refer [GET POST]]))
+
+; Contants
+
+(def ^:const PAGESIZE 10)

 ; Mithril helpers

@@ -15,7 +19,8 @@
 ;

 (def db
-  {:var (str "tosi:" (rand-int 10))})
+  {:var (str "tosi:" (rand-int 10))
+   :start 10})

 (defn ^:export updatedb [fields value]
   (set! db (assoc-in db fields value))
@@ -40,13 +45,13 @@
 ; View
 ;

-(defn notes []
+(defn notes [start]
   "Returns 10 items from data"
   (map
     (fn [item]
       (let [title (get item "title")]
           (m "li" nil title)))
-    (take 10 (:data db))))
+    (take PAGESIZE (drop start (:data db)))))

 (defn ctrl []
   (println "Calling major Tom")
@@ -56,7 +61,7 @@
   (println "Seeing things")
   (m "div" nil
      [(m "h1" {:style {:color "green"}} (:var db))
-      (m "ol" nil (notes))]))
+      (m "ol" nil (notes (:start db)))]))

 (def app {:controller ctrl :view viewer})


Use max ratings, not avg ratings in book move stats.

--- src/clojure/clj_chess/book.clj
+++ src/clojure/clj_chess/book.clj
@@ -127,10 +127,8 @@
   (BookEntry.
     (:key (first book-entries))
     (:move (first book-entries))
-    (/ (reduce + (map :elo book-entries))
-       (max 1 (count (remove #{0} (map :elo book-entries)))))
-    (/ (reduce + (map :opponent-elo book-entries))
-       (max 1 (count (remove #{0} (map :opponent-elo book-entries)))))
+    (reduce max (map :elo book-entries))
+    (reduce max (map :opponent-elo book-entries))
     (reduce + (map :wins book-entries))
     (reduce + (map :draws book-entries))
     (reduce + (map :losses book-entries))


added three-way cogroup

added three-way cogroup

--- src/clojure/sparkling/core.clj
+++ src/clojure/sparkling/core.clj
@@ -386,7 +386,13 @@
    (u/set-auto-name
      (.cogroup rdd
                other1
-               other2))))
+               other2)))
+  ([^JavaPairRDD rdd ^JavaPairRDD other1 ^JavaPairRDD other2 ^JavaPairRDD other3]
+   (u/set-auto-name
+     (.cogroup rdd
+               other1
+               other2
+               other3))))

 (defn union
   "Build the union of two or more RDDs"


Convert indentation to spaces

Convert indentation to spaces

--- src/wishlistd/server.clj
+++ src/wishlistd/server.clj
@@ -1,6 +1,6 @@
 (ns wishlistd.server
   (:require [noir.server :as server]
-  	        [noir.fetch.remotes :as remotes]))
+            [noir.fetch.remotes :as remotes]))

 (server/load-views "src/wishlistd/views/")
 (server/add-middleware remotes/wrap-remotes)
@@ -10,4 +10,3 @@
         port (Integer. (get (System/getenv) "PORT" "8080"))]
     (server/start port {:mode mode
                         :ns 'wishlistd})))
-


Small fixes in the generation of the move scripts for migration

--- src/mdr2/abacus/import.clj
+++ src/mdr2/abacus/import.clj
@@ -201,7 +201,7 @@
   (spit filename s :append true))

 (defn format-obi-move [production]
-  (format "mv %s %s\n" (obi-project-path production) (path/recording-path production)))
+  (format "mv %s/* %s\n" (obi-project-path production) (path/recording-path production)))

 (defn format-merge [production]
   (let [file-name (str (:id production) ".xml")
@@ -268,9 +268,9 @@
                          (map #(nio/resolve-path path %))
                          (map nio/normalize))]
     (apply str
-           (format "xsltproc --novalid recode_ncc.xsl %s > %s\n"
+           (format "xsltproc --novalid recode_ncc.xsl %s > /tmp/foo.xml && mv /tmp/foo.xml %s\n"
                    ncc-file ncc-file)
-           (map (fn [f] (format "xsltproc --novalid recode_smil.xsl %s > %s\n" f f))
+           (map (fn [f] (format "xsltproc --novalid recode_smil.xsl %s > /tmp/foo.xml && mv /tmp/foo.xml %s\n" f f))
                 smil-files))))

 (defn copy-sigtuna-project! [production]


CMR-387: Merged master changes.

CMR-387: Merged master changes.


Default ES scroll batch size = 100000

Default ES scroll batch size = 100000


route lines element labeled ID is actually the short name

--- src/otp_api_proxy/util.clj
+++ src/otp_api_proxy/util.clj
@@ -38,12 +38,12 @@
   (let [lines (split (route-lines-request) #"\n")]
     (for [l lines]
       (let [fields (split l #"\\")]
-        {:route_id (nth fields 0)
-         :frequency (nth fields 5)}
+        {:route_short_name (nth fields 0)
+         :frequency        (nth fields 5)}
         ))))

-(defn anaheim-frequency-for-route-id [id]
-  (-> (filter (comp #{id} :route_id) (anaheim-route-lines))
+(defn anaheim-frequency-for-route-short-name [n]
+  (-> (filter (comp #{n} :route_short_name) (anaheim-route-lines))
       first
       :frequency))

@@ -285,11 +285,11 @@
   "Add route frequency for each route in otp itinerary."
   [plan]
   (let [walk-add-url (fn [x]
-                       (if (:routeId x)
+                       (if (:routeShortName x)
                          (assoc x
                                 :routeHumanFrequency
-                                (anaheim-frequency-for-route-id
-                                  (get x :routeId)))
+                                (anaheim-frequency-for-route-short-name
+                                  (get x :routeShortName)))
                          x))]
     (clojure.walk/postwalk walk-add-url plan)))


Modify default dependency satisfaction timeout to 20s

Also, correctly print out number of seconds, not ms!

--- src/overtone/libs/deps.clj
+++ src/overtone/libs/deps.clj
@@ -143,17 +143,17 @@
    Thread enters a sleep cycle sleeping for wait-time seconds before
    each dep check.  If timeout is a positive value throws timeout
    exception if deps haven't been satisfied by timeout secs. The default
-   wait-time is 0.1 seconds, and the default timeout is 10 seconds."
-  ([deps] (wait-until-deps-satisfied deps 10 0.1))
+   wait-time is 0.1 seconds, and the default timeout is 20 seconds."
+  ([deps] (wait-until-deps-satisfied deps 20 0.1))
   ([deps timeout] (wait-until-deps-satisfied deps timeout 0.1))
   ([deps timeout wait-time]
-     (let [timeout   (* 1000 timeout)
-           wait-time (* 1000 wait-time)]
-       (if (<= timeout 0)
+     (let [timeout-ms (* 1000 timeout)
+           wait-time  (* 1000 wait-time)]
+       (if (<= timeout-ms 0)
          (while (not (deps-satisfied? deps))
            (Thread/sleep wait-time))
          (loop [sleep-time 0]
-           (when (> sleep-time timeout)
+           (when (> sleep-time timeout-ms)
              (throw (Exception. (str "The following deps took too long (" timeout
                                      " seconds) to be satisfied: " deps))))
            (when-not (deps-satisfied? deps)


Avoid unnecessary sql updates when syncing executors

--- src/all/cider_ci/server/dispatcher/sync/update_executor.clj
+++ src/all/cider_ci/server/dispatcher/sync/update_executor.clj
@@ -52,7 +52,8 @@
         (get-executor (:id executor)))))

 (defn update-max-load [executor data]
-  (if (= (:max_load executor) (:max_load data))
+  (if (= (float (:max_load executor))
+         (float (:max_load data)))
     executor
     (do (jdbc/update!
           (rdbms/get-ds)


Dumb bytecode errors

Dumb bytecode errors

--- src/oxcart/emitter/jvm.clj
+++ src/oxcart/emitter/jvm.clj
@@ -101,13 +101,13 @@
                        :attr   #{:public :static}
                        :method `[[:main "java.lang.String[]"] :void]
                        :code   `[[:start-method] ; stack 1
+                                 [:aload 1]
                                  [:invoke-static [:clojure.lang.RT/seq :java.lang.Object] :clojure.lang.Seq] ; seq the array ; stack 1
                                  [:new-instance ~(e/var->class (resolve entry))] ; stack 2
                                  [:dup] ; stack 3
                                  [:invoke-constructor [~(keyword (e/var->class (resolve entry)) "<init>")] :void] ; stack 2
                                  [:invoke-interface [:clojure.lang.IFn/applyTo :clojure/lang/ISeq] :java.lang.Object] ; stack 1
                                  [:pop] ; stack 0
-                                 [:insn :ACONST_NULL] ; stack 1
                                  [:return-value] ; return garbage
                                  [:end-method]]}]}))))


Refactored parse-params

Refactored parse-params

--- src/compojure/http/request.clj
+++ src/compojure/http/request.clj
@@ -12,6 +12,7 @@

 (ns compojure.http.request
   (:use compojure.control)
+  (:use compojure.str-utils)
   (:use clojure.contrib.duck-streams)
   (:use clojure.contrib.str-utils)
   (:import java.net.URLDecoder)
@@ -38,14 +39,12 @@
   [param-str]
   (reduce
     (fn [param-map s]
-      (if (= s "")
-        param-map
-        (let [[key val] (re-split #"=" s)]
-          (assoc-vec param-map
-            (keyword (urldecode key))
-            (urldecode val)))))
+      (let [[key val] (re-split #"=" s)]
+        (assoc-vec param-map
+          (keyword (urldecode key))
+          (urldecode val))))
     {}
-    (re-split #"&" param-str)))
+    (remove blank? (re-split #"&" param-str))))

 (defn get-query-params
   "Parse parameters from the query string."


Make a torus-stepper suited to our screen size

--- src/petulant_life/main.clj
+++ src/petulant_life/main.clj
@@ -58,9 +58,11 @@
      (finally
        (~close-fn))))

+(def torus-step (l/stepper (l/mk-torus-neighbours [91 68]) #{3} #{2 3}))
+
 ;; Entry point.
 (defn -main [& args]
   (with-cleanup destroy
     (create)
     (run (s/load-shader-program "resources/gol")
-      l/rect-step)))
+      torus-step)))


added some documentation

added some documentation

--- sidecar/src/figwheel_sidecar/schemas/config.clj
+++ sidecar/src/figwheel_sidecar/schemas/config.clj
@@ -479,7 +479,14 @@
 figwheel client. Supplying a true value or a map indicates that you
 want the figwheel client code to be injected into the build.

-  :figwheel true")
+  :figwheel true
+
+Or
+
+  :figwheel {
+    :on-jsload \"example.core/on-reload\"
+  }
+")

 (def-key ::compiler ::cljs-opt/compiler-options
   "The options to be forwarded to the ClojureScript Compiler
@@ -638,7 +645,7 @@
 These urls will be opened with clojure.java.browse/browse-url.
 Default: nil (disabled)

-  :open-urls")
+  :open-urls [\"http://localhost:3449/index.html\"] ")

 ;; TODO fill out the docs below


ensure test sections have required fields


Change gamepad test function to specify 'harness'.

--- test/org/playasophy/wonderdome/input/gamepad_test.clj
+++ test/org/playasophy/wonderdome/input/gamepad_test.clj
@@ -6,7 +6,7 @@
     [org.playasophy.wonderdome.input.gamepad :as gamepad]))

-(defn gamepad-test
+(defn gamepad-harness
   "Creates and starts a gamepad input component attached to a channel and reader
   which will print events received to the console."
   []


CMR-3048: Changed SNS subscriptions to use raw mode

--- message-queue-lib/src/cmr/message_queue/queue/sqs.clj
+++ message-queue-lib/src/cmr/message_queue/queue/sqs.clj
@@ -182,8 +182,10 @@
         q-url (.getQueueUrl (.getQueueUrl sqs-client q-name))
         ex-name (normalize-queue-name exchange-name)
         topic (get-topic sns-client ex-name)
-        topic-arn (.getTopicArn topic)]
-    (Topics/subscribeQueue sns-client sqs-client topic-arn q-url extend?)))
+        topic-arn (.getTopicArn topic)
+        sub-arn (Topics/subscribeQueue sns-client sqs-client topic-arn q-url extend?)]
+    ;; use raw mode
+    (.setSubscriptionAttributes sns-client sub-arn "RawMessageDelivery" "true")))

 (defn- bind-queue-to-exchanges
  "Bind a queue to SNS Topics representing exchanges."


window size tests added

window size tests added

--- test/etaoin/api_test.clj
+++ test/etaoin/api_test.clj
@@ -248,16 +248,15 @@
 ;;          (is (numeric? x))
 ;;          (is (numeric? y)))))))

-;; (deftest test-window-size
-;;   (testing "getting size"
-;;     (let-window-size {:keys [width height]}
-;;       (is (numeric? width))
-;;       (is (numeric? height))))
-;;   (testing "setting size"
-;;     (with-window-size 555 666
-;;       (let-window-size {:keys [width height]}
-;;         (is (numeric? width))
-;;         (is (numeric? height))))))
+(deftest test-window-size
+  (testing "getting size"
+    (let [{:keys [width height]} (get-window-size *driver*)]
+      (is (numeric? width))
+      (is (numeric? height))
+      (set-window-size *driver* (+ width 10) (+ height 10))
+      (let [{:keys [width' height']} (get-window-size *driver*)]
+        (not= width width')
+        (not= height height')))))

 ;; (deftest test-active-element
 ;;   (testing "active element"


prevent double reporting of javascript errors on client-side

--- sidecar/src/figwheel_sidecar/repl/driver.clj
+++ sidecar/src/figwheel_sidecar/repl/driver.clj
@@ -7,7 +7,8 @@
     [figwheel-sidecar.repl.sniffer :as sniffer]
     [figwheel-sidecar.repl.messaging :as messaging]
     [cljs.analyzer :as ana]
-    [figwheel-sidecar.repl.registry :as registry]))
+    [figwheel-sidecar.repl.registry :as registry])
+  (:import (clojure.lang IExceptionInfo)))

 ; -- driver construction ----------------------------------------------------------------------------------------------------

@@ -180,6 +181,21 @@
       (announce-ns driver)
       (cljs-repl/repl-prompt)
       (sniffer/clear-content! @stdout-sniffer))))
+
+(defn custom-caught-factory [driver]
+  (fn [e repl-env opts]
+    (let [orig-call #(cljs-repl/repl-caught e repl-env opts)]
+      ; we want to prevent recording javascript errors and exceptions,
+      ; because those were already reported on client-side directly
+      ; other exceptional cases should be recorded as usual (for example exceptions originated in compiler)
+      (if (and (recording? driver)
+               (instance? IExceptionInfo e)
+               (#{:js-eval-error :js-eval-exception} (:type (ex-data e))))
+        (do
+          (stop-recording! driver)
+          (orig-call)
+          (start-recording! driver))
+        (orig-call)))))                                                                                ; TODO: in case of long clojure stacktraces we can do more user-friendly job

 ; -- sniffer handlers -------------------------------------------------------------------------------------------------------

@@ -208,6 +224,7 @@
                     :read (multiplexing-reader-factory driver)
                     :eval (custom-eval-factory driver)
                     :prompt (custom-prompt-factory driver)
+                    :caught (custom-caught-factory driver)
                     :bind-err false)]
     (let [stdout-sniffer (sniffer/make-sniffer *out* (partial flush-handler driver :stdout))
           stderr-sniffer (sniffer/make-sniffer *out* (partial flush-handler driver :stderr))]                                 ; *out* is here on purpose, see :bind-err and its effect when true (default)


Temporary commit

Temporary commit

--- edn-reader/src-cljs/edn_reader/core.cljs
+++ edn-reader/src-cljs/edn_reader/core.cljs
@@ -23,6 +23,24 @@
   (let [data (r/read-string s)]
     (with-out-str (fipp/pprint data))))

+(defn to-ink*
+  "Recursive form of conversion to Atom ink tree."
+  [v]
+  (cond
+    (map? v)
+    (for [[k val] v]
+      (into [(str (pr-str k) " " (pr-str val))]
+            (to-ink* val)))
+    (sequential? v)
+    (map to-ink* v)
+    :else [v]))
+
+(defn ^:export to-ink-tree
+  "Parses an EDN style tree and converts it into the Atom ink style tree for display."
+  [v]
+  (let [v (r/read-string v)]
+    (clj->js (into [(pr-str v)] (to-ink* v)))))
+
 (defn -main [& args])

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


CLJS-1270: Docstring for delay not printed by cljs.repl/doc

The order of the `doc-string?` and `[params*]` arguments
to the `delay` `defmacro` are reversed.

--- src/main/clojure/cljs/core.clj
+++ src/main/clojure/cljs/core.clj
@@ -1394,11 +1394,12 @@
   [& body]
   `(new cljs.core/LazySeq nil (fn [] ~@body) nil nil))

-(defmacro delay [& body]
+(defmacro delay
   "Takes a body of expressions and yields a Delay object that will
   invoke the body only the first time it is forced (with force or deref/@), and
   will cache the result and return it on all subsequent force
   calls."
+  [& body]
   `(new cljs.core/Delay (fn [] ~@body) nil))

 (defmacro with-redefs


clear some comments

clear some comments

--- test/open_company/unit/resources/company/company_create.clj
+++ test/open_company/unit/resources/company/company_create.clj
@@ -14,43 +14,6 @@

 (with-state-changes [(before :facts (c/delete-all-companies!))
                      (after :facts (c/delete-all-companies!))]
-
-;   (fact "about validity checks of a valid new companies"
-;     (c/valid-company r/TICKER r/OPEN) => true)
-
-;   (facts "about validity checks of invalid new companies"
-
-;     (facts "when no ticker symbol is provided"
-;       (doseq [ticker r/bad-symbols]
-;         (c/valid-company ticker (assoc r/OPEN :symbol ticker)) => :invalid-symbol
-;         (c/valid-company ticker r/OPEN) => :invalid-symbol
-;         (c/valid-company r/TICKER (assoc r/OPEN :symbol ticker)) => :invalid-symbol))
-
-;     (facts "when no name is provided"
-;       (c/valid-company r/TICKER (dissoc r/OPEN :name)) => :invalid-name
-;       (doseq [bad-name r/bad-names]
-;         (c/valid-company r/TICKER (assoc r/OPEN :name bad-name)) => :invalid-name))
-
-;     (fact "when a ticker symbol that's too long is provided"
-;       (c/valid-company r/too-long (assoc r/OPEN :symbol r/too-long)) => :invalid-symbol)
-
-;     (future-fact "when a ticker symbol with special characters is provided")
-
-;     (future-fact "when a reserved property is included"))
-
-;   (future-facts "about company creation failures"
-
-;     (future-facts "when no ticker symbol is provided")
-
-;     (future-facts "when no name is provided")
-
-;     (future-facts "when a ticker symbol that's too long is provided")
-
-;     (future-fact "when a ticker symbol with special characters is provided")
-
-;     (future-fact "when a reserved property is included")
-
-;     (future-fact "when a ticker symbol is already used"))

   (facts "about company creation"

@@ -105,4 +68,4 @@
                                      (add-section :mission) (add-section :press) (add-section :help)
                                      (add-section :challenges) (add-section :diversity) (add-section :update))
                                  r/coyote)))
-        => {:progress [:update :challenges :press :help] :financial [] :company [:diversity :mission]}))))+        => {:progress [:update :challenges :press :help] :financial [] :company [:diversity :mission]}))))


(MAINT) wrap IOException when throwing in shellutils

--- src/clj/puppetlabs/puppetserver/shell_utils.clj
+++ src/clj/puppetlabs/puppetserver/shell_utils.clj
@@ -73,4 +73,5 @@
          (throw (IllegalStateException.
                  (format "Exception while executing '%s': %s"
                          command
-                         (.getMessage e)))))))))+                         (.getMessage e))
+                 e)))))))


fix sleep import from healthkit

fix sleep import from healthkit

--- rn-app/src/cljs/meo/ios/healthkit.cljs
+++ rn-app/src/cljs/meo/ios/healthkit.cljs
@@ -114,9 +114,9 @@
                                   :sample         sample
                                   :md             text
                                   :tags           #{tag}
-                                  :custom-fields  {tag {:duration minutes}}
-                                  :linked-stories #{1479889430353}
-                                  :primary-story  1479889430353}]
+                                  :custom_fields  {tag {:duration minutes}}
+                                  :linked_stories #{1479889430353}
+                                  :primary_story  1479889430353}]
                        (put-fn (with-meta [:entry/update entry] {:silent true}))
                        (put-fn [:entry/persist entry]))))
         init-cb (fn [err res] (.getSleepSamples health-kit sleep-opts sleep-cb))]


Modify reddit recommender; add user-weights

--- src/main/clojure/dm/expt/reddit_recommender.clj
+++ src/main/clojure/dm/expt/reddit_recommender.clj
@@ -6,7 +6,7 @@
             [clojure [pprint :as pp]]))

 (defprotocol FeatureExtractor
-  (features [this subreddit-weight]))
+  (features [this user-weight subreddit-weight]))

 (defprotocol Affinity
   (value [this]))
@@ -16,8 +16,8 @@
   (value [this] (Float/valueOf value-str))

   FeatureExtractor
-  (features [this subreddit-weight]
-    [(subreddit-weight subreddit) (value this)]))
+  (features [this user-weight subreddit-weight]
+    [#_(user-weight user) (subreddit-weight subreddit) (value this)]))

 (defn -main
   ([]
@@ -27,10 +27,9 @@
    (with-open [r (io/reader file)]
      (let [data (i/sample (next (data/read-csv r)) :size 10000 :replacement false)
            affinities (map (partial apply ->RedditAffinity) data)
-           subreddit->user-count (reduce-kv #(assoc %1 %2 (count (into #{} (map :user %3))))
-                                            {}
-                                            (group-by :subreddit affinities))
-           feature-extractor #(features % subreddit->user-count)
+           user->subreddit-count (frequencies (map :user affinities))
+           subreddit->user-count (frequencies (map :subreddit affinities))
+           feature-extractor #(features % user->subreddit-count subreddit->user-count)
            k 4
            max-iters 10
            clusters (cluster/k-means affinities i/euclidean-distance feature-extractor k max-iters)]


[#113] Add more examples

[#113] Add more examples

--- priv/examples/guard.clj
+++ priv/examples/guard.clj
@@ -33,3 +33,16 @@
 (assert (clj_core/equiv.e (simple-or-guard 3) :integer-or-binary))
 (assert (clj_core/equiv.e (simple-or-guard "three") :integer-or-binary))
 (assert (try (simple-or-guard :three) false (catch _ e true)))
+
+(def nested-and-or
+  (fn* [x] {:when [:and [:or (erlang/is_integer.e x)
+                             (erlang/is_float.e x)]
+                        (erlang/>.e x 1)]}
+   :integer-or-float-more-than-1))
+
+(assert (clj_core/equiv.e (nested-and-or 3) :integer-or-float-more-than-1))
+(assert (clj_core/equiv.e (nested-and-or 3.0) :integer-or-float-more-than-1))
+(assert (try (nested-and-or 1) false (catch _ e true)))
+(assert (try (nested-and-or 1.0) false (catch _ e true)))
+(assert (try (nested-and-or "one") false (catch _ e true)))
+(assert (try (nested-and-or :one) false (catch _ e true)))


CMR-3253 Simplified more code

CMR-3253 Simplified more code

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/dif10.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/dif10.clj
@@ -46,11 +46,8 @@
   (let [access-constraints-record
         {:Description (value-of doc "/DIF/Access_Constraints")
          :Value (value-of doc "/DIF/Extended_Metadata/Metadata[Name='Restriction']/Value")}]
-    (if (seq (util/remove-nil-keys access-constraints-record))
-      (assoc access-constraints-record
-             :Description
-             (u/with-default (:Description access-constraints-record) apply-default?))
-      nil)))
+    (when (seq (util/remove-nil-keys access-constraints-record))
+      (update access-constraints-record :Description #(u/with-default % apply-default?)))))

 (defn- parse-instruments-impl
   [platform-el]


clean up docstrings

clean up docstrings

--- src/overtone/sc/machinery/server/connection.clj
+++ src/overtone/sc/machinery/server/connection.clj
@@ -25,12 +25,13 @@
   (when (not-empty @connection-info*) true))

 (defn- server-notifications-on
-  "Turn on notification messages from the audio server.  This lets us free
-  synth IDs when they are automatically freed with envelope triggers.  It also
-  lets us receive custom messages from various trigger ugens.
-
-  These messages are sent as notification of some event to all clients who have
-  registered via the /notify command .
+  "Turn on notification messages from the audio server.  This lets us
+  free synth IDs when they are automatically freed with envelope
+  triggers.  It also lets us receive custom messages from various
+  trigger ugens.
+
+  These messages are sent as notification of some event to all clients
+  who have registered via the /notify command .

   All of these have the same arguments:
    int - node ID
@@ -53,9 +54,10 @@
   (server-snd "/notify" 1))

 (defn- connect-jack-ports
-  "Connect the jack input and output ports as best we can.  If jack ports are
-  always different names with different drivers or hardware then we need to find
-  a better strategy to auto-connect. (For Linux users)"
+  "Connect the jack input and output ports as best we can.  If jack
+  ports are always different names with different drivers or hardware
+  then we need to find a better strategy to auto-connect. (For Linux
+  users)"
   ([] (connect-jack-ports 2))
   ([n-channels]
      (let [port-list (:out (sh "jack_lsp"))
@@ -137,11 +139,12 @@
 (defn connect
   "Connect to an externally running SC audio server.

-  (connect 57710)                  ;=> connect to an external server on the
-                                       localhost listening to port 57710
-  (connect \"192.168.1.23\" 57110) ;=> connect to an external server with ip
-                                       address 192.168.1.23 listening to port
-                                       57110"
+  (connect 57710)                ;=> connect to an external server on
+                                     the localhost listening to port
+                                     57710
+  (connect \"192.168.1.23\" 57110) ;=> connect to an external server with
+                                     ip address 192.168.1.23 listening to
+                                     port 57110"
   ([port] (connect "127.0.0.1" port))
   ([host port]
      (.run (Thread. #(external-connection-runner host port)))))
@@ -196,8 +199,8 @@
     (.destroy proc)))

 (defn- find-sc-path
-  "Find the path for SuperCollider. If linux don't check for a file as it should
-  be in the PATH list."
+  "Find the path for SuperCollider. If linux don't check for a file as
+  it should be in the PATH list."
   []
   (let [os    (config-get :os)
         paths (SC-PATHS os)
@@ -210,8 +213,8 @@
     path))

 (defn- boot-external-server
-  "Boot the audio server in an external process and tell it to listen on a
-  specific port."
+  "Boot the audio server in an external process and tell it to listen on
+  a specific port."
   ([port]
      (when-not (= :connected @connection-status*)
        (log/debug "booting external server")
@@ -234,13 +237,14 @@
            :external {:port port :host "127.0.0.1"})))

 (defn boot
-  "Boot either the internal or external audio server. If specified port is nil
-  will choose a random port.
+  "Boot either the internal or external audio server. If specified port
+  is nil will choose a random port.

    (boot) ; uses the default settings defined in your config
-   (boot :internal) ; boots the internal server
-   (boot :external) ; boots an external server on a random port
-   (boot :external 57110) ; boots an external server listening on port 57110"
+   (boot :internal)       ; boots the internal server
+   (boot :external)       ; boots an external server on a random port
+   (boot :external 57110) ; boots an external server listening on port
+                            57110"
   ([]                (boot (or (config-get :server) :internal) SERVER-PORT))
   ([connection-type] (boot connection-type SERVER-PORT))
   ([connection-type port]


remove fn used for generating test data

remove fn used for generating test data

--- test/metabase/test/data/dataset_definitions.clj
+++ test/metabase/test/data/dataset_definitions.clj
@@ -44,18 +44,11 @@
     ["Boston Port Act Passed"          (unix-timestamp :year 1774 :month  3 :date 31)]
     ["First Continental Congress Held" (unix-timestamp :year 1774 :month  9 :date  5)]]])

-(defn random-incident []
-  [(rand-int 6) (unix-timestamp-ms :year   2015
-                                   :month  6
-                                   :date    (+ 1 (rand-int 28)) ; 0 - 28
-                                   :hour   (rand-int 24)
-                                   :minute (rand-int 60))])
-
-(def ^:const edn-definitions-dir "./test/metabase/test/data/dataset_definitions/")
+(def ^:private ^:const edn-definitions-dir "./test/metabase/test/data/dataset_definitions/")

 ;; TODO - move this to interface
 ;; TODO - make rows be lazily loadable for DB definitions from a file
-(defmacro def-database-definition-edn [dbname]
+(defmacro ^:private def-database-definition-edn [dbname]
   `(def-database-definition ~dbname
      (edn/read-string (slurp ~(str edn-definitions-dir (name dbname) ".edn")))))


Remove expected output as we use the checker


Rename functions to use clojure style

Rename functions to use clojure style

--- src/clj/clojurewerkz/statistiker/metrics.clj
+++ src/clj/clojurewerkz/statistiker/metrics.clj
@@ -93,8 +93,8 @@
           (= 1 (count (distinct U)) (count (distinct V)))          ;only one cluster
           (= (count U) (count (distinct U)) (count (distinct V)))) ;every point is a singleton cluster
     1.0    ;special limit cases
-    (let [MI (mutual-information U V)
-          EMI (expected_mututal_information U V)
+    (let [MI  (mutual-information U V)
+          EMI (expected-mututal-information U V)
           h_U (prot-shannon-entropy (vals (frequencies U)))
           h_V (prot-shannon-entropy (vals (frequencies V)))]
       (/ (- MI EMI) (- (max h_U h_V) EMI)))))


Add error handling to garbage collection tasks

This helps to make them more standalone, to more easily refactor the way
they're managed and invoked.

--- src/com/puppetlabs/puppetdb/cli/services.clj
+++ src/com/puppetlabs/puppetdb/cli/services.clj
@@ -97,31 +97,40 @@
   "Deactivate nodes which haven't had any activity (catalog/fact submission) in
   more than `node-ttl-seconds` seconds."
   [db node-ttl-seconds]
-  (pl-utils/demarcate
-    (format "sweep of stale nodes (threshold: %s)"
-            (format-period (secs node-ttl-seconds)))
-    (with-transacted-connection db
-      (doseq [node (scf-store/stale-nodes (ago (secs node-ttl-seconds)))]
-        (send-command! "deactivate node" 1 (json/generate-string node))))))
+  (try
+    (pl-utils/demarcate
+      (format "sweep of stale nodes (threshold: %s)"
+              (format-period (secs node-ttl-seconds)))
+      (with-transacted-connection db
+        (doseq [node (scf-store/stale-nodes (ago (secs node-ttl-seconds)))]
+          (send-command! "deactivate node" 1 (json/generate-string node)))))
+    (catch Exception e
+      (log/error e "Error while deactivating stale nodes"))))

 (defn purge-nodes!
   "Delete nodes which have been *deactivated* for more than
   `node-purge-ttl-seconds` seconds."
   [db node-purge-ttl-seconds]
-  (pl-utils/demarcate
-    (format "purge deactivated nodes (threshold: %s)"
-            (format-period (secs node-purge-ttl-seconds)))
-    (with-transacted-connection db
-      (scf-store/purge-deactivated-nodes! (ago (secs node-purge-ttl-seconds))))))
+  (try
+    (pl-utils/demarcate
+      (format "purge deactivated nodes (threshold: %s)"
+              (format-period (secs node-purge-ttl-seconds)))
+      (with-transacted-connection db
+        (scf-store/purge-deactivated-nodes! (ago (secs node-purge-ttl-seconds)))))
+    (catch Exception e
+      (log/error e "Error while purging deactivated nodes"))))

 (defn sweep-reports!
   "Delete reports which are older than than `report-ttl-seconds` seconds."
   [db report-ttl-seconds]
-  (pl-utils/demarcate
-    (format "sweep of stale reports (threshold: %s)"
-            (format-period (secs report-ttl-seconds)))
-    (with-transacted-connection db
-      (scf-store/delete-reports-older-than! (ago (secs report-ttl-seconds))))))
+  (try
+    (pl-utils/demarcate
+      (format "sweep of stale reports (threshold: %s)"
+              (format-period (secs report-ttl-seconds)))
+      (with-transacted-connection db
+        (scf-store/delete-reports-older-than! (ago (secs report-ttl-seconds)))))
+    (catch Exception e
+      (log/error e "Error while sweeping reports"))))

 (defn garbage-collect!
   "Perform garbage collection on `db`, which means deleting any orphaned data.
@@ -129,10 +138,13 @@
   logging and other ceremony. Exceptions are logged but otherwise ignored."
   [db]
   {:pre [(map? db)]}
-  (pl-utils/demarcate
-    "database garbage collection"
-    (with-transacted-connection db
-      (scf-store/garbage-collect!))))
+  (try
+    (pl-utils/demarcate
+      "database garbage collection"
+      (with-transacted-connection db
+        (scf-store/garbage-collect!)))
+    (catch Exception e
+      (log/error e "Error during garbage collection"))))

 (defn sweep-database!
   "Sweep the indicated database every `interval` minutes.


correct threading error

correct threading error

--- src/clj_money/models/storage/sql_storage.clj
+++ src/clj_money/models/storage/sql_storage.clj
@@ -39,10 +39,6 @@
   "Accepts a hash and replaces underscores in key names
   with hyphens"
   [model]
-
-  (println "->clojure-keys")
-  (pprint model)
-
   (->> model
        (map #(update-in % [0] ->clojure-key))
        (into {})))
@@ -69,8 +65,8 @@
     [_]
     (let [sql (sql/format (-> (h/select :first_name :last_name :email)
                               (h/from :users)))]
-      (-> (jdbc/query db-spec sql)
-          (map ->clojure-keys))))
+      (->> (jdbc/query db-spec sql)
+           (map ->clojure-keys))))

   (find-user-by-email
     [this email]


defaulting :recompile-dependents to false

--- sidecar/src/figwheel_sidecar/auto_builder.clj
+++ sidecar/src/figwheel_sidecar/auto_builder.clj
@@ -26,8 +26,6 @@
         #_(clj-stacktrace.repl/pst+ e)))))

 (defn notify-on-complete [{:keys [build-options parsed-notify-command]}]
-  (println "Build options - after build")
-  (prn build-options)
   (let [{:keys [output-to]} build-options]
     (notify-cljs
      parsed-notify-command
@@ -61,8 +59,14 @@
                                                           (warn-handler build))]
       (builder build))))

+(defn default-build-options [builder default-options]
+  (fn [build]
+    (builder
+     (update-in build [:build-options] (partial merge default-options)))))
+
 (defn builder [figwheel-server]
   (-> cbuild/build-source-paths*
+    (default-build-options {:recompile-dependents false})
     (warning
      (fn [build]
        (auto/warning-message-handler


Perf-utils

Perf-utils

--- perf-test/clj/reitit/perf_utils.clj
+++ perf-test/clj/reitit/perf_utils.clj
@@ -34,9 +34,11 @@
     (mapv
       (fn [path]
         (let [request (map->Request (req path))
-              time (int (* (first (:sample-mean (cc/quick-benchmark (dotimes [_ 1000] (f request)) {}))) 1e6))]
-          (println path "=>" time "ns")
-          [path time]))
+              results (cc/quick-benchmark (dotimes [_ 1000] (f request)) {})
+              mean (int (* (first (:sample-mean results)) 1e6))
+              lower (int (* (first (:lower-q results)) 1e6))]
+          (println path "=>" lower "/" mean "ns")
+          [path [mean lower]]))
       urls)))

 (defn bench [routes req no-paths?]
@@ -45,8 +47,8 @@
                          [(str/replace path #"\:" "") name]
                          [path name])) routes)
         router (reitit/router routes)]
-    (doseq [[path time] (bench-routes routes req #(reitit/match-by-path router %))]
-      (println path "\t" time))))
+    (doseq [[path [mean lower]] (bench-routes routes req #(reitit/match-by-path router %))]
+      (println path "\t" mean lower))))

 ;;
 ;; Perf tests
@@ -58,8 +60,10 @@
   (println)
   (suite name)
   (println)
-  (let [times (for [[path time] (bench-routes routes req f)]
+  (let [times (for [[path [mean lower]] (bench-routes routes req f)]
                 (do
-                  (when verbose? (println (format "%7s" time) "\t" path))
-                  time))]
-    (title (str "average: " (int (/ (reduce + times) (count times)))))))
+                  (when verbose? (println (format "%7s %7s" mean lower) "\t" path))
+                  [mean lower]))]
+    (title (str "average, lower/mean: "
+                (int (/ (reduce + (map second times)) (count times))) "/"
+                (int (/ (reduce + (map first times)) (count times)))))))


Update test.check

Update test.check

--- src/leiningen/new/clanhr_service/project.clj
+++ src/leiningen/new/clanhr_service/project.clj
@@ -48,7 +48,7 @@
                        :dev {:env {:dev true
                                    :secret "test"
                                    :gateway-provider :postgres}
-                       :dependencies [[org.clojure/test.check "0.7.0"]
+                       :dependencies [[org.clojure/test.check "0.8.0"]
                                       [ring-mock "0.1.5"]
                                       [criterium "0.4.3"]]
                        :global-vars {*warn-on-reflection* false


Fixes description textarea initial size

Fixes description textarea initial size

--- src/front/ui/widgets/description_editor.cljs
+++ src/front/ui/widgets/description_editor.cljs
@@ -36,8 +36,9 @@

 (defn- add-autogrow
   [input _]
-  (.autosize js/window
-             input))
+  (js/setTimeout #(.autosize js/window
+                             input)
+                 0))

 (defn- make-editable
   [entity callback]


Add mp/PMatrixMultiply implementation

Add mp/PMatrixMultiply implementation

This gets matrix multiplication working for complex matrices. I can add a few tests if you like, but first let me know if this is welcome!

--- src/main/clj/clojure/core/matrix/complex.clj
+++ src/main/clj/clojure/core/matrix/complex.clj
@@ -109,6 +109,26 @@
   Seqable
   (seq [m]
     (map complex-array (m/slices (.real m)) (m/slices (.imag m))))
+
+  mp/PMatrixMultiply
+  (matrix-multiply [m a]
+    ;; \\(AB = (A_r + A_i I)(B_r + B_i I) = (A_rB_r - A_iB_i) + (A_rB_i + A_iB_r)I \\)
+    (ComplexArray.
+     (mp/add-scaled
+      (mp/matrix-multiply
+       (clojure.core.matrix.complex/real m)
+       (clojure.core.matrix.complex/real a))
+      -1
+      (mp/matrix-multiply
+       (clojure.core.matrix.complex/imag m)
+       (clojure.core.matrix.complex/imag a)))
+     (mp/matrix-add
+      (mp/matrix-multiply
+       (clojure.core.matrix.complex/real m)
+       (clojure.core.matrix.complex/imag a))
+      (mp/matrix-multiply
+       (clojure.core.matrix.complex/imag m)
+       (clojure.core.matrix.complex/real a)))))

   mp/PMatrixAdd
   (matrix-add [m a]


remove validation

remove validation

--- src/hu/ssh/github_changelog/conventional.clj
+++ src/hu/ssh/github_changelog/conventional.clj
@@ -3,8 +3,6 @@
     [hu.ssh.github-changelog.schema :refer [Config Tag Issue Pull Change Fn]]
     [schema.core :as s]
     [clojure.string :as string]))
-
-(s/set-fn-validation! true)

 ; https://help.github.com/articles/closing-issues-via-commit-messages/
 (s/defn fixes-pattern :- s/Regex


Deleted unnecessary code.

Deleted unnecessary code.

--- src/ai_playground/client/core.cljs
+++ src/ai_playground/client/core.cljs
@@ -6,11 +6,6 @@
             [pinot.draw.visualization :as vis]
             [pinot.util.clj :as pclj])
   (:require-macros [pinot.macros :as pm]))
-
-(def x (html/html [:p [:em "hey"]]))
-(dom/css x {:color :blue})
-(dom/attr x {:class "para"})
-;(dom/val (dom/query "input"))

 (defn remove-attribute [elem k]
   (doseq [el (pclj/->coll elem)]
@@ -53,11 +48,9 @@

 (pm/defpartial mean [[[x y] {:keys [index points]}]]
   (let [color (nth (cycle colors) index)]
+    (visualize-group points (partial line [x y]))
     (visualize-group points (partial data-point color))
-    (visualize-group points (partial line [x y]))
     [:svg:circle {:r 6 :cx x :cy y :stroke "#333" :fill color}]))
-
-(def points (atom []))

 (def initial-state {:next-step :init
                     :k 10
@@ -69,18 +62,6 @@
         cy (+ 50 (rand 300))]
     (for [_ (range n)]
       [(+ cx -40 (rand 80)) (+ cy -40 (rand 80))])))
-
-(defn k-means-vis []
-  (let [k 5
-        N 8
-        data (mapcat random-cluster (repeat k N))
-        means (clustering/k-means k data)]
-    (-> (vis/visual @points)
-        (vis/elem (partial data-point "#fff"))
-        (vis/enter (partial dom/append (dom/query "svg"))))
-    (-> (vis/visual means)
-        (vis/elem mean)
-        (vis/enter (partial dom/append (dom/query "svg"))))))

 (defn clear-svg []
   (dom/empty (dom/query "svg")))
@@ -109,7 +90,9 @@
     (enable-buttons false))
   (visualize))

+(defn run [])
+
 (append-button (dom/query "#legend") "Clear" #(do (swap! state (constantly initial-state)) (visualize)))
 (append-button (dom/query "#legend") "Add Random Cluster" add-random-cluster)
 (append-button (dom/query "#legend") "Step" step "step-button")
-(append-button (dom/query "#legend") "Run" k-means-vis)
+(append-button (dom/query "#legend") "Run" run "run-button")


Needs longer maze build. Should re-write to guarantee whole maze is built!

--- src/blue_salamander/blockmaze.cljs
+++ src/blue_salamander/blockmaze.cljs
@@ -79,7 +79,7 @@
   (let [empty-tiles (gen-empty-maze maze-size)
         start-coord [0 0]
         initial-tiles (mark-tile-used empty-tiles start-coord)
-        branch-attempts (* maze-size maze-size 10)]
+        branch-attempts (* maze-size maze-size 20)]
     ;; just keep trying to add tiles to the maze by repeatedly branching off of tiles
     ;; already in the maze.
     (nth


Use magic sparkles for generichash

Use magic sparkles for generichash

--- src/caesium/crypto/generichash.clj
+++ src/caesium/crypto/generichash.clj
@@ -26,10 +26,8 @@
   want [[hash]]."
   ([buf msg]
    (hash-to-buf! buf msg {}))
-  ([buf msg {:keys [key]
-             :or {key (byte-array 0)}}]
-   (.crypto_generichash
-    sodium buf (buflen buf) msg (buflen msg) key (buflen key))
+  ([buf msg {:keys [key] :or {key (bb/alloc 0)}}]
+   (b/✨ generichash buf msg key)
    buf))

 (defn hash


NoSuchMethodFound bug

NoSuchMethodFound bug

--- src/clojure/zensols/model/weka.clj
+++ src/clojure/zensols/model/weka.clj
@@ -450,7 +450,9 @@
         (let [res (proxy-super testCV folds fold)]
           (if test-fn
             (test-fn res train-state inst folds fold)
-            res))))))
+            res)))
+      (add [item]
+        (proxy-super add item)))))

 (defn instances
   "Create a new `weka.core.Instances` instance.
@@ -490,8 +492,7 @@
   (let [res (clone-instances src)]
     (->> (.enumerateInstances dst)
          enumeration-seq
-         (map #(.add res %))
-         doall)
+         (.addAll res))
     res))

 (defn- index-for-attribute


just implement the Autofocus interface directly

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

--- autofocus/ZippyFocus/src/zippy_focus/core.clj
+++ autofocus/ZippyFocus/src/zippy_focus/core.clj
@@ -1,11 +1,11 @@
 (ns zippy-focus.core
-  (:import [org.micromanager.utils AutofocusBase PropertyItem]
+  (:import [org.micromanager.utils PropertyItem]
            [org.micromanager.api Autofocus])
   (:use [org.micromanager.mm
             :only (load-mm gui mmc core double-vector)])
   (:gen-class
     :name org.micromanager.ZippyFocus
-    :extends org.micromanager.utils.AutofocusBase))
+    :implements [org.micromanager.api.Autofocus]))

 (defn triggerable-focus? []
   (core isStageSequenceable (core getFocusDevice)))


Wobbly dub! We're having to much elements, but cycles don't kill us

--- grafff.clj
+++ grafff.clj
@@ -11,20 +11,15 @@
   ([g a b] (add-edge g a b)))

 (def g (->
- (edge :vertex 90)
- (edge :vertex 80)
- (edge :vertex 70)
-
- (edge 70 100)
- (edge 100 120)
- (edge 120 4)
- (edge 120 6)
- (edge 120 8)))
+        (edge 70 100)
+        (edge 100 120)
+        (edge 120 8)
+        (edge 8 70)))

 (defn travel [g v mem]
-  (if (contains? g v)
+  (if (and (not (some #{v} mem)) (contains? g v))
     (reduce
      #(flatten (conj %1 %2))
-     (conj mem v)
-     (map #(travel g % mem) (g v)))
+     mem
+     (map #(travel g % (conj mem v)) (g v)))
     v))


Fixing doc-string

Fixing doc-string

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

--- src/conexp/contrib/draw/scenes.clj
+++ src/conexp/contrib/draw/scenes.clj
@@ -65,7 +65,7 @@
   (.getWidth (.getWorldExtent scn)))

 (defn ^GCanvas scene-canvas
-  "Returns canvas associated with a scene."
+  "Returns the canvas associated with a scene."
   [^GScene scn]
   (.. scn getWindow getCanvas))


prefixing all with dev env

prefixing all with dev env

--- test/celestial/test/config.clj
+++ test/celestial/test/config.clj
@@ -16,20 +16,21 @@
       (validate-missing :celestial :port) => {:celestial {:port '("must be present")}})

 (fact "missing proxmox options"
-    (validate-missing :hypervisor :proxmox :nodes :proxmox-a :password) =>
-      '{:hypervisor {:proxmox {:nodes (({:proxmox-a {:password ("must be present")}}))}}} )
+    (validate-missing :hypervisor :dev :proxmox :nodes :proxmox-a :password) =>
+      '{:hypervisor {:dev {:proxmox {:nodes (({:proxmox-a {:password ("must be present")}}))}}}} )

 (fact "non legal proxmox template flavor"
-  (validate-conf (assoc-in local-prox [:hypervisor :proxmox :ostemplates :ubuntu-12.04 :flavor] :bar)) =>
-     {:hypervisor {:proxmox {:ostemplates '(({:ubuntu-12.04 {:flavor ("flavor must be either #{:debian :redhat}")}}))}}}
+  (validate-conf (assoc-in local-prox [:hypervisor :dev :proxmox :ostemplates :ubuntu-12.04 :flavor] :bar)) =>
+     {:hypervisor {:dev {:proxmox {:ostemplates '(({:ubuntu-12.04 {:flavor ("flavor must be either #{:debian :redhat}")}}))}}}}
       )

 (fact "missing aws options"
-    (validate-conf (assoc-in local-prox [:hypervisor :aws] {})) =>
-      {:hypervisor {:aws {:access-key '("must be present") :secret-key '("must be present")}}})
+    (validate-conf (assoc-in local-prox [:hypervisor :dev :aws] {})) =>
+      {:hypervisor {:dev {:aws {:access-key '("must be present") :secret-key '("must be present")}}}})

 (fact "vcenter validations"
-   (validate-missing :hypervisor :vcenter :password) => {:hypervisor {:vcenter {:password '("must be present")}}}
-   (validate-missing :hypervisor :vcenter :url) => {:hypervisor {:vcenter {:url '("must be present")}}}
-   (validate-conf (assoc-in local-prox [:hypervisor :vcenter :ostemplates] [])) => {:hypervisor {:vcenter {:ostemplates '("must be a map")}}}
+   (validate-missing :hypervisor :dev :vcenter :password) => {:hypervisor {:dev {:vcenter {:password '("must be present")}}}}
+   (validate-missing :hypervisor :dev :vcenter :url) => {:hypervisor {:dev {:vcenter {:url '("must be present")}}}}
+   (validate-conf (assoc-in local-prox [:hypervisor :dev :vcenter :ostemplates] [])) =>
+      {:hypervisor {:dev {:vcenter {:ostemplates '("must be a map")}}}}
   )


Added two tests for assoc-route-params, one using a map, the other a vector.

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

--- test/compojure/http/routes.clj
+++ test/compojure/http/routes.clj
@@ -63,6 +63,14 @@
   (are (= (match-uri _1 _2) _3)
     #"/foo/(\w+)"   "/foo/bar" ["bar"]
     #"/(\w+)/(\d+)" "/foo/10"  ["foo" "10"]))
+
+(deftest assoc-route-map
+  (is (= (assoc-route-params {:params {}} {"foo" "bar"})
+         {:route-params {"foo" "bar"}, :params {"foo" "bar"}})))
+
+(deftest assoc-route-vector
+  (is (= (assoc-route-params {:params {}} ["foo" "bar"])
+         {:route-params ["foo" "bar"], :params {}})))

 (deftest route-response
   (let [route    (GET "/" "Lorem Ipsum")


[#3] Code cleanup: Fix lint error

[#3] Code cleanup: Fix lint error

--- test/org/akvo/resumed_test.clj
+++ test/org/akvo/resumed_test.clj
@@ -86,7 +86,7 @@

 (deftest test-head-not-found
   (let [handler (make-handler)
-        head (-> (m/request :head "http://localhost:3000/file/some-file"))
+        head (m/request :head "http://localhost:3000/file/some-file")
         resp (handler head)]
     (testing "HEAD not found"
       (is (= 404 (:status resp)))


add tests for `food-kb/diversity-score`

add tests for `food-kb/diversity-score`

--- test/whatsoup/food_kb_test.clj
+++ test/whatsoup/food_kb_test.clj
@@ -29,4 +29,29 @@
   (is (almost= 0.0 (score {} :food/broccoli #{:food/lauch})))
   (is (almost= 0.0 (score {} :food/broccoli #{:food/broccoli})))
   (is (almost= 0.5 (score test-kb :food/broccoli #{:food/lauch})))
-  (is (almost= 5.0 (score test-kb :food/schweinefleisch #{:food/lauch}))))+  (is (almost= 5.0 (score test-kb :food/schweinefleisch #{:food/lauch}))))
+
+(deftest -diversity-score
+  (let [kb
+        (component/start
+          (->FoodKnowledgeBase
+            {:food-catalog              [{:food/name       :food/a
+                                          :food/properties #{:property/one :property/two :property/three :property/all}}
+                                         {:food/name       :food/b
+                                          :food/properties #{:property/two :property/three :property/all}}
+                                         {:food/name       :food/c
+                                          :food/properties #{:property/three :property/all}}
+                                         {:food/name  :food/d
+                                          :food/properties #{:property/de-only :property/d-only :property/all}}
+                                         {:food/name  :food/e
+                                          :food/properties #{:property/de-only :property/e-only :property/all}}
+                                         {:food/name  :food/f
+                                          :food/properties #{:property/fgh-only :property/f-only :property/all}}
+                                         {:food/name  :food/g
+                                          :food/properties #{:property/fgh-only :property/g-only :property/all}}
+                                         {:food/name  :food/h
+                                          :food/properties #{:property/fgh-only :property/h-only :property/all}}]
+             :food-compatibility-matrix {}}))]
+    (is (= (diversity-score kb :food/a :food/b) (diversity-score kb :food/b :food/a)) "commutativity")
+    (is (< (diversity-score kb :food/a :food/b) (diversity-score kb :food/b :food/c)) "smaller overlap -> higher score")
+    (is (< (diversity-score kb :food/d :food/e) (diversity-score kb :food/f :food/g)) "overlap in less specific group -> higher score")))


Ditto

Ditto

--- src/clojure/clojurewerkz/cassaforte/uuids.clj
+++ src/clojure/clojurewerkz/cassaforte/uuids.clj
@@ -1,3 +1,12 @@
+;; Copyright (c) 2012-2014 Michael S. Klishin, Alex Petrov, and the ClojureWerkz Team
+;;
+;; The use and distribution terms for this software are covered by the
+;; Eclipse Public License 1.0 (http://opensource.org/licenses/eclipse-1.0.php)
+;; which can be found in the file epl-v10.html at the root of this distribution.
+;; By using this software in any fashion, you are agreeing to be bound by
+;; the terms of this license.
+;; You must not remove this notice, or any other, from this software.
+
 (ns clojurewerkz.cassaforte.uuids
   "Provides utility functions for UUID generation."
   (:import com.datastax.driver.core.utils.UUIDs


Debug

Debug

--- src/clojush/pushgp/selection/preselection.clj
+++ src/clojush/pushgp/selection/preselection.clj
@@ -110,9 +110,11 @@
                                       (vec (take (rand (count all))
                                                  (rest all)))))]
                   (fn [ind]
-                    (mapv (fn [errs]
-                           (vec (for [i keepers] (nth errs i)))
-                         (:history ind)))))
+                    (if (empty? (:history ind))
+                      []
+                      (mapv (fn [errs]
+                              (vec (for [i keepers] (nth errs i))))
+                            (:history ind)))))
                 :history)
               diffs (first knock-spec)
               outof (second knock-spec)


datamunging (clojure) 0

datamunging (clojure) 0

--- src/main/clojure/datamunging/datamunging0.clj
+++ src/main/clojure/datamunging/datamunging0.clj
@@ -1,3 +1,4 @@
 (ns datamunging.datamunging0)

-(print (slurp "/Users/dima/IdeaProjects/katas/src/main/scala/ru/katas/n4/weather.dat"))
+(def data (slurp "/Users/dima/IdeaProjects/katas/src/main/scala/ru/katas/n4/weather.dat"))
+(print data)


PDOK-1025: quote table

PDOK-1025: quote table

--- src/main/clojure/pdok/featured/projectors.clj
+++ src/main/clojure/pdok/featured/projectors.clj
@@ -91,7 +91,7 @@
                  records (map #(feature-to-sparse-record % all-fields-constructor) grouped-features)
                  fields (concat [:_id :_geometry] (map (comp keyword pg/quoted) all-attributes))]
              (apply
-              (partial j/insert! c (str dataset "." collection) fields) records)))))
+              (partial j/insert! c (str dataset "." (pg/quoted collection)) fields) records)))))
       (catch java.sql.SQLException e (j/print-sql-exception-chain e))))
   )


added wait, go, click-anchor actions

added wait, go, click-anchor actions

--- src/hypertext_ray/page_handler.clj
+++ src/hypertext_ray/page_handler.clj
@@ -11,11 +11,13 @@
   (let [choice  (if (vector? action) (first action) action)]
     (case choice
       :login (do-login siteinfo)
-      :wait (do (println "wait") siteinfo)
+      :wait (do (println "wait") (Thread/sleep (second action)) siteinfo)
       :collect-data (find-data siteinfo current-page)
       :logout (do (println "logout") siteinfo)
       :quit (stop-driver siteinfo)
+      :go (do (to (second action)) siteinfo)
       :click-text (do (click-text (second action)) siteinfo)
+      :click-anchor (do (click-anchor (second action)) siteinfo)
       ))
   )


test hook

test hook

--- src/main/cawala/ui/components.cljs
+++ src/main/cawala/ui/components.cljs
@@ -11,7 +11,7 @@
                     {:db/id id :person/name name :person/age age})}
   (dom/li
    (dom/h5 (str name "(age: " age ")")
-           (dom/button {:onClick #(onDelete id)} "X")
+           (dom/button {:onClick #(onDelete id)} "Y")
            (dom/button {:onClick #(df/refresh! this)} "Refresh"))))

 (def ui-person (prim/factory Person {:keyfn :person/name}))


Removed un-used orbit-json field from index-set.

--- indexer-app/src/cmr/indexer/data/index_set.clj
+++ indexer-app/src/cmr/indexer/data/index_set.clj
@@ -305,9 +305,8 @@
                    ;; So we are saving the links in json string, then parse it out when we need it.
                    :atom-links (not-indexed (stored string-field-mapping))

-                   ;; :orbit-json and :orbit-calculated-spatial-domains-json are json strings
+                   ;; :orbit-calculated-spatial-domains-json is json string
                    ;; stored for retrieval similar to :atom-links above
-                   :orbit-json (not-indexed (stored string-field-mapping))
                    :orbit-calculated-spatial-domains-json (not-indexed (stored string-field-mapping))
                    }
                   spatial-coverage-fields)}})


Remove erroneous no-op code

Remove erroneous no-op code

--- src/io/perun.clj
+++ src/io/perun.clj
@@ -82,9 +82,6 @@

 (def ^:private mime-type-deps
   '[[com.novemberain/pantomime "2.8.0"]])
-
-(defn add-filedata [tmp-files]
-  )

 (def ^:private +mime-type-defaults+
   {:filterer identity


Use the unicode, Ivan

Use the unicode, Ivan

--- src/gpx/geo.clj
+++ src/gpx/geo.clj
@@ -23,18 +23,18 @@
   "
   [point1 point2]

-  (let [lat1 (-> point1 :lat deg-rad)
-        lon1 (-> point1 :lon deg-rad)
-        lat2 (-> point2 :lat deg-rad)
-        lon2 (-> point2 :lon deg-rad)
-        d_lat (- lat2 lat1)
-        d_lon (- lon2 lon1)
+  (let [φ1 (-> point1 :lat deg-rad)
+        λ1 (-> point1 :lon deg-rad)
+        φ2 (-> point2 :lat deg-rad)
+        λ2 (-> point2 :lon deg-rad)
+        Δφ (- φ2 φ1)
+        Δλ (- λ2 λ1)

-        a (+ (math/expt (Math/sin (/ d_lat 2)) 2)
+        a (+ (math/expt (Math/sin (/ Δφ 2)) 2)
              (*
-               (Math/cos lat1)
-               (Math/cos lat2)
-               (math/expt (Math/sin (/ d_lon 2)) 2)))
+               (Math/cos φ1)
+               (Math/cos φ2)
+               (math/expt (Math/sin (/ Δλ 2)) 2)))

         c (* 2 (Math/atan2 (math/sqrt a)
                            (math/sqrt (- 1 a)))) ]


nml-add refactoring

nml-add refactoring

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -33,19 +33,17 @@
 (defn nml-name [x]
   (nml-str (second x)))

-;;(defn nml-set [tree nml key val & sub]
-;; (let [child (if sub :nvsubseq :stmt)
-;;       match (if sub key nml)
-;;       vnew  (if sub (fn [tree] (parse val :start :values)) #(nml-set % nml key val true))
-;;       f     (fn [k v] [child k (if (= (nml-str k) match) (vnew v) v)])]
-;;   (insta/transform {child f} tree)))
+(defn nml-add [tree parent child match]
+  (insta/transform {parent (fn [& children] (into [parent (if (not-any? #(= (nml-str (second %)) match) children) (parse (str match "=0") :start child))] children))} tree))
+
 (defn nml-set [tree nml key val & sub]
   (let [child  (if sub :nvsubseq :stmt)
         match  (if sub key nml)
         parent (if sub :nvseq :s)
         vnew   (if sub (fn [tree] (parse val :start :values)) #(nml-set % nml key val true))
         f      (fn [k v] [child k (if (= (nml-str k) match) (vnew v) v)])]
-    (let [t2 (if sub (insta/transform {parent (fn [& children] (into [parent (if (not-any? #(= (nml-str (second %)) match) children) (parse (str key "=0") :start child))] children))} tree) tree)]
+    (let [t2 (if sub (nml-add tree parent child match) tree)]
+      (if sub (println t2))
       (insta/transform {child f} t2))))

 (defn nml-sets [tree sets]


cosmetics

cosmetics

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -4,6 +4,9 @@
   (:require [clojure.string  :as string]))

 (def debug false)
+
+(defn nmlget [] )
+(defn nmlset [] )

 (def parse (insta/parser (clojure.java.io/resource "grammar")))

@@ -17,45 +20,45 @@
         sf       #(prpr (first %))
         sl       #(prpr (last %))]
     (if debug (println (str "k=" k " v=" v)))
-    (apply str
-           (case k
-             :s        (ds v)
-             :array    [(sf v) (sl v)]
-             :c        (sf v)
-             :colon    ":"
-             :comma    ","
-             :comment  ""
-             :complex  ["(" (cjoin (delegate v)) ")"]
-             :dataref  (delegate v)
-             :dec      (delegate v)
-             :dot      "."
-             :exp      [(first v) (sl v)]
-             :false    "f"
-             :int      (delegate v)
-             :junk     ""
-             :logical  (sf v)
-             :name     (map string/lower-case v)
-             :nvseq    (ds v)
-             :nvsubseq ["  " (sf v) "=" (sl v) "\n"]
-             :partref  (sf v)
-             :percent  "%"
-             :r        (sf v)
-             :real     (delegate v)
-             :sect     ["(" (list2str v) ")"]
-             :sep      v
-             :sign     v
-             :slash    v
-             :star     "*"
-             :stmt     ["&" (sf v) "\n" (list2str (rest v)) "/\n"]
-             :string   v
-             :true     "t"
-             :uint     v
-             :value    (delegate v)
-             :values   (cjoin (delegate v))
-             :ws       ""
-             :wsopt    ""))))
+    (apply str (case k
+                 :s        (ds v)
+                 :array    [(sf v) (sl v)]
+                 :c        (sf v)
+                 :colon    ":"
+                 :comma    ","
+                 :comment  ""
+                 :complex  ["(" (cjoin (delegate v)) ")"]
+                 :dataref  (delegate v)
+                 :dec      (delegate v)
+                 :dot      "."
+                 :exp      [(first v) (sl v)]
+                 :false    "f"
+                 :int      (delegate v)
+                 :junk     ""
+                 :logical  (sf v)
+                 :name     (map string/lower-case v)
+                 :nvseq    (ds v)
+                 :nvsubseq ["  " (sf v) "=" (sl v) "\n"]
+                 :partref  (sf v)
+                 :percent  "%"
+                 :r        (sf v)
+                 :real     (delegate v)
+                 :sect     ["(" (list2str v) ")"]
+                 :sep      v
+                 :sign     v
+                 :slash    v
+                 :star     "*"
+                 :stmt     ["&" (sf v) "\n" (list2str (rest v)) "/\n"]
+                 :string   v
+                 :true     "t"
+                 :uint     v
+                 :value    (delegate v)
+                 :values   (cjoin (delegate v))
+                 :ws       ""
+                 :wsopt    ""))))

 (defn -main [& args]
   (alter-var-root #'*read-eval* (constantly false))
-  (let [namelist-file (last args)]
-    (println (prpr (parse (slurp namelist-file))))))
+  (let [namelist-file (last args)
+        tree (parse (slurp namelist-file))]
+    (println (prpr tree))))


UI for empty cart

UI for empty cart

--- examples/shopping-cart/src/app/view.cljs
+++ examples/shopping-cart/src/app/view.cljs
@@ -26,12 +26,16 @@
   [products total dispatch]
   [:div
    [:h3 "Your Cart"]
-   [:div
-    (for [p products]
-      ^{:key (:id p)}
-      [-product p])]
+   (if (empty? products)
+     [:em "Please add some products to cart."]
+     [:div
+      (for [p products]
+        ^{:key (:id p)}
+        [-product p])])
    [:p "Total: $" total]
-   [:button {:on-click #(dispatch :on-checkout)}
+   [:button
+    {:disabled (empty? products)
+     :on-click #(dispatch :on-checkout)}
     "Checkout"]])

 (defn view


Currently working.

Currently working.

--- src-cljs/client/websocket_handler.cljs
+++ src-cljs/client/websocket_handler.cljs
@@ -58,7 +58,7 @@

               ;; Send termination message to write loop and notify on meta channel
               (>! write-channel h/socket-closed-message)
-              (>! meta-channel (h/attempting-connect-message address))))
+              (>! meta-channel  (h/attempting-connect-message address)))))
         (recur)))
     [(h/combine-channels read-channel write-channel)
      meta-channel]))


fix log

fix log

--- src-cljs/frontend/controllers/api.cljs
+++ src-cljs/frontend/controllers/api.cljs
@@ -82,7 +82,7 @@
   [target message status {:keys [context frontend-id-state]} state]
   (if (= (:document/id state)
          (:document-id context))
+    (assoc state :frontend-id-state frontend-id-state)
     (do
       (utils/mlog "document ids don't match")
-      (assoc state :frontend-id-state frontend-id-state))
-    state))
+      state)))