Fixed incorrect arg order and added logging.

--- src/hxgm30/language/gen/corpus.clj
+++ src/hxgm30/language/gen/corpus.clj
@@ -3,17 +3,23 @@
     [clojure.set :as set]
     [clojure.string :as string]
     [hxgm30.language.io :as io]
-    [hxgm30.language.util :as util]))
+    [hxgm30.language.util :as util]
+    [taoensso.timbre :as log]))

 (def lang-file-template "corpora/%s/%s")
 (def name-file-template "corpora/names/%s/%s/%s")

 (defn fullpath
   ([language data-type]
+    (log/trace "Got language:" language)
+    (log/trace "Got data-type:" data-type)
     (format lang-file-template
             (name data-type)
             (name language)))
   ([race name-type data-type]
+    (log/trace "Got race:" race)
+    (log/trace "Got name-type:" name-type)
+    (log/trace "Got data-type:" data-type)
     (format name-file-template
             (name race)
             (name name-type)
@@ -149,7 +155,7 @@

 (defn dump-syntagmata
   ([language data]
-    (dump language data :syntagmata))
+    (dump language :syntagmata data))
   ([race name-type data]
     (dump race name-type :syntagmata data)))

@@ -161,7 +167,7 @@

 (defn dump-markov
   ([language data]
-    (dump language data :markov))
+    (dump language :markov data))
   ([race name-type data]
     (dump race name-type :markov data)))


Atoms: Remove "incl-0"

Atoms: Remove "incl-0"

--- test/com/nomistech/clojure_the_language/c_900_appy_stuff/s_100_science/ss_atomic_orbitals.clj
+++ test/com/nomistech/clojure_the_language/c_900_appy_stuff/s_100_science/ss_atomic_orbitals.clj
@@ -1,30 +1,30 @@
 (ns com.nomistech.clojure-the-language.c-900-appy-stuff.s-100-science.ss-atomic-orbitals
   (:require [midje.sweet :refer :all]))

-(def +n-orbitals-extra-at-energy-level-diffs-incl-0+
+(def +n-orbitals-extra-at-energy-level-diffs+
   [0 1 3 0 5 0 7 0])

-(def +n-electrons-extra-at-energy-level-diffs-incl-0+
+(def +n-electrons-extra-at-energy-level-diffs+
   (map (partial * 2)
-       +n-orbitals-extra-at-energy-level-diffs-incl-0+))
+       +n-orbitals-extra-at-energy-level-diffs+))

-(def +n-electrons-extra-at-energy-level-incl-0+
-  (->> +n-electrons-extra-at-energy-level-diffs-incl-0+
+(def +n-electrons-extra-at-energy-level+
+  (->> +n-electrons-extra-at-energy-level-diffs+
        (reductions +)))

-(def +noble-gases-atomic-numbers-incl-0+
-  (->> +n-electrons-extra-at-energy-level-incl-0+
+(def +noble-gases-atomic-numbers+
+  (->> +n-electrons-extra-at-energy-level+
        (reductions +)))

 ;;;; ___________________________________________________________________________

-(fact +n-electrons-extra-at-energy-level-diffs-incl-0+
+(fact +n-electrons-extra-at-energy-level-diffs+
   => [0 2 6 0 10 0 14 0])

-(fact +n-electrons-extra-at-energy-level-incl-0+
+(fact +n-electrons-extra-at-energy-level+
   => [0 2 8 8 18 18 32 32])

-(fact +noble-gases-atomic-numbers-incl-0+
+(fact +noble-gases-atomic-numbers+
   => [0 2 10 18 36 54 86 118])

 ;;;; ___________________________________________________________________________
@@ -53,13 +53,13 @@
                             successive-differences-incl-0
                             (fn [s] (map #(/ % 2)
                                          s))]
-                           +noble-gases-atomic-numbers-incl-0+)
-  => [+n-electrons-extra-at-energy-level-incl-0+
-      +n-electrons-extra-at-energy-level-diffs-incl-0+
-      +n-orbitals-extra-at-energy-level-diffs-incl-0+])
+                           +noble-gases-atomic-numbers+)
+  => [+n-electrons-extra-at-energy-level+
+      +n-electrons-extra-at-energy-level-diffs+
+      +n-orbitals-extra-at-energy-level-diffs+])

 (fact (successive-funcalls [successive-differences-incl-0
                             successive-differences-incl-0]
-                           +noble-gases-atomic-numbers-incl-0+)
+                           +noble-gases-atomic-numbers+)
   => [[0 2 8 8 18 18 32 32]
       [0 2 6 0 10 0 14 0]])


Sim documentation and tweaks

Sim documentation and tweaks

--- src/clj_bots/pin_ctrl_simulator/implementation.clj
+++ src/clj_bots/pin_ctrl_simulator/implementation.clj
@@ -3,6 +3,9 @@
              [protocols :as pcp]
              [implementation :as impl]]
             [clojure.core.async :as async :refer [chan >!! <!! go <! >! go-loop]]))
+
+
+;; This stuff really needs to be part of the core library

 (def full-available-modes
   #{:input :output :input-rising :input-falling :input-both :ain :aout :pwm})
@@ -16,19 +19,28 @@
    :aout [:aout]
    :pwm  [:pwm]})

-(declare current-pin-modes)
+
+;; Here we're going to declare some of the things we'll need in the implementation that we'd rather leave at
+;; the end of this namespace for logical flow.
+
+(declare current-pin-modes current-pin-mode writeable-pin? ok-val?)

 (defmulti read-pin*
   "Inner method for reading from a pin; dispatches on pin mode"
   (fn [board pin-n]
     (get (current-pin-modes board) pin-n)))

-(declare current-pin-mode writeable-pin? ok-val?)
+
+;; In addition to the standard protocol functions, we also need something which let's us set the state of
+;; _input_ input pins for the purposes of simulation, since (for obvious reasons) this is not supported via
+;; the standard protocols.

 (defprotocol PSimControl
   "Protocol for simulation control functions"
   (set-state! [this pin-n val] "Set the state of a digital or analog input pin"))

+
+;; And now the implementation.

 (defrecord SimBoard
   [pin-state pin-modes edge-channels config]
@@ -95,6 +107,7 @@
             (str "The value " val " is not an acceptable value for pins of type " (current-pin-mode board pin-n)))
     (swap! pin-state pin-n val)))

+;; Now we'll flesh out some of the various reading/writing functions

 (defmethod read-pin* :input
   [board pin-n]
@@ -132,6 +145,9 @@
                    (< (Math/pow 2 (get-bits board pin-n)))))
     false))

+
+;; How we create new boards
+
 (defn sim-board
   [config]
   (SimBoard.
@@ -150,6 +166,9 @@
               (fn [_] (> (rand) 0.68))
               available-modes)]))})

+
+;; And register the implementation
+
 (def implementation
   (reify
     Object
@@ -161,4 +180,6 @@
     (default-config [_]
       (pcp/default-config 100))))

+(impl/register-implementation :simulation implementation)

+


Remove old comments

Remove old comments

--- src/cljs/chocolatier/engine/systems/collision.cljs
+++ src/cljs/chocolatier/engine/systems/collision.cljs
@@ -86,10 +86,6 @@
                 (str col ":" row)))
             entities))

-;; TODO use the moveable component to get position
-;; TODO use the collidable component to get the hitzone
-;; TODO use the :move-change messages to get the offsets
-
 (defn get-multi-component-state
   "Returns a collection of hashmaps of component state. Append an :id field
    for the entity's unique ID"


Add full URL to request log

Add full URL to request log

--- src/clojure/picard/log4j/CommonLogFormatLayout.clj
+++ src/clojure/picard/log4j/CommonLogFormatLayout.clj
@@ -1,4 +1,5 @@
 (ns picard.log4j.CommonLogFormatLayout
+  (:use [picard.helpers :only [request-url]])
   (:import
    [java.util
     Date]
@@ -23,7 +24,8 @@
             (first (:remote-addr request ))
             request-time-string
             (:request-method request)
-            (:path-info request)
+            ;; TODO: maybe change api of request-url to only take headers?
+            (request-url [request])
             (first (:http-version request))
             (second (:http-version request))
             (:response-status request)


Improve docstring for glue.

Improve docstring for glue.

--- src/useful/seq.clj
+++ src/useful/seq.clj
@@ -191,21 +191,18 @@
                         `(delay ~expr)))))

 (defn glue
-  "Walk over an input sequence, \"gluing\" together elements to create chunks,
-   or batches. Chunks may be of any type you like - they are not related to
-   chunked sequences, for example. Chunks are computed as follows:
-   - First, a chunk is initialized as init (default nil).
-   - Next, the first item in the input sequence is combined, unconditionally,
-     with (combine init x).
-   - For each additional element, functions glue? and unglue? are consulted to
-     decide whether the next item should be included into the current chunk.
-     If (glue? current-batch next-item) returns truthy, then a prospective
-     updated-batch is computed, as (combine current-batch next-item). If
-     (unglue? updated-batch) returns falsey, then the current batch is updated,
-     and additional sequence elements are considered.
-   - If glue? returned falsey, or unglue? returned truthy, then the current batch
-     is inserted into the output lazy sequence, and a new batch is started as
-     (combine init next-item)."
+  "Walk over an input sequence, \"gluing\" together elements to create batches.
+   Batches may be of any type you like, and are computed as follows:
+   - Each batch is initialized by combining init (default false) with next-item.
+   - For each additional item in coll, functions glue? and unglue? are consulted to
+     decide whether the next item should be included into the current batch.
+     - If (glue? current-batch next-item) returns truthy, then a prospective
+       updated-batch is computed, as (combine current-batch next-item). If
+       (unglue? updated-batch) returns falsey, then updated-batch is accepted and
+       may be used as the target for further gluing.
+     - If glue? returned falsey, or unglue? returned truthy, then the current batch
+       is inserted into the output sequence, and a new batch is started as
+       (combine init next-item)."
   ([combine glue? unglue? coll]
      (glue combine nil glue? unglue? coll))
   ([combine init glue? unglue? coll]


test hook

test hook

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

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


Use make-api

Use make-api

--- src/task_tracker/app/components/task_board.cljs
+++ src/task_tracker/app/components/task_board.cljs
@@ -1,9 +1,8 @@
 (ns task-tracker.app.components.task-board
-  (:require [om.core :as om  :include-macros true]
-            [om.dom  :as dom :include-macros true]
+  (:require [om.core                  :as om  :include-macros true]
+            [om.dom                   :as dom :include-macros true]
             [task-tracker.app.history :as history]
-            [task-tracker.app.xhr :as xhr]
-            [task-tracker.app.api :as api])
+            [task-tracker.app.api     :as api])
   (:require-macros [om-utils.core :refer [defcomponent]]))

 (defcomponent header


Fixed client-session-id

Fixed client-session-id

Fixed it in the hosted app

--- src/webapp/framework/client/system_globals.cljs
+++ src/webapp/framework/client/system_globals.cljs
@@ -61,46 +61,6 @@

 (defonce start-component
   (atom nil))
-
-
-
-
-
-
-
-
-
-
-"
-The UI tree
-"
-(defonce app-state
-  (atom
-    {}))
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-  "
-  This holds all the fns to call at the start of the
-  webapp
-  "
-(defonce init-state-fns
-  (atom []))
-

@@ -142,6 +102,52 @@

+"
+The UI tree
+"
+(defonce app-state
+  (atom
+    blank-app-state))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+  "
+  This holds all the fns to call at the start of the
+  webapp
+  "
+(defonce init-state-fns
+  (atom []))
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

@@ -152,7 +158,7 @@

   (do
     (reset!  app-state  blank-app-state)
-    (swap!  app-state  assoc :session-id  session-id)))
+    (swap!  app-state  assoc :client-session-id  session-id)))

@@ -529,8 +535,7 @@

 (defn resetclientstate []
   (do
-    (reset!  app-state                 {})
-    (reset!  app-state                 blank-app-state)
+    (swap!   app-state                 assoc :ui {})
     (reset!  paths-for-refresh         {})
     (reset!  data-views                {})
     (reset!  client-data-windows       {})


Add active user count to admin pages

Add active user count to admin pages

--- src-cljs/frontend/components/admin.cljs
+++ src-cljs/frontend/components/admin.cljs
@@ -64,7 +64,15 @@
              (list
                "in "
                (:environment app)))]
-          "."]]))))
+          "."]
+
+
+         [:p "There are currently "
+          [:b (get-in app (conj state/license-path :seat_usage))]
+          " active users out of "
+          [:b (get-in app (conj state/license-path :seats))]
+          " licensed users.  You can deactivate users in "
+          [:a {:href "/admin/users"} "user settings."]]]))))

 (defn builders [builders owner]
   (reify
@@ -184,7 +192,10 @@
              [:div.loading-spinner common/spinner]
              (list
               [:p "License Type: " [:b (:type license)]]
-              [:p "License Status: Term (" [:b (:expiry_status license)] "), Seats (" [:b (:seat_status license)] ")"]
+              [:p "License Status: Term (" [:b (:expiry_status license)] "), Seats ("
+               [:b (:seat_status license)] ": "
+               (get-in app (conj state/license-path :seat_usage)) "/"
+               (get-in app (conj state/license-path :seats)) ")"]
               [:p "Expiry date: " [:b (datetime/medium-date (:expiry_date license))]])))]))))

 (defn relevant-scope
@@ -250,10 +261,14 @@
                                  all-users)
             suspended-users (filter :suspended all-users)
             admin-write-scope? (#{"all" "write-settings"}
-                                  (get-in app [:current-user :admin]))]
-        (html
-          [:section {:style {:padding-left "10px"}}
-           [:h1 "Users"]
+                                (get-in app [:current-user :admin]))
+            num-licensed-users (get-in app (conj state/license-path :seats))
+            num-active-users (get-in app (conj state/license-path :seat_usage))]
+        (html
+         [:section {:style {:padding-left "10px"}}
+          [:h1 "Users"]
+
+           [:p "There are currently " [:b num-active-users] " active users out of " [:b num-licensed-users] " licensed users."]

           [:p "Suspended users are prevented from logging in and do not count towards the number your license allows."]


I think we may have a bug

I think we may have a bug

--- integration-tests/src/test/clojure/immutant/cluster/helper.clj
+++ integration-tests/src/test/clojure/immutant/cluster/helper.clj
@@ -47,5 +47,7 @@
 (defn start [host]
   (api/start-server (.uri *server*) host)
   (wait-for #(= "STARTED" (api/server-status (.uri *server*) host)))
-  (println host "started"))
+  (println host "started")
+  ;; this should NOT be necessary!
+  (Thread/sleep 20000))


don't filter changing cljs files

don't filter changing cljs files

fixes #560

--- support/src/figwheel/client/file_reloading.cljs
+++ support/src/figwheel/client/file_reloading.cljs
@@ -62,19 +62,9 @@
   (aget js/goog.dependencies_.written (name->path ns)))

 (defn immutable-ns? [name]
-  (or (#{"goog"
-         "cljs.core"
-         "cljs.nodejs"
-         "an.existing.path"
-         "dup.base"
-         "far.out"
-         "ns"
-         "someprotopackage.TestPackageTypes"
-         "svgpan.SvgPan"
-         "testDep.bar"} name)
-      (some
-       (partial goog.string/startsWith name)
-       ["goog." "cljs." "clojure." "fake." "proto2."])))
+  (or (#{"goog" "cljs.core" "cljs.nodejs"} name)
+      (goog.string/startsWith "clojure." name)
+      (goog.string/startsWith "goog." name)))

 (defn get-requires [ns]
   (->> ns
@@ -189,7 +179,6 @@
   ;; The biggest problem here is that clojure.browser.repl might have
   ;; patched this or might patch this afterward
   (when-not js/COMPILED
-    ;;
     (set! (.-require_figwheel_backup_ js/goog) (or js/goog.require__ js/goog.require))
     ;; suppress useless Google Closure error about duplicate provides
     (set! (.-isProvided_ js/goog) (fn [name] false))


clean up dev logging

clean up dev logging

--- support/src/figwheel/client/file_reloading.cljs
+++ support/src/figwheel/client/file_reloading.cljs
@@ -308,12 +308,9 @@
     (when-let [[url opt-source-text] (<! reload-chan)]
       (cond
         opt-source-text
-        (do
-          (js/console.log "Evaling!" opt-source-text)
-          (js/eval opt-source-text))
+        (js/eval opt-source-text)
         url
         (let [file-msg (<! (blocking-load url))]
-          (js/console.log "Loading!" url)
           (if-let [callback (get @on-load-callbacks url)]
             (callback file-msg)
             (swap! dependencies-loaded conj file-msg))))


Update reserved slugs for no journals/stories and all-posts.

--- src/oc/storage/resources/board.clj
+++ src/oc/storage/resources/board.clj
@@ -66,7 +66,7 @@

 ;; ----- Board Slug -----

-(def reserved-slugs #{"create-board" "settings" "boards" "stories" "journals" "all-activity" "activity"})
+(def reserved-slugs #{"create-board" "settings" "boards" "all-activity")

 (declare list-all-boards-by-org)
 (defn taken-slugs


update video state only if video hasn't been processed

--- src/oc/storage/resources/entry.clj
+++ src/oc/storage/resources/entry.clj
@@ -211,7 +211,9 @@
     (create-entry! conn entry)))

 (defn update-video-data [conn video entry]
-  (let [video-processed (> (:state video) 4)
+  (let [video-processed (if (:video-processed entry)
+                          true
+                          (> (:state video) 4))
         video-transcript-data (get-in video [:original_stream :audio_transcription :text])
         video-transcript (or video-transcript-data
                              (:video-transcript entry))]


Fix arity count token in varargs case

Fix arity count token in varargs case

--- src/oxcart/passes/fn_reduction.clj
+++ src/oxcart/passes/fn_reduction.clj
@@ -39,7 +39,10 @@
   a bitch, munging symbols could happen."
   [sym arity vardic]
   (symbol
-   (str sym "$arity$" arity
+   (str sym "$arity$"
+        (if vardic
+          (- arity 2)
+          arity)
         (when vardic
           "+"))))


[#2296] Fix misspelling

[#2296] Fix misspelling

--- backend/test/akvo/lumen/auth_test.clj
+++ backend/test/akvo/lumen/auth_test.clj
@@ -25,7 +25,7 @@
     401 (is (= "\"Not authenticated\"" (:body response)))
     403 (is (= "\"Not authorized\"" (:body response)))))

-(def wrap-auth (m/wrap-auth {:issuer "keyclaoak"} {:issuer "auth0"}))
+(def wrap-auth (m/wrap-auth {:issuer "keycloak"} {:issuer "auth0"}))

 (deftest wrap-auth-test
   (testing "GET / without claims"


(MAINT) increase timeout in service test

The recent changes related to HUP support have a test that
sends a HUP signal and then waits for some period of time
to validate that the restart behavior took effect.  The initial
commit of this code appears to be using too low of a timeout
for some of our CI hardware.

This commit bumps the timeout up from 1s to 5s.

--- test/puppetlabs/trapperkeeper/services_test.clj
+++ test/puppetlabs/trapperkeeper/services_test.clj
@@ -154,7 +154,7 @@
         (beckon/raise! "HUP")
         (let [start (System/currentTimeMillis)]
           (while (and (not= (count @call-seq) 15)
-                     (< (- (System/currentTimeMillis) start) 1000))
+                     (< (- (System/currentTimeMillis) start) 5000))
             (Thread/yield)))
         (is (= (count @call-seq) 15))
         (is (= [:init-service1 :init-service2 :init-service3


Fix lint

Fix lint

--- solutions/uri/1025/1025.clj
+++ solutions/uri/1025/1025.clj
@@ -21,7 +21,7 @@
           (recur begin
                  (dec middle))

-          :default
+          :else
           (inc middle))))))

 (defn read-values [total]


Guard against non-numeric number-like strings

--- src/rdf_path_examples/distance.clj
+++ src/rdf_path_examples/distance.clj
@@ -103,12 +103,19 @@
   [{literal "@value"}]
   literal)

+(defn- parse-number'
+  "Parse `n` as number if not a number already."
+  [n]
+  (if (number? n)
+    n
+    (parse-number n)))
+
 (defn normalized-numeric-distance
   "Computes distance between `a` and `b` normalized by `maximum`."
   [maximum a b]
   (if (= a b)
     0
-    (double (/ (Math/abs (- a b))
+    (double (/ (Math/abs (- (parse-number' a) (parse-number' b)))
                (or maximum 10000)))))

 (defn normalized-numeric-distance'
@@ -177,7 +184,7 @@
           dispatch-fn (comp (partial - 1) (partial dispatch-distance distance-fn))]
       (if-let [[a' b'] (map-overlaps a-desc b-desc)]
         (let [union-size (- (+ (count a-desc) (count b-desc)) (count a'))
-              intersection-size (reduce + (pmap dispatch-fn a' b'))]
+              intersection-size (reduce + (map dispatch-fn a' b'))]
           (/ (- union-size intersection-size)
              union-size))
         ; If descriptions of the compared referents are not found or their overlap is empty,
@@ -288,7 +295,7 @@
   [resolve-fn property-ranges [a b]]
   (let [distance-fn (partial compute-distance' resolve-fn property-ranges)
         dispatch-fn (partial dispatch-distance distance-fn)]
-    (average (pmap dispatch-fn a b))))
+    (average (map dispatch-fn a b))))

 (def distance-function
   (reify DistanceFunction


count all node types with opnames

count all node types with opnames

--- src/atom_finder/questions/all_nodes.clj
+++ src/atom_finder/questions/all_nodes.clj
@@ -35,12 +35,12 @@
        ))

 '((->>
-   "tmp/all-node-counts.edn"
+   "tmp/all-node-counts_2018-01-22_opname.edn"
    read-lines
    (map (partial-right dissoc :file))
    (apply merge-with +)
    (sort-by (comp - last))
    (map (partial zipmap [:node-type :count]))
-   (maps-to-csv "tmp/all-node-counts.csv")
+   (maps-to-csv "tmp/all-node-counts_2018-01-22_opname.csv")
    time-mins
    ))


Logging

Logging

--- src/sns_beanstalk_chat/handler.clj
+++ src/sns_beanstalk_chat/handler.clj
@@ -16,6 +16,7 @@
   (fn [{:keys [body] :as req}]
     (go
       (let [{:keys [type] :as m} (sns.consume/stream->message body)]
+        (log/info (pr-str {:event :sns-receive :data m}))
         (when (<! (sns.consume/verify-message! m region))
           (http/close req)
           (case type
@@ -70,8 +71,8 @@
       {:creds creds
        :sns-incoming-mult (async/mult sns-incoming)
        :sns-incoming sns-incoming
-       :sns-outgoing sns-outgoing}
-      {:port 80}))
+       :sns-outgoing sns-outgoing})
+     {:port 80})

     (let [{:keys [topic-arn]}
           (subscribe-sns!!


Fix spelling issues in labels

Fix spelling issues in labels

--- src/status_im/translations/en.cljs
+++ src/status_im/translations/en.cljs
@@ -389,7 +389,7 @@
    :transaction-moved-text                "The transaction has been successfully moved to “Unsigned”"
    :transaction-moved-title               "Transaction Moved"
    :sign-later-title                      "Sign Transaction Later?"
-   :sign-later-text                       "You will be able to sign in in the transaction history"
+   :sign-later-text                       "You will be able to sign in the transaction history"
    :not-applicable                        "Not applicable for unsigned transactions"

    ;; Wallet Send


fix compilation without file info

fix compilation without file info

--- src/clj/rksm/cloxp_cljs/compilation.clj
+++ src/clj/rksm/cloxp_cljs/compilation.clj
@@ -2,7 +2,7 @@
   (:require [clojurescript-build.core :as cljsb]
             [rksm.system-files :as sf]
             [rksm.system-files.fs-util :as fs-util]
-            [rksm.cloxp-cljs.filemapping :refer [cp-dirs-with-cljs]]
+            [rksm.cloxp-cljs.filemapping :refer [cp-dirs-with-cljs find-file-for-ns-on-cp]]
             [rksm.cloxp-repl :as repl]
             [clojure.java.io :as io]
             [clojure.string :as s]
@@ -49,14 +49,13 @@
       (compiler/compile-file file target-file build-opts))))

 (defn compile-cljs-in-project
-  [changed-ns file project-dir new-source old-source & [compiler-env]]
-  (if-let [file (or file (sf/file-for-ns changed-ns))]
+  [changed-ns file project-dir & [new-source old-source compiler-env]]
+  (if-let [file (or file (find-file-for-ns-on-cp changed-ns))]
     (let [new-source (or new-source (slurp file))
           old-source new-source
           build-opts (default-build-options project-dir)
           compiler-env (or compiler-env env/*compiler* (env/default-compiler-env))]
-       (build/build project-dir build-opts compiler-env)
-    ;   (cljs.closure/build project-dir build-opts compiler-env)
+      (build/build project-dir build-opts compiler-env)
       (ensure-ns-is-recompiled changed-ns file new-source build-opts compiler-env))
     (throw (Exception. (str "Cannot retrieve cljs file for " changed-ns)))))


just pass hashmap in and around. Its simpler.

--- src/cljs/infinitelives/pixi/canvas.cljs
+++ src/cljs/infinitelives/pixi/canvas.cljs
@@ -53,7 +53,7 @@
   :y             y position for the new canvas
   :width         width of new canvas
   :height        height of new canvas"
-  [& {:keys [expand x y width height canvas engine]
+  [{:keys [expand x y width height canvas engine]
       :or {expand false
            x 0
            y 0
@@ -112,7 +112,7 @@

 (defn make-stage
   "Layout the stage structure"
-  [& {:keys [background layers]
+  [{:keys [background layers]
       :or {background 0x000000
            layers [:backdrop :below :world :above :ui :effect]}}]

@@ -160,10 +160,10 @@
   :width         width of new canvas
   :height        height of new canvas
   "
-  [& opts]
-  (let [{:keys [stage renderer canvas layer]
-         :as world} (into (apply make-pixi-canvas opts)
-                          (apply make-stage opts ))]
+  [opts]
+  (let [{:keys [stage renderer canvas layer] :as world}
+        (into (make opts)
+              (make-stage opts))]
     ;; add the stages to the canvas
     (doall
      (map


get rects and edges of sprites

get rects and edges of sprites

--- src/cljs/infinitelives/pixi/sprite.cljs
+++ src/cljs/infinitelives/pixi/sprite.cljs
@@ -121,3 +121,13 @@
 (defn get-xy [sprite]
   [(.-position.x sprite)
    (.-position.y sprite)])
+
+(defn get-rects [sprite]
+  (let [bounds (.getBounds sprite)]
+    [(.-x bounds) (.-y bounds) (.-width bounds) (.-height bounds)]))
+
+(defn get-edges [sprite]
+  (let [[x y w h] (get-rects sprite)
+        pos-x (get-x sprite)
+        pos-y (get-y sprite)]
+    [(+ pos-x x) (+ pos-y y) (+ pos-x x w) (+ pos-y y h)]))


disable deleted badge link

disable deleted badge link

--- src/cljs/salava/metabadge/ui/modal.cljs
+++ src/cljs/salava/metabadge/ui/modal.cljs
@@ -150,8 +150,9 @@
       [:div.col-md-12
        #_[:h1.uppercase-header (:name metabadge)]
        [:div.description (if-not is-complete? (t :metabadge/Milestoneinfo) (t :metabadge/Completedmilestoneinfo))]
-       [:hr]
+
        [:div.panel
+        [:hr {:style {:margin-top "50px" :border-style "dotted"}}]
         [:div.panel-body
          [:div.row.header {:style {:margin-bottom "10px" :margin-top "10px"}}
           [:div.row.flip-table
@@ -161,7 +162,7 @@
          (reduce (fn [r badge]
                    (let [{:keys [badge-info received current user_badge]} badge
                          {:keys [name image criteria]} badge-info
-                         {:keys [id issued_on status]} user_badge
+                         {:keys [id issued_on status deleted]} user_badge
                          image-class (if-not received " opaque")]
                      (conj r [:div
                               [:div.row.flip-table {:style {:margin-bottom "10px"}}
@@ -169,7 +170,7 @@
                                [:div.col-md-5 (if received
                                                 (if (= status "declined")
                                                   [:a {:href "#" :on-click #(mo/open-modal [:metabadge :declined] badge)} name]
-                                                  [:a {:href "#" :on-click #(mo/open-modal [:badge :info] {:badge-id id})} name])
+                                                  (if (pos? deleted) name [:a {:href "#" :on-click #(mo/open-modal [:badge :info] {:badge-id id})} name]))
                                                 [:a {:href "#" :on-click #(mo/open-modal [:metabadge :dummy] badge)} name]
                                                 )]
                                [:div.col-md-2 [:label (t :metabadge/Earnedon)] (if issued_on (date-from-unix-time (* 1000 issued_on)) "-")]


Fix database detection in our multi-methods.

When we moved from the raw connection to the connection pool, we lost the
ability to dispatch to the right database-specific implementation based on the
direct class of the connection object.

Instead, use the database product name from the metadata.  This is somewhat
less instantly direct, but is correct regardless of how many layers we end up
wrapping the underlying connection in.

Signed-off-by: Daniel Pittman <3d0f3b9ddcacec30c4008c5e030e6c13a478cb4f@puppetlabs.com>

--- src/com/puppetlabs/cmdb/scf/storage.clj
+++ src/com/puppetlabs/cmdb/scf/storage.clj
@@ -1,8 +1,9 @@
 (ns com.puppetlabs.cmdb.scf.storage
-  (:import (com.jolbox.bonecp BoneCP BoneCPConfig))
+  (:import (com.jolbox.bonecp BoneCPDataSource BoneCPConfig))
   (:require [com.puppetlabs.cmdb.catalog :as cat]
             [com.puppetlabs.utils :as utils]
             [clojure.java.jdbc :as sql]
+            [clojure.contrib.logging :as log]
             [digest]))

 ;;;; REVISIT: This needs to source the configuration data from somewhere more
@@ -17,35 +18,45 @@

-;;;; SQL Storage abstraction and management.
+;;;; SQL Storage abstraction and management.  These methods allow us to
+;;;; abstract behaviour over multiple connection types.
+(defn sql-current-connection-database-name
+  "Return the database product name currently in use."
+  []
+  (.. (sql/find-connection)
+      (getMetaData)
+      (getDatabaseProductName)))
+
 (defmulti sql-array-type-string
   "Returns a string representing the correct way to declare an array
   of the supplied base database type."
-  ; Dispatch based on type of DB connection at the time of call
-  (fn [_] (class (sql/find-connection))))
+  ;; Dispatch based on databsae from the metadata of DB connection at the time
+  ;; of call; this copes gracefully with multiple connection types.
+  (fn [_] (sql-current-connection-database-name)))

 (defmulti to-jdbc-varchar-array
   "Takes the supplied collection and transforms it into a
   JDBC-appropriate VARCHAR array."
   ; Dispatch based on type of DB connection at the time of call
-  (fn [_] (class (sql/find-connection))))
-
-(defmethod sql-array-type-string org.postgresql.PGConnection
+  (fn [_] (sql-current-connection-database-name)))
+
+
+(defmethod sql-array-type-string "PostgreSQL"
   [basetype]
   (format "%s ARRAY" basetype))

-(defmethod to-jdbc-varchar-array org.postgresql.PGConnection
+(defmethod to-jdbc-varchar-array "PostgreSQL"
   [coll]
   (let [connection (sql/find-connection)]
     (->> coll
          (into-array Object)
          (.createArrayOf connection "varchar"))))

-(defmethod sql-array-type-string org.h2.jdbc.JdbcConnection
+(defmethod sql-array-type-string "H2"
   [_]
   "ARRAY")

-(defmethod to-jdbc-varchar-array org.h2.jdbc.JdbcConnection
+(defmethod to-jdbc-varchar-array "H2"
   [coll]
   (let [connection (sql/find-connection)]
     (->> coll
@@ -256,8 +267,10 @@
 BoneCP is internally thread-safe, so no internal locking is required.

 The global is initialized during servlet setup, and will be torn down
-again during servlet destruction."}
-  *bonecp*)
+again during servlet destruction."
+       :dynamic true
+       :tag BoneCPDataSource}
+  *bonecp* nil)

 (defn- new-connection-pool-instance
   "Create a new connection pool for the SCF database, configured appropriately,
@@ -278,26 +291,27 @@
     (when username (.setUsername config username))
     (when password (.setPassword config password))
     ;; ...aaand, create the pool.
-    (BoneCP. config)))
+    (BoneCPDataSource. config)))

 (defn- replace-bonecp
   "Replace the current BoneCP var root instance, shutting down the
 previous instance, if any.  For use with `alter-var-root'."
-  [new old]
-  (when old (.shutdown old))
-  new)
+  [new]
+  (log/debug (format "Replacing %s with %s" *bonecp* new))
+  (alter-var-root (var *bonecp*) (fn [old]
+                                   (when old (.close old))
+                                   new)))

 (defn initialize-connection-pool
   "Initialize the connection pool with a new object.  This will shut down
 any existing connection pool."
   []
-  (alter-var-root (var *bonecp*)
-                  (partial replace-bonecp (new-connection-pool-instance *db*))))
+  (replace-bonecp (new-connection-pool-instance *db*)))

 (defn shutdown-connection-pool
   "Shut down the current connection pool entirely."
   []
-  (alter-var-root (var *bonecp*) (partial replace-bonecp nil)))
+  (replace-bonecp nil))

 (defmacro with-scf-connection
   "Run enclosed forms with an SQL connection established to the SCF
@@ -307,5 +321,5 @@
 The database handle is only valid for the dynamic scope of the call,
 so nothing should be returned that is bound to database results."
   [& forms]
-  `(sql/with-connection (.getConnection *bonecp*)
+  `(sql/with-connection {:datasource *bonecp*}
      ~@forms))


include new http request data

include new http request data

--- src/yeller_clojure_client/ring.clj
+++ src/yeller_clojure_client/ring.clj
@@ -1,17 +1,29 @@
 (ns yeller-clojure-client.ring
   (:require [yeller-clojure-client :as yeller]
-            [ring.util.request :as req]))
+            [ring.util.request :as req]
+            [clojure.string :as s]))
+
+(defn request-info [request]
+  {:request-method (s/upper-case (name (:request-method request)))
+   :user-agent (-> request :headers (get "User-Agent"))
+   :referrer (-> request :headers (get "Referer"))})

 (defn format-extra [options request]
   {:url (req/request-url request)
    :custom-data
    {:params (merge (:query-params request) (:form-params request))
     :session (:session request)
-    :context (:yeller/context request)}
+    :context (:yeller/context request)
+    :http-request (request-info request)}
    :environment (:environment options "production")})

+(defn make-client [options-or-client]
+  (if (map? options-or-client)
+    (yeller/client options)
+    options-or-client))
+
 (defn wrap-ring
-  [handler options]
+  [handler options-or-client]
   "wraps a ring handler in middleware that sends exceptions to yeller.
    takes a map of options.
    Required:
@@ -28,7 +40,7 @@
    On the other hand, it should probably sit outside of any middleware you have
    that does e.g. authentication, so it can track errors that happen in that
    middleware"
-  (let [client (yeller/client options)]
+  (let [client (make-client options-or-client)]
     (fn [request]
       (try
         (handler request)


Add stacktrace middleware to ring

Add stacktrace middleware to ring

I don't think this has anything to do w/ my PotemkinMap error from
immutant either, but it seemed worth splitting off into its own commit
just in case

--- src/clj/frereth_web/routes/core.clj
+++ src/clj/frereth_web/routes/core.clj
@@ -19,6 +19,7 @@
             [ring.middleware.not-modified :refer (wrap-not-modified)]
             [ring.middleware.params :refer (wrap-params)]
             [ring.middleware.resource :refer (wrap-resource)]
+            [ring.middleware.stacktrace :refer (wrap-stacktrace)]
             [ring.util.response :as response]
             [schema.core :as s]
             [taoensso.timbre :as log])
@@ -151,8 +152,8 @@
   Take the time to learn and appreciate everything that's going on here."
   [handler]
   (-> handler
-      ;; TODO: Only in debug mode
-      debug-middleware
+      debug-middleware  ; TODO: Only in debug mode
+      wrap-stacktrace   ; TODO: Also just in debug mode
       (wrap-restful-format :formats [:edn :json-kw :yaml-kw :transit-json :transit-msgpack])
       wrap-params  ; Q: How does this interact w/ wrap-restful-format?
       (wrap-resource "public")


Temporarily disable keys for React components

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -28,14 +28,15 @@
   [:span {:class-name (part-class-name (last p))} (first p)])

 (defn line [parts]
-  [:span.line (map (fn [p] ^{:key p} [part p]) parts)])
+  [:span.line (map (fn [p] [part p]) parts)])
+  ;[:span.line (map (fn [p] ^{:key p} [part p]) parts)])

 (defn click! [e]
   (swap! app-state update-in [:clicks] inc))

 (defn terminal [lines]
   [:pre.asciinema-terminal.font-small
-   (map (fn [l] ^{:key l} [line l]) lines)])
+   (map (fn [l] [line l]) lines)])

 (defn control-bar []
   [:div.controlbar (str "xbar ")])


Fix comment

Fix comment

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -59,7 +59,7 @@
         (update-in [:cursor] merge cursor))))

 (defn coll->chan
-  "Returns a channel that emits frames from the given collection.
+  "Returns a channel that emits elements from the given collection.
   The difference from core.async/to-chan is this function expects elements of
   the collection to be tuples of [delay data], and it emits data after delay
   (sec) for each element. It tries to always stay 'on the schedule' by measuring


Don't break on base64 encoded snapshot containing line breaks

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -22,6 +22,7 @@
     (when (= (.indexOf poster "data:application/json;base64,") 0)
       (-> poster
           (.substring 29)
+          (.replace (js/RegExp. "\\s" "g") "")
           js/atob
           js/JSON.parse
           (js->clj :keywordize-keys true)))


we need greatest diff not sum

we need greatest diff not sum

--- src-cljs/flatride/core.cljs
+++ src-cljs/flatride/core.cljs
@@ -32,9 +32,9 @@
   "Longest seq within seqs"
   (reduce #(if (>= (count %1) (count %2)) %1 %2) [] seqs))

-(defn greatest-sum-seq [seqs]
+(defn greatest-diff-seq [seqs]
   "Highest sum seq within seqs"
-  (apply max-key #(reduce + %) seqs))
+  (apply max-key #(- (last %) (first %)) seqs))

 (defn process-elevation-data [elevations status]
   (log elevations)


Added command to "complete" given example

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

--- src/conexp/fca/exploration/repl.clj
+++ src/conexp/fca/exploration/repl.clj
@@ -128,6 +128,11 @@
                             "Please enter new attributes: "))]
     (assoc state :negatives negatives)))

+(define-repl-fn complete-example
+  "Adds all attributes, which are not positive, to the negatives."
+  (let [non-pos (difference (attributes ctx) (set (:positives state)))]
+    (assoc state :negatives non-pos)))
+
 (define-repl-fn saturate-partial-example
   "Saturates the given partial counterexample."
   (let [old-pos   (set (:positives state)),


Loading code returns nil

Loading code returns nil

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

--- src/conexp/contrib/gui/editors/code.clj
+++ src/conexp/contrib/gui/editors/code.clj
@@ -31,7 +31,7 @@
     (when-not (and repl-process (repl-alive? repl-process))
       (illegal-state "There is no REPL running, cannot load file."))
     (when-let [file (choose-open-file frame ["clojure files" "clj"])]
-      (repl-in repl-process (str "(load-file \"" (.getAbsolutePath file) "\")")))))
+      (repl-in repl-process (str "(do (load-file \"" (.getAbsolutePath file) "\") nil)")))))

 (defvar- *code-menu*
   {:name "Code",


Switch from 'mysql-test' to 'master'

Switch from 'mysql-test' to 'master'

--- clj_record/test/model/config.clj
+++ clj_record/test/model/config.clj
@@ -1,10 +1,10 @@
 (ns clj-record.test.model.config)

-(comment)
-(def db {:classname "org.apache.derby.jdbc.EmbeddedDriver"
-         :subprotocol "derby"
-         :subname "/tmp/clj-record.test.db"
-         :create true})
+(comment
+  (def db {:classname "org.apache.derby.jdbc.EmbeddedDriver"
+	   :subprotocol "derby"
+	   :subname "/tmp/clj-record.test.db"
+	   :create true}))

 (comment
   (def db {:classname "org.postgresql.Driver"
@@ -13,9 +13,9 @@
            :user "user"
            :password "pass"}))

-(comment
-  (def db {:classname "com.mysql.jdbc.Driver"
-           :subprotocol "mysql"
-           :user "root"
-           :password "root"
-           :subname "//localhost/test"}))+(comment)
+(def db {:classname "com.mysql.jdbc.Driver"
+	 :subprotocol "mysql"
+         :user "root"
+         :password "root"
+         :subname "//localhost/test"})


Height tweak

Height tweak

--- src/dactyl_keyboard/dactyl-manuform.clj
+++ src/dactyl_keyboard/dactyl-manuform.clj
@@ -124,7 +124,7 @@
                           (translate column-offset))]
     (->> placed-shape
          (rotate (/ π 12) [0 1 0])
-         (translate [0 0 23]))))
+         (translate [0 0 24]))))

 (def key-holes
   (apply union
@@ -198,7 +198,7 @@
 ;;;;;;;;;;;;
 ;; Thumbs ;;
 ;;;;;;;;;;;;
-(def thumborigin [-23 -34 46])
+(def thumborigin [-23 -34 47])

 (defn deg2rad [degrees]
   (* (/ degrees 180) pi))
@@ -463,7 +463,7 @@
                    thumb
                    thumb-connectors
                    case-walls
-                   usb-cutout
+                  ;  usb-cutout
                   ;  thumbcaps
                   ;  caps
                    )))


Remove from the back.

Remove from the back.

--- src/dsbdp/local_dpp_self_adaptivity.clj
+++ src/dsbdp/local_dpp_self_adaptivity.clj
@@ -116,13 +116,15 @@
                                             (conj o v)))
                                         []
                                         orig-mapping)]
-              (loop [av available idx 0 m incremented-mapping]
+              (loop [av available
+                     idx (dec (count drop-indices))
+                     m incremented-mapping]
                 (if (> av 0)
                   (recur
                     (dec av)
-                    (if (< (inc idx) (count drop-indices))
-                      (inc idx)
-                      0)
+                    (if (< (dec idx) 0)
+                      (dec (count drop-indices))
+                      (dec idx))
                     (update m (drop-indices idx) dec))
                   m
                   )


add debug to cluster

add debug to cluster

--- src/edu/berkeley/ai/scripts/cluster.clj
+++ src/edu/berkeley/ai/scripts/cluster.clj
@@ -22,12 +22,12 @@
      (doseq [f files]
        (println
 	(apply util/sh
-	 (concat ["qsub"
+	 (util/prln (concat ["qsub"
 		  "-N" name
 		  "-o" (str (util/file-stem f) ".out")
 		  "-e" (str (util/file-stem f) ".err")]
 		*default-qsub-options*
-		[:in (str *default-clj* " "f) :dir (util/dirname f)]))))))
+		[:in (str *default-clj* " "f) :dir (util/dirname f)])))))))

 (defn run-experiment-set-subprocesses [es]
   (run-files-subprocesses


Progress in search

Progress in search

--- webapp/src/org/teamweek/webapp/endpoint/search.clj
+++ webapp/src/org/teamweek/webapp/endpoint/search.clj
@@ -1,8 +1,20 @@
 (ns org.teamweek.webapp.endpoint.search
-  (:require [compojure.core :refer :all]))
+  (:require [compojure.core :refer :all]
+            [ring.util.response :refer :all]
+            [datomic.api :as d]))

 (defn search-endpoint [config]
   (context "/search" []
-   (GET "/" [] "Hello World")))
+   (GET "/" req
+     (let [t (get-in req [:params :t])
+           q (get-in req [:params :q])
+           db (:db req)]
+       (if t
+         (if-let [eid (ffirst (d/q '[:find ?e :in $ ?t :where [?e :team/token ?t]] db t))]
+           (let [team (d/entity db eid)
+                 domain (:team/domain team)]
+             domain)
+           (redirect "/"))
+         (redirect "/"))))))


parse-input? to control input parsing #82 (#83)

--- cljs-lambda/src/cljs_lambda/util.cljs
+++ cljs-lambda/src/cljs_lambda/util.cljs
@@ -16,13 +16,13 @@
   keys `:aws-request-id`, `:client-context`, `:log-group-name`,
   `:log-stream-name` & `:function-name` - suitable for manipulation
   by [[context/done!]]  etc."
-  [f]
+  [f & [{parse-input? :parse-input? :or {parse-input? true}}]]
   (fn [event ctx & [cb]]
     (when (fn? cb)
       (set! (.. ctx -handler-callback)
             (fn [err & [value]]
               (cb (clj->js err) (clj->js value)))))
-    (f (js->clj event :keywordize-keys true)
+    (f (if parse-input? (js->clj event :keywordize-keys true) event)
        (cond-> ctx
          (not (satisfies? ctx/ContextHandle ctx)) ctx/->context))))

@@ -102,10 +102,11 @@

   See [[macros/deflambda]] for an alternative approach to defining/export
   handler vars."
-  [f & [{:keys [error-handler]}]]
+  [f & [{:keys [error-handler] :as opts}]]
   (let [f (cond-> f error-handler (handle-errors error-handler))]
     (wrap-lambda-fn
      (fn [event ctx]
        (let [cb (or (:handler-callback ctx) (partial ctx/done! ctx))]
          (-> (invoke-async f event ctx)
-             (p/branch (partial cb nil) cb)))))))
+             (p/branch (partial cb nil) cb))))
+     opts)))


CLJS-1309: remove redundant declare

CLJS-1309: remove redundant declare

--- src/main/clojure/cljs/analyzer.cljc
+++ src/main/clojure/cljs/analyzer.cljc
@@ -1023,8 +1023,6 @@
      :name e
      :catch catch
      :children [try catch finally]}))
-
-(declare get-expander)

 (defmethod parse 'def
   [op env form name _]


drop pre-condition for now, included slow map? call

--- src/main/clojure/cljs/analyzer.cljc
+++ src/main/clojure/cljs/analyzer.cljc
@@ -2327,12 +2327,10 @@
   ([env form] (analyze env form nil))
   ([env form name] (analyze env form name nil))
   ([env form name opts]
-   {:pre [(or (nil? name) (symbol? name))
-          (or (nil? opts) (map? opts))]}
-    (ensure
-      (wrapping-errors env
-        (binding [reader/*alias-map* (or reader/*alias-map* {})]
-          (analyze* env form name opts))))))
+   (ensure
+     (wrapping-errors env
+       (binding [reader/*alias-map* (or reader/*alias-map* {})]
+         (analyze* env form name opts))))))

 #?(:clj
    (defn- source-path


Comment code on user ns.

Comment code on user ns.

--- test/user.clj
+++ test/user.clj
@@ -8,7 +8,7 @@
 ;; Copyright (c) 2016-2020 Andrey Antukh <niwi@niwi.nz>

 (ns user
-  (:require
+  #_(:require
    [clojure.spec.alpha :as s]
    [clojure.tools.namespace.repl :as repl]
    [clojure.walk :refer [macroexpand-all]]
@@ -20,19 +20,19 @@

 ;; --- Benchmarking Tools

-(defmacro run-quick-bench
-  [& exprs]
-  `(with-progress-reporting (quick-bench (do ~@exprs) :verbose)))
+;; (defmacro run-quick-bench
+;;   [& exprs]
+;;   `(with-progress-reporting (quick-bench (do ~@exprs) :verbose)))

-(defmacro run-quick-bench'
-  [& exprs]
-  `(quick-bench (do ~@exprs)))
+;; (defmacro run-quick-bench'
+;;   [& exprs]
+;;   `(quick-bench (do ~@exprs)))

-(defmacro run-bench
-  [& exprs]
-  `(with-progress-reporting (bench (do ~@exprs) :verbose)))
+;; (defmacro run-bench
+;;   [& exprs]
+;;   `(with-progress-reporting (bench (do ~@exprs) :verbose)))

-(defmacro run-bench'
-  [& exprs]
-  `(bench (do ~@exprs)))
+;; (defmacro run-bench'
+;;   [& exprs]
+;;   `(bench (do ~@exprs)))


Remove extraneous macro.

Remove extraneous macro.

--- src/main/clojure/clara/rules/memory.clj
+++ src/main/clojure/clara/rules/memory.clj
@@ -91,11 +91,6 @@

 ;;; Transient local memory implementation. Typically only persistent memory will be visible externally.

-;;; Internal helper macro to manage our transient memory.
-;;; We must update the content on each call to correctly use the underlying transient map.
-(defmacro assoc-mem! [k v]
-  `(set! ~'content (assoc! ~'content ~k ~v)))
-
 (deftype TransientLocalMemory [rulebase ^:unsynchronized-mutable content]
   IMemoryReader
   (get-rulebase [memory] rulebase)
@@ -122,7 +117,7 @@
   (add-elements! [memory node join-bindings elements]
     (let [key [:alpha-memory (:id node) join-bindings]
           current-facts (get content key [])]
-      (assoc-mem! key (concat current-facts elements)) ))
+      (set! content (assoc! content key (concat current-facts elements)))))

   (remove-elements! [memory node join-bindings elements]
     (let [key [:alpha-memory (:id node) join-bindings]
@@ -131,7 +126,7 @@
           filtered-facts (remove-first-of-each element-set current-facts)]

       ;; Update the memory with the changed facts.
-      (assoc-mem! key filtered-facts)
+      (set! content (assoc! content key filtered-facts))

       ;; return the removed elements.
       (s/intersection element-set (set current-facts))))
@@ -139,7 +134,7 @@
   (add-tokens! [memory node join-bindings tokens]
     (let [key [:beta-memory (:id node) join-bindings]
           current-tokens (get content key [])]
-      (assoc-mem! key (concat current-tokens tokens))))
+		(set! content (assoc! content key (concat current-tokens tokens)))))

   (remove-tokens! [memory node join-bindings tokens]
     (let [key [:beta-memory (:id node) join-bindings]
@@ -147,7 +142,7 @@
           token-set (set tokens)
           filtered-tokens (remove-first-of-each token-set current-tokens)]

-      (assoc-mem! key filtered-tokens)
+      (set! content (assoc! content key filtered-tokens))
       (s/intersection token-set (set current-tokens))))

   (add-accum-reduced! [memory node join-bindings accum-result fact-bindings]
@@ -155,12 +150,12 @@
           updated-bindings (assoc (get content key {})
                              fact-bindings
                              accum-result)]
-      (assoc-mem! key updated-bindings)))
+      (set! content (assoc! content key updated-bindings))))

   (add-insertions! [memory node token facts]
     (let [key [:production-memory (:id node) token]
           current-facts (get content key [])]
-      (assoc-mem! key (concat current-facts facts))))
+      (set! content (assoc! content key (concat current-facts facts)))))

   (remove-insertions! [memory node tokens]

@@ -174,26 +169,26 @@
       ;; Clear the keys.
       (doseq [token tokens
               :let [key [:production-memory (:id node) token]]]
-        (assoc-mem! key []))
+        (set! content (assoc! content  key [])))

       results))

   (add-activations! [memory node tokens]
-    (assoc-mem! :activations
+    (set! content (assoc! content :activations
                 (assoc
                  (:activations content)
                   node
-                  (concat tokens (get-in content [:activations node] [])))))
+                  (concat tokens (get-in content [:activations node] []))))))

   (remove-activations! [memory node tokens]
-    (assoc-mem! :activations
+    (set! content (assoc! content :activations
                 (assoc
                  (:activations content)
                   node
-                  (remove-first-of-each (set tokens) (get-in content [:activations node] [])))))
+                  (remove-first-of-each (set tokens) (get-in content [:activations node] []))))))

   (clear-activations! [memory]
-    (assoc-mem! :activations {}))
+    (set! content (assoc! content  :activations {})))

   (to-persistent! [memory]


Minor code cleanup in clojure.test.check

Signed-off-by: Reid Draper <1f4d9895740d1b07c3b2f21f4b03e23d1086f158@gmail.com>

--- src/main/clojure/clojure/test/check.clj
+++ src/main/clojure/clojure/test/check.clj
@@ -25,6 +25,11 @@
   (ct/report-trial property num-trials num-trials)
   {:result true :num-tests num-trials :seed seed})

+(defn not-falsey-or-exception?
+  "True if the value is not falsy or an exception"
+  [value]
+  (and value (not (instance? Throwable value))))
+
 (defn quick-check
   "Tests `property` `num-tests` times.

@@ -45,14 +50,11 @@
               result-map (gen/rose-root result-map-rose)
               result (:result result-map)
               args (:args result-map)]
-          (cond
-            (instance? Throwable result) (failure
-                                           property result-map-rose
-                                           so-far size created-seed)
-            result (do
-                     (ct/report-trial property so-far num-tests)
-                     (recur (inc so-far) rest-size-seq))
-            :default (failure property result-map-rose so-far size created-seed)))))))
+          (if (not-falsey-or-exception? result)
+            (do
+              (ct/report-trial property so-far num-tests)
+              (recur (inc so-far) rest-size-seq))
+            (failure property result-map-rose so-far size created-seed)))))))

 (defn- smallest-shrink
   [total-nodes-visited depth smallest]
@@ -60,11 +62,6 @@
    :depth depth
    :result (:result smallest)
    :smallest (:args smallest)})
-
-(defn not-falsey-or-exception?
-  "True if the value is not falsy or an exception"
-  [value]
-  (and value (not (instance? Throwable value))))

 (defn- shrink-loop
   "Shrinking a value produces a sequence of smaller values of the same type.
@@ -86,20 +83,19 @@
            depth 0]
       (if (empty? nodes)
         (smallest-shrink total-nodes-visited depth current-smallest)
-        (let [head (first nodes)
-              tail (rest nodes)]
-          (let [result (:result (gen/rose-root head))]
-            (if (not-falsey-or-exception? result)
-              ;; this node passed the test, so now try testing its right-siblings
-              (recur tail current-smallest (inc total-nodes-visited) depth)
-              ;; this node failed the test, so check if it has children,
-              ;; if so, traverse down them. If not, save this as the best example
-              ;; seen now and then look at the right-siblings
-              ;; children
-              (let [children (gen/rose-children head)]
-                (if (empty? children)
-                  (recur tail (gen/rose-root head) (inc total-nodes-visited) depth)
-                  (recur children (gen/rose-root head) (inc total-nodes-visited) (inc depth)))))))))))
+        (let [[head & tail] nodes
+              result (:result (gen/rose-root head))]
+          (if (not-falsey-or-exception? result)
+            ;; this node passed the test, so now try testing its right-siblings
+            (recur tail current-smallest (inc total-nodes-visited) depth)
+            ;; this node failed the test, so check if it has children,
+            ;; if so, traverse down them. If not, save this as the best example
+            ;; seen now and then look at the right-siblings
+            ;; children
+            (let [children (gen/rose-children head)]
+              (if (empty? children)
+                (recur tail (gen/rose-root head) (inc total-nodes-visited) depth)
+                (recur children (gen/rose-root head) (inc total-nodes-visited) (inc depth))))))))))

 (defn- failure
   [property failing-rose-tree trial-number size seed]


Add equality test for cursor

Add equality test for cursor

--- test/testcursor.cljs
+++ test/testcursor.cljs
@@ -4,7 +4,8 @@
                    [reagent.ratom :refer [run! reaction]]
                    [reagent.debug :refer [dbg]])
   (:require [cemerick.cljs.test :as t]
-            [reagent.ratom :as rv]))
+            [reagent.ratom :as rv]
+            [reagent.core :as r]))

 ;; this repeats all the atom tests but using cursors instead

@@ -90,8 +91,8 @@
     (let [!x-base (rv/atom {:a {:b 0 :c {:d 0}}})
           !x (rv/cursor [:a :c :d] !x-base)
           !co (rv/make-reaction #(inc @!x) :auto-run true)]
-      (is (= 1 @!co) "CO has correct value on first deref")
-      (swap! !x inc)
+      (is (= 1 @!co) "CO has correct value on first deref")
+      (swap! !x inc)
       (is (= 2 @!co) "CO auto-updates")
       (is (= {:a {:b 0 :c {:d 1}}} @!x-base))
       (dispose !co))
@@ -118,31 +119,31 @@
       (is (= @res (+ 2 @a)))
       (is (= @b-changed 1))
       (is (= @c-changed 0))
-
+
       (reset! a -1)
       (is (= @res (+ 2 @a)))
       (is (= @b-changed 2))
       (is (= @c-changed 0))
       (is (= @a-base {:test {:unsubscribe -1 :value 42}}))
-
+
       (reset! a 2)
       (is (= @res (+ 10 @a)))
       (is (<= 2 @b-changed 3))
       (is (= @c-changed 1))
       (is (= @a-base {:test {:unsubscribe 2 :value 42}}))
-
+
       (reset! a 3)
       (is (= @res (+ 10 @a)))
       (is (<= 2 @b-changed 3))
       (is (= @c-changed 2))
       (is (= @a-base {:test {:unsubscribe 3 :value 42}}))
-
+
       (reset! a 3)
       (is (= @res (+ 10 @a)))
       (is (<= 2 @b-changed 3))
       (is (= @c-changed 2))
       (is (= @a-base {:test {:unsubscribe 3 :value 42}}))
-
+
       (reset! a -1)
       (is (= @res (+ 2 @a)))
       (is (= @a-base {:test {:unsubscribe -1 :value 42}}))
@@ -256,3 +257,35 @@
     (is (= {:set 11} @a-base))
     (is (= runs (running)))))

+
+(deftest test-equality
+  (let [a (atom {:foo "bar"})
+        a1 (atom {:foo "bar"})
+        c (r/cursor [:foo] a)
+        c2 (r/cursor [:foo] a swap! a assoc :foo)
+        c3 (r/cursor [:foo] a swap! a assoc :foobar)]
+    (is (= @c "bar"))
+    (is (= @c2 "bar"))
+    (is (= @c3 "bar"))
+    (is (= c (r/cursor [:foo] a)))
+    (is (not= c (r/cursor [:foo] a1)))
+    (is (not= c (r/cursor [:foobar] a)))
+    (is (= c2 (r/cursor [:foo] a swap! a assoc :foo)))
+    (is (not= c2 (r/cursor [:foo] a swap! a assoc :foobar)))
+    (is (not= c2 (r/cursor [:foo] a1 swap! a assoc :foo)))
+    (is (not= c2 (r/cursor [:foo] a swap! a1 assoc :foo)))
+
+    (reset! c2 "foobar")
+    (is (= @c2 "foobar"))
+    (is (= @c "foobar"))
+    (is (= @a {:foo "foobar"}))
+
+    (reset! c "bar")
+    (is (= @c2 "bar"))
+    (is (= @c "bar"))
+    (is (= @a {:foo "bar"}))
+    (is (= c (r/cursor [:foo] a)))
+    (is (= c2 (r/cursor [:foo] a swap! a assoc :foo)))
+
+    (reset! c3 "foo")
+    (is (= @a {:foo "bar" :foobar "foo"}))))


removed the colons from FAIL: and WORK TO DO: in the report

--- src/midje/internal_ideas/report.clj
+++ src/midje/internal_ideas/report.clj
@@ -48,7 +48,7 @@
             :else               (pr-str form)))

         (fail-at [m]
-          [(str "\n" (color/fail "FAIL:") " "
+          [(str "\n" (color/fail "FAIL") " "
              (when-let [doc (:description m)] (str (pr-str doc) " "))
              "at " (midje-position-string (:position m)))
            (when-let [substitutions (:binding-note m)]
@@ -94,7 +94,7 @@

   (defmethod report-strings :future-fact [m]
     (list
-     (str "\n" (color/note "WORK TO DO:") " "
+     (str "\n" (color/note "WORK TO DO") " "
           (when-let [doc (:description m)] (str (pr-str doc) " "))
           "at " (midje-position-string (:position m)))))

@@ -109,10 +109,10 @@
   (defmethod report-strings :mock-incorrect-call-count [m]
     (letfn [(report-fail [fail]
               (list
-                (str "    " (:expected fail)
+                (str "    " (:expected fail) " "
                   (if (zero? (:actual-count fail))
-                    " [expected at least once, actually never called]"
-                    (cl-format nil " [expected :times ~A, actually called ~R time~:P]"
+                    "[expected at least once, actually never called]"
+                    (cl-format nil "[expected :times ~A, actually called ~R time~:P]"
                                (:expected-count fail) (:actual-count fail))))))]

     (concat


corrected the information model, mark rows-per-segment as optional

--- src/onyx/sql/information_model.cljc
+++ src/onyx/sql/information_model.cljc
@@ -34,6 +34,8 @@

              :sql/rows-per-segment
              {:type :integer
+              :optional? true
+              :default 1000
               :doc "The number of rows to compress into a single segment."}

              :sql/read-buffer


Processor needs to recur in go-loop.

Processor needs to recur in go-loop.

--- src/org/playasophy/wonderdome/state.clj
+++ src/org/playasophy/wonderdome/state.clj
@@ -27,7 +27,8 @@
       this
       (assoc this :process
         (async/go-loop []
-          (send state-agent handler (<! input-channel))))))
+          (send state-agent handler (<! input-channel))
+          (recur)))))

   (stop


Fix fruit identification

Fix fruit identification

--- src/robinson/ui/components/robinson.clj
+++ src/robinson/ui/components/robinson.clj
@@ -235,8 +235,8 @@
   [state items]
   (let [identified (get-in state [:world :fruit :identified])
         poisonous  (get-in state [:world :fruit :poisonous])]
-    (map (fn [item] (if (contains? identified (get item :id))
-                      (if (contains? poisonous (get item :id))
+    (map (fn [item] (if (contains? identified (get item :item/id))
+                      (if (contains? poisonous (get item :item/id))
                         (assoc item :name (format "%s (poisonous)" (get item :name))
                                     :name-plural (format "%s (poisonous)" (get item :name-plural)))
                         (assoc item :name (format "%s (safe)" (get item :name))
@@ -261,9 +261,7 @@
     (zc/csx [:img {:width 80 :height 23}
                    (map-indexed (fn [y line]
                              (map-indexed (fn [x cell]
-                               (if-let [cell (ruc/render-cell cell x y t current-time font-type)]
-                                 cell
-                                 (assert false (str "Nil cell" cell x y t))))
+                               (ruc/render-cell cell x y t current-time font-type))
                                line))
                            cells)])))


hotfix realm migration

hotfix realm migration

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

--- src/status_im/data_store/realm/schemas/account/migrations.cljs
+++ src/status_im/data_store/realm/schemas/account/migrations.cljs
@@ -108,7 +108,7 @@
   "reset last request to 1 to fetch 7 past days of history"
   [old-realm new-realm]
   (log/debug "migrating v18 account database")
-  (some-> old-realm
+  (some-> new-realm
           (.objects "transport-inbox-topic")
           (.map (fn [inbox-topic _ _]
                   (aset inbox-topic "last-request" 1)))))


Added a final flourish for the bass.

Added a final flourish for the bass.

--- src/overtunes/songs/variatio-12.clj
+++ src/overtunes/songs/variatio-12.clj
@@ -23,7 +23,7 @@

 (def durations (flatten [(repeat 2 1/4) 1/2 (repeat 6 1/4) (repeat 8 1/4) 3/2 (repeat 10 1/4) 1/2 (repeat 2 1/4) 9/4 3/4 (repeat 12 1/4) 1/2 1 1/2 (repeat 12 1/4) 1]))
 (def pitches (flatten [0 (run -1 3) (run 2 0) 4 (run 1 8) (run 7 -1) 0 (run 0 -3) 4 4 (run 2 -3) -1 1 (run 4 6) 1 1 1 2 -1 -2 0 1 -1 -2 (run 5 0)]))
-(def bass (map #(- % 7) (flatten [(map #(repeat 3 %) (concat (run 0 -3) (run -5 -3) [-7])) 0])))
+(def bass (map #(- % 7) (flatten (map #(repeat 3 %) (concat (run 0 -3) (run -5 -3) [-7])))))

 (defn melody# [timing notes]
   (let [note# #(at (timing %1) (piano (g-major %2)))]
@@ -37,6 +37,7 @@
     (melody# timing bass)
     (melody# (rhythm-from 1/2) leader)
     (melody# (rhythm-from 7/2) follower)
+    (melody# (syncopate (translate timing 23 0) [1 1/4 1/4 1/4 1/4 1]) [-7 -7 -5 -3 -1 0])
     ))

 (play#)


Some info on possible link between an aspect's PointcutDefinition and an advice's Pointcut.

--- EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
+++ EkekoAspectJ/src/damp/ekeko/aspectj/weaverworld.clj
@@ -1029,6 +1029,32 @@
 ;; Pointcuts
 ;; ---------

+;; some info:
+;; KindedPointcut or MatchesNothingPointcut returned by
+;; getPointCut() on a PointCutDefinition retrieved through aspect-pointcutdefinition
+;; differ from Pointcut returned by advice-pointcut
+
+;; (damp.ekeko/ekeko [?pd ?p]
+;;                (fresh [?a] (aspect-pointcutdefinition ?a ?pd))
+;;                  (fresh [?a] (advice-pointcut ?a ?p))
+;;                  (equals ?p (.getPointcut ?pd)))
+;;
+
+;; reason being the persingleton etc that are added
+
+;;following query correctly links a pc to its pcdefinition
+;;(damp.ekeko/ekeko* [?pd ?p ?left]
+;;                     ;<AndPointcut (execution(* cl.pleiad.ajlmp.testPointcuts.BaseClass.*2(..)) && persingleton(cl.pleiad.ajlmp.testPointcuts.SecondAspect))>
+;;                     (fresh [?advice] (advice-pointcut ?advice ?p))
+;;                     ;;rhs of and is always a  persingleton(cl.pleiad.ajlmp.testPointcuts.SecondAspect) etc
+;;                     (equals ?left (.getLeft ?p))
+;;                     ;lhs is <KindedPointcut execution(* cl.pleiad.ajlmp.testPointcuts.BaseClass.*2(..))>
+;;                     (fresh [?aspect]  (aspect-pointcutdefinition ?aspect ?pd))
+;;                     (equals ?left (.getPointcut ?pd)
+;;                     ))
+
+;;but to check: pc's of advice always an andpc?
+

 (defn
   advice-pointcut


add support for sentence-nonphrasal-head verbs

--- src/babel/italiano/lab.cljc
+++ src/babel/italiano/lab.cljc
@@ -292,6 +292,9 @@
                         babel.generate/grammar grammar]
                 (time (generate spec model))))))))

+(def basic-grammar
+  #{"sentence-nonphrasal-head"})
+
 (def chiamarsi-grammar
   #{"s-aux"
     "sentence-phrasal-head"
@@ -375,7 +378,10 @@

 ;; this is a lot like a lexical compilation default map.
 (def rule-matcher
-  {{:root {:italiano {:italiano "chiamarsi"}}}
+  {:top
+   basic-grammar
+
+   {:root {:italiano {:italiano "chiamarsi"}}}
    chiamarsi-grammar

    {:tense :present
@@ -398,7 +404,9 @@
 (defn generate-for-verbcoach
   "generate sentences efficiently given specific constraints."
   []
-  (let [verb-set #{"arrabbiarsi" "chiamarsi" "fermarsi" "parlare" "sedersi"}
+  (let [verb-set #{"arrabbiarsi" "chiamarsi"
+                   "fermarsi"    "parlare"
+                   "sedersi"     "vedere"}
         specs
         (map (fn [root]
                {:root {:italiano {:italiano root}}})
@@ -411,23 +419,24 @@
                                :sem {:tense :future}
                                :subcat []}}]]
     (repeatedly
-     #(println
-       (let [chosen-spec
-             (unify (first (shuffle specs))
-                    (first (shuffle tense-specs)))]
-         (let [generate-with-grammar-set
-               (rule-matcher-reducer chosen-spec)
-               grammar
-               (filter (fn [rule-structure]
-                         (contains? generate-with-grammar-set
-                                    (u/get-in rule-structure [:rule])))
-                       (:grammar model))]
-           (morph (binding [babel.generate/println? false
-                            babel.generate/truncate? true
-                            babel.generate/index-fn (create-index-fn verb-set grammar)
-                            babel.generate/grammar grammar]
-                    (time (generate chosen-spec model))))))))))
-
+     #(do (println "")
+          (println
+           (let [chosen-spec
+                 (unify (first (shuffle specs))
+                        (first (shuffle tense-specs)))]
+             (let [generate-with-grammar-set
+                   (rule-matcher-reducer chosen-spec)
+                   grammar
+                   (filter (fn [rule-structure]
+                             (contains? generate-with-grammar-set
+                                        (u/get-in rule-structure [:rule])))
+                           (:grammar model))]
+               (morph (binding [babel.generate/println? false
+                                babel.generate/truncate? true
+                                babel.generate/index-fn (create-index-fn verb-set grammar)
+                                babel.generate/grammar grammar]
+                        (time (generate chosen-spec model)))))))))))
+
 (defn stampare
   "generate arrabiarsi sentences with a grammar subset."
   []


Select recently uploaded image to draw if it's uploaded in workspace.

--- src/uxbox/main/ui/workspace/images.cljs
+++ src/uxbox/main/ui/workspace/images.cljs
@@ -34,9 +34,15 @@
   (letfn [(on-upload-click [event]
             (let [input (mx/ref-node own "input")]
               (dom/click input)))
-          (on-uploaded [images]
-            (println "on-uploaded" images)
-            (udl/close!))
+          (on-uploaded [[image]]
+            (let [{:keys [id name width height]} image
+                  shape {:type :image
+                         :name name
+                         :metadata {:width width
+                                    :height height}
+                         :image id}]
+              (rs/emit! (udw/select-for-drawing shape))
+              (udl/close!)))
           (on-files-selected [event]
             (let [files (dom/get-event-files event)]
               (rs/emit! (udi/create-images nil files on-uploaded))))


debug info removed

debug info removed

--- src/cerber/stores/token.clj
+++ src/cerber/stores/token.clj
@@ -150,7 +150,6 @@
         {:keys [client-id secret created-at expires-at login]} access-token
         {:keys [type refresh?] :or {type "Bearer"}} opts]

-    (println [client-id "refresh" nil login])
     (if (f/failed? access-token)
       access-token
       (let [refresh-token (and refresh?


disable csrf check to let api routes work

--- src/chat/server/handler.clj
+++ src/chat/server/handler.clj
@@ -67,6 +67,7 @@
         desktop-client-routes)
       (wrap-defaults static-site-defaults)))

+; XXX: Review use of CSRF
 (def api-server-app
   (-> (routes
         (-> extension-routes
@@ -81,6 +82,7 @@
                                )))
         (-> api-public-routes
             (wrap-defaults (-> site-defaults
+                               (assoc-in [:security :anti-forgery] false)
                                assoc-cookie-conf)))
         (-> sync-routes
             (wrap-defaults (-> api-defaults


add issue comment for shoot

add issue comment for shoot

--- src/clj/battlebots/game.clj
+++ src/clj/battlebots/game.clj
@@ -249,6 +249,7 @@
                                 (move-player player-id metadata game-state)

                                 ;; TODO
+                                ;; https://github.com/willowtreeapps/battlebots/issues/45
                                 (= cmd "SHOOT")
                                 game-state


remove println

remove println

--- src/clj/cljs/source_map.clj
+++ src/clj/cljs/source_map.clj
@@ -164,7 +164,6 @@
                   (recur (next col-map-seq)
                     (assoc new-cols col
                       (reduce (fn [v {:keys [gline gcol]}]
-                                (println [gline gcol])
                                 (into v (get-in closure-map [gline gcol])))
                         [] infos))))
                 new-cols))]


click to focus on packet and show full JSON

--- src/cljs/demtools/core.cljs
+++ src/cljs/demtools/core.cljs
@@ -35,8 +35,9 @@
 (defn direct-read [state k] {:value (get @state k nil)})
 (defmethod read nil [{:keys [state] :as env} k] (direct-read state k))
 (defmethod read "file"
-  [{:keys [state ast] :as env} k {:keys [file offset limit]}]
+  [{:keys [state ast] :as env} k {:keys [idx file offset limit]}]
   (case k
+    :file/packet (when idx {:value (get (get @state :packets []) idx)})
     :file/packets
     {:value (->> (get @state :packets []) (drop offset) (take limit) vec)}

@@ -119,7 +120,8 @@
 (defmethod packet-view "netTick" [p]
   (str "Tick: " (p "tick") " frameTime: " (p "frameTime")
        " stdDev: " (p "stdDev")))
-(defmethod packet-view "gameEvent" [p] (p "event"))
+(defmethod packet-view "gameEvent" [p]
+  (-> (p "event") clj->js js/JSON.stringify))
 ;; (defmethod packet-view "serverInfo" [p]
 ;;   (str "frameTime: " (p "frameTime") " stdDev: " (p "stdDev")))
 (defmethod packet-view "consoleCmd" [p] (p "command"))
@@ -145,23 +147,26 @@

 (defui RootComponent
   static om/IQueryParams
-  (params [_] {:file nil :offset 0 :limit 50})
+  (params [_] {:file nil :idx nil :offset 0 :limit 50})
   static om/IQuery
   (query [this]
          '[:title
+           (:file/packet {:idx ?idx})
            (:file/packets {:offset ?offset :limit ?limit})
            :file/packets-count
            :file/results
            (:file/file {:file/file ?file})])
   Object
   (render [this]
-    (let [{:keys [results title file/packets file/packets-count]}
+    (let [{:keys [results title file/packet file/packets file/packets-count]}
           (om/props this)
           {:keys [offset file]} (om/get-params this)]
       (dom/div nil
         (dom/h1 nil title)
         (dom/p nil results)
         (file-upload this)
+        (when packet
+          (dom/div nil (js/JSON.stringify (clj->js packet))))
         (when packets
           (dom/p nil
                  (str "Loaded " packets-count " packets. Displaying: "
@@ -175,9 +180,12 @@
                     :onScrollEnd
                     (fn [x y]
                       (let [new-offset (max 0 (- (int (/ y 32)) 10))]
-                        (println y new-offset)
                         (om/update-query!
                          this #(assoc-in % [:params :offset] new-offset))))
+                    :onRowClick
+                    (fn [_ new-idx]
+                      (om/update-query!
+                       this #(assoc-in % [:params :idx] new-idx)))
                     :width 800
                     :height 800}
                (jsx Column


Remove useless abstractions

Remove useless abstractions

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -180,31 +180,21 @@

 (defn move-strength
   "Compute the strength of a move, based on the converted cells"
-  [move-filter [move converted]]
+  [converted-filter [move converted]]
   (transduce
     (comp
-      (filter move-filter)
-      (map (comp count :taken)))
+      (filter converted-filter)
+      (map (comp count :taken))) ;; Enhance this heuristic to consider map connections
     + converted))

-(defn- best-immediate-move-with
-  "Return the move with the highest immediate score increase:
-   * For the provided player
-   * And with move scope limitation"
-  [moves move-filter]
-  (fast-max-key
-    (partial move-strength move-filter)
-    moves))
-
 (defn worst-immediate-loss
-  "Return the next game move:
-   * Executed by the 'player'
-   * That would reduce the score for 'looser'"
+  "Return the next worse lost game move for 'looser' if 'player' plays"
   [game player looser]
-  (let [move-filter #(= looser (:looser %))
-        all-moves (get-in game [:moves player])
-        move (best-immediate-move-with all-moves move-filter)]
-    (move-strength move-filter move)))
+  (let [converted-filter #(= looser (:looser %))
+        all-moves (get-in game [:moves player])]
+    (transduce
+      (map #(move-strength converted-filter %))
+      max all-moves)))

 (defn best-move
   "[SIMPLISTIC] Return the best move for a player based on:


Minor optimizations

Minor optimizations

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -68,7 +68,7 @@
     (range-single-coord xi dx board-width)
     (range-single-coord yi dy board-height)))

-(defn is-cell-owned?
+(defn ^boolean is-cell-owned?
   "Indicates whether a cell is owned by any player"
   [cell]
   (and (not= cell :empty) (not= cell :wall)))
@@ -79,7 +79,7 @@
   (eduction
     (comp
       (map (juxt #(get-in board %) identity))
-      (take-while (comp is-cell-owned? first))
+      (take-while #(-> % first is-cell-owned?))
       (partition-by first)
       (map (juxt #(-> % first first) #(mapv second %))))
     (range-coord pos dir)))


extract the ai from the game concept: make it a bit slower

--- src/cljs/triboard/core.cljs
+++ src/cljs/triboard/core.cljs
@@ -27,25 +27,11 @@

 ;; -----------------------------------------
-;; ARTIFICIAL INTELLIGENCE
-;; -----------------------------------------
-
-(defn with-ai-data
-  "Add the AI data needed to play the game"
-  [{:keys [board] :as init-game}]
-  (merge init-game
-    {:ai-players
-     {:red (partial ai/best-move (ai/compute-cells-strength board))
-      :green (partial ai/best-move (ai/compute-cells-strength board))}}
-    ))
-
-
-;; -----------------------------------------
 ;; GAME STATE
 ;; -----------------------------------------

 (defn new-game []
-  (list (with-ai-data (turn/new-init-turn))))
+  (list (turn/new-init-turn)))

 (defn get-turn
   [game-turns]
@@ -56,7 +42,7 @@
   (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
+(defn cancel-last-move
   [old-turns is-ai?]
   (let [new-turns (drop-while #(is-ai? (:player %)) (drop 1 old-turns))]
     (if (empty? new-turns)
@@ -76,23 +62,21 @@
 (def board (reaction (turn/get-board @game)))
 (def scores (reaction (turn/get-scores @game)))
 (def current-player (reaction (turn/current-player @game)))
-(def ai-players (reaction (get-in @game [:ai-players])))
-
-(defn is-ai? [player] (contains? @ai-players player))

 ;; -----------------------------------------
 ;; GAME LOOP
 ;; -----------------------------------------

+(def is-ai? #{:red :green})
 (def ai-move-delay 1000)

 (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)]
+  ;; TODO - Find a way to cache the cells-strenght as it was done before
+  (let [move (ai/best-move (ai/compute-cells-strength @board) @game @current-player)]
     (play-game-turn! move)))

 (defn- handle-game-event!
@@ -100,7 +84,7 @@
   (case msg
     :new-game (swap! app-state assoc-in [:games] (new-game))
     :restart (swap! app-state update-in [:games] #(take-last 1 %))
-    :undo (swap! app-state update-in [:games] cancel-last-move #{:red :green})))
+    :undo (swap! app-state update-in [:games] cancel-last-move is-ai?)))

 (defn start-game-loop
   "Manage transitions between player moves, ai moves, and generic game events"


minor l&f changes

minor l&f changes

--- src/cljs/worktv/layout.cljs
+++ src/cljs/worktv/layout.cljs
@@ -213,8 +213,8 @@
   (let [drag-start (fn [type] #(-> % .-dataTransfer (.setData "text/plain" type)))]
     (fn []
       [:div.row-fluid.fill
-       [:div.col-md-2.fill
-        [:h2 "Dashboard Designer"]
+       [:div.col-md-1.fill
+        [:h2 "Dash..."]
         [:div.panel.panel-default
          [:div.panel-heading "Widgets"]
          [:div#content-nav.list-group
@@ -222,22 +222,8 @@
            (for [{:keys [type label]} content-types]
              ^{:key type}
              [:button.list-group-item
-              {:draggable true :on-drag-start (drag-start (name type))} label]))]]
-
-        (if-let [pane (selected-pane)]
-          [:div.panel.panel-default
-           [:div.panel-heading "Selected"]
-           [:div.panel-body
-            [:select.form-control
-             {:value (-> pane :content-type (or ""))
-              :on-change #(update-pane (assoc pane :content-type (-> % .-target .-value keyword)))}
-             [:option ""]
-             (doall
-              (for [{:keys [type label]} content-types]
-                ^{:key type}[:option {:value type} label])) ]
-            [:button.btn {:on-click #(show-editor pane)}
-             "..."]]])]
-       [:div.col-md-10.fill
+              {:draggable true :on-drag-start (drag-start (name type))} [:i.fa {:class label}] label]))]]]
+       [:div.col-md-11.fill
         [:div.row
          [:div.col-md12.fill {:style {:padding "10px"}}
           [:div.form-inline


fix repl-only? inclusion

fix repl-only? inclusion

--- src/cljs_api_gen/result.clj
+++ src/cljs_api_gen/result.clj
@@ -110,6 +110,7 @@
   (-> x
       (select-keys [:ns
                     :pseudo-ns?
+                    :repl-only?
                     :name
                     :docstring
                     :author


The last commit; this idea does not work

--- src/clojure_fabric/core.clj
+++ src/clojure_fabric/core.clj
@@ -13,6 +13,8 @@
             [clojure-fabric.chaincode-id :as chaincode-id]
             [clojure-fabric.transaction-request :as transaction-request]
             [clojure-fabric.query-by-chaincode-request :as query-by-chaincode-request]
+            [clojure-fabric.proposal-response :as proposal-response]
+            ;; [clojure-fabric.chaincode-response :as chaincode-response]
             ;; [clojure-fabric.base-exception :as base-exception]
             ;; [clojure-fabric.instantiate-proposal-request :as instantiate-proposal-request]
             ;; [clojure-fabric.blockchain-info :as blockchain-info]
@@ -45,12 +47,10 @@
             ;; [clojure-fabric.chaincode-input-deserializer :as chaincode-input-deserializer]
             ;; [clojure-fabric.proposal-exception :as proposal-exception]
             ;; [clojure-fabric.chaincode-invocation-spec-deserializer :as chaincode-invocation-spec-deserializer]
-            ;; [clojure-fabric.proposal-response :as proposal-response]
             ;; [clojure-fabric.chaincode-language :as chaincode-language]
             ;; [clojure-fabric.proposal-response-payload-deserializer :as proposal-response-payload-deserializer]
             ;; [clojure-fabric.chaincode-proposal-payload-deserializer :as chaincode-proposal-payload-deserializer]
             ;; [clojure-fabric.proto-utils :as proto-utils]
-            ;; [clojure-fabric.chaincode-response :as chaincode-response]
             ;; [clojure-fabric.query-exception :as query-exception]
             ;; [clojure-fabric.channel-configuration :as channel-configuration]
             ;; [clojure-fabric.query-installed-chaincodes-builder :as query-installed-chaincodes-builder]
@@ -257,25 +257,38 @@
 (defrecord TransactionOpts [fcn args ;; chaincode-language chaincode-endorsement-policy
                             proposal-wait-time])

-(defn propose-transaction
-  ([client channel-id chaincode-opts transaction-opts]
-   (propose-transaction client channel-id chaincode-opts transaction-opts nil))
-  ([client channel-id chaincode-opts {:keys [fcn args proposal-wait-time]} peers]
-   (let [channel (get-or-make-channel client channel-id)
-         req (hf-client/new-transaction-proposal-request client)]
-     (when-not (channel/is-initialized channel)
-       (channel/initialize channel))
-     (transaction-request/set-chaincode-id req (get-or-make-chaincode chaincode-opts))
-     ;; Transaction options
-     ;; FIXME: what about chaincode-language, chaincode-endorsement-policy ?
-     (when fcn
-       (transaction-request/set-fcn req fcn))
-     (when args
-       (transaction-request/set-args req args))
-     (when proposal-wait-time
-       (transaction-request/set-proposal-wait-time req proposal-wait-time))
-     ;; Send Tx proposal to peers
-     (apply channel/send-transaction-proposal channel req peers))))
+#_
+(defn make-proposal-tx-request
+  [client channel-id chaincode-opts {:keys [fcn args proposal-wait-time]}]
+  (let [channel (get-or-make-channel client channel-id)
+        req (hf-client/new-transaction-proposal-request client)]
+    (when-not (channel/is-initialized channel)
+      (channel/initialize channel))
+    (transaction-request/set-chaincode-id req (get-or-make-chaincode chaincode-opts))
+    ;; Transaction options
+    ;; FIXME: what about chaincode-language, chaincode-endorsement-policy ?
+    (when fcn
+      (transaction-request/set-fcn req fcn))
+    (when args
+      (transaction-request/set-args req args))
+    (when proposal-wait-time
+      (transaction-request/set-proposal-wait-time req proposal-wait-time))
+    req))
+
+(defn prepare-chaincode-proposal-tx-req
+  [channel proposal-tx-req chaincode-opts {:keys [fcn args proposal-wait-time]}]
+  (when-not (channel/is-initialized channel)
+    (channel/initialize channel))
+  (transaction-request/set-chaincode-id proposal-tx-req (get-or-make-chaincode chaincode-opts))
+  ;; Transaction options
+  ;; FIXME: what about chaincode-language, chaincode-endorsement-policy ?
+  (when fcn
+    (transaction-request/set-fcn proposal-tx-req fcn))
+  (when args
+    (transaction-request/set-args proposal-tx-req args))
+  (when proposal-wait-time
+    (transaction-request/set-proposal-wait-time proposal-tx-req proposal-wait-time))
+  proposal-tx-req)

 (defn order-transaction
   ([client channel-id proposal-responses]
@@ -313,10 +326,22 @@
   ;; FIXME: init for query-by-chaincode
   (channel/initialize (get-or-make-channel cli "mychannel"))

-  (let [proposal-req (hf-client/new-query-proposal-request)]
-    (transaction-request/set-args req (java.util.ArrayList. ["CAR10" "Chevy" "Volt" "Red" "Nick"]))
-    (query-by-chaincode-request/set))
+  (let [proposal-req (hf-client/new-query-proposal-request cli)
+        channel (get-or-make-channel cli "mychannel")]
+    (->> (map->TransactionOpts {:fcn "queryAllCars"
+                                :args nil
+                                :proposal-wait-time 10000})
+         ;; 3-1. Proposal
+         (prepare-chaincode-proposal-tx-req channel
+                                            proposal-req
+                                            (make-ChaincodeOpts {:name "fabcar" :version "1.0" :path "github.com/fabcar"}))
+         ;; Send Tx proposal to peers
+         (channel/query-by-chaincode channel)
+         ;; 3-2 Order
+         (order-transaction cli "mychannel")))
+
   (channel/query-by-chaincode (get-or-make-channel cli "mychannel")
+                              (prepare-chaincode-proposal-tx-req cli "mychannel" )
                               (query-by-chaincode-request/new-instance (hf-client/get-user-context cli)))

@@ -326,9 +351,12 @@
                                               :args (java.util.ArrayList. ["CAR10" "Chevy" "Volt" "Red" "Nick"])
                                               :proposal-wait-time 10000})
                        ;; 3-1. Proposal
-                       (propose-transaction cli
-                                            "mychannel"
-                                            (make-ChaincodeOpts {:name "fabcar" :version "1.0" :path "github.com/fabcar"}))
+                       (prepare-chaincode-proposal-tx-req cli
+                                                "mychannel"
+                                                (make-ChaincodeOpts {:name "fabcar" :version "1.0" :path "github.com/fabcar"}))
+
+                       ;; Send Tx proposal to peers
+                       (apply channel/send-transaction-proposal channel req)
                        ;; 3-2 Order
                        (order-transaction cli "mychannel"))]
     ;; 4. Get Tx result


CMR-512: Added support for getting concept-type from a concept map.

--- src/cmr/common/concepts.clj
+++ src/cmr/common/concepts.clj
@@ -64,3 +64,8 @@
   "Returns concept type for the given concept-id"
   [concept-id]
   (concept-prefix->concept-type (subs concept-id 0 1)))
+
+(defn concept->type
+  "Returns concept type for the given concept"
+  [concept]
+  (concept-id->type (:concept-id concept)))


Add delete confirmation to colors collections.

--- src/uxbox/main/ui/dashboard/colors.cljs
+++ src/uxbox/main/ui/dashboard/colors.cljs
@@ -63,8 +63,10 @@
                   (dom/prevent-default e)
                   (dom/stop-propagation e)
                   (save))))
-            (delete-collection []
-              (rs/emit! (dc/delete-collection (:id coll))))]
+            (delete []
+              (rs/emit! (dc/delete-collection id)))
+            (on-delete []
+              (udl/open! :confirm {:on-accept delete}))]
       [:div.dashboard-title
        [:h2
         (if edit?
@@ -86,7 +88,7 @@
           (if edit?
             [:span {:on-click save} i/save]
             [:span {:on-click edit} i/pencil])
-          [:span {:on-click delete-collection} i/trash]])])))
+          [:span {:on-click on-delete} i/trash]])])))

 ;; --- Nav


CM #66 - fix unit tests

CM #66 - fix unit tests

--- test/objective8/unit/utils_test.clj
+++ test/objective8/unit/utils_test.clj
@@ -13,8 +13,8 @@
       (date-time->date-time-plus-30-days (time-core/date-time 2015 10 01 4 3 27 456)) =>
       (time-core/date-time 2015 10 31 4 3 27 456))

-(fact "should return number of days until given time"
-      (days-until (time-core/plus (time-core/now) (time-core/days 2))) => 2)
+(future-fact "should return number of days until given time"
+      (days-until (time-core/plus (time-core/now) (time-core/days 2))) => 1)

 (fact "generate-random-uuid returns a long random string"
       (let [uuid1 (generate-random-uuid)