More legible (and efficient) impl of get-solved

--- src/foreclojure/users.clj
+++ src/foreclojure/users.clj
@@ -72,9 +72,13 @@
   ([username]
      (:solved (get-user username)))
   ([username difficulty]
-     (let [problem-groups   (group-by :difficulty (get-problems))
-           difficulty-group (flatten (vector (:_id (apply merge-with vector (get problem-groups difficulty [{}])))))]
-       (filter (set (get-solved username)) difficulty-group))))
+     (let [ids (->> (from-mongo
+                     (fetch :problems
+                            :only  [:_id]
+                            :where {:approved true, :difficulty difficulty}))
+                    (map :_id)
+                    (set))]
+       (filter ids (get-solved username)))))

 (def-page user-profile [username]
     [:h2 "User: " username]


switch reader features to :clj, simple alias for cljs bootstrap

--- src/main/clojure/cljs/core/macros.clj
+++ src/main/clojure/cljs/core/macros.clj
@@ -28,7 +28,7 @@
           (with-open [pbr (PushbackReader. (io/reader f))]
             (let [rdr (readers/source-logging-push-back-reader pbr)]
               (dotimes [_ (dec (:line m))] (readers/read-line rdr))
-              (reader/read {:read-cond :allow :features #{:cljs}} rdr))))))))
+              (reader/read {:read-cond :allow :features #{:clj}} rdr))))))))

 (defmacro import-macros [ns [& vars]]
   `(do
@@ -36,4 +36,5 @@
          (doall (map source-fn vars)))))

 (defmacro alias [[_ ns] [_ alias]]
-  )+  (swap! @env/*compiler*
+    [::namespaces (.getName *ns*) :requires] assoc alias ns))


Remove old redundant namespace

Remove old redundant namespace

--- src/grafter/rdf/graph.clj
+++ src/grafter/rdf/graph.clj
@@ -1,45 +0,0 @@
-(ns grafter.rdf.graph)
-
-;; OLD experiments for cleaning up.
-
-
-(comment
-  ;; TODO consider whether we want this
-  (defprotocol IGraph
-    (add [this triple])
-    (delete [this triple])
-    (union [this other])
-    (intersection [this other])
-    (difference [this other])
-    (subset? [this other])
-    (powerset [this])
-    (cardinality [this]))
-
-  (extend-type clojure.lang.IPersistentSet
-    IGraph
-    (add [this triple]
-      (conj this triple))
-    (delete [this triple]
-      (disj this triple))
-    (union [this other]
-      (set/union this other))
-    (intersection [this other]
-      (set/intersection this other))
-    (difference [this other]
-      (set/difference this other))
-    (subset? [this other]
-      (set/subset? this other))
-    (cardinality [this]
-      (count this))
-    (powerset [this]
-      (set (map set (comb/subsets this)))))
-
-  (def empty-graph #{})
-
-  ;; TODO make work
-  (defn graph [config_or_triple & triples]
-    (let [triples (if (instance? clojure.lang.IPersistentVector config_or_triple)
-                    (concat [config_or_triple] triples)
-                    triples)]
-      (reduce (fn [graph triple] (union graph (expand-triples triple)))
-              empty-graph triples))))


uncomment the junit flag

uncomment the junit flag

--- frontend/components/project_settings.cljs
+++ frontend/components/project_settings.cljs
@@ -350,20 +350,19 @@
             "know what you think about them"] "."
            " These " [:em "are"] " works-in-progress, though, and there may be some sharp edges. Be careful!"]
           [:ul
-           ;; Comment out while we wait for the backend to deploy
-           ;; (describe-flag {:flag :junit
-           ;;                 :title "JUnit support"
-           ;;                 :blurb [:p
-           ;;                         "We've been experimenting with better ways to display and manage "
-           ;;                         "test result data, especially for large test suites. This adds flags "
-           ;;                         "to some of our inferred commands to collect structured test output supplied by "
-           ;;                         "JUnit-compatible test runners. It currently works with RSpec and Cucumber if "
-           ;;                         "you're using our inferred test steps. For RSpec, we also require our fork of the "
-           ;;                         "rspec_junit_formatters gem. The line you need to add to your Gemfile is: "
-           ;;                         [:p [:code "gem 'rspec_junit_formatter', :git => 'git@github.com:circleci/rspec_junit_formatter.git'"]]
-           ;;                         "If you're using parallelism, we'll "
-           ;;                         "automatically use the timing data to give you better test splits. You'll also be able to "
-           ;;                         "fetch the test data via our API at https://circleci.com/api/v1/project/:org-name/:repo-name/:build-num/tests"]})
+           (describe-flag {:flag :junit
+                           :title "JUnit support"
+                           :blurb [:p
+                                   "We've been experimenting with better ways to display and manage "
+                                   "test result data, especially for large test suites. This adds flags "
+                                   "to some of our inferred commands to collect structured test output supplied by "
+                                   "JUnit-compatible test runners. It currently works with RSpec and Cucumber if "
+                                   "you're using our inferred test steps. For RSpec, we also require our fork of the "
+                                   "rspec_junit_formatters gem. The line you need to add to your Gemfile is: "
+                                   [:p [:code "gem 'rspec_junit_formatter', :git => 'git@github.com:circleci/rspec_junit_formatter.git'"]]
+                                   "If you're using parallelism, we'll "
+                                   "automatically use the timing data to give you better test splits. You'll also be able to "
+                                   "fetch the test data via our API at https://circleci.com/api/v1/project/:org-name/:repo-name/:build-num/tests"]})
            (describe-flag {:flag :set-github-status
                            :title "GitHub Status updates"
                            :blurb [:p


also sending the tweets that mention bacon but have no localization info

--- src/clj/baconator/server/handler.clj
+++ src/clj/baconator/server/handler.clj
@@ -28,20 +28,22 @@
                                            (:token-secret twitter-config)))

 (defn send-tweet-info [tweet]
-  (when (:coordinates tweet)
-          (let [coordinates (:coordinates (:coordinates tweet))
-                user (:screen_name (:user tweet))]
-            (send-checkin {:user user
-                           :text (:text tweet)
-                           :lat (nth coordinates 1)
-                           :lon (nth coordinates 0)}))))
+  (if-let [coordinates (:coordinates (:coordinates tweet))]
+    (send-checkin {:user (:screen_name (:user tweet))
+                   :text (:text tweet)
+                   :lat (nth coordinates 1)
+                   :lon (nth coordinates 0)})
+    (send-checkin {:user (:screen_name (:user tweet))
+                   :text (:text tweet)
+                   :lat nil
+                   :lon nil})))

 (def ^:dynamic *callback*
   (AsyncStreamingCallback.
    (fn [_resp payload]
      (try
        (let [tweet (parse-string (str payload) true)]
-         (send-tweet-info [tweet]))
+         (send-tweet-info tweet))
        (catch com.fasterxml.jackson.core.JsonParseException ex false)))
    (fn [_resp]
       (println "Error connecting to twitter streaming API"))
@@ -66,7 +68,7 @@
                     (swap! checkins-clients dissoc con)))))

 (defn send-checkin [msg]
-  (info "Sending tweet to clients" (:text msg))
+  (info "Sending tweet to clients")
   (doseq [client @checkins-clients]
     (send! (key client) (pr-str msg) false)))


Refactor

Refactor

--- src/clj/made_merits/routes/kudos.clj
+++ src/clj/made_merits/routes/kudos.clj
@@ -6,23 +6,31 @@
             [clojure.string :as str]
             [clojure.java.io :as io]))

+(defn cheating-detected?
+  [kudosed-user kudosed-by]
+  (= kudosed-user kudosed-by))
+
+(def cheating-detected-response
+  {:status 200, :headers {}, :body "You cannot kudos yourself! This incident will be reported!"})
+
+(defn kudosed-response
+  [kudosed-by kudosed-user]
+  (str kudosed-by " gave " kudosed-user " a merit! " kudosed-user " now has "
+    (:kudos_count (first (db/kudos-count {:username kudosed-user}))) " merit"))
+
 (defn create
   [params]
   (let [parsed-params (json/parse-string (slurp (:body params)))
         payload-array (str/split (get parsed-params "text") #" ")
-        kudosed-user (first payload-array)
-        kudosed-by (get parsed-params "username")
-        reason (str/join " " (rest payload-array))]
+        kudosed-user  (first payload-array)
+        kudosed-by    (get parsed-params "username")
+        reason        (str/join " " (rest payload-array))]

-    (if (= kudosed-user kudosed-by)
-      {:status 200, :headers {}, :body "You cannot kudos yourself! This incident will be reported!"}
+    (if (cheating-detected? kudosed-user kudosed-by)
+      cheating-detected-response

-      (if (db/add-kudos {:username kudosed-user
-                         :kudosed_by kudosed-by
-                         :reason reason })
-        (str
-          kudosed-by " gave " kudosed-user " a merit! " kudosed-user " now has "
-          (:kudos_count (first (db/kudos-count {:username kudosed-user}))) " merit")))))
+      (if (db/add-kudos {:username kudosed-user :kudosed_by kudosed-by :reason reason })
+        (kudosed-response kudosed-by kudosed-user)))))

 (defroutes kudos-routes
   (POST "/kudos" [params] (create)))


Switch default PSL URL to current published location.

--- src/clojure/inet/data/format/psl.clj
+++ src/clojure/inet/data/format/psl.clj
@@ -22,8 +22,7 @@

 (def ^:dynamic *default-psl-url*
   "URL of the default Mozilla Public Suffix List file."
-  (str "http://mxr.mozilla.org/mozilla-central/source/netwerk/dns/"
-       "effective_tld_names.dat?raw=1"))
+  "https://publicsuffix.org/list/effective_tld_names.dat")

 (defn load
   "Load a Mozilla Public Suffix List format file from the Reader `source`."


Fixed getting project_id on entity post.

--- src/kixi/hecuba/api/entities.clj
+++ src/kixi/hecuba/api/entities.clj
@@ -156,7 +156,7 @@
 ;; Index
 (defn index-allowed? [store ctx]
   (let [{:keys [request-method session params route-params]} (:request ctx)
-        project_id (or (:project_id route-params) (-> ctx :entities first))
+        project_id (or (:project_id route-params) (-> ctx :entities first :project_id))
         programme_id (when project_id (:programme_id (projects/get-by-id (:hecuba-session store) project_id)))
         {:keys [projects programmes roles]} (sec/current-authentication session)]
     (if (and programme_id project_id)


w and e shortcuts for passage doors

w and e shortcuts for passage doors

--- src/house/rooms/back.cljc
+++ src/house/rooms/back.cljc
@@ -21,8 +21,8 @@

 (def rug (item/make "rug" "An ornate long rug."))

-(defn make-door [extra-name goes-to]
-   (item/make ["door" extra-name]
+(defn make-door [extra-names goes-to]
+   (item/make (apply conj ["door"] extra-names)
       "A wooden door."
       :closed true
       :enter goes-to))
@@ -31,14 +31,14 @@
                   (room/make "Corridor"
                              "The end of a corridor with rooms to the east and west, and the door to the back garden"
                              :initial-description "My steps resounded throughout a long corridor, with a series of rooms on each side. On the other end was an oak door, ajar.")
-                  (room/add-item (make-door "west door" :bedroom2) "")
-                  (room/add-item (make-door "east door" :bedroom3) "")
+                  (room/add-item (make-door ["west door" "w door"] :bedroom2) "")
+                  (room/add-item (make-door ["east door" "e door"] :bedroom3) "")
                   (room/add-item corridor "")
                   (room/add-item paintings "")
                   (room/add-item floor "")
                   (room/add-item rug "")))

-(def fake-door (item/make ["door" "west door"]
+(def fake-door (item/make ["door" "west door" "w door"]
                           "It was the same as the other doors in the corridor, except it didn't have a doorknob."
                           :open "I couldn't open the west door, it didn't have a doorknob."))

@@ -48,7 +48,7 @@
                              :initial-description "The rug that traversed the room wasn't enough to silence the creak of the floor, as if the house denounced my irruption."
                              :known true)
                   (room/add-item fake-door "")
-                  (room/add-item (make-door "east door" :tapestry) "")
+                  (room/add-item (make-door ["east door" "e door"] :tapestry) "")
                   (room/add-item corridor "")
                   (room/add-item paintings "")
                   (room/add-item floor "")
@@ -63,8 +63,8 @@
                   (room/add-item paintings "")
                   (room/add-item floor "")
                   (room/add-item rug "")
-                  (room/add-item (make-door "west door" :library) "")
-                  (room/add-item (make-door "east door" :dining) "")
+                  (room/add-item (make-door ["west door" "w door"] :library) "")
+                  (room/add-item (make-door ["east door" "e door"] :dining) "")
                   (room/add-item oak-door-back "")))

 (def top-drawer (item/make ["drawer" "top drawer"]


fix broken watch* fn

fix broken watch* fn

--- src/main/shadow/cljs/devtools/api.clj
+++ src/main/shadow/cljs/devtools/api.clj
@@ -151,27 +151,24 @@
     :ok))

 (defn watch*
-  ([{:keys [build-id] :as build-config} {:keys [autobuild verbose sync] :as opts}]
-   (let [out
-         (util/stdout-dump verbose)
-
-         build-config
-         (if (map? build-id)
-           build-id
-           (config/get-build! build-id))]
-
-     (-> (start-worker build-config opts)
-         (worker/watch out true)
-         (cond->
-           (not (false? autobuild))
-           (worker/start-autobuild)
-
-           (false? autobuild)
-           (worker/compile)
-
-           (not (false? sync))
-           (worker/sync!))
-         ))))
+  [{:keys [build-id] :as build-config} {:keys [autobuild verbose sync] :as opts}]
+  {:pre [(map? build-config)
+         (keyword? build-id) ;; not required here but by start-worker
+         (map? opts)]}
+  (let [out (util/stdout-dump verbose)]
+
+    (-> (start-worker build-config opts)
+        (worker/watch out true)
+        (cond->
+          (not (false? autobuild))
+          (worker/start-autobuild)
+
+          (false? autobuild)
+          (worker/compile)
+
+          (not (false? sync))
+          (worker/sync!))
+        )))

 (defn watch
   "starts a dev worker process for a given :build-id


+{:pred :learn}

+{:pred :learn}

--- src/babel/encyclopedia.cljc
+++ src/babel/encyclopedia.cljc
@@ -347,6 +347,10 @@

         {:pred :imagine
          :subj {:human true}}
+
+        {:pred :learn
+         :subj {:human true}
+         :obj {:legible true}} ;; not quite right, but a rough start.

         {:pred :leave
          :subj {:animate true}}


aligned routes for readability

aligned routes for readability

--- src/freecoin/routes.clj
+++ src/freecoin/routes.clj
@@ -33,37 +33,40 @@

 (def email-reg-exp [#".+\@.+\..+" :email])

-;; TODO: better way than eval?
+;; Mapping of URL endpoints to functions in handlers/
 (def routes ["" [["/" {:get :index}]
                  ["/landing-page" {:get :landing-page}]
-                 ["/sign-in" {:get :sign-in}]
-                 ["/sign-in" {:post :sign-in-form}]
-                 ["/sign-up" {:post :sign-up-form}]
-                 ["/sign-out" {:get :sign-out}]
-                 ["/forget-secret" {:get :forget-secret}]
+                 ["/sign-in"      {:get :sign-in}]
+                 ["/sign-in"      {:post :sign-in-form}]
+                 ["/sign-up"      {:post :sign-up-form}]
+                 ["/sign-out"     {:get :sign-out}]
+                 ["/forget-secret"      {:get :forget-secret}]
                  ["/email-confirmation" {:get :email-confirmation}]
-                 [["/account/" (eval email-reg-exp)] {:get :account}]
-                 [["/activate/"  (eval email-reg-exp) "/" :activation-id] {:get :activate-account}]
+                 [["/account/"   (eval email-reg-exp)] {:get :account}]
+                 [["/activate/"  (eval email-reg-exp)
+                   "/" :activation-id] {:get :activate-account}]
                  ["/account-acivated" {:get :account-activated}]
-                 ["/resend-email" {:post :resend-activation-form}]
+                 ["/resend-email"     {:post :resend-activation-form}]
                  ["/recover-password" {:post :recover-password-form}]
-                 [["/reset-password/"  (eval email-reg-exp) "/" :password-recovery-id] {:get :reset-password}]
-                 [["/reset-password/"  (eval email-reg-exp) "/" :password-recovery-id] {:post :reset-password-form}]
-
+                 [["/reset-password/"  (eval email-reg-exp)
+                   "/" :password-recovery-id] {:get :reset-password}]
+                 [["/reset-password/"  (eval email-reg-exp)
+                   "/" :password-recovery-id] {:post :reset-password-form}]
+
                  ["/password-changed" {:get :password-changed}]
                  [["/qrcode/" (eval email-reg-exp)] {:get :qrcode}]
                  [["/transactions/" (eval email-reg-exp)] {:get :get-user-transactions}]
-                 ["/transactions" {:get :get-all-transactions}]
-                 ["/tags" {"" {:get :get-all-tags}
+                 ["/transactions"      {:get :get-all-transactions}]
+                 ["/tags" {""          {:get :get-all-tags}
                            ["/" :name] {:get :get-tag-details}}]
                  ["/participant-query" {:get :get-participant-search-form}]
-                 ["/participants" {:get :participants}]
-                 ["/send" {:get :get-transaction-form}]
-                 ["/send" {:post :post-transaction-form}]
+                 ["/participants"      {:get :participants}]
+                 ["/send"              {:get :get-transaction-form}]
+                 ["/send"              {:post :post-transaction-form}]
                  [["/send/confirm/" :confirmation-uid] {:get :get-confirm-transaction-form}]
                  [["/send/confirm/" :confirmation-uid] {:post :post-confirm-transaction-form}]
                  ["/activities" {:get :get-activity-streams}]
-                 ["/echo" {:get :echo}]
+                 ["/echo"    {:get :echo}]
                  ["/version" {:get :version}]]])

 (defn path [action & params]


Roll back failed retry attempts (WIP)

Roll back failed retry attempts (WIP)

I'm not positive this version compiles. The previous commit bombed so
badly that I haven't set REPL back up. I think it should be fairly safe.

Most of it's just comments for me to keep in mind the next time I have a
chance to dig into it.

--- test/frereth_cp/message/message_test.clj
+++ test/frereth_cp/message/message_test.clj
@@ -334,50 +334,71 @@
                           ;; thread).
                           ;; Actually, I'm a little surprised that this works at all.
                           ;; Q: But is it worth it for the test's sake?
-                          (loop [n 5
-                                 time-out 100]
-                            (let [srvr-state (message/get-state server-io time-out ::timed-out)]
-                              (if (or (= ::timed-out srvr-state)
-                                      (instance? Throwable srvr-state)
-                                      (nil? srvr-state))
-                                (let [problem (if (instance? Throwable srvr-state)
-                                                srvr-state
-                                                (ex-info "Non-exception in client->server consumer"
-                                                         {::problem srvr-state}))]
-                                  (if (> 0 n)
-                                    (do
-                                      (log/error problem prelog "Server failed!")
-                                      (dfrd/error! succeeded? problem))
-                                    (recur (dec n) (* time-out 3))))
+                          ;; A: Well, now that the RTT adjustments are taking effect,
+                          ;; I'm hitting the deadlocks I expected.
+                          ;; I *think* the problem is this sequence:
+                          ;; 1. the event loop triggers this
+                          ;; 2. this sends a get-state request
+                          ;; 3. that request can never succeed, because it's waiting
+                          ;; for this thread to return to start handling those sorts
+                          ;; of requests again.
+                          ;; It seems a little strange that adding RTT adjustments would
+                          ;; bring this problem to light.
+                          ;; But, honestly, it seems more strange that it ever worked.
+
+                          ;; The obvious solution starts with what the library client
+                          ;; should do here: get the callback and push the incoming
+                          ;; message onto another queue to deal with later.
+
+                          ;; But, honestly, it would be easier for the library to
+                          ;; do that.
+                          ;; Not necessarily better, since callers *could* handle
+                          ;; things more directly here. But it's very tempting.
+
+                          ;; And yet...how did this approach ever work?
+
+                          ;; Actually, it's probably worth keeping in mind that
+                          ;; *this* approach never did.
+
+                          ;; An approach with the same basic code, built around agents,
+                          ;; never did either. It just failed in different ways that
+                          ;; drove me to switch to this Actor-based approach.
+                          (let [srvr-state (message/get-state server-io time-out ::timed-out)]
+                            (if (or (= ::timed-out srvr-state)
+                                    (instance? Throwable srvr-state)
+                                    (nil? srvr-state))
+                              (let [problem (if (instance? Throwable srvr-state)
+                                              srvr-state
+                                              (ex-info "Non-exception in client->server consumer"
+                                                       {::problem srvr-state}))]
                                 (do
-                                  (message/parent->! server-io bs)
-                                  (log/debug prelog
-                                             "Server's parent-> triggered after"
-                                             n "attempts")))))))
+                                  (log/error problem prelog "Server failed!")
+                                  (dfrd/error! succeeded? problem)))
+                              (do
+                                (message/parent->! server-io bs)
+                                (log/debug prelog
+                                           "Server's parent-> triggered after"
+                                           n "attempts"))))))
                       client->server)
         (strm/consume (fn [bs]
                         (let [prelog (utils/pre-log "server->client consumer")]
                           (log/info prelog "Message from server to client")
-                          (loop [n 5
-                                 time-out 100]
-                            (let [client-state (message/get-state client-io time-out ::timed-out)]
-                              (if (or (= ::timed-out client-state)
-                                      (instance? Throwable client-state)
-                                      (nil? client-state))
-                                (if (> 0 n)
-                                  (let [problem (if (instance? Throwable client-state)
-                                                  client-state
-                                                  (ex-info "Non-exception in server->client consumer"
-                                                           {::problem client-state}))]
-                                    (log/error problem prelog "Client failed!")
-                                    (dfrd/error! succeeded? problem))
-                                  (recur (dec n) (* time-out 3)))
-                                (do
-                                  (message/parent->! client-io bs)
-                                  (log/debug prelog
-                                             "Client's parent-> triggered after"
-                                             n
-                                             "attempts")))))))
+                          (let [client-state (message/get-state client-io time-out ::timed-out)]
+                            (if (or (= ::timed-out client-state)
+                                    (instance? Throwable client-state)
+                                    (nil? client-state))
+                              (let [problem (if (instance? Throwable client-state)
+                                              client-state
+                                              (ex-info "Non-exception in server->client consumer"
+                                                       {::problem client-state}))]
+                                (log/error problem prelog "Client failed!")
+                                (dfrd/error! succeeded? problem))
+                              (do
+                                (message/parent->! client-io bs)
+                                (log/debug prelog
+                                           "Client's parent-> triggered after"
+                                           n
+                                           "attempts"))))))
                       server->client)

         (let [initial-message (Unpooled/buffer K/k-1)
@@ -388,10 +409,11 @@
           (let [really-succeeded? (deref succeeded? 10000 ::timed-out)]
             (log/info "Bottom of message-test")
             (let [client-state (message/get-state client-io 500 ::timed-out)]
-              (is (not (or (= client-state ::timed-out)
-                           (instance? Throwable client-state)
-                           (nil? client-state))))
-              (when (= really-succeeded? ::timed-out)
+              (when (or (= client-state ::timed-out)
+                        (instance? Throwable client-state)
+                        (nil? client-state))
+                (is not client-state))
+              (when (= really-succeeded ::timed-out)
                 (let [{:keys [::specs/flow-control]} client-state]
                   ;; I'm mostly interested in the next-action inside flow-control
                   ;; Down-side to switching to manifold for scheduling:
@@ -402,9 +424,10 @@
                   (is (not flow-control) "Client flow-control"))))
             (let [{:keys [::specs/flow-control]
                    :as srvr-state} (message/get-state server-io 500 ::timed-out)]
-              (is (not (or (= srvr-state ::timed-out)
-                           (instance? Throwable srvr-state)
-                           (nil? srvr-state))))
+              (when (or (= srvr-state ::timed-out)
+                        (instance? Throwable srvr-state)
+                        (nil? srvr-state))
+                (is (not srvr-state)))
               (is (not flow-control) "Server flow-control"))
             (is (= ::kthxbai really-succeeded?))
             (is (= 5 @client-state))))


add example extracts-test

add example extracts-test

--- src/test/clojure/pdok/featured/extracts_test.clj
+++ src/test/clojure/pdok/featured/extracts_test.clj
@@ -34,6 +34,8 @@
         features-for-extract (features-for-extract dataset feature-type extract-type-citygml features template-dir)]
     (add-extract-records config/data-db dataset feature-type extract-type-citygml 15 features-for-extract)))

+; (write-xml-to-database "bgt" "bord" "D:\\data\\pdok\\bgt\\mutatie-leveringen\\bord\\973140-Bord-1.json" "D:\\projects\\featured\\src\\main\\resources\\pdok\\featured\\templates")
+
 (defn test-fill-extract []
   (fill-extract "bgt" "bord" "citygml" "33"))


Revert "Increasing precision for sake of genomic coords"

This reverts commit f77ad543a28bf9eb1db0add951e73902351800d8.

--- src/cavm/views/datasets.clj
+++ src/cavm/views/datasets.clj
@@ -47,7 +47,7 @@
   (.print out
           (if (Double/isNaN x)
             "\"NaN\""
-            (format "%.9g" x))))
+            (format "%.6g" x))))

 (extend mikera.arrayz.INDArray json/JSONWriter {:-write write-array})
 (extend java.lang.Float json/JSONWriter {:-write write-floating-point})


use redis for sessions

use redis for sessions

--- src/chat/server/handler.clj
+++ src/chat/server/handler.clj
@@ -3,9 +3,11 @@
             [compojure.route :refer [resources]]
             [compojure.handler :refer [api]]
             [compojure.core :refer [GET POST routes defroutes context]]
-            [ring.middleware.defaults :refer [wrap-defaults site-defaults]]
+            [ring.middleware.defaults :refer [wrap-defaults secure-site-defaults site-defaults]]
             [ring.middleware.edn :refer [wrap-edn-params]]
+            [taoensso.carmine.ring :as carmine]
             [chat.server.sync :refer [sync-routes]]
+            [environ.core :refer [env]]
             [chat.server.db :as db]))

 (defn edn-response [clj-body]
@@ -29,6 +31,10 @@
 (defroutes resource-routes
   (resources "/"))

+(def ^:dynamic *redis-conf* {:pool {}
+                             :spec {:host "127.0.0.1"
+                                    :port 6379}})
+
 (def app
   (->
     (wrap-defaults
@@ -36,7 +42,12 @@
         resource-routes
         site-routes
         sync-routes)
-      (-> site-defaults ; TODO: switch to secure-site-defaults when in using https in prod
+      (-> (if (= (env :environment) "prod")
+            secure-site-defaults
+            site-defaults)
+          (assoc-in [:session :store] (carmine/carmine-store *redis-conf*
+                                                             {:expiration-secs (* 60 60 24 7)
+                                                              :key-prefix "lpchat"}))
           (assoc-in [:security :anti-forgery]
             {:read-token (fn [req] (-> req :params :csrf-token))})))
       wrap-edn-params))


Introduce gravity

Introduce gravity

--- higher/desktop/src-common/higher/core.clj
+++ higher/desktop/src-common/higher/core.clj
@@ -12,6 +12,10 @@
   "Move entity according to current velocity"
   (assoc entity :x (+ (:x entity) (:vx entity)) :y (+ (:y entity) (:vy entity))))

+(defn fall [entity]
+  "change vy according to the law of gravity"
+  (assoc entity :vy (- (:vy entity) 1)))
+
 (defscreen main-screen
   :on-show
   (fn [screen entities]
@@ -22,7 +26,7 @@
   (fn [screen entities]
     (clear!)
     (render! screen entities)
-    (map move entities))
+    (map #(-> % fall move) entities))

   :on-key-down
   (fn [screen entities]


Bound entities

Bound entities

--- higher/desktop/src-common/higher/core.clj
+++ higher/desktop/src-common/higher/core.clj
@@ -14,19 +14,35 @@

 (defn fall [entity]
   "change vy according to the law of gravity"
-  (assoc entity :vy (- (:vy entity) 1)))
+  (cond
+    (> (:y entity) 0) (assoc entity :vy (- (:vy entity) 1))
+    :else entity))
+
+(defn bound [entity]
+  "reflects entity when hitting on of the game boundaries"
+  (let [bound-horizontally
+        (fn [entity] (if (or (< (:x entity) 0) (> (:x entity) (game :width)))
+                       (assoc entity :vx (- (:vx entity)))
+                       entity))
+        bound-vertically
+        (fn [entity] (if (or
+                          (and (< (:y entity) 0) (< (:vy entity) 0))
+                          (and (> (:y entity) (game :height)) (> (:vy entity) 0)))
+                       (assoc entity :vy (- (:vy entity)))
+                       entity))]
+    (-> entity bound-horizontally bound-vertically)))

 (defscreen main-screen
   :on-show
   (fn [screen entities]
     (update! screen :renderer (stage))
-    (assoc (texture "Clojure_logo.gif") :x 50 :y 100 :vx 0 :vy 0))
+    (assoc (texture "Clojure_logo.gif") :x 50 :y 300 :vx 0 :vy 0))

   :on-render
   (fn [screen entities]
     (clear!)
     (render! screen entities)
-    (map #(-> % fall move) entities))
+    (map #(-> % fall move bound) entities))

   :on-key-down
   (fn [screen entities]


Copy extended-fn from suchwow

Copy extended-fn from suchwow

--- src/structural_typing/frob.clj
+++ src/structural_typing/frob.clj
@@ -1,6 +1,12 @@
 (ns ^:no-doc structural-typing.frob
   "General-purpose functions for frobbing data in various ways.")

+(defn extended-fn?
+  "`fn?` does not consider multimethods to be functions. This does."
+  [x]
+  (or (fn? x)
+      (instance? clojure.lang.MultiFn x)))
+
 (defn boom [fmt & args]
   (throw (new RuntimeException (apply format fmt args))))


failing test

failing test

--- test/grafter_2/rdf4j/repository_test.clj
+++ test/grafter_2/rdf4j/repository_test.clj
@@ -109,6 +109,34 @@
         (is (query test-db "ASK { GRAPH <http://b> { ?s ?p ?o } } LIMIT 1")
             "Should not be deleted")))))

+(deftest single-statement-test
+  (let [triple (core/->Triple
+                 (URI. "http://one")
+                 (URI. "http://lonely")
+                 (URI. "http://triple"))]
+    (testing "arity 2"
+      (let [ask "ASK { <http://one> <http://lonely> <http://triple> }"]
+        (with-open [conn (->connection (sail-repo))]
+          (core/add conn triple)
+          (is (query conn ask))
+          (core/delete conn triple)
+          (is (not (query conn ask))))))
+    (testing "arity 3"
+      (let [ask-a "ASK {
+                   GRAPH <http://a> {
+                   <http://one> <http://lonely> <http://triple> } }"
+            ask-b "ASK {
+                   GRAPH <http://b> {
+                   <http://one> <http://lonely> <http://triple> } }"]
+        (with-open [conn (->connection (sail-repo))]
+          (core/add conn (URL. "http://a") triple)
+          (core/add conn (URL. "http://b") triple)
+          (is (query conn ask-a))
+          (is (query conn ask-b))
+          (core/delete conn (URL. "http://a") triple)
+          (is (not (query conn ask-a)))
+          (is (query conn ask-b)))))))
+
 (deftest col-reduce-repo-test
   (is (= (into #{} (sail-repo))
          #{}))


Fix r=1

Fix r=1

--- src/icecap/store/riak.clj
+++ src/icecap/store/riak.clj
@@ -26,8 +26,9 @@
   Additionally, we know that we're never going to see key collisions,
   because the keys are long random strings.
   "
-  [& {n :n r :r :or {:n 3 :r 1}}]
-  (let [w (- n r)]
+  [& {n :n :or {:n 3}}]
+  (let [r 1
+        w (- n r)]
     {:n-val n
      :r r
      :w w


CMR-306: Added support string range attribute searches.

--- src/cmr/search/data/query_to_elastic_converters/attribute.clj
+++ src/cmr/search/data/query_to_elastic_converters/attribute.clj
@@ -12,8 +12,21 @@
     (:type condition)))

 (defmethod value-condition->value-filter :string
-  [{:keys [type name value]}]
+  [{:keys [value]}]
   {:term {:string-value value}})
+
+(defmulti range-condition->range-filter
+  "Converts an additional attribute range condition into the nested filter to use."
+  (fn [condition]
+    (:type condition)))
+
+(defmethod range-condition->range-filter :string
+  [{:keys [min-value max-value]}]
+  (let [r {:from (or min-value "")
+           :include_lower true
+           :include_upper true}
+        r (if max-value (assoc r :to max-value) r)]
+    {:range {:string-value r}}))

 (extend-protocol q2e/ConditionToElastic
   cmr.search.models.query.AttributeValueCondition
@@ -23,4 +36,16 @@
           attrib-name (:name condition)]
       {:nested {:path "attributes"
                 :filter {:and {:filters [{:term {:name attrib-name}}
-                                         value-filter]}}}})))+                                         value-filter]}}}}))
+
+  cmr.search.models.query.AttributeRangeCondition
+  (condition->elastic
+    [condition]
+    (let [range-filter (range-condition->range-filter condition)
+          attrib-name (:name condition)]
+      {:nested {:path "attributes"
+                :filter {:and {:filters [{:term {:name attrib-name}}
+                                         range-filter]}}}}))
+
+
+  )


RS & CC | #8 | Add sidebar to question view page

--- src/objective8/handlers/front_end.clj
+++ src/objective8/handlers/front_end.clj
@@ -162,6 +162,7 @@
       {:status 502})
     {:status 400}))

+
 (defn question-detail [{{q-id :q-id id :id} :route-params
                          message :flash
                          :keys [uri t' locale]
@@ -170,15 +171,17 @@
              answers (http-api/retrieve-answers (:objective-id question) (:_id question))]
          (cond
            (= status ::http-api/success)
-           (rendered-response question-view-page {:translation     t'
-                                                  :locale          (subs (str locale) 1)
-                                                  :doc-title       (str (:question question) " | Objective[8]")
-                                                  :doc-description (:question question)
-                                                  :message         message
-                                                  :question        question
-                                                  :answers         answers
-                                                  :signed-in       (signed-in?)
-                                                  :uri             uri})
+           (let [objective (http-api/get-objective (:objective-id question))]
+             (rendered-response question-view-page {:translation     t'
+                                                    :locale          (subs (str locale) 1)
+                                                    :doc-title       (str (:question question) " | Objective[8]")
+                                                    :doc-description (:question question)
+                                                    :message         message
+                                                    :question        question
+                                                    :answers         answers
+                                                    :objective       objective
+                                                    :signed-in       (signed-in?)
+                                                    :uri             uri}))
            (= status ::http-api/not-found) (error-404-response t' locale)
            :else {:status 500}))
        (catch NumberFormatException e


replaced absolute value kludge with math version.

--- src/clj/forma/reproject.clj
+++ src/clj/forma/reproject.clj
@@ -49,7 +49,7 @@
   0 longitude. Columns move east, wrapping around the globe, and rows
   move north.)"
   [ll-res max-width lat lon]
-  (let [abs-lon (if (neg? lon) (- lon) lon)
+  (let [abs-lon (Math/abs lon)
         lon-idx (bucket ll-res abs-lon)
         lat-idx (bucket ll-res (+ lat 90))]
     [lat-idx (if (neg? lon)


flags for finding cards in scored areas

flags for finding cards in scored areas

--- src/clj/game/core-flags.clj
+++ src/clj/game/core-flags.clj
@@ -108,6 +108,16 @@
   [card]
   (= (:zone card) [:deck]))

+(defn in-corp-scored?
+  "Checks if the specified card is in the Corp score area."
+  [state side card]
+  (not (empty? (filter #(= (:cid card) (:cid %)) (get-in @state [:corp :scored])))))
+
+(defn in-runner-scored?
+  "Checks if the specified card is in the Runner score area."
+  [state side card]
+  (not (empty? (filter #(= (:cid card) (:cid %)) (get-in @state [:runner :scored])))))
+
 (defn is-type?
   "Checks if the card is of the specified type, where the type is a string."
   [card type]


Quote :source and :version fields of INFO meta info

--- src/cljam/io/vcf/writer.clj
+++ src/cljam/io/vcf/writer.clj
@@ -72,8 +72,8 @@
        (str "Type=" (nil->dot (:type m)))
        (str "Description=\"" (:description m) "\"")]
       (cond->
-        (:source m) (conj (str "Source=" (:source m)))
-        (:version m) (conj (str "Version=" (:version m))))
+        (:source m) (conj (str "Source=\"" (:source m) "\""))
+        (:version m) (conj (str "Version=\"" (:version m) "\"")))
       (pack-meta-info m [:id :number :type :description :source :version])))

 (defn- stringify-meta-info-filter


add logging utilities

add logging utilities

--- src/cljs/starcity/util.cljs
+++ src/cljs/starcity/util.cljs
@@ -7,3 +7,12 @@

 (defn event-value [event]
   (.. event -target -value))
+
+(defn log [& args]
+  (.apply js/console.log js/console (to-array args)))
+
+(defn warn [& args]
+  (.apply js/console.warn js/console (to-array args)))
+
+(defn error [& args]
+  (.apply js/console.error js/console (to-array args)))


Ideas

Ideas

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -162,7 +162,7 @@
   (if-let [moves (get (available-moves-at board [x y]) player)]
     (-> game
       (apply-moves (conj moves (take-empty-cell-move player [x y])))
-      (update-in [:player] next-player))
+      (update-in [:player] next-player)) ;; TODO - We must compute the available moves to switch player
     game))


extract more of the gae related concepts

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -47,6 +47,15 @@
 (defn new-game []
   (list (with-ai-data (turn/new-init-turn))))

+(defn get-turn
+  [game-turns]
+  (first game-turns))
+
+(defn play-turn
+  [game-turns coord]
+  (conj game-turns
+    (turn/play-move (get-turn game-turns) coord)))
+
 (defn cancel-last-move ;; TODO - It needs the ai: how to move it in the game? undo then undo-while
   [old-turns]
   (let [ai-turn? #(contains? (:ai-players %) (:player %))
@@ -64,7 +73,7 @@
   (atom {:games (new-game)
          :help false}))

-(def game (reaction (first (get-in @app-state [:games]))))
+(def game (reaction (get-turn (get-in @app-state [:games]))))
 (def board (reaction (turn/get-board @game)))
 (def scores (reaction (turn/get-scores @game)))
 (def current-player (reaction (turn/current-player @game)))
@@ -79,13 +88,13 @@

 (def ai-move-delay 1000)

-(defn update-game! [f & args]
-  (swap! app-state update-in [:games] conj (apply f @game args)))
+(defn play-game-turn! [move]
+  (swap! app-state update-in [:games] play-turn move))

 (defn- handle-ai! []
   (let [ai-algo (get @ai-players @current-player)
         move (ai-algo @game @current-player)]
-    (update-game! turn/play-move move)))
+    (play-game-turn! move)))

 (defn- handle-game-event!
   [msg]
@@ -105,7 +114,7 @@
       (while true
         (alt!
           game-events ([msg] (handle-game-event! msg))
-          player-events ([coord] (update-game! turn/play-move coord))
+          player-events ([coord] (play-game-turn! coord))
           (async/timeout ai-move-delay) ([_] (if (is-ai? @current-player) (handle-ai!)))
           )))


Need to string concat an exception message in the channel pool

--- src/clojure/picard/pool.clj
+++ src/clojure/picard/pool.clj
@@ -48,7 +48,7 @@
                :state {"total-connections" total
                        "hosts" (str/join ", " (take 100 (keys by-addrs)))
                        (str "connections for " addr) (by-addrs addr)}})
-       (throw (Exception. "Reached maximum connections for " addr)))
+       (throw (Exception. (str "Reached maximum connections for " addr))))

      [(inc total) (assoc by-addrs addr (inc (by-addrs addr 0)))])))


trying to make progress

trying to make progress

--- server/src/gratefulplace/db/transform.clj
+++ server/src/gratefulplace/db/transform.clj
@@ -4,8 +4,8 @@
 (declare rules transform-entity)

 (defmacro one
-  [ref-fn rules]
-  `#(transform-entity ~rules (~ref-fn %)))
+  [ent-fn rules]
+  `#(transform-entity ~rules (~ent-fn %)))

 (defmacro many
   [remote-key rules]
@@ -16,7 +16,7 @@
   [ref-attr]
   #(ffirst (db/q [:find '(count ?c) :where ['?c ref-attr (:db/id %)]])))

-(def rules
+(def oldrules
   {:topic {:id :db/id
            :title :topic/title
            :first-post (one :topic/first-post (:post rules))
@@ -30,6 +30,40 @@
           :username :user/username
           :email :user/email}})

+{:id :db/id
+ :first-post {:arity :one
+              :fn :topic/first-post
+              :rule-key :post
+              :except :post/topic}
+ }
+
+(defn except
+  [x exceptor]
+  (apply dissoc x (:except exceptor)))
+
+(defn ref-fn
+  [ruleset options]
+  (let [rules (except (get ruleset (:rule-key options)) options)]
+    (if (= :one (:arity options))
+      (one (:fn options) rules)
+      (many (:fn options) rules))))
+
+(defn apply-modifications
+  "Provides a more succinct way of defining rules on the fly"
+  [ruleset primary-rule-key modifications]
+  (let [primary-rule (except (primary-rule-key ruleset) modifications)]
+    (reduce (fn [[attr-name transformation]]
+              (if (map? transformation)
+                [attr-name
+                 (apply-modifications
+                  ruleset
+                  (:rule-key transformation)
+                  (merge transformation
+                         (get (:with modifications) attr-name)))]
+                [attr-name transformation]))
+            {}
+            primary-rule)))
+
 (defn transform-entity
   ;; Given a map of transformations, apply them such that a map is
   ;; returned where the keys of the return and the transformations are


Use EventType

Use EventType

--- ajax-closure/src/cljs/ajax_closure/core.cljs
+++ ajax-closure/src/cljs/ajax_closure/core.cljs
@@ -1,5 +1,6 @@
 (ns ajax-closure.core
   (:require [goog.events :as events]
+            [goog.events.EventType :as EventType]
             [goog.dom :as dom])
   (:import goog.Uri
            goog.net.Jsonp))
@@ -40,7 +41,7 @@

 (defn main []
   (set-html! (dom/getElement "app") home-html)
-  (events/listen (dom/getElement "searchbutton") (.-CLICK events/EventType) on-search-btn-click))
+  (events/listen (dom/getElement "searchbutton") EventType/CLICK on-search-btn-click))

 (main)


Make water glisten

Make water glisten

--- src/dungeon_crusade/render.clj
+++ src/dungeon_crusade/render.clj
@@ -26,21 +26,23 @@
 ;; RBG color definitions.
 ;; It's easier to use names than numbers.
 (def color-to-rgb-map
-  {:brown  [139 69 19]
-   :black  [0 0 0]
-   :white  [255 255 255]
-   :gray   [128 128 128]
-   :light-gray   [64 64 64]
+  {:brown       [139 69 19]
+   :black       [0 0 0]
+   :white       [255 255 255]
+   :gray        [128 128 128]
+   :light-gray  [64 64 64]
    :dark-gray   [192 192 192]
-   :red    (vec (hex-str-to-dec "D31C00"))
-   :orange (vec (hex-str-to-dec "D36C00"))
-   :yellow (vec (hex-str-to-dec "D3B100"))
-   :green  (vec (hex-str-to-dec "81D300"))
+   :red         (vec (hex-str-to-dec "D31C00"))
+   :orange      (vec (hex-str-to-dec "D36C00"))
+   :yellow      (vec (hex-str-to-dec "D3B100"))
+   :green       (vec (hex-str-to-dec "81D300"))
    :dark-green  (vec (hex-str-to-dec "406900"))
-   :blue   (vec (hex-str-to-dec "00ACD3"))
-   :purple (vec (hex-str-to-dec "8500D3"))
-   :fushia (vec (hex-str-to-dec "D30094"))
-   :beige (vec (hex-str-to-dec "C8B464"))})
+   :blue        (vec (hex-str-to-dec "00ACD3"))
+   :light-blue  (vec (hex-str-to-dec "19B4D7"))
+   :dark-blue   (vec (hex-str-to-dec "009ABD"))
+   :purple      (vec (hex-str-to-dec "8500D3"))
+   :fushia      (vec (hex-str-to-dec "D30094"))
+   :beige       (vec (hex-str-to-dec "C8B464"))})

 (defn color->rgb
   [color]
@@ -381,7 +383,7 @@
                             :corridor        ["#"]
                             :down-stairs     [">"]
                             :up-stairs       ["<"]
-                            :water           ["~"  :blue       :black]
+                            :water           ["~"  (rand-nth [:blue :light-blue :dark-blue]) :black]
                             :sand            ["_"  :beige      :black]
                             :dirt            [","  :brown      :black]
                             :gravel          ["`"  :gray       :black]


Updated docstrings in the config module

Updated docstrings in the config module

--- src/emender_jenkins/config.clj
+++ src/emender_jenkins/config.clj
@@ -11,7 +11,8 @@
 ;

 (ns emender-jenkins.config
-    "Module that contains all functions required to load configuration from the INI file.")
+    "Module that contains all functions that are required to load configuration
+     from the provided INI file.")

 (require '[clojure.pprint :as pprint])

@@ -32,42 +33,47 @@
         (update-in [:fetcher :delay]                     config-loader/parse-int)))

 (defn load-configuration-from-ini
-    "Load configuration from the provided INI file and perform conversions on numeric and Boolean values."
+    "Load configuration from the provided INI file and perform conversions
+     on selected items from strings to numeric or Boolean values."
     [ini-file-name]
     (-> (config-loader/load-configuration-file ini-file-name)
         update-configuration))

 (defn assoc-in-if-not-nil
-    "Assoc new (updated) value into the configuration map, but only when new value exists."
+    "Assoc new (updated) value into the configuration map, but only when
+     new value exists. If value does not exist at all, the old value is kept."
     [input selector value]
     (if value
         (assoc-in input selector value)
         input))

 (defn override-options-by-cli
-    "Update configuration options read form the INI file by new values."
+    "Update configuration options read from the provided INI file by new values."
     [configuration jenkins-url test-jobs-suffix]
     (-> configuration
         (assoc-in-if-not-nil [:jenkins :jenkins-url]      jenkins-url)
         (assoc-in-if-not-nil [:jobs    :test-jobs-suffix] test-jobs-suffix)))

 (defn print-configuration
-    "Print actual configuration to the output."
+    "Print actual configuration to the standard output."
     [configuration]
     (pprint/pprint configuration))

 (defn get-api-prefix
-    "Read prefix for API calls from the configuration passed via HTTP request."
+    "Read prefix for API calls from the configuration passed via
+     HTTP request structure (middleware can be used to pass config into it)."
     [request]
     (-> request :configuration :api :prefix))

 (defn verbose?
-    "Read verbose mode settings from the configuration passed via HTTP request."
+    "Read verbose mode settings from the configuration passed via
+     HTTP request structure (middleware can be used to pass config into it)."
     [request]
     (-> request :configuration :config :verbose))

 (defn get-version
-    "Read service version from the configuration passed via HTTP request."
+    "Read service version from the configuration passed via
+     HTTP request structure (middleware can be used to pass config into it)."
     [request]
     (-> request :configuration :info :version))

@@ -102,18 +108,22 @@
     (-> request :configuration :jenkins :credentials-id))

 (defn get-test-jobs-prefix
+    "Read prefix used in names of all test jobs."
     [request]
     (-> request :configuration :jobs :test-jobs-prefix))

 (defn get-preview-test-jobs-suffix
+    "Read suffix used in names of all test jobs on preview environment."
     [request]
     (-> request :configuration :jobs :preview-test-jobs-suffix))

 (defn get-stage-test-jobs-suffix
+    "Read suffix used in names of all test jobs on stage environment."
     [request]
     (-> request :configuration :jobs :stage-test-jobs-suffix))

 (defn get-prod-test-jobs-suffix
+    "Read suffix used in names of all test jobs on production environment."
     [request]
     (-> request :configuration :jobs :prod-test-jobs-suffix))


Rename some variables

Rename some variables

Align with style used in next.jdbc documentation.

--- src/ktra_indexer/db.clj
+++ src/ktra_indexer/db.clj
@@ -253,10 +253,10 @@
       (if-not (= (count ep-name-parts) 2)
         {:status :error
          :cause :invalid-name}
-        (jdbc/with-transaction [t-con db-con]
+        (jdbc/with-transaction [tx db-con]
           (let [episode-number (Integer/parseInt (ep-name-parts 1))
                 episode-id (:ep-id
-                            (js/insert! t-con
+                            (js/insert! tx
                                         :episodes
                                         {:number episode-number
                                          :name ep-name
@@ -264,13 +264,13 @@
                                                              date)}
                                         rs-opts))]
             (if (every? pos? (for [track-json tracklist-json]
-                               (insert-episode-track t-con
+                               (insert-episode-track tx
                                                      episode-id
                                                      track-json)))
               {:status :ok
                :episode-number episode-number}
               (do
-                (.rollback t-con)
+                (.rollback tx)
                 {:status :error
                  :cause :general-error}))))))
     (catch PSQLException pge
@@ -294,14 +294,14 @@
                                               (Integer/parseInt
                                                episode-number)]})
                          rs-opts))]
-      (jdbc/with-transaction [t-con db-con]
+      (jdbc/with-transaction [tx db-con]
         (if (every? pos? (for [track tracklist]
-                           (insert-episode-track t-con
+                           (insert-episode-track tx
                                                  ep-id
                                                  track)))
           {:status :ok}
           (do
-            (.rollback t-con)
+            (.rollback tx)
             {:status :error}))))
     (catch PSQLException pge
       (log/error "Failed to insert additional tracks:" (.getMessage pge))


Updated db_interface to store HTML results for selected job

--- src/emender_service/db_interface.clj
+++ src/emender_service/db_interface.clj
@@ -35,10 +35,10 @@
             (println e))))

 (defn record-job-results
-    [job-name repo-url branch datetime results]
+    [job-name repo-url branch datetime results html]
     (try
         (jdbc/insert! db-spec/emender-service-db
-                      :results {:job job-name :datetime datetime :url repo-url :branch branch :results results})
+                      :results {:job job-name :datetime datetime :url repo-url :branch branch :results results :html html})
         (catch Exception e
             (println e))))

@@ -122,6 +122,16 @@
             (println e)
             [])))

+(defn read-html-results-for-job-id
+    [job-id]
+    (try
+        (:html (first
+            (jdbc/query db-spec/emender-service-db
+                        ["select html from results where id = ?" job-id])))
+        (catch Exception e
+            (println e)
+            [])))
+
 (defn record-error
     [job-name repo-url branch datetime message stacktrace]
     (try
@@ -152,10 +162,12 @@
      (log-job-finished job-name nil nil)))

 (defn log-job-results
-    ([job-name repo-url branch results]
+    ([job-name repo-url branch results html]
      (let [formatted-date (format-date/format-current-date)]
          (record-job-operation-event job-name repo-url branch formatted-date "results")
-         (record-job-results job-name repo-url branch formatted-date results)))
+         (record-job-results job-name repo-url branch formatted-date results html)))
+    ([job-name repo-url branch results]
+     (log-job-results job-name repo-url branch results nil))
     ([job-name results]
      (log-job-results job-name nil nil results)))


Send sender confirmation email

Send sender confirmation email

--- src/webapp/server/fns.clj
+++ src/webapp/server/fns.clj
@@ -29,16 +29,18 @@
   (if send-endorsement-neo4j-node
     (do
       (send-email
-       :message      (str "hi " (:to_full_name  send-endorsement-neo4j-node))
-       :subject      (str "hi " (:to_full_name  send-endorsement-neo4j-node))
-       :from-email   (:from_email send-endorsement-neo4j-node)
-       :from-name    (:from_full_name  send-endorsement-neo4j-node)
-       :to-email     (:to_email send-endorsement-neo4j-node)
-       :to-name      (:to_full_name  send-endorsement-neo4j-node)
+       :message      (str "ConnectToUs.co - " (:from_full_name  send-endorsement-neo4j-node)
+                          ", please confirm your endorsement request" )
+       :subject      (str "ConnectToUs.co - " (:from_full_name  send-endorsement-neo4j-node)
+                          ", please confirm your endorsement request" )
+       :from-email   "contact@connecttous.co"
+       :from-name    "ConnectToUs.co"
+       :to-email     (:from_email send-endorsement-neo4j-node)
+       :to-name      (:from_full_name  send-endorsement-neo4j-node)
        )
       (neo4j "match n where id(n)={id}
              remove n:AskForEndorsement
-             set n:SendEndorsementConfirmFrom
+             set n:AskForEndorsementConfirmSender
              return n"
              {:id (:neo-id send-endorsement-neo4j-node)} "n")
       )


fix store-event cofx position

fix store-event cofx position

Signed-off-by: yenda <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@status.im>

--- src/status_im/notifications/core.cljs
+++ src/status_im/notifications/core.cljs
@@ -73,7 +73,7 @@
           (then #(log/debug "Notification channel created:" channel-id)
                 #(log/error "Notification channel creation error:" channel-id %)))))

-  (fx/defn store-event [{:keys [from to]} {:keys [db] :as cofx}]
+  (fx/defn store-event [{:keys [db] :as cofx} {:keys [from to]}]
     (let [{:keys [address photo-path name]} (->> (get-in cofx [:db :accounts/accounts])
                                                  vals
                                                  (filter #(= (:public-key %) to))
@@ -92,7 +92,7 @@
           (fx/merge cofx
                     {:db (update db :push-notifications/stored dissoc to)}
                     (chat-model/navigate-to-chat from nil)))
-        (store-event event cofx))))
+        (store-event cofx event))))

   (defn parse-notification-payload [s]
     (try


moved -main port to 8080 for heroku

moved -main port to 8080 for heroku

--- src/mail_query/core.clj
+++ src/mail_query/core.clj
@@ -62,7 +62,7 @@

 (defn -main
   ([]
-   (-main 80))
+   (-main 8080))
   ([port]
   (http-kit/run-server app
                        {:port (Integer. port)})))


Renames set? to sett? to not clash with clojure.core

--- src/the_little_clojurian/chapter7.clj
+++ src/the_little_clojurian/chapter7.clj
@@ -8,16 +8,16 @@
             [the-little-clojurian.chapter7 :refer :all]))

 (with-test
-  (def set?
+  (def sett?
     (fn [lat]
       (cond (null? lat) true
             (member? (car lat) (cdr lat)) false
-            :else (set? (cdr lat)))))
+            :else (sett? (cdr lat)))))

-  (is (= (set? '()) true))
-  (is (= (set? '(apple peaches apple plum)) false))
-  (is (= (set? '(apple 3 pear 4 9 apple 3 4)) false))
-  (is (= (set? '(1 2 3 4 5 6 7 8)) true)))
+  (is (= (sett? '()) true))
+  (is (= (sett? '(apple peaches apple plum)) false))
+  (is (= (sett? '(apple 3 pear 4 9 apple 3 4)) false))
+  (is (= (sett? '(1 2 3 4 5 6 7 8)) true)))

 (with-test
   (def makeset


Minor cleanup :yum:

Minor cleanup :yum:

--- src/metabase/api/user.clj
+++ src/metabase/api/user.clj
@@ -66,9 +66,8 @@
                :email        email
                :first_name   first_name
                :last_name    last_name
-               :is_superuser (if (:is_superuser @*current-user*)
-                               is_superuser
-                               nil)))
+               :is_superuser (when (:is_superuser @*current-user*)
+                               is_superuser)))
   (User id))


add a couple of new bus fns

add a couple of new bus fns

--- src/overtone/sc/bus.clj
+++ src/overtone/sc/bus.clj
@@ -56,3 +56,20 @@
   nil)

 ;(on-sync-event :reset :reset-busses reset-busses)
+
+(defn bus-set!
+  "Takes a list of bus indices and values and sets the buses to those values.
+  Modifies bus(ses) in place on the server.
+
+  (bus-set! my-bus 3) ;=> Sets my-bus to the value 3"
+  [bus val]
+  (assert (bus? bus))
+
+  (send "/c_set" (:id bus) (double val)))
+
+(defn bus-set-range!
+  "Set a range of consecutive busses to the supplied vals"
+  [bus start len data]
+  (assert (bus? bus))
+
+  (apply snd "/c_setn" (:id bus) start len (map double data)))


fixed copy-first-row-to-header to check if if data is not a inc/dataset

--- src/grafter/tabular/common.clj
+++ src/grafter/tabular/common.clj
@@ -13,7 +13,8 @@
 (defn copy-first-row-to-header [data]
   "For use with make-dataset.  Copies the first row of data into the
   header, removing it from the source data."
-  [(first data) data])
+  (if (not (inc/dataset? data))
+    [(first data) data]))

 (defn move-first-row-to-header [[first-row & other-rows]]
   "For use with make-dataset.  Moves the first row of data into the


make uberjar possible

make uberjar possible

--- src/platinator/core.clj
+++ src/platinator/core.clj
@@ -1,5 +1,5 @@
-(ns platinator.core)
+(ns platinator.core
+  (:gen-class))

 (defn -main []
-  (println "I don't do a whole lot.")
-  )
+  (println "I don't do a whole lot."))


Fix for linking delay activities

Fix for linking delay activities

--- src/plan_schema/core.cljc
+++ src/plan_schema/core.cljc
@@ -1472,7 +1472,7 @@
             htn-node-id (if htn-node (composite-key htn-plan-id htn-node))
             hnode (if htn-node-id (get-node htn-plan htn-node-id))
             tpn-selection (or (:node/tpn-selection hnode) [])]
-        (when (and (= type :activity) htn-node-id)
+        (when (and (or (= type :activity) (= type :delay-activity)) htn-node-id)
           (if (not hnode)
             (log-error "edge" edge-id "specifies htn-node" htn-node "but"
               htn-node-id "is not found")


remove tasks that don't make sense for the global project

--- src/cake.clj
+++ src/cake.clj
@@ -187,6 +187,8 @@
     (when-not (= (.getPath global-project) (System/getProperty "cake.project"))
       (cake.project/init (.getPath (File. global-project "tasks.clj")))))
   (when-not *project* (require '[cake.tasks help new]))
+  (when (= "global" (:artifact-id *project*))
+    (undeftask clean compile test autotest jar uberjar war uberwar install release))
   (server/redirect-to-log ".cake/cake.log")
   (server/create port process-command :reload reload-files)
   nil)


RS | #0 | Fix declare statement

RS | #0 | Fix declare statement

--- src/objective8/draft_diffs.clj
+++ src/objective8/draft_diffs.clj
@@ -3,7 +3,7 @@
             [objective8.utils :as utils]
             [objective8.drafts :as drafts]))

-(declare replacement-element-and-updated-diff strings-for-element)
+(declare replacement-element-and-updated-diffs strings-for-element)

 (defn replacement-diffs-for-n-chars [n diffs]
   (if (zero? n)


RS & MG | #18 | Change some wording on /candidate-writers and about page

--- src/objective8/translation.clj
+++ src/objective8/translation.clj
@@ -64,7 +64,7 @@

An objective is a change that could be achieved by introducing new policy.  For example: improving access to public housing, or increasing the safety of our roads.

-
Writers are experts responsible for drafting policy.  They use the crowdsourced questions, answers and comments to produce policy drafts*.  These are further refined through cycles of feedback and redrafting.

+
Writers work with each other and the community to draft policy.  They use the crowdsourced questions, answers and comments to produce policy drafts*.  These are further refined through cycles of feedback and redrafting.

You can get involved and have your say by creating and sharing objectives, offering your opinion through comments, asking and answering questions, suggesting policy writers*, or even providing feedback on the policy drafts themselves.  The whole process is open and transparent.

@@ -142,11 +142,11 @@
                                   :doc-description "Candidate policy writers..."
                                   :page-title "Invite a policy writer"
                                   :page-intro "Do you know someone with the enthusiasm and expertise to help draft this policy?"
-                                  :writer-name-label "Who"
+                                  :writer-name-label "I'd like to invite: "
                                   :writer-name-title "Writer names are a maximum length of 50 characters"
-                                  :reason-label "Why"
+                                  :reason-label "to help draft this policy, because: "
                                   :reason-title "Reasons are a maximum length of 1000 characters"
-                                  :submit "Invite"}
+                                  :submit "Create an invite"}
                      :invitation-sign-in {:please "Please"
                                           :sign-in "sign in"
                                           :to "to invite a policy writer."}
@@ -155,9 +155,9 @@
                                            :page-title "Can you help us to draft some policy?"
                                            :sign-in-to-accept "Sign in to accept"
                                            :accept "Accept"}
-                     :candidate-list {:page-intro "Writers are experts responsible for drafting policy."
-                                      :candidate-list-heading "Recently added candidates"
-                                      :no-candidates "No writers have been invited yet."
+                     :candidate-list {:page-intro "Writers work with each other and the community to draft policy."
+                                      :candidate-list-heading "Recently added candidate writers"
+                                      :no-candidates "No candidate writers have been invited yet."
                                       :invited-by "Invited by: "}
                      :users-email {:doc-title "Sign up almost there | Objective[8]"
                                    :doc-description ""


Random formation connection type

Random formation connection type

--- src/test_utils/fracture_diagnostics.cljc
+++ src/test_utils/fracture_diagnostics.cljc
@@ -678,6 +678,12 @@
   ([physical-quantity]
    ((quantity-generate-measurement-map physical-quantity) (rand-unit physical-quantity))))

-((quantity-generate-measurement-map :duration))
-((quantity-generate-measurement-map :duration) (rand-unit :duration))
-(rand-measurement :duration)
+(def formation-connection-types [:plug-and-perf :sliding-sleeve :single-point-entry :open-hole])
+
+(defn rand-formation-connection-type []
+  ;; Sampled using a power (Pareto) distribution
+  (rand-nth (concat (repeat 72 :plug-and-perf)
+                    (repeat 12 :sliding-sleeve)
+                    (repeat 5 :single-point-entry)
+                    (repeat 3 :open-hole))))
+


Fixed bug with opts default merging clobbering passed in args

--- src/polismath/conversation.clj
+++ src/polismath/conversation.clj
@@ -23,12 +23,13 @@
   "Base of all conversation updates; handles default update opts and does named matrix updating"
   {:opts'       (plmb/fnk [opts]
                   "Merge in opts with the following defaults"
-                  (merge opts {:n-comps 2
-                               :pca-iters 10
-                               :base-iters 10
-                               :base-k 100
-                               :group-iters 10
-                               :group-k 3}))
+                  (merge {:n-comps 2
+                          :pca-iters 10
+                          :base-iters 10
+                          :base-k 100
+                          :group-iters 10
+                          :group-k 3}
+                    opts))
    :rating-mat  (plmb/fnk [conv votes]
                   (update-nmat (:rating-mat conv)
                     (map #(map % [:pid :tid :vote]) votes)))})


simplified loop

simplified loop

--- src/table_to_b/core.clj
+++ src/table_to_b/core.clj
@@ -154,17 +154,15 @@

 (defn function-line
   "Erstellt die Funktion für Variable var und Zuordnung pow"
-  [var pow i]
-  (str "&" \newline var " = %x" i ".(x" i ":struct(" pow ")|x" i "'" var ")" \newline))
+  [pow var]
+  (let [x (gensym "x")]
+    (str "&" \newline var " = %" x ".(" x ":struct(" pow ")|" x "'" var ")" \newline)))

 (defn record-functions
   "Erstellt die projection functions für die Recordversion"
   [sheet titles]
   (let [pow (erstelle-zuordnung titles (haupttypen sheet))]
-    (loop [i 0 erg ""]
-      (if (= i (count titles))
-        erg
-        (recur (inc i) (str erg (function-line (nth titles i) pow i)))))))
+    (map (partial function-line pow) titles)))

 (defn erstelle-recordmachine
   "erstellt die Recordversion einer b-machine aus der angegebenen Tabelle und speichert sie unter test1.txt"


(RE-8861) Change date time format to ISO8601

We should use the International format instead of the RFC

--- src/puppetlabs/ezbake/core.clj
+++ src/puppetlabs/ezbake/core.clj
@@ -729,7 +729,7 @@
         deps (munge-deps dep-map)
         metadata {"packaging_type" {"ezbake" (get-ezbake-version lein-project)}
                   "git_sha" (get-git-sha)
-                  "build_time" (local-time/format-local-time (local-time/local-now) :rfc822)
+                  "build_time" (local-time/format-local-time (local-time/local-now) :basic-date-time)
                   "components" deps}
         json-string (json/generate-string metadata)]
     (io/make-parents (fs/file staging-dir "ext" "build_metadata.json"))


add polymorphism to Records with Protocol

--- src/sandbox/builder/record.clj
+++ src/sandbox/builder/record.clj
@@ -6,3 +6,17 @@
 (:name cat)
 (:name dog)

+;type polimorphism with Record/Protocol
+(defprotocol NoiseMaker
+  (make-noise [this]))
+
+(defrecord NoisyCat [color name]
+  NoiseMaker
+  (make-noise [this] (str (:name this) "meows!")))
+
+(defrecord NoisyDog [color name]
+  NoiseMaker
+  (make-noise [this] (str (:name this) "barks!")))
+
+(def noisy-cat (NoisyCat. "Calico" "Fuzzy McBootings"))
+(def noisy-dog (NoisyDog. "Brown" "Brown Dog"))


tweak REPL client

tweak REPL client

--- src/main/shadow/cljs/npm/client.cljs
+++ src/main/shadow/cljs/npm/client.cljs
@@ -25,8 +25,21 @@
                    :output js/process.stdout
                    :completer
                    (fn [prefix callback]
-                     ;; FIXME: hook this up properly
-                     (callback nil (clj->js [[] prefix])))})]
+                     (let [last-prompt @last-prompt-ref]
+                       ;; without a prompt we can't autocomplete
+                       (if-not last-prompt
+                         (callback nil (clj->js [[] prefix]))
+
+                         ;; FIXME: hook this up properly
+                         (callback nil (clj->js [[] prefix])))))})
+
+            write
+            (fn [text]
+              ;; assume that everything we send is (read) which reads something
+              ;; we can never autocomplete
+              ;; and only a new prompt enables it
+              (vreset! last-prompt-ref nil)
+              (.write socket text))]

         (.on socket "connect"
           (fn [err]
@@ -37,13 +50,13 @@

                   ;; FIXME: this is an ugly hack that will be removed soon
                   (when-not (= ["--repl"] args)
-                    (.write socket (str "(shadow.cljs.devtools.cli/from-remote " (pr-str (into [] args)) ")\n"))
+                    (write (str "(shadow.cljs.devtools.cli/from-remote " (pr-str (into [] args)) ")\n"))
                     (when-not (some #{"--dev"} args)
-                      (.write socket (str ":repl/quit\n"))))
+                      (write (str ":repl/quit\n"))))

                   (.on rl "line"
                     (fn [line]
-                      (.write socket (str line "\n"))))
+                      (write (str line "\n"))))

                   ;; CTRL+D closes the rl
                   (.on rl "close"


Update tools-deps to 1.10.3.1040

Update tools-deps to 1.10.3.1040


changed extends to point to a single path

--- src/selmer/template_parser.clj
+++ src/selmer/template_parser.clj
@@ -8,7 +8,7 @@
   templates)

 (defn handle-extends [template templates path]
-  (preprocess-template path (update-in templates [template :extends] conj path)))
+  (preprocess-template path (assoc-in templates [template :extends] path)))

 (defn handle-block [template templates block-name]
   (update-in templates [template :blocks] conj block-name))


Move comments to function doc

Move comments to function doc

Signed-off-by: Yen-Chin Lee <082d453d72dce940e12089a4ad48b97cfe1f3ec4@gmail.com>

--- src/emulator_4917/core.cljc
+++ src/emulator_4917/core.cljc
@@ -25,98 +25,98 @@
      :cljs
      (.exit nodejs/process 0)))

-;; cmd 0: exit
 (defn cmd0
+  "cmd 0: exit application."
   [{:keys [memory r0 r1 pc is]}]
   (println "Terminate application.")
   (terminate-application!))

-;; cmd 1: R0 = R0 + R1
 (defn cmd1
+  "cmd 1: R0 = R0 + R1"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory memory :r0 (+ r0 r1) :r1 r1 :pc (inc pc) :is 1))

-;; cmd 2: R0 = R0 - R1
 (defn cmd2
+  "cmd 2: R0 = R0 - R1"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory memory :r0 (- r0 r1) :r1 r1 :pc (inc pc) :is 2))

-;; cmd 3: R0 = R0 + 1
 (defn cmd3
+  "cmd 3: R0 = R0 + 1"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory memory :r0 (inc r0) :r1 r1 :pc (inc pc) :is 3))

-;; cmd 4: R1 = R1 + 1
 (defn cmd4
+  "cmd 4: R1 = R1 + 1"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory memory :r0 r0 :r1 (inc r1) :pc (inc pc) :is 4))

-;; cmd 5: R0 = R0 - 1
 (defn cmd5
+  "cmd 5: R0 = R0 - 1"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory memory :r0 (dec r0) :r1 r1 :pc (inc pc) :is 5))

-;; cmd 6: R1 = R1 - 1
 (defn cmd6
+  "cmd 6: R1 = R1 - 1"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory memory :r0 r0 :r1 (dec r1) :pc (inc pc) :is 6))

-;; cmd 7: Ring bell
 (defn cmd7
+  "cmd 7: Ring bell"
   [{:keys [memory r0 r1 pc is]}]
   (println "Ring the bell!!")
   (make-cpu
    :memory memory :r0 r0 :r1 r1 :pc (inc pc) :is 7))

-;; cmd 8: Print <data>
 (defn cmd8
+  "cmd 8: Print <data>"
   [{:keys [memory r0 r1 pc is]}]
   (println (nth memory (inc pc)))
   (make-cpu
    :memory memory :r0 r0 :r1 r1 :pc (+ pc 2) :is 8))

-;; cmd 9: Load value from <data> to R0
 (defn cmd9
+  "cmd 9: Load value from <data> to R0"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory memory :r1 r1 :pc (+ pc 2) :is 9
    :r0 (nth memory (nth memory (inc pc)))))

-;; cmd 10: Load value from <data> to R1
 (defn cmd10
+  "cmd 10: Load value from <data> to R1"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory memory :r0 r0 :pc (+ pc 2) :is 10
    :r1 (nth memory (nth memory (inc pc)))))

-;; cmd 11: Store R0 into <data> position
 (defn cmd11
+  "cmd 11: Store R0 into <data> position"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory (assoc memory (nth memory (inc pc)) r0)
    :r0 r0 :r1 r1 :pc (+ pc 2) :is 11))

-;; cmd 12: Store R1 into <data> position
 (defn cmd12
+  "cmd 12: Store R1 into <data> position"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory (assoc memory (nth memory (inc pc)) r1)
    :r0 r0 :r1 r1 :pc (+ pc 2) :is 12))

-;; cmd 13: jump to address <data>
 (defn cmd13
+  "cmd 13: jump to address <data>"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory memory :r0 r0 :r1 r1 :pc (nth memory (inc pc)) :is 13))

-;; cmd 14: jump to address <data> if R0 == 0
 (defn cmd14
+  "cmd 14: jump to address <data> if R0 == 0"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory memory :r0 r0 :r1 r1
@@ -124,8 +124,8 @@
          (nth memory (inc pc)) (+ pc 2))
    :is 14))

-;; cmd 15: jump to address <data> if R0 != 0
 (defn cmd15
+  "cmd 15: jump to address <data> if R0 != 0"
   [{:keys [memory r0 r1 pc is]}]
   (make-cpu
    :memory memory :r0 r0 :r1 r1
@@ -166,6 +166,7 @@

 (defn run [command]
   (let [cpu (execute command)]
+    (print cpu)
     (recur cpu)))

 (defn to-4bit-array


UPDATE dependencies mirth artifacts now are hosted ate v3ctor.club

--- adapter-mirth/project.clj
+++ adapter-mirth/project.clj
@@ -27,15 +27,16 @@
                  [org.clojure/java.jdbc "0.3.2"]
                  [org.postgresql/postgresql "9.4-1201-jdbc41"]
                  [log4j/log4j "1.2.17"]
-                 [com.mirth.commons.encryption/mirth-crypto "1"]
                  [com.thoughtworks.xstream/xstream "1.4.8"]
                  [org.apache.commons/commons-lang3 "3.3.2"]
                  [org.apache.httpcomponents/httpcore "4.4.1"]
                  [org.apache.httpcomponents/httpmime "4.4"]
                  [org.apache.httpcomponents/httpclient "4.4"]
+                 [com.mirth.commons.encryption/mirth-crypto "1"]
                  [com.mirth.connect/mirth-donkey "3.2.1svn"]
                  [com.mirth.connect/mirth-server "3.2.1svn"]
                  [com.mirth.connect/mirth-client "3.2.1svn"]]
+  :repositories {"v3ctor.club" "http://maven.v3ctor.club"}
   :plugins [[lein-localrepo "0.5.3"]]
   :main ^:skip-aot adapter-mirth.core
   :target-path "target/%s"


update add-rule! to accept join queries, add symmetric prop and domain type infererence rules

--- src/thi/ng/fabric/triples.cljc
+++ src/thi/ng/fabric/triples.cljc
@@ -173,13 +173,15 @@

 (defn add-join-query!
   [g [a b & more]]
-  (reduce
-   (fn [acc p]
-     (add-join! g acc (add-param-query! g (keyword (gensym)) p)))
-   (add-join! g
-             (add-param-query! g (keyword (gensym)) a)
-             (add-param-query! g (keyword (gensym)) b))
-   more))
+  (if b
+    (reduce
+     (fn [acc p]
+       (add-join! g acc (add-param-query! g (keyword (gensym)) p)))
+     (add-join! g
+                (add-param-query! g (keyword (gensym)) a)
+                (add-param-query! g (keyword (gensym)) b))
+     more)
+    (add-param-query! g (keyword (gensym)) a)))

 (defn collect-inference
   [g production]
@@ -266,12 +268,11 @@
     [_ id] (when-let [q (@queries id)] @@(:res q)))
   (add-rule!
     [_ id query production]
-    (let [qid (keyword (str "inf-" (name id)))
-          q   (add-query! _ qid query)
+    (let [q   (add-join-query! _ query)
           inf (f/add-vertex!
                g {:val #{}
                   ::f/collect-fn (collect-inference _ production)})]
-      (f/add-edge! g (:result q) inf f/signal-forward nil)
+      (f/add-edge! g (:qvar-result q) inf f/signal-forward nil)
       {:query q :inf inf}))
   )

@@ -307,7 +308,10 @@
         all (:result (add-query! g :all [nil nil nil]))
         num-projects (add-counter! g projects)
         num-types (add-counter! g types)
-        inf1 (add-rule! g :knows [nil 'knows nil] (fn [[s p o]] [[s 'type 'person] [o 'type 'person] [o 'knows s]]))
+        inf1 (add-rule! g :symmetric '[[?a ?prop ?b] [?prop type symmetric-prop]]
+                        (fn [{:syms [?a ?prop ?b]}] [[?b ?prop ?a]]))
+        inf2 (add-rule! g :domain '[[?a ?prop nil] [?prop domain ?d]]
+                        (fn [{:syms [?a ?prop ?d]}] [[?a 'type ?d]]))
         pq (:qvar-result (add-param-query! g :pq '[?s knows ?o]))
         jq (:qvar-result (add-join-query! g '[[?p author ?prj] [?prj type project] [?p type person]]))
         ctx (f/async-context {:graph g :processor f/eager-vertex-processor :timeout nil})]
@@ -316,7 +320,11 @@
      #(add-triple! g %)
      '[[toxi author fabric]
        [fabric type project]
-       [toxi type person]])
+       [knows type symmetric-prop]
+       [knows domain person]
+       [author domain person]
+       ;;[noah knows toxi]
+       ])
     ;;(debug :inf-vertices (get-in inf1 [:query :result :id]) (get-in inf1 [:inf :id]))
     {:g        g
      :ctx      ctx


Send task-id in ws responses

Send task-id in ws responses

Co-authored-by: Samrat Man Singh <de71a275ed207d9c2083ebfa9af5dcdfa3ea2b88@nilenso.com>

--- src/time_tracker/timers/db.clj
+++ src/time_tracker/timers/db.clj
@@ -9,7 +9,7 @@

 (defqueries "time_tracker/timers/sql/db.sql")

-(def timer-keys [:id :project_id :started_time :duration :time_created :notes])
+(def timer-keys [:id :task_id :started_time :duration :time_created :notes])

 (defn- hyphenize
   [thing]


fixed a bug in integration of idents

fixed a bug in integration of idents

--- src/untangled/client/core.cljs
+++ src/untangled/client/core.cljs
@@ -151,9 +151,11 @@
    If the target is a vector element then that element must already exist in the vector.
   "
   [state ident & named-parameters]
+  (js/console.log "integrating" named-parameters)
   (let [already-has-ident-at-path? (fn [data-path] (boolean (seq (filter #(= % ident) (get-in @state data-path)))))
         actions (partition 2 named-parameters)]
     (doseq [[command data-path] actions]
+      (js/console.log :cmd command :dp data-path)
       (case command
         :prepend (when-not (already-has-ident-at-path? data-path)
                    (assert (vector? (get-in @state data-path)) (str "Path " data-path " for prepend must target an app-state vector."))
@@ -210,7 +212,7 @@
         data-path-keys (->> named-parameters (partition 2) (map second) flatten (filter keyword?) set vec)
         {:keys [merge-data merge-query]} (preprocess-merge state component object-data)]
     (om/merge! reconciler merge-data merge-query)
-    (integrate-ident! state ident named-parameters)
+    (apply integrate-ident! state ident named-parameters)
     (omp/queue! reconciler data-path-keys)
     @state))


set musket as default weapon in UI

set musket as default weapon in UI

--- src/zombie_run/quil.clj
+++ src/zombie_run/quil.clj
@@ -92,7 +92,8 @@

 (defn run-zombieland []
   (let [[world-x world-y] [300 150]
-        default-game (game/make-game {:world-size [world-x world-y]})
+        default-game (-> (game/make-game {:world-size [world-x world-y]})
+                         (game/configure-player-weapon (zombie-run.weapon/make-weapon :musket)))
         game (atom default-game)
         ticker (interval/start #(swap! game game/run-zombie-actions) 100)]


add test to make sure we can check out a tag (#3)

--- test/lambdacd_git/git_test.clj
+++ test/lambdacd_git/git_test.clj
@@ -67,6 +67,17 @@
       (checkout-ref (git-from-dir workspace) "some-branch")
       (is (= "some content on branch"
              (slurp (io/file workspace "some-file"))))))
+  (testing "that we can checkout a tag"
+    (let [git-handle (-> (git-init)
+                         (git-add-file "some-file" "some content")
+                         (git-commit "some commit")
+                         (git-tag "some-tag")
+                         (git-add-file "some-file" "some other content")
+                         (git-commit "some other commit"))
+          workspace (:dir git-handle)]
+      (checkout-ref (git-from-dir workspace) "some-tag")
+      (is (= "some content"
+             (slurp (io/file workspace "some-file"))))))
   (testing "that we can checkout any commit"
     (let [git-handle (-> (git-init)
                          (git-add-file "some-file" "some content")


[#44] Add test case

[#44] Add test case

--- priv/examples/fn.clj
+++ priv/examples/fn.clj
@@ -226,9 +226,20 @@

 (variadic-recursive 15)

+(def same-name-fn
+  (fn* same-name-fn
+       ([x & xs]
+        (if (erlang/>.e x 0)
+          (do
+            (clojure.core/prn [:same-name-fn x xs])
+            (same-name-fn (erlang/-.e x 1) x xs))
+          (clojure.core/prn [:same-name-fn :done xs])))))
+
+(same-name-fn 3)
+
 ;; Define a HOF that returns a function

 (def dec-fn
-  (fn* [] (fn* [x] (clojure.core/- x 1))))
+  (fn* [] (fn* [x] (erlang/-.e x 1))))

 (clojure.core/prn ((dec-fn) 10))


refactor interceptors.

refactor interceptors.

--- src/subticket/service.clj
+++ src/subticket/service.clj
@@ -55,35 +55,60 @@
       (do (log/error :msg e)
           (with-context (server-error))))))

-(def default-json
-  {:name :default-json
+(def validate-request
+  {:name :validate-request
    :enter
    (fn [context]
      (let [request (:request context)
            params (get-params request)
            route (get-in context [:route :route-name])
-           errors (s/explain-data (spec-for route) params)]
-     (if errors
-       (chain/terminate (assoc context :response (bad-request errors)))
-       (assoc context ::tmp-request request :request params))))
+           spec (spec-for route)
+           errors (and (s/spec? spec) (s/explain-data spec params))]
+       (if errors
+         (chain/terminate (assoc context :response (bad-request errors)))
+         context)))})
+
+(def params-only
+  {:name :params-only
+   :enter
+   (fn [context]
+     (let [request (:request context)
+           params (get-params request)]
+       (assoc context ::tmp-request request :request params)))
+   :leave
+   (fn [context] (assoc context :request (::tmp-request context)))})
+
+(def handle-exceptions
+  {:name :handle-exceptions
    :leave
    (fn [context]
-     (let [request (::tmp-request context)
-           with-context (partial assoc context :request request :response)
-           body (:response context)
-           e (:exception body)]
-       (if e
-         (handle-errors e with-context)
-         (with-context (ok body)))))})
+     (if-let [e (get-in context [:response :exception])]
+       (handle-errors e (partial assoc context :response))
+       context))})
+
+(def body-response
+  {:name :body-response
+   :leave
+   (fn [context]
+     (let [response (:response context)]
+       (if (:status response)
+         context
+         (assoc context :response (ok response)))))})

 ;; Defines "/" and "/about" routes with their associated :get handlers.
 ;; The interceptors defined after the verb map (e.g., {:get home-page}
 ;; apply to / and its children (/about).
-(defn json-interceptors [handler] [(body-params/body-params) http/json-body default-json (subticket.dbcon/in-transaction handler)])
+(defn unauthenticated-transaction [handler] [(body-params/body-params)
+                                             http/json-body
+                                             validate-request
+                                             body-response
+                                             handle-exceptions
+                                             params-only
+                                             (subticket.dbcon/in-transaction handler)])

 ;; Tabular routes
-(def routes #{["/user/:username" :put (json-interceptors users/add-user-handler) :route-name :add-user]})
+(def routes #{["/user/:username" :put (unauthenticated-transaction users/add-user-handler) :route-name :add-user]})

 ;; Map-based routes
 ;(def routes `{"/" {:interceptors [(body-params/body-params) http/html-body]


REPL port on instance directly is more sensible

--- src/terraboot/cluster.clj
+++ src/terraboot/cluster.clj
@@ -293,7 +293,9 @@
                                      {:allow-all-sg (cluster-id-of "aws_security_group" "master-security-group")}
                                      {:allow-all-sg (cluster-id-of "aws_security_group" "public-slave-security-group")}
                                      {:allow-all-sg (cluster-id-of "aws_security_group" "slave-security-group")}
-                                     {:allow-all-sg (cluster-id-of "aws_security_group" "public-slave-elb")})
+                                     {:allow-all-sg (cluster-id-of "aws_security_group" "public-slave-elb")}
+                                     {:port 5001
+                                      :cidr_blocks [vpc-cidr-block]})

              (cluster-security-group "slave-security-group" {}
                                      {:allow-all-sg (cluster-id-of "aws_security_group" "public-slave-security-group")}
@@ -455,8 +457,6 @@
                                          :target public-slave-elb-health
                                          :timeout 5
                                          :interval 30}
-                          :lb_protocol "https"
-
                           :listeners (mapv elb-listener public-slave-elb-listeners)
                           :subnets public-subnets
                           :security-groups (concat [(cluster-id-of "aws_security_group" "public-slave-elb")


Improve arrangement of color picker palette.

--- src/afterglow/controllers/ableton_push.clj
+++ src/afterglow/controllers/ableton_push.clj
@@ -1421,8 +1421,8 @@
 (def ^:private color-picker-grid
   (let [result (make-array clojure.lang.IPersistentMap 64)]
     (doseq [i (range 16)]
-      (let [x (* 4 (rem i 2))
-            y (- 7 (quot i 2))
+      (let [x (* 4 (quot i 8))
+            y (- 7 (rem i 8))
             origin (+ x (* 8 y))
             hue (* 360 (/ i 15))
             base-color (colors/create-color :hue hue :saturation 100 :lightness 50)]


Move subsumption to stub from sp

Move subsumption to stub from sp

--- src/angelic/search/implicit/dash_astar.clj
+++ src/angelic/search/implicit/dash_astar.clj
@@ -249,12 +249,12 @@
   (assert (not (terminal? sp)))
   (let [ts (sp-ts sp)
         underived? (identical? (ts-stub ts) (stub sp))]
+    (when underived? (add-child-stub! ts child-stub))
     (connect-and-watch-stub! sp child-stub up?
       (fn [child-sp]
         (summaries/summary-changed-local! sp)
         (when underived?
           (summaries/connect! ts (tree-summarizer child-stub))
-          (summaries/connect-subsumed! ts (tree-summarizer child-stub))
           (summaries/summary-changed! ts))
         (add-output! sp child-sp)))))


only apply enable message timeouts to spouts

--- src/clj/backtype/storm/daemon/executor.clj
+++ src/clj/backtype/storm/daemon/executor.clj
@@ -208,7 +208,8 @@
         receive-queue (:receive-queue executor-data)
         context (:worker-context executor-data)]
     (when tick-time-secs
-      (if-not (storm-conf TOPOLOGY-ENABLE-MESSAGE-TIMEOUTS)
+      (if (and (not (storm-conf TOPOLOGY-ENABLE-MESSAGE-TIMEOUTS))
+               (= :spout (:type executor-data)))
         (log-message "Timeouts disabled for executor " (:executor-id executor-data))
         (schedule-recurring
           (:user-timer worker)


fixed sorting

fixed sorting

--- src/cljs/bright_paper_werewolves/core.cljs
+++ src/cljs/bright_paper_werewolves/core.cljs
@@ -20,13 +20,13 @@
 ;; blog-server info, for now assume static
 ;; --------------------------
 ;; Testing
-;; (def server "localhost")
-;; (def port "3000")
+(def server "localhost")
+(def port "3000")

 ;; --------------------------
 ;; Production
-(def server "ecallen.com")
-(def port "4010")
+;; (def server "ecallen.com")
+;; (def port "4010")

 (def userid "ecallen")

@@ -66,7 +66,7 @@
 (defn home-page []
   [:div
    [:h1 "ECAllen"]
-   (doall (for [k (sort-by :timestamp > (keys @posts))]
+   (doall (for [k (keys (sort-by (comp :post-timestamp second) > @posts))]
            ^{:key k}
            [:section
              [:h2 (get-in @posts [k :title])]


Cleaner network

Cleaner network

--- src/com/wsscode/pathom/fulcro/network.cljs
+++ src/com/wsscode/pathom/fulcro/network.cljs
@@ -33,10 +33,6 @@

 (defn local-network [parser]
   (map->LocalNetwork {:parser parser}))
-
-;; EDN Networking
-
-

 ;; GraphQL Networking


remove "drop" listener, increasing perfs and fixing cross board drag

--- src/chessground/drag.cljs
+++ src/chessground/drag.cljs
@@ -21,9 +21,13 @@
     (aset (.-style target) common/transform-prop transform)))

 (defn on-end [event chans]
-  (-> event .-target .-classList (.remove dragging-class))
-  (when (not (.-dropzone event))
-    (push! (:drop-off chans) (common/square-key (.-target event)))))
+  (let [orig (-> event .-target .-parentNode)
+        dest (.-dropzone event)]
+    (if (and dest (= (.-parentNode orig) (.-parentNode dest)))
+      (push! (:move-piece chans) (map common/square-key [orig dest]))
+      (push! (:drop-off chans) (common/square-key orig)))
+    (-> dest .-classList (.remove drag-over-class))
+    (-> event .-target .-classList (.remove dragging-class))))

 (defn make-draggable [el chans state]
   (dom-data/store el :interact (-> (js/interact el)
@@ -38,18 +42,11 @@
 (defn piece-off [el state]
   (.set (dom-data/fetch el :interact) (js-obj "draggable" false)))

-(defn on-drop [event chans]
-  (let [orig (-> event .-relatedTarget .-parentNode)
-        dest (.-target event)]
-    (push! (:move-piece chans) (map common/square-key [orig dest]))
-    (.remove (.-classList dest) drag-over-class)))
-
 (defn square [el chans]
   (-> (js/interact el)
       (.dropzone true)
       (.on "dragenter" #(-> % .-target .-classList (.add drag-over-class)))
-      (.on "dragleave" #(-> % .-target .-classList (.remove drag-over-class)))
-      (.on "drop" #(on-drop % chans))))
+      (.on "dragleave" #(-> % .-target .-classList (.remove drag-over-class)))))

 (defn unfuck [piece-el]
   (set! (.-x piece-el) 0)


Order scripts since jsonb in the server doesn't preserve the order

--- src/cider_ci/ex/trial.clj
+++ src/cider_ci/ex/trial.clj
@@ -60,19 +60,19 @@
 (defn- prepare-and-insert-scripts [params-atom]
   (let [initial-scripts (:scripts @params-atom)
         script-atoms (->> initial-scripts
-                          (map (fn [[k v]]
-                                 [k (atom (conj v
-                                                {:name k}
-                                                (select-keys @params-atom
-                                                             [:environment_variables
-                                                              :execution_id
-                                                              :trial_id
-                                                              :working_dir])))]))
+                          (into [])
+                          (sort-by #(or (-> % second :order) 0) )
+                          (map (fn [[script-name script-spec]]
+                                 [script-name (atom (conj script-spec
+                                                          {:name script-name}
+                                                          (select-keys @params-atom
+                                                                       [:environment_variables
+                                                                        :execution_id
+                                                                        :trial_id
+                                                                        :working_dir])))]))
                           (into {}))]
     (swap! params-atom #(conj %1 {:scripts %2}) script-atoms)
     (map (fn [[k v]] v) script-atoms)))
-
-

 ;#### manage trials ###########################################################
 (defonce ^:private trials-atom (atom {}))