Enter 0.1.0-alpha2-SNAPSHOT

Enter 0.1.0-alpha2-SNAPSHOT

--- build.boot
+++ build.boot
@@ -18,7 +18,7 @@

 (task-options!
   pom {:project "om-mantras"
-       :version "0.1.0-alpha1"})
+       :version "0.1.0-alpha2-SNAPSHOT"})

 (require '[adzerk.boot-cljs :refer [cljs]]
          '[adzerk.boot-reload :refer [reload]]


Update paren-soup

Update paren-soup

--- build.boot
+++ build.boot
@@ -5,7 +5,7 @@
                   [adzerk/boot-cljs "1.7.228-2" :scope "test"]
                   ; cljs deps
                   [org.clojure/clojurescript "1.9.473" :scope "test"]
-                  [paren-soup "2.8.4" :scope "test"]
+                  [paren-soup "2.8.5" :scope "test"]
                   [cljsjs/codemirror "5.19.0-0" :scope "test"]
                   ; clj deps
                   [org.clojure/clojure "1.9.0-alpha14"]


Task src renamed to the clearer add-cljs-source

--- build.boot
+++ build.boot
@@ -156,7 +156,7 @@
         (add-resource (java.io.File. ".") :include #{#"^version\.properties$"})
         commit!)))

-(declare add-cache src)
+(declare add-cache add-cljs-source)

 ;;;;;;;;;;;;;;;;;;
 ;;  MAIN TASKS  ;;
@@ -175,7 +175,7 @@
             (sift :include #{#"main.out"}
                   :invert true)
             identity)
-          (src)
+          (add-cljs-source)
           (add-cache :dir "js-cache"))))

 (deftask dev
@@ -190,7 +190,7 @@
           (cljs-repl)
           (reload :on-jsload 'cljs-repl-web.core/main)
           (apply cljs (reduce #(into %2 %1) [] (:cljs options)))
-          (src)
+          (add-cljs-source)
           (add-cache :dir "js-cache")
           (serve))))

@@ -246,7 +246,7 @@
 ;;  OTHER TASKS  ;;
 ;;;;;;;;;;;;;;;;;;;

-(deftask src
+(deftask add-cljs-source
   []
   (comp (with-pre-wrap [fs]
           (boot.util/info "Pack source files...\n")


cleaned up angular app routes a bit

cleaned up angular app routes a bit

--- server/src/gratefulplace/middleware/routes.clj
+++ server/src/gratefulplace/middleware/routes.clj
@@ -29,16 +29,16 @@
 (defroutes routes
   (authroute GET "/scripts/load-session.js" js/load-session)

-  ;; TODO clean this up
-
+  ;; Server up angular app
   (apply compojure.core/routes
-         (map #(compojure.route/files "/" {:root %})
+         (map #(compojure.core/routes
+                (compojure.route/files "/" {:root %})
+                (compojure.route/resources "/" {:root %}))
               (config :html-paths)))
   (apply compojure.core/routes
-         (map #(compojure.route/resources "/" {:root %})
-              (config :html-paths)))
-  (GET "/" [] (resp/file-response "index.html" {:root "html-app"}))
-  (GET "/" [] (resp/resource-response "index.html" {:root "html-app"}))
+         (map (fn [response-fn]
+                (GET "/" [] (response-fn "index.html" {:root "html-app"})))
+              [resp/file-response resp/resource-response]))

   ;; Topics
   (route GET "/topics" topics/query)


Zeroing the constants in closure bodies.

--- jlad/jlad.clj
+++ jlad/jlad.clj
@@ -148,12 +148,23 @@
   (zero [self] self)
   closure
   ;; TODO zero out the constants too
-  (zero [self] (new closure (:formal self) (:body self)
+  (zero [self] (new closure (:formal self) (zero (:body self))
 		    (map-env zero (:env self))))
   pair
   (zero [self] (new pair (zero (:car self)) (zero (:cdr self))))
   Number
-  (zero [self] 0))
+  (zero [self] 0)
+
+  variable
+  (zero [self] self)
+  constant
+  (zero [self] (new constant (zero (:object self))))
+  lambda-exp
+  (zero [self] (new lambda-exp (:formal self) (zero (:body self))))
+  application
+  (zero [self] (new application (zero (:operator self)) (zero (:operand self))))
+  empty-list
+  (zero [self] self))

 ;;;; Syntax


Add tests for missing output and resolver error

--- test/com/wsscode/pathom/connect/run_graph_readers_test.cljc
+++ test/com/wsscode/pathom/connect/run_graph_readers_test.cljc
@@ -11,26 +11,34 @@
     (parser {} query)))

 (deftest test-runner3
-  (testing "simple resolver"
+  (testing "single attribute"
     (is (= (run-parser
-             {::resolvers [(pc/resolver 'a
-                             {::pc/output [:a]}
-                             (fn [_ _] {:a 42}))]
+             {::resolvers [(pc/constantly-resolver :a 42)]
               ::query     [:a]})
            {:a 42}))

+    (testing "missed output"
+      (is (= (run-parser
+               {::resolvers [(pc/resolver 'a
+                               {::pc/output [:a]}
+                               (fn [_ _] {}))]
+                ::query     [:a]})
+             {:a ::p/not-found})))
+
+    (testing "resolver error"
+      (is (= (run-parser
+               {::resolvers [(pc/resolver 'a
+                               {::pc/output [:a]}
+                               (fn [_ _] (throw (ex-info "Error" {:error "detail"}))))]
+                ::query     [:a]})
+             {:a                              :com.wsscode.pathom.core/reader-error
+              :com.wsscode.pathom.core/errors {[:a] "class clojure.lang.ExceptionInfo: Error - {:error \"detail\"}"}}))))
+
+  (testing "multiple attributes"
     (is (= (run-parser
              {::resolvers [(pc/resolver 'a
                              {::pc/output [:a :b]}
                              (fn [_ _] {:a 42 :b "foo"}))]
               ::query     [:a :b]})
            {:a 42
-            :b "foo"})))
-
-  (testing "missed output"
-    (is (= (run-parser
-             {::resolvers [(pc/resolver 'a
-                             {::pc/output [:a]}
-                             (fn [_ _] {}))]
-              ::query     [:a]})
-           {:a ::p/not-found}))))
+            :b "foo"}))))


Doing some minor tidying up.

Doing some minor tidying up.

--- wysitutwyg/src-clj/wysitutwyg/markov/builder.clj
+++ wysitutwyg/src-clj/wysitutwyg/markov/builder.clj
@@ -10,6 +10,11 @@
   [seed & code]
   `(binding [*rnd* (java.util.Random. ~seed)]
     ~@code))
+
+(defn word-count
+  "Returns the word count of a string."
+  [s]
+  (count (clojure.string/split s #"\s")))

 (defn- pick-word
   "Takes a map of counts in the form of {'sad' 2, 'mad' 3} (values from the
@@ -39,49 +44,20 @@
   [state {:keys [counts end] :as datamap}]
   (first (filter end (pick-words (counts state)))))

-(defn- words-to-states
-  "Takes a state and a collection of words, and maps it to the next set of
-  states."
-  [state words]
-  (map #(conj (vec (rest state)) %) words))
-
-(defn- gen-next-continuations
-  [{:keys [counts end] :as datamap} {:keys [depth queue state]}]
-  (->> (counts state)
-       (pick-words)
-       (words-to-states state)
-       (remove #(end (last %)))
-       (map #(hash-map :depth (inc depth)
-                       :queue (conj queue state)
-                       :state %1))))
-
-;; cont consists of: {:depth depth, :queue string, :state state}
-;;   Works for 2-3 tuples with caveats - many fewer viable paths, so drops to
-;; dive a lot more! Also - it has n too many words, where n is one less than
-;; the size of the tuple.
-(defn- dfs-cont
-  [{:keys [counts end] :as datamap} n continuations]
-  (if-let [{:keys [depth queue state] :as cont} (first continuations)]
-    (if (>= (+ depth (count state)) n)
-        (if-let [end-state (find-first-end state datamap)]
-          (conj queue state (vector end-state))
-          (recur datamap n (rest continuations)))
-        (if-let [new-conts (seq (gen-next-continuations datamap cont))]
-          (recur datamap n (apply conj (rest continuations) new-conts))
-          (recur datamap n (rest continuations))))))
-
-(defn gen-next-info
-  [{:keys [counts end] :as datamap} {:keys [depth node edges]}]
+(defn gen-next-frame
+  "Builds the next frame, applying the func parameter to the depth to produce
+  the next depth."
+  [inc-depth?
+   {:keys [counts end] :as datamap}
+   {:keys [depth node edges] :as frame}]
   (let [next-node (conj (vec (rest node)) (first edges))]
-    {:depth (inc depth)
+    {:depth (if inc-depth? (inc depth) depth)
      :node next-node
      :edges (pick-words (counts next-node))}))

-;; More true implementation of dfs
-(defn dfs-true
+(defn- dfs
+  "Runs a dfs to produce a sequence of tokens of n depth ending on a end node."
   [{:keys [counts end] :as datamap} n stack]
-  (Thread/sleep 500)
-  (prn (str "dfs-true first=" (first stack)))
   (if-let [{:keys [depth node edges] :as node-info} (first stack)]
     (cond
       (and (= (+ depth (dec (count node))) n) ; TODO: lol
@@ -90,34 +66,13 @@
       (or (end (last node)) (= depth n) (empty? edges))
         (recur datamap n (rest stack))
       :else
-        (let [next-info (gen-next-info datamap node-info)
-              new-node-info (update-in node-info [:edges] rest)]
-          (recur datamap n (conj (cons new-node-info (rest stack)) next-info))))))
-
-(defn- dfs-true-begin
-  [{:keys [start counts] :as datamap} n]
-  {:pre [(pos? n)]}
-  (->> (pick-words start)
-       (map #(dfs-true datamap n [{:depth 0 :node % :edges (pick-words (counts %))}]))
-       (remove nil?)
-       (first)))
-
-(defn- dfs-begin
-  [{:keys [start counts] :as datamap} n]
-  {:pre [(pos? n)]}
-  (->> (pick-words start)
-       (map #(dfs-cont datamap n [{:queue [] :state % :depth 0}]))
-       (remove nil?)
-       (first)))
-
-(defn gen-next-dive
-  [{:keys [counts end] :as datamap} {:keys [depth node edges]}]
-  (let [next-node (conj (vec (rest node)) (first edges))]
-    {:depth (if (end (first edges)) depth (inc depth))
-     :node next-node
-     :edges (pick-words (counts next-node))}))
+        (let [next-info (gen-next-frame true datamap node-info)
+              new-node-info (update-in node-info [:edges] rest)
+              next-stack (conj (cons new-node-info (rest stack)) next-info)]
+          (recur datamap n next-stack)))))

 (defn- dive
+  "Runs a dfs, with no punctuation constraints."
   [{:keys [counts end] :as datamap} n stack]
   (if-let [{:keys [depth node edges] :as node-info} (first stack)]
     (cond
@@ -126,23 +81,29 @@
       (empty? edges)
         (recur datamap n (rest stack))
       :else
-        (let [next-info (gen-next-dive datamap node-info)
-              new-node-info (update-in node-info [:edges] rest)]
-          (recur datamap n (conj (cons new-node-info (rest stack)) next-info))))))
+        (let [next-info (gen-next-frame (not (end (first edges)))
+                                        datamap
+                                        node-info)
+              new-node-info (update-in node-info [:edges] rest)
+              next-stack (conj (cons new-node-info (rest stack)) next-info)]
+          (recur datamap n next-stack)))))

-(defn- dfs-single
-  [{:keys [start counts] :as datamap} n]
+(defn- run-func
+  [f {:keys [start counts] :as datamap} n]
   {:pre [(pos? n)]}
-  (prn (str "Could not gen for: " n " entering single mode"))
   (->> (pick-words start)
-       (map #(dive datamap n [{:depth 0 :node % :edges (pick-words (counts %))}]))
+       (map #(f datamap n [{:depth 0
+                            :node %
+                            :edges (pick-words (counts %))}]))
        (remove nil?)
        (first)))

 (defn gen-sentence
   [{:keys [end] :as datamap} n]
   {:pre [(pos? n)]}
-  (let [coll (if-let [s (dfs-begin datamap n)] s (dfs-single datamap n))]
+  (let [coll (if-let [s (run-func dfs datamap n)]
+                     s
+                     (run-func dive datamap n))]
     (->> coll
          (rest)
          (map last)
@@ -151,60 +112,10 @@
                       (str %1 %2)
                       (str %1 \space %2))))))

-(defn gen-sentence-true-dfs
-  [{:keys [end] :as datamap} n]
-  {:pre [(pos? n)]}
-  (let [coll (if-let [s (dfs-true-begin datamap n)] s (dfs-single datamap n))]
-    (->> coll
-         (rest)
-         (map last)
-         (concat (first coll))
-         (reduce #(if (end %2)
-                      (str %1 %2)
-                      (str %1 \space %2))))))
-
-(def map-loc "resources/public/corpora/loremipsum/2.json")
-(use 'wysitutwyg.markov.textgen)
-(def dmap (read-into-datamap map-loc))
-
-;; TODO: Okay, it doesn't generate the currect length if you have 2-tuples.
-;; I thought I fixed that, but I didn't.
-;; This is why tests are good.
-
-(defn sentence-length
-  [s]
-  (count (clojure.string/split s #"\s")))
-
-;;; See: 85 - New - IS MULTIPLE SENTENCES!
-(defn test-both [n]
-  (let [old (binding [*rnd* (java.util.Random. 1)]
-              (gen-sentence dmap n))
-        new (binding [*rnd* (java.util.Random. 1)]
-              (gen-sentence-true-dfs dmap n))]
-    (do
-      (if-not (= n (sentence-length old))
-              (prn (str "OLD! N: " n " LEN: " (sentence-length old)
-                        " SEN: " old)))
-      (if-not (= n (sentence-length new))
-              (prn (str "NEW! N: " n " LEN: " (sentence-length new)
-                        " SEN: " new))))))
-
-#_(doall (map test-both (range 1 100)))
-;   Whoa okay, wow, some of this is super duper broken. Uh, is my end case
-; HORRIBLY WRONG?
-
-; -----=====##### CONCERNING NEW ALGORITHM GENNING SHORT #####=====-----
-; Hmm, they all appear to be 1 off?
-; No, they're not. See: #89, #87.
-#_(doall (map test-both (range 30 50)))
-#_(doall (map test-both (range 85 90)))
-
-; -----=====##### CONCERNING #89 AND #50 #####=====-----
-;   Okay, so, for #89 and #50 old, they both end on "resultant pleasure?" -
-; which is the last set of tokens in the corpus! So it has nowhere to go from
-; there, since it's using 2-tuples, and so it goes woefully under-sized. That's
-; because my dive doesn't do any backtracking. uuuuuuuuh why doesn't it do any
-; backtracking? Past-me, I AM VERY CROSS.
+#_(def map-loc "resources/public/corpora/loremipsum/2.json")
+#_(use 'wysitutwyg.markov.textgen)
+#_(def dmap (read-into-datamap map-loc))
+#_(prn (str "30: " (gen-sentence dmap 30)))

 ; -----=====##### CONCERNING FALLBACK TEXT GENERATION BEHAVIOR #####=====-----
 ;   OKAY I get why some generated texts are slightly shorter than n! That's
@@ -229,18 +140,6 @@
 ; text will be less than fifty words.
 ;   I will do the former.

-(defn time-both [n]
-  (prn (str "For " n " old, then new:"))
-  (do
-    (binding [*rnd* (java.util.Random. 1)]
-      (time (gen-sentence dmap n)))
-    (binding [*rnd* (java.util.Random. 1)]
-      (time (gen-sentence-true-dfs dmap n)))))
-
-#_(doall (map time-both (range 80 100)))
-#_(doall (map time-both (range 150 155)))
-; What's happening at 153? It takes an inordinate amount of time to resolve.
-
 ;;; -----=====##### CONCERNING 153 #####=====-----
 ;   Watching what's happening using the true-dfs code is quite interesting. One
 ; thing that could be improved is predicting end branches. That is, if a node
@@ -256,4 +155,21 @@
 ; compute a sentence ending in a specific node. We can return *temporary*
 ; results, but not *partial* results (temporary by, for example, switching to
 ; the "doesn't care about end nodes" algorithm while also leaving the main
-; computation running in the background).+; computation running in the background).
+;   Okay, so it's the day after aaaand...I think I'm somehow allowing it to
+; loop infinitely. The nature of the depth comparison should make that not
+; possible, in the traditional looping sense (as in, going around in circles
+; attempting to satisfy the end criteria - because it will be assured to end
+; when depth is overrun) but this is taking Basically Forever.
+;   Well, the algorithm is exponential, and we want to go for 153 deep,
+; so...uh, yeah, that's Basically Forever if no such sentence exists and it has
+; to try and enumerate every node. Horrifyingly slow. As far as I can remember
+; there isn't really any way to remedy this - the efficiency is exponential by
+; size to branching factor. So, actually, you wouldn't need a loop to take
+; forever - to depth 153 at 3 branching, that's 3^153=Infinity Nodes To Search.
+; I mean, not technically infinity, but yeah, that's not happening.
+;   Hmm. That's troublesome, though.
+;   What would be a good way to estimate how long it *should* take? Because
+; right now I'm thinking maybe it would be best to estimate how long it should
+; take, and then if it takes longer than that by some margin, go and hit the
+; fallback algorithm.


remove excess space

remove excess space

--- test/metabase/api/card_test.clj
+++ test/metabase/api/card_test.clj
@@ -49,8 +49,6 @@
                                :public_perms 0
                                :created_at $})
     (post-card card-name)))
-
-

 ;; ## GET /api/card/:id
 ;; Test that we can fetch a card


Added url-encode and url-params function based on code from arohner

--- lib/compojure/html/page_functions.clj
+++ lib/compojure/html/page_functions.clj
@@ -3,8 +3,10 @@
 ;; Functions for generating document and header boilerplate.

 (ns compojure.html
-  (:use (compojure control
-                   str-utils)))
+  (:use    (compojure control
+                      str-utils)
+           (clojure.contrib str-utils))
+  (:import (java.net URLEncoder)))

 (def doctype
   {:html4
@@ -49,9 +51,27 @@
     (str "//<![CDATA[\n" script "\n//]]>")])

 (defn link-to
-  "Link some page content to another URL."
+  "Wraps some content in a HTML hyperlink with the supplied URL."
   [url & content]
   [:a {:href url} content])
+
+(defn url-encode
+  "Encodes a single string or sequence of key/value pairs."
+  [string-or-map]
+  (let [enc #(.encode URLEncoder (str* %))]
+    (if (string? string-or-map)
+      (enc string-or-map)
+      (str-join "&"
+        (map (fn [[key val]] (str (enc key) "="(enc val)))
+             string-or-map)))))
+
+(defn url-params
+  "Encodes a map of parameters and adds them onto the end of an existing
+  address.
+  e.g. (url-params \"http://example.com\" {:lang \"en\", :offset 10})
+       => \"http://example.com?lang=en&offset=10\""
+  [address param-map]
+  (str address "?" (url-encode param-map)))

 (defn unordered-list
   "Wrap a collection in an unordered list"


Fixed the binding variable in produce-generic-singles-triples

--- kabob-build/src/main/clojure/edu/ucdenver/ccp/kabob/build/id_sets/id_set_triples.clj
+++ kabob-build/src/main/clojure/edu/ucdenver/ccp/kabob/build/id_sets/id_set_triples.clj
@@ -235,7 +235,7 @@
                      (dorun
                       (map (partial add! output-kb)
                            (doall
-                            (let [id (get bindings '?/ice nil)]
+                            (let [id (get bindings '?/id nil)]
                               (generic-id-set-triples (list id)))))))
                    singles-query ;need to add reify find clauses on optionally
                    ))))


Fix f.c.add-projects/main signature

Fix f.c.add-projects/main signature

--- src-cljs/frontend/components/add_projects.cljs
+++ src-cljs/frontend/components/add_projects.cljs
@@ -268,7 +268,7 @@
                  :on-change #(utils/toggle-input owner [:settings :add-projects :show-forks] %)}]
         "Show forks"]]])))

-(defrender main [{:keys [user repos selected-org settings]} data owner]
+(defrender main [{:keys [user repos selected-org settings] :as data} owner]
   (let [selected-org-login (:login selected-org)
         loading-repos? (get-in user [:repos-loading (keyword (:vcs-type selected-org))])
         repo-filter-string (get-in settings [:add-projects :repo-filter-string])


Pulling linux containers part into it's own om component.

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -326,6 +326,119 @@
             [:a.unselected {:href "mailto:sayhi@circleci.com"}
              [:img {:src (utils/cdn-path "img/inner/mobile-focused-2x.png")}]]]])))))

+(defn linux-plan [{:keys [app checkout-loaded?]} owner]
+  (reify
+    om/IRender
+    (render [_]
+      (let [
+            org-name (get-in app state/org-name-path)
+            plan (get-in app state/org-plan-path)
+            selected-containers (or (get-in app state/selected-containers-path)
+                                    (max (pm/usable-containers plan)
+                                         (pm/trial-containers plan)))
+            min-slider-val (max 1 (+ (pm/freemium-containers plan) (pm/paid-plan-min-containers plan)))
+            max-slider-val (max 80 (* 2 (pm/usable-containers plan)))
+            old-max-slider-val (if (< selected-containers 50)
+                                 80
+                                 (let [n (* 2 selected-containers)] (+ n (- 10 (mod n 10)))))
+            selected-paid-containers (max 0 (- selected-containers (pm/freemium-containers plan)))
+            osx-total (or (some-> plan :osx :template :price) 0)
+            old-total (- (pm/stripe-cost plan) osx-total)
+            new-total (pm/cost plan selected-containers)
+            container-cost (pm/per-container-cost plan)
+            piggiebacked? (pm/piggieback? plan org-name)
+            button-clickable? (not= (if piggiebacked? 0 (pm/paid-containers plan))
+                                    selected-paid-containers)]
+      (html
+        (if-not plan
+          (cond ;; TODO: fix; add plan
+            (nil? plan)
+            [:div.loading-spinner common/spinner]
+            (not (seq plan))
+            [:h3 (str "No plan exists for" org-name "yet. Follow a project to trigger plan creation.")]
+            :else [:h3 "Something is wrong! Please submit a bug report."])
+
+          [:div#edit-plan {:class "pricing.page"}
+           (when (pm/piggieback? plan org-name)
+             (plans-piggieback-plan-notification plan org-name))
+           (when-not (config/enterprise?)
+             [:fieldset
+              [:legend (str "Our pricing is flexible and scales with you. Add as many containers as you want for $"
+                            container-cost "/month each.")]])
+           [:div.main-content
+            [:div.left-section
+             [:div.pricing-calculator-controls
+              [:h3 "Linux Containers"]
+              [:form
+               [:div.container-picker
+                [:p "More containers means faster builds and lower queue times."]
+                (om/build shared/styled-range-slider
+                          (merge app {:start-val selected-containers :min-val min-slider-val :max-val max-slider-val}))
+                [:div.container-input
+                 [:input {:style {:margin "4px" :height "calc(2em + 2px)"}
+                          :type "text" :value selected-containers
+                          :on-change #(utils/edit-input owner state/selected-containers-path %
+                                                        :value (int (.. % -target -value)))}]
+                 [:span.new-plan-total (str (pluralize-no-val selected-containers "container") (when-not (config/enterprise?) (str " for " (if (= 0 new-total) "Free!" (str "$" new-total "/month")))))]
+                 (when (not (= new-total old-total))
+                   [:span.strikeout {:style {:margin "auto"}} (str "$" old-total "/month")])
+                 (when false                                ;; (pm/grandfathered? plan) ;; I don't
+                   ;; think this is useful anymore.
+                   [:i.fa.fa-question-circle#grandfathered-tooltip-hack
+                    {:title "We've changed plan prices since you signed up, so you're grandfathered in at the old price!"}])]]
+               [:fieldset
+                (if (and (pm/can-edit-plan? plan org-name) (or (config/enterprise?) (pm/paid? plan)))
+                  (forms/managed-button
+                    [:button.btn.btn-large.btn-primary.center
+                     {:data-success-text "Saved",
+                      :data-loading-text "Saving...",
+                      :type "submit"
+                      :disabled (when-not button-clickable? "disabled")
+                      :on-click (when button-clickable?
+                                  #(do (raise! owner [:update-containers-clicked
+                                                      {:containers selected-paid-containers}])
+                                       false))}
+                     (if (config/enterprise?)
+                       "Save changes"
+                       "Update plan")])
+                  (if-not checkout-loaded?
+                    [:div.loading-spinner common/spinner [:span "Loading Stripe checkout"]]
+                    (forms/managed-button
+                      [:button.btn.btn-large.btn-primary.center
+                       {:data-success-text "Paid!",
+                        :data-loading-text "Paying...",
+                        :data-failed-text "Failed!",
+                        :type "submit"
+                        :disabled (when-not button-clickable? "disabled")
+                        :on-click (when button-clickable?
+                                    #(do (raise! owner [:new-plan-clicked
+                                                        {:containers selected-paid-containers
+                                                         :paid {:template (:id pm/default-template-properties)}
+                                                         :price new-total
+                                                         :description (str "$" new-total "/month, includes "
+                                                                           (pluralize selected-containers "container"))}])
+                                         false))}
+                       "Pay Now"])))
+
+
+                (when-not (config/enterprise?)
+                  ;; TODO: Clean up conditional here - super nested and many interactions
+                  (if (or (pm/paid? plan) (and (pm/freemium? plan) (not (pm/in-trial? plan))))
+                    (list
+                      (when (< old-total new-total)
+                        [:span.help-block
+                         "We'll charge your card today, for the prorated difference between your new and old plans."])
+                      (when (> old-total new-total)
+                        [:span.help-block
+                         "We'll credit your account, for the prorated difference between your new and old plans."]))
+                    (if (pm/in-trial? plan)
+                      [:span "Your trial will end in " (pluralize (Math/abs (pm/days-left-in-trial plan)) "day")
+                       "."]
+                      ;; TODO: Only show for trial-plans?
+                      [:span "Your trial of " (pluralize (pm/trial-containers plan) "container")
+                       " ended " (pluralize (Math/abs (pm/days-left-in-trial plan)) "day")
+                       " ago. Pay now to enable builds of private repositories."])))]]]]]]))))))
+
 (defn containers [app owner]
   (reify
     ;; I stole the stateful "did we load stripe checkout code" stuff
@@ -354,119 +467,18 @@
       (close! (om/get-state owner [:checkout-loaded-chan])))
     om/IRenderState
     (render-state [_ {:keys [checkout-loaded?]}]
-      (let [org-name (get-in app state/org-name-path)
-            plan (get-in app state/org-plan-path)
-            selected-containers (or (get-in app state/selected-containers-path)
-                                    (max (pm/usable-containers plan)
-                                         (pm/trial-containers plan)))
-            min-slider-val (max 1 (+ (pm/freemium-containers plan) (pm/paid-plan-min-containers plan)))
-            max-slider-val (max 80 (* 2 (pm/usable-containers plan)))
-            old-max-slider-val (if (< selected-containers 50)
-                                 80
-                                 (let [n (* 2 selected-containers)] (+ n (- 10 (mod n 10)))))
-            selected-paid-containers (max 0 (- selected-containers (pm/freemium-containers plan)))
-            osx-total (or (some-> plan :osx :template :price) 0)
-            old-total (- (pm/stripe-cost plan) osx-total)
-            new-total (pm/cost plan selected-containers)
-            container-cost (pm/per-container-cost plan)
-            piggiebacked? (pm/piggieback? plan org-name)
-            button-clickable? (not= (if piggiebacked? 0 (pm/paid-containers plan))
-                                    selected-paid-containers)]
+      (let [plan (get-in app state/org-plan-path)
+            org-name (get-in app state/org-name-path)]
         (html
-          [:div
-         (if-not plan
-           (cond ;; TODO: fix; add plan
-            (nil? plan)
-              [:div.loading-spinner common/spinner]
-            (not (seq plan))
-              [:h3 (str "No plan exists for" org-name "yet. Follow a project to trigger plan creation.")]
-            :else [:h3 "Something is wrong! Please submit a bug report."])
-
-           [:div#edit-plan {:class "pricing.page"}
-            (when (pm/piggieback? plan org-name)
-              (plans-piggieback-plan-notification plan org-name))
-            (when-not (config/enterprise?)
-              [:fieldset
-               [:legend (str "Our pricing is flexible and scales with you. Add as many containers as you want for $"
-                             container-cost "/month each.")]])
-            [:div.main-content
-             [:div.left-section
-              [:div.pricing-calculator-controls
-               [:h3 "Linux Containers"]
-               [:form
-                [:div.container-picker
-                 [:p "More containers means faster builds and lower queue times."]
-                 (om/build shared/styled-range-slider
-                           (merge app {:start-val selected-containers :min-val min-slider-val :max-val max-slider-val}))
-                 [:div.container-input
-                  [:input {:style {:margin "4px" :height "calc(2em + 2px)"}
-                           :type "text" :value selected-containers
-                           :on-change #(utils/edit-input owner state/selected-containers-path %
-                                                         :value (int (.. % -target -value)))}]
-                  [:span.new-plan-total (str (pluralize-no-val selected-containers "container") (when-not (config/enterprise?) (str " for " (if (= 0 new-total) "Free!" (str "$" new-total "/month")))))]
-                  (when (not (= new-total old-total))
-                    [:span.strikeout {:style {:margin "auto"}} (str "$" old-total "/month")])
-                  (when false ;; (pm/grandfathered? plan) ;; I don't
-                    ;; think this is useful anymore.
-                    [:i.fa.fa-question-circle#grandfathered-tooltip-hack
-                     {:title "We've changed plan prices since you signed up, so you're grandfathered in at the old price!"}])]]
-                [:fieldset
-                 (if (and (pm/can-edit-plan? plan org-name) (or (config/enterprise?) (pm/paid? plan)))
-                   (forms/managed-button
-                    [:button.btn.btn-large.btn-primary.center
-                     {:data-success-text "Saved",
-                      :data-loading-text "Saving...",
-                      :type "submit"
-                      :disabled (when-not button-clickable? "disabled")
-                      :on-click (when button-clickable?
-                                  #(do (raise! owner [:update-containers-clicked
-                                                      {:containers selected-paid-containers}])
-                                       false))}
-                     (if (config/enterprise?)
-                       "Save changes"
-                       "Update plan")])
-                   (if-not checkout-loaded?
-                     [:div.loading-spinner common/spinner [:span "Loading Stripe checkout"]]
-                     (forms/managed-button
-                      [:button.btn.btn-large.btn-primary.center
-                       {:data-success-text "Paid!",
-                        :data-loading-text "Paying...",
-                        :data-failed-text "Failed!",
-                        :type "submit"
-                        :disabled (when-not button-clickable? "disabled")
-                        :on-click (when button-clickable?
-                                    #(do (raise! owner [:new-plan-clicked
-                                                        {:containers selected-paid-containers
-                                                         :paid {:template (:id pm/default-template-properties)}
-                                                         :price new-total
-                                                         :description (str "$" new-total "/month, includes "
-                                                                           (pluralize selected-containers "container"))}])
-                                         false))}
-                       "Pay Now"])))
-
-
-                 (when-not (config/enterprise?)
-                   ;; TODO: Clean up conditional here - super nested and many interactions
-                   (if (or (pm/paid? plan) (and (pm/freemium? plan) (not (pm/in-trial? plan))))
-                     (list
-                      (when (< old-total new-total)
-                        [:span.help-block
-                         "We'll charge your card today, for the prorated difference between your new and old plans."])
-                      (when (> old-total new-total)
-                        [:span.help-block
-                         "We'll credit your account, for the prorated difference between your new and old plans."]))
-                     (if (pm/in-trial? plan)
-                       [:span "Your trial will end in " (pluralize (Math/abs (pm/days-left-in-trial plan)) "day")
-                        "."]
-                       ;; TODO: Only show for trial-plans?
-                       [:span "Your trial of " (pluralize (pm/trial-containers plan) "container")
-                        " ended " (pluralize (Math/abs (pm/days-left-in-trial plan)) "day")
-                        " ago. Pay now to enable builds of private repositories."])))]]]]]])
-           (when (and (feature/enabled? :osx-plans)
-                      (get-in app state/org-osx-beta-path))
-             (list
-              (om/build osx-plans plan)
-              (om/build osx-faq osx-faq-items)))])))))
+          (if (pm/piggieback? plan org-name)
+            (plans-piggieback-plan-notification plan org-name)
+            [:div
+             (om/build linux-plan {:app app :checkout-loaded? checkout-loaded?})
+             (when (and (feature/enabled? :osx-plans)
+                        (get-in app state/org-osx-beta-path))
+               (list
+                 (om/build osx-plans plan)
+                 (om/build osx-faq osx-faq-items)))]))))))

 (defn piggyback-organizations [app owner]
   (om/component


for analytics we want is-upgrade not upgrade? as a column

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -400,7 +400,7 @@
                                                                                :properties {:plan-type "osx"
                                                                                :new-plan plan-id
                                                                                :previous-plan (pm/osx-plan-id plan)
-                                                                                :upgrade? (> (:price plan-data) (pm/osx-cost plan))}}))})
+                                                                                :is-upgrade (> (:price plan-data) (pm/osx-cost plan))}}))})
                 (om/build plan-payment-button {:text "Pay Now"
                                                :loading-text "Paying..."
                                                :on-click-fn #(do


Add BB to string with GH

Add BB to string with GH

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -737,7 +737,7 @@
             "Your plan covers all projects (including forked repos) in the "
             [:strong org-name]
             " organization by default."]
-           [:p "You can let any GitHub organization you belong to, including personal accounts, piggieback on your plan. Projects in your piggieback organizations will be able to run builds on your plan."]
+           [:p "You can let any GitHub or Bitbucket organization you belong to, including personal accounts, piggieback on your plan. Projects in your piggieback organizations will be able to run builds on your plan."]
            [:p "Members of the piggieback organizations will be able to see that you're paying for them, the name of your plan, and the number of containers you've paid for. They won't be able to edit the plan unless they are also admins on the " org-name " org."]
            (if-not (or gh-users-and-orgs bb-users-and-orgs)
              [:div "Loading organization list..."]


Update cheshire to "5.8.1"

Update cheshire to "5.8.1"

--- backend/project.clj
+++ backend/project.clj
@@ -10,7 +10,7 @@
                  [org.slf4j/log4j-over-slf4j "1.7.26" :exclusions [org.slf4j/slf4j-api]]
                  [org.slf4j/jcl-over-slf4j "1.7.26" :exclusions [org.slf4j/slf4j-api]]
                  [org.slf4j/jul-to-slf4j "1.7.26" :exclusions [org.slf4j/slf4j-api]]
-                 [cheshire "5.8.0" :exclusions [com.fasterxml.jackson.core/jackson-core]]
+                 [cheshire "5.8.1" :exclusions [com.fasterxml.jackson.core/jackson-core]]
                  [clj-http "3.10.0" :exclusions [org.apache.httpcomponents/httpcore org.apache.httpcomponents/httpclient org.apache.httpcomponents/httpmime]]
                  [clj-time "0.15.1"]
                  [com.layerware/hugsql "0.4.9"]


implemented counter example

implemented counter example

--- examples/counter/src/app/core.cljs
+++ examples/counter/src/app/core.cljs
@@ -1,30 +1,53 @@
 (ns app.core
   (:require [mvsa.core :as mvsa]
-            [reagent.core :as r]))
+            [reagent.core :as r]
+            [cljs.core.match :refer-macros [match]])
+  (:require-macros [reagent.ratom :refer [reaction]]))

 (enable-console-print!)

 (defn control
   [model signal dispatch]
-  nil)
+  (match signal
+         :on-increment
+         (dispatch :increment)
+
+         :on-decrement
+         (dispatch :decrement)
+
+         :on-increment-if-odd
+         (when (odd? (:val model))
+           (dispatch :increment))
+
+         :on-increment-async
+         (.setTimeout js/window #(dispatch :increment) 1000)))

 (defn reconcile
   [model action]
-  model)
+  (match action
+         :increment (update model :val inc)
+         :decrement (update model :val dec)))

 (defn view-model
   [model]
-  model)
+  {:counter (reaction (str "#" (:val @model)))})

 (defn view
-  [view-model dispatch]
-  [:div "HEy!"])
+  [{:keys [counter] :as _view-model} dispatch]
+  [:p
+   @counter
+   " "
+   [:button {:on-click #(dispatch :on-increment)} "+"]
+   " "
+   [:button {:on-click #(dispatch :on-decrement)} "-"]
+   " "
+   [:button {:on-click #(dispatch :on-increment-if-odd)} "Increment if odd"]
+   " "
+   [:button {:on-click #(dispatch :on-increment-async)} "Increment async"]])

 (defn main
   []
-  (println "Hi.")
-
-  (let [app-spec {:initial-model {:counter 0}
+  (let [app-spec {:initial-model {:val 0}
                   :control       control
                   :reconcile     reconcile
                   :on-start      (constantly nil)
@@ -33,7 +56,7 @@
         [app-view-model app-view] (mvsa/connect-ui app view-model view)]
     ((:start app))

-    (r/render-component app-view (. js/document (getElementById "root")))
+    (r/render app-view (.getElementById js/document "root"))

     (assoc app :view-model app-view-model)))


Add sqr to fast-math

Add sqr to fast-math

--- src/clj/clojurewerkz/statistiker/fast_math.clj
+++ src/clj/clojurewerkz/statistiker/fast_math.clj
@@ -9,6 +9,10 @@
   [v power]
   (FastMath/pow (double v) power))

+(defn sqr
+  [v]
+  (FastMath/pow (double v) 2))
+
 (defn sqrt
   [v]
   (FastMath/sqrt v))


template for core main function

template for core main function

--- cljx/plongeur-clj/src/plongeur/core.clj
+++ cljx/plongeur-clj/src/plongeur/core.clj
@@ -1,5 +1,17 @@
 (ns plongeur.core
+  (:require [clojure.core.async :as a :refer [<! >! chan]]
+            [kierros.core :as cycle]
+            [kierros.sente-server-driver :as ws])
+  )

-  "main function definition"
-
-  )+(defn plongeur-server-main
+  "Main function cfr. Cycle.js architecture."
+  [{client-request-chan :WEB}]
+  (let [client-push (chan 10)
+
+        ]
+    {:WEB client-push}))
+
+(defn launch-server []
+  (cycle/run plongeur-server-main
+             {:WEB (ws/make-sente-server-driver {})}))


change nrepl piggieback binding so its immediately available after set

--- src/main/shadow/cljs/devtools/server/nrepl.clj
+++ src/main/shadow/cljs/devtools/server/nrepl.clj
@@ -117,11 +117,25 @@

 (defn cljs-select [next]
   (fn [{:keys [session op] :as msg}]
+    (swap! session assoc #'api/*nrepl-active* true)
+
     (let [repl-var #'api/*nrepl-cljs*]
       (when-not (contains? @session repl-var)
-        (swap! session assoc repl-var nil))
-
-      (swap! session assoc #'api/*nrepl-active* true)
+        (swap! session assoc repl-var nil)
+
+        ;; always set the piggieback compiler env binding to a IDeref
+        ;; so its immediately derefable when the nrepl-cljs binding is set
+        ;; if we only add the binding on message in it isn't available
+        ;; for some cider-nrepl middleware that already uses it on message-out
+        (swap! session assoc #'cemerick.piggieback/*cljs-compiler-env*
+          ;; FIXME: cider seems to use this in places and bind cljs.env/*compiler* with it
+          ;; if something tries to write to it this will fail?
+          (reify
+            clojure.lang.IDeref
+            (deref [_]
+              (when-let [build-id @repl-var]
+                (when-let [worker (api/get-worker build-id)]
+                  (-> worker :state-ref deref :build-state :compiler-env)))))))

       (let [build-id
             (get @session repl-var)
@@ -136,10 +150,6 @@
             (println (:code msg))
             (println)
             (flush))
-
-        (if worker
-          (swap! session assoc #'cemerick.piggieback/*cljs-compiler-env* (-> worker :state-ref deref :build-state :compiler-env))
-          (swap! session dissoc #'cemerick.piggieback/*cljs-compiler-env*))

         (-> msg
             (cond->


increase timeout

increase timeout

--- test/clj/conference_rating/functional_test.clj
+++ test/clj/conference_rating/functional_test.clj
@@ -32,7 +32,7 @@
   (taxi/find-element {:css (e2e-selector e2e-tag)}))

 (defn wait-for [e2e-tag]
-  (taxi/wait-until #(find-element e2e-tag) 20000))
+  (taxi/wait-until #(find-element e2e-tag) 60000))

 (defn click [e2e-tag]
   (taxi/click (e2e-selector e2e-tag)))


handle null error

handle null error

--- bot/fb.clj
+++ bot/fb.clj
@@ -12,13 +12,15 @@
     (get-in attachment [:payload :url])

     (:url attachment)
-    (let [query-params (-> (:url attachment) io/as-url .getQuery (str/split #"&"))
-          u (->> query-params
-                 (map #(str/split % #"="))
-                 (filter (fn [[k _]] (= "u" k)))
-                 first
-                 second)]
-      (java.net.URLDecoder/decode u "UTF-8"))))
+    (let [query-params (some-> (:url attachment) io/as-url .getQuery (str/split #"&"))
+          u (some->> query-params
+                     (map #(str/split % #"="))
+                     (filter (fn [[k _]] (= "u" k)))
+                     first
+                     second)]
+      (some-> u (java.net.URLDecoder/decode "UTF-8")))
+
+    :else nil))

 (defn generic-template [text image-url web-url]
   {:type "template"


! parallelize perfect numbers (somehow flawed)

--- Clojure/benchmark/src/benchmark/perfectnumber.clj
+++ Clojure/benchmark/src/benchmark/perfectnumber.clj
@@ -13,5 +13,6 @@

 (defn perfect-numbers [n]
   "Returns all perfect numbers upto n"
-  (doall (filter perfect? (range 1 n))))
-
+  (let [preds (pmap perfect? (range 1 n))]
+    (doall (filter true? preds))))
+  ;(doall (filter perfect? (range 1 n))))


inbox: Fetch necessary documents for document-columns.

--- src-cljs/pepa/workflows/inbox2.cljs
+++ src-cljs/pepa/workflows/inbox2.cljs
@@ -22,7 +22,7 @@
 (defprotocol ColumnSource
   (column-title [_ state])
   (column-pages  [_ state])
-  ;; TODO: Handle immutable colum sources
+  ;; TODO: Handle immutable column sources
   (remove-pages! [_ state page-ids]))

 (defprotocol ColumnDropTarget
@@ -100,7 +100,11 @@
     (get-in state [:documents document-id :pages]))
   (remove-pages! [_ state page-ids]
     (go
-      (js/console.warn "Unimplemented: Removing pages from Fake..."))))
+      (js/console.warn "Unimplemented: Removing pages from Document " document-id "...")))
+  om/IWillMount
+  (will-mount [_]
+    (assert (number? document-id))
+    (api/fetch-documents! [document-id])))

 ;;; NOTE: We need on-drag-start in `inbox-column' and in
 ;;; `inbox-column-page' (the latter to handle selection-updates when
@@ -239,7 +243,12 @@
                       (map (juxt :id identity))
                       columns)}))
   (will-mount [_]
-    (api/fetch-inbox! state))
+    (api/fetch-inbox! state)
+    ;; HACK: Use om/IWillMount to fetch additional data needed by each
+    ;; column
+    (doseq [[_ column] (om/get-state owner :columns)]
+      (when (satisfies? om/IWillMount column)
+        (om/will-mount column))))
   (render-state [_ {:keys [columns]}]
     ;; We generate a lookup table from all known pages so `on-drop' in
     ;; `inbox-column' can access it (as the drop `dataTransfer' only


1. applied ref at Thread

1. applied ref at Thread

--- src/clj/cauca/component/crawler.clj
+++ src/clj/cauca/component/crawler.clj
@@ -252,7 +252,7 @@
         )
       )
     (if (= repeatCnt -1)
-      (.start (Thread. -launch repeatCnt sleepMsec))
+      (.start (Thread. -launch @repeatCnt @sleepMsec))
       (-launch @repeatCnt @sleepMsec)
       )
     )


throw exception on null resource

throw exception on null resource

--- src/clj/clj_money/authorization.clj
+++ src/clj/clj_money/authorization.clj
@@ -9,6 +9,8 @@
 (defn get-resource-tag
   "Returns a keyword identifying the type of the resource"
   [resource]
+  (if-not resource
+    (throw (IllegalArgumentException. "resource cannot be null")))
   (if-let [result (if (keyword? resource)
                     resource
                     (-> resource meta ::resource-type))]


Use cond-> instead of -> & if

Use cond-> instead of -> & if

--- src/cljam/io/vcf/util/normalize.clj
+++ src/cljam/io/vcf/util/normalize.clj
@@ -108,10 +108,8 @@
                                  cstr/join)
                            alleles
                            allele-seqs)]
-        (-> (if (integer? END)
-              (assoc-in v [:info :END] (dec (+ pos' (count ref'))))
-              v)
-            (assoc :pos pos' :ref ref' :alt alt')))
+        (cond-> (assoc v :pos pos' :ref ref' :alt alt')
+          (integer? END) (assoc-in [:info :END] (dec (+ pos' (count ref'))))))
       v)))

 (defn- trim-left


Add batch processing fixes for parallel-reader

- Retrieve cached result for individual batch items instead of
  discarding them.

- Only call batch resolver when there are uncached items to process.

--- src/com/wsscode/pathom/connect.cljc
+++ src/com/wsscode/pathom/connect.cljc
@@ -1103,29 +1103,37 @@
       (pt/tracing env (assoc trace-data ::pt/event ::call-resolver-batch)
         (if (p/cache-contains? env [resolver-sym e params])
           (<! (p/cache-read env [resolver-sym e params]))
-          (let [items-map      (->> (<? (map-async-serial #(entity-select-keys env % input) processing-sequence))
-                                    (into [] (comp
-                                               (map-indexed vector)
-                                               (filter #(all-values-valid? (second %) input))
-                                               (remove #(p/cache-contains? env [resolver-sym (second %) params]))))
-                                    (group-input-indexes))
-                items          (keys items-map)
-                _              (pt/trace env {::pt/event ::batch-items-ready
-                                              ::items    items})
-                channels       (into [] (map (fn [resolver-input]
-                                               (let [ch (async/promise-chan)]
-                                                 (p/cache-hit env [resolver-sym resolver-input params] ch)
-                                                 ch))) items)
-
-                batch-result   (try
-                                 (p.async/throw-err (<?maybe (call-resolver env items)))
-                                 (catch #?(:clj Throwable :cljs :default) e
-                                   (parallel-batch-error env e)))
-
-                _              (pt/trace env {::pt/event    ::batch-result-ready
-                                              ::items-count (count batch-result)})
-
-                linked-results (zipmap items (mapv vector channels batch-result))]
+          (let [valid-inputs     (into [] (comp
+                                           (map-indexed vector)
+                                           (filter #(all-values-valid? (second %) input)))
+                                       (<? (map-async-serial #(entity-select-keys env % input)
+                                                             processing-sequence)))
+                items-map        (group-input-indexes valid-inputs)
+
+                {cached true
+                 uncached false} (group-by #(p/cache-contains? env [resolver-sym % params])
+                                           (keys items-map))
+
+                _                (pt/trace env {::pt/event ::batch-items-ready
+                                                ::items    uncached})
+
+                channels         (mapv (fn [resolver-input]
+                                         (let [ch (async/promise-chan)]
+                                           (p/cache-hit env [resolver-sym resolver-input params] ch)
+                                           ch))
+                                       uncached)
+
+                batch-result     (when (seq uncached)
+                                   (try
+                                     (p.async/throw-err (<?maybe (call-resolver env uncached)))
+                                     (catch #?(:clj Throwable :cljs :default) e
+                                       (parallel-batch-error env e))))
+
+                _                (pt/trace env {::pt/event    ::batch-result-ready
+                                                ::items-count (count batch-result)})
+
+                linked-results   (zipmap uncached (mapv vector channels batch-result))
+                cached-set       (set cached)]

             (if (and (not= ::p/reader-error (first batch-result))
                      (>= (count path) 2))
@@ -1140,14 +1148,16 @@
                           cache
                           (get items-map item)))
                       cache
-                      (zipmap items batch-result))))))
+                      (zipmap uncached batch-result))))))

             (doseq [[_ [ch value]] linked-results]
               (if value
                 (async/put! ch (or value {}))
                 (async/close! ch)))

-            (second (get linked-results e [nil {}]))))))))
+            (if (contains? cached-set e)
+              (<! (p/cache-read env [resolver-sym e params]))
+              (second (get linked-results e [nil {}])))))))))

 (defn parallel-reader
   [{::keys    [indexes max-resolver-weight]


(Fixed small update bug...)

(Fixed small update bug...)

--- src/conexp/gui/editors/contexts.clj
+++ src/conexp/gui/editors/contexts.clj
@@ -221,13 +221,6 @@
            obj-rows        (ref (conj (zipmap compatible-obj obj-range)
                                   (zipmap obj-range compatible-obj)))

-           write-obj-to-table
-           (fn-doc "Writes the objects of the context to the table-widget.
-
-  Parameters:
-    widget   _table widget to write the object cell values to"
-             [widget]
-             nil)

            extend-rows-hook
            (fn-doc "This hook is called when the number of rows is extended by
@@ -400,6 +393,25 @@
                              row column good-value)))
                  good-value)))

+
+           set-table-extents
+           (fn-doc "This function will set the row and column count of the
+  table widget to the appropriate sizes.
+
+  Parameters:
+    table  _table widget"
+             [table]
+             (dosync
+               (let [ ctx @context
+                      fca-ctx (get-context ctx)
+                      attrs (attributes fca-ctx)
+                      attr-count (count attrs)
+                      objs (objects fca-ctx)
+                      obj-count (count objs)]
+                 (do
+                   (!! table :set-column-count (+ 1 attr-count))
+                   (!! table :set-row-count (+ 1 obj-count))))))
+

            fill-table-widget
            (fn-doc "This function will fill the given table widget with the
@@ -494,7 +506,9 @@
              []
              (let [ widgets @assoc-widgets
                     tables  (map :table widgets)]
-               (one-by-one tables fill-table-widget)))
+               (dosync
+                 (one-by-one tables set-table-extents)
+                 (one-by-one tables fill-table-widget))))

            :remove-widget-
            (fn-doc "Removes a widget from associated widgets.
@@ -543,6 +557,11 @@
    (make-editable-context (make-context [] [] []))))

 (def ctx (conexp.fca/make-context ["a" "b" "c"] [1 2 3] [["a" 1] ["c" 3]]))
+(def ctx2 (make-context #{"Apfel" "Birne" "Möhre" "Gurke"}
+            #{"lecker" "geht so" "iieh"}
+            #{["Apfel" "lecker"] ["Birne" "lecker"] ["Möhre" "iieh"]
+            ["Gurke" "geht so"]}))
+
 (def ectx (make-editable-context ctx))


Add dependency on weald, bump other dependencies

The most notable "other" difference here is just using whichever
version of netty that we inherit from aleph.

--- build.boot
+++ build.boot
@@ -3,34 +3,28 @@

 (set-env! :resource-paths #{"src/clojure"}
           :dependencies '[[adzerk/boot-test "RELEASE" :scope "test"]
-                          ;; Default uses a version of netty that's about 6 months
-                          ;; old.
-                          ;; That might not be a huge deal...but there have been
-                          ;; 6 bug fix releases since then.
-                          ;; STARTED: Switch to newer version and see how it works.
-                          #_[aleph "0.4.4" :exclusions [io.netty/netty-all
-                                                      org.clojure/tools.logging]]
-                          ;; Alt: Try this instead
-                          [aleph "0.4.5-alpha6"]
-                          ;; Note that 5.0.0 is up to alpha2
-                          [io.netty/netty-all "4.1.20.Final"]
+                          ;; Stick with whichever version of netty this inherits.
+                          ;; That library isn't shy about breaking backwards compatibility
+                          ;; between build versions.
+                          [aleph "0.4.7-alpha3"]
+                          [com.frereth.weald "0.0.1"]
                           ;; TODO: Eliminate these logging dependencies.
                           ;; I have no business imposing them on library
                           ;; users
                           [org.apache.logging.log4j/log4j-core "2.10.0" :scope "test"]
                           [org.apache.logging.log4j/log4j-1.2-api "2.10.0" :scope "test"]
-                          [org.clojure/clojure "1.9.0" :exclusions [org.clojure/spec.alpha]]
+                          [org.clojure/clojure "1.9.0" :exclusions [org.clojure/spec.alpha] :scope "provided"]
                           [org.clojure/spec.alpha "0.2.176"]
                           ;; FIXME: Move this to the testing task.
                           ;; Don't want to depend on it in general.
-                          [org.clojure/test.check "0.10.0-alpha2" :scope "test" :exclusions [org.clojure/clojure]]
+                          [org.clojure/test.check "0.10.0-alpha3" :scope "test" :exclusions [org.clojure/clojure]]
                           ;; TODO: Eliminate this dependency. It's another one
                           ;; that I really don't have any business imposing on anyone else
                           [org.clojure/tools.logging "0.4.0" :exclusions [org.clojure/clojure]]
                           ;; TODO: Move this into the dev task
                           ;; (sadly, it isn't a straight copy/paste)
                           [samestep/boot-refresh "0.1.0" :scope "test" :exclusions [org.clojure/clojure]]
-                          [tolitius/boot-check "0.1.9" :scope "test" :exclusions [org.clojure/clojure]]]
+                          [tolitius/boot-check "0.1.11" :scope "test" :exclusions [org.clojure/clojure]]]
           :source-paths   #{"src/java"})

 (task-options!


Add function to create an AudioBuffer from CLJS data

--- src/main/audio_utils/web_audio.cljs
+++ src/main/audio_utils/web_audio.cljs
@@ -6,25 +6,30 @@
     (constructor.)))

 (defn create-buffer
-  [ctx n-channels size sample-rate]
-  (.createBuffer ctx n-channels size sample-rate))
+  ([ctx n-channels size sample-rate]
+   (.createBuffer ctx n-channels size sample-rate)))
+
+(defn create-buffer-from-data
+  [ctx n-channels sample-rate data]
+  (let [buf (create-buffer ctx n-channels
+                           (count (cond-> data
+                                    (> n-channels 1)
+                                    first))
+                           sample-rate)]
+    (doseq [channel (range 0 n-channels)
+            :let [channel-data (.getChannelData buf channel)
+                  input-data   (cond-> data
+                                 (> n-channels 1)
+                                 (get channel))]]
+      (doseq [[i x] (map-indexed vector input-data)]
+        (aset channel-data i x)))
+    buf))

 (defn create-buffer-source
   ([ctx]
    (.createBufferSource ctx))
   ([ctx n-channels sample-rate data]
-   (let [buf (create-buffer ctx n-channels
-                            (count (cond-> data
-                                     (> n-channels 1)
-                                     first))
-                            sample-rate)
-         src (create-buffer-source ctx)]
-     (doseq [channel (range 0 n-channels)
-             :let [channel-data (.getChannelData buf channel)
-                   input-data   (cond-> data
-                                  (> n-channels 1)
-                                  (get channel))]]
-       (doseq [[i x] (map-indexed vector input-data)]
-         (aset channel-data i x)))
-     (set! (.-buffer src) buf)
-     src)))
+   (doto (create-buffer-source ctx)
+     (aset "buffer"
+           (create-buffer-from-data ctx n-channels
+                                    sample-rate data)))))


cljs.bootstrap analyzer wip, can now compile without warnings

--- src/main/clojure/cljs/analyzer.cljc
+++ src/main/clojure/cljs/analyzer.cljc
@@ -12,7 +12,7 @@
   #?(:cljs (:require-macros [cljs.analyzer.macros
                              :refer [no-warn wrapping-errors
                                      disallowing-recur allowing-redef]]))
-  #?(:clj (:require [cljs.util :as util :refer [ns->relpath]]
+  #?(:clj (:require [cljs.util :as util :refer [ns->relpath topo-sort]]
                     [clojure.java.io :as io]
                     [clojure.string :as string]
                     [clojure.set :as set]
@@ -112,6 +112,20 @@
      ([ns ext]
       (str (string/replace (munge-path ns) \. \/) "." (name ext)))))

+#?(:cljs
+   (defn topo-sort
+     ([x get-deps]
+      (topo-sort x 0 (atom (sorted-map)) (memoize get-deps)))
+     ([x depth state memo-get-deps]
+      (let [deps (memo-get-deps x)]
+        (swap! state update-in [depth] (fnil into #{}) deps)
+        (doseq [dep deps]
+          (topo-sort dep (inc depth) state memo-get-deps))
+        (doseq [[<depth _] (subseq @state < depth)]
+          (swap! state update-in [<depth] set/difference deps))
+        (when (= depth 0)
+          (distinct (apply concat (vals @state))))))))
+
 (declare message namespaces)

 (defn ast? [x]
@@ -303,11 +317,18 @@
 ;; `default-namespaces` when accessed outside the scope of a
 ;; compilation/analysis call
 (def namespaces
-  (reify clojure.lang.IDeref
-    (deref [_]
-      (if-not (nil? env/*compiler*)
-        (::namespaces @env/*compiler*)
-        default-namespaces))))
+  #?(:clj
+     (reify clojure.lang.IDeref
+       (deref [_]
+         (if-not (nil? env/*compiler*)
+           (::namespaces @env/*compiler*)
+           default-namespaces)))
+     :cljs
+     (reify IDeref
+       (-deref [_]
+         (if-not (nil? env/*compiler*)
+           (::namespaces @env/*compiler*)
+           default-namespaces)))))

 (defn get-namespace [key]
   (get-in @env/*compiler* [::namespaces key]))
@@ -338,7 +359,7 @@
     (when (or (nil? (get-in @env/*compiler* [::namespaces ns :macros]))
               reload)
       (swap! env/*compiler* assoc-in [::namespaces ns :macros]
-        (->> (ns-interns ns)
+        (->> #?(:clj (ns-interns ns) :cljs (ns-interns* ns))
              (filter (fn [[_ ^Var v]] (.isMacro v)))
              (map (fn [[k v]]
                     [k (as-> (meta v) vm
@@ -348,13 +369,14 @@
                              :name (symbol (str ns) (str k)))))]))
              (into {}))))))

-(defn load-core []
-  (when (not @-cljs-macros-loaded)
-    (reset! -cljs-macros-loaded true)
-    (if *cljs-macros-is-classpath*
-      (load *cljs-macros-path*)
-      (load-file *cljs-macros-path*)))
-  (intern-macros 'cljs.core))
+#?(:clj
+   (defn load-core []
+     (when (not @-cljs-macros-loaded)
+       (reset! -cljs-macros-loaded true)
+       (if *cljs-macros-is-classpath*
+         (load *cljs-macros-path*)
+         (load-file *cljs-macros-path*)))
+     (intern-macros 'cljs.core)))

 #?(:clj
    (defmacro with-core-macros
@@ -611,7 +633,7 @@
                  (or (map? requires)
                      (set? requires)) (contains? requires parent)
                  (vector? requires) (some #{(munge (name parent))} requires))))]
-     (util/topo-sort ns
+     (topo-sort ns
        (fn [ns']
          (set (map first (filter #(parent? ns' %) ns-map))))))))

@@ -1478,8 +1500,9 @@
     (let [ns (if (sequential? form) (first form) form)
          {:keys [use-macros require-macros]}
          (or (get-in @env/*compiler* [::namespaces ns])
-             (when-let [res (util/ns->source ns)]
-               (:ast (parse-ns res))))]
+             #?(:clj
+                (when-let [res (util/ns->source ns)]
+                  (:ast (parse-ns res)))))]
       (or (some #{ns} (vals use-macros))
           (some #{ns} (vals require-macros))))))

@@ -1552,14 +1575,10 @@
     (when (some js-reserved segments)
       (warning :munged-namespace env {:name name}))
     (find-def-clash env name segments)
-    (when (some (complement util/valid-js-id-start?) segments)
-      (throw
-        #?(:clj
+    #?(:clj
+       (when (some (complement util/valid-js-id-start?) segments)
+         (throw
            (AssertionError.
-             (str "Namespace " name " has a segment starting with an invaild "
-                  "JavaScript identifier"))
-           :cljs
-           (js/Error.
              (str "Namespace " name " has a segment starting with an invaild "
                   "JavaScript identifier"))))))
   (let [docstring (if (string? (first args)) (first args))
@@ -1609,26 +1628,27 @@
     (when (and *analyze-deps* (seq uses))
       (check-uses uses env))
     (set! *cljs-ns* name)
-    (when *load-macros*
-      (load-core)
-      (doseq [nsym (vals use-macros)]
-        (let [k (or (:use-macros @reload)
-                    (get-in @reloads [:use-macros nsym])
-                    (and (= nsym name) *reload-macros* :reload))]
-          (if k
-            (clojure.core/require nsym k)
-            (clojure.core/require nsym))
-          (intern-macros nsym k)))
-      (doseq [nsym (vals require-macros)]
-        (let [k (or (:require-macros @reload)
-                    (get-in @reloads [:require-macros nsym])
-                    (and (= nsym name) *reload-macros* :reload))]
-          (if k
-            (clojure.core/require nsym k)
-            (clojure.core/require nsym))
-          (intern-macros nsym k)))
-      (when (seq use-macros)
-        (check-use-macros use-macros env)))
+    #?(:clj
+       (when *load-macros*
+         (load-core)
+         (doseq [nsym (vals use-macros)]
+           (let [k (or (:use-macros @reload)
+                       (get-in @reloads [:use-macros nsym])
+                       (and (= nsym name) *reload-macros* :reload))]
+             (if k
+               (clojure.core/require nsym k)
+               (clojure.core/require nsym))
+             (intern-macros nsym k)))
+         (doseq [nsym (vals require-macros)]
+           (let [k (or (:require-macros @reload)
+                       (get-in @reloads [:require-macros nsym])
+                       (and (= nsym name) *reload-macros* :reload))]
+             (if k
+               (clojure.core/require nsym k)
+               (clojure.core/require nsym))
+             (intern-macros nsym k)))
+         (when (seq use-macros)
+           (check-use-macros use-macros env))))
     (let [ns-info
           {:name name
            :doc (or docstring mdocstr)
@@ -2059,7 +2079,7 @@
             (let [form (if (instance? clojure.lang.LazySeq form)
                          (or (seq form) ())
                          form)]
-              (load-core)
+              #?(:clj (load-core))
               (cond
                 (symbol? form) (analyze-symbol env form)
                 (and (seq? form) (seq form)) (analyze-seq env form name opts)
@@ -2067,7 +2087,7 @@
                 (vector? form) (analyze-vector env form)
                 (set? form) (analyze-set env form)
                 (keyword? form) (analyze-keyword env form)
-                (instance? JSValue form) (analyze-js-value env form)
+                #?@(:clj [(instance? JSValue form) (analyze-js-value env form)])
                 (= form ()) (analyze-list env form)
                 :else
                 (let [tag (cond


asJavaList is gone, bufferAsJavaList now

--- src/main/clojure/powderkeg/core.clj
+++ src/main/clojure/powderkeg/core.clj
@@ -407,7 +407,7 @@
              partitioner
              evidence)
       (map (fn [groups]
-             (clj/into [] (map #(scala.collection.JavaConversions/asJavaList %)) groups))))))
+             (clj/into [] (map #(scala.collection.JavaConversions/bufferAsJavaList %)) groups))))))

 (defmacro with-res
   "Returns a \"with-open\" inspired transducer which wraps the specified transducers (xforms) and manages the resources specified by bindings (let-style bindings).


Comment out test code

Comment out test code

--- src/atom_finder/core.clj
+++ src/atom_finder/core.clj
@@ -20,10 +20,6 @@
    (map atom-lookup [:preprocessor-in-statement :reversed-subscript]))
 )

-;(ns-unmap 'atom-finder.core 'contains-location?)
-
-(def psgl (read-string (slurp (clojure.java.io/file (ClassLoader/getSystemResource "data/preprocessor_subscript_gcc_linux_2017-02-13.edn")))))
-
 (defn dedupe-preprocessors
   [results]
 (->> results
@@ -42,7 +38,6 @@
        )
   )

-;(pprint (sum-found-atoms (dedupe-preprocessors psgl)))

 (defn found-atom-source
   [atom-name results]
@@ -57,6 +52,6 @@
        )
   )

+;(def psgl (read-string (slurp (clojure.java.io/file (ClassLoader/getSystemResource "data/preprocessor_subscript_gcc_linux_2017-02-13.edn")))))
+;(pprint (sum-found-atoms (dedupe-preprocessors psgl)))
 ; (found-atom-source :reversed-subscript psgl)
-(def vsx_preempt (slurp-lines (expand-home "~/opt/src/linux/tools/testing/selftests/powerpc/math/vsx_preempt.c")))
-;(pprint (map vector (range) vsx_preempt))


Sort clauses by min-var

Sort clauses by min-var

--- src/aurora/language.cljs
+++ src/aurora/language.cljs
@@ -209,8 +209,17 @@
               var->ix (zipmap vars (range))
               num-vars (count vars)

+              clause->min-var (atom {})
+
+              _ (doseq [[_ clause-type clause-id name] clauses
+                        [_ field-type key val] (get @clause-id->fields clause-id)
+                        :when (= field-type "variable")]
+                  (swap! clause->min-var update-in [clause-id] #(min (or % js/Infinity) (var->ix val))))
+
+              sorted-clauses (sort-by (fn [[_ clause-type clause-id name]] (or (@clause->min-var clause-id) js/Infinity)) clauses)
+
               ;; make inputs
-              constraints (for [[_ clause-type clause-id name] clauses
+              constraints (for [[_ clause-type clause-id name] sorted-clauses
                                      :when (= clause-type "when")]
                                  (let [fields (get @clause-id->fields clause-id)]
                                    (case name


handle unspecified [:synsem :subcat]

handle unspecified [:synsem :subcat]

--- src/babel/lexiconfn.cljc
+++ src/babel/lexiconfn.cljc
@@ -555,15 +555,23 @@
 (defn commonnoun [lexical-entry]
   ;; subcat non-empty: pronoun is false
   (cond (and (= (get-in lexical-entry [:synsem :cat]) :noun)
-             (not (empty? (get-in lexical-entry [:synsem :subcat])))
+             (or (not (empty? (get-in lexical-entry [:synsem :subcat])))
+                 (= :unspecified (get-in lexical-entry [:synsem :subcat] :unspecified)))
              (not (= (get-in lexical-entry [:synsem :pronoun]) true))
              (not (= (get-in lexical-entry [:synsem :propernoun]) true)))
-        (unifyc lexical-entry
-                (unifyc agreement-noun
-                        common-noun
-                        {:synsem {:pronoun false
-                                  :subcat {:1 {:cat :det}
-                                           :2 '()}}}))
+        (let [result
+              (unifyc lexical-entry
+                      (unifyc agreement-noun
+                              common-noun
+                              {:synsem {:pronoun false
+                                        :subcat {:1 {:cat :det}
+                                                 :2 '()}}}))]
+          (if (fail? result)
+            (throw (exception (str "fail when trying to create common-noun from lexical-entry: " lexical-entry
+                                   "subcat: " (get-in lexical-entry [:synsem :subcat])
+                                   "subcat emptyness: " (empty? (get-in lexical-entry [:synsem :subcat])))))
+
+            result))
         true
         lexical-entry))


Revert "variable rename and add :g"

Revert "variable rename and add :g"

This reverts commit 17b204e2ca5c58489c76acceae1a6afb24834f70.

--- src/babel/morphology.clj
+++ src/babel/morphology.clj
@@ -81,13 +81,13 @@
      (group-by-two (rest (rest remaining))))))

 (defn expand-replace-patterns [unify-with patterns]
-  (mapcat (fn [pattern]
+  (mapcat (fn [x]
             (map (fn [pair]
-                   {:u pattern
-                    :g (:g pair)
+                   {:u (unify unify-with
+                              (:agr x))
                     :p (:p pair)})
                  (map (fn [p]
-                        {:g (:g pattern)
+                        {:agr :top
                          :p p})
-                      (group-by-two (:p pattern)))))
+                      (group-by-two (:p x)))))
           patterns))


spacing

spacing

--- src/celestial/launch.clj
+++ src/celestial/launch.clj
@@ -25,7 +25,6 @@
   (:require [celestial.jobs :as jobs]))

 (import-logging)
-

 (defn setup-logging
   "Sets up logging configuration"


klay: pass along edge type

klay: pass along edge type

--- src/cfg/layout/klay.cljs
+++ src/cfg/layout/klay.cljs
@@ -82,7 +82,7 @@
         bend-points (get edge "bendPoints")
         points (concat [src-point] bend-points [target-point])]
     {:points (mapv klay-point->cfg points)
-     :type (get edge "type")
+     :type (keyword (get edge "type"))
      :src (js/parseInt (get edge "source"))
      :dst (js/parseInt (get edge "target"))}))


remove with-conn from seed

remove with-conn from seed

--- src/chat/server/seed.clj
+++ src/chat/server/seed.clj
@@ -5,80 +5,76 @@
 (defn drop! []
   (datomic.api/delete-database db/*uri*))

-(defn init! []
-  (db/init!))
+(defn seed! []
+  (let [group-1 (db/create-group! {:id (db/uuid) :name "Braid"})
+        group-2 (db/create-group! {:id (db/uuid) :name "Chat"})
+        user-1 (db/create-user! {:id (db/uuid)
+                                 :email "foo@example.com"
+                                 :nickname "foo"
+                                 :password "foo"
+                                 :avatar "data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="})
+        user-2 (db/create-user! {:id (db/uuid)
+                                 :email "bar@example.com"
+                                 :nickname "bar"
+                                 :password "bar"
+                                 :avatar "data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="})
+        _ (db/user-add-to-group! (user-1 :id) (group-1 :id))
+        _ (db/user-add-to-group! (user-2 :id) (group-1 :id))
+        _ (db/user-add-to-group! (user-1 :id) (group-2 :id))
+        _ (db/user-add-to-group! (user-2 :id) (group-2 :id))

-(defn seed! []
-  (db/with-conn
-    (let [group-1 (db/create-group! {:id (db/uuid) :name "Braid"})
-          group-2 (db/create-group! {:id (db/uuid) :name "Chat"})
-          user-1 (db/create-user! {:id (db/uuid)
-                                   :email "foo@example.com"
-                                   :nickname "foo"
-                                   :password "foo"
-                                   :avatar "data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="})
-          user-2 (db/create-user! {:id (db/uuid)
-                                   :email "bar@example.com"
-                                   :nickname "bar"
-                                   :password "bar"
-                                   :avatar "data:image/gif;base64,R0lGODlhAQABAPAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="})
-          _ (db/user-add-to-group! (user-1 :id) (group-1 :id))
-          _ (db/user-add-to-group! (user-2 :id) (group-1 :id))
-          _ (db/user-add-to-group! (user-1 :id) (group-2 :id))
-          _ (db/user-add-to-group! (user-2 :id) (group-2 :id))
+        tag-1 (db/create-tag! {:id (db/uuid) :group-id (group-1 :id) :name "braid"})
+        tag-2 (db/create-tag! {:id (db/uuid) :group-id (group-1 :id) :name "watercooler"})

-          tag-1 (db/create-tag! {:id (db/uuid) :group-id (group-1 :id) :name "braid"})
-          tag-2 (db/create-tag! {:id (db/uuid) :group-id (group-1 :id) :name "watercooler"})
+        _ (db/user-subscribe-to-tag! (user-1 :id) (tag-1 :id))
+        _ (db/user-subscribe-to-tag! (user-2 :id) (tag-1 :id))

-          _ (db/user-subscribe-to-tag! (user-1 :id) (tag-1 :id))
-          _ (db/user-subscribe-to-tag! (user-2 :id) (tag-1 :id))
+        _ (db/user-subscribe-to-tag! (user-1 :id) (tag-2 :id))
+        _ (db/user-subscribe-to-tag! (user-2 :id) (tag-2 :id))

-          _ (db/user-subscribe-to-tag! (user-1 :id) (tag-2 :id))
-          _ (db/user-subscribe-to-tag! (user-2 :id) (tag-2 :id))
-
-          msg (db/create-message! {:id (db/uuid)
-                                   :group-id (group-1 :id)
-                                   :user-id (user-1 :id)
-                                   :thread-id (db/uuid)
-                                   :created-at (java.util.Date.)
-                                   :content "Hello?"
-                                   :mentioned-tag-ids [(tag-1 :id)]})
-          _ (db/create-message! {:id (db/uuid)
-                                 :group-id (group-1 :id)
-                                 :thread-id (msg :thread-id)
-                                 :user-id (user-2 :id)
-                                 :created-at (java.util.Date.)
-                                 :content "Hi!"})
-          _ (db/create-message! {:id (db/uuid)
-                                 :thread-id (msg :thread-id)
+        msg (db/create-message! {:id (db/uuid)
                                  :group-id (group-1 :id)
                                  :user-id (user-1 :id)
+                                 :thread-id (db/uuid)
                                  :created-at (java.util.Date.)
-                                 :content "Oh, great, someone else is here."})
-          _ (db/create-message! {:id (db/uuid)
-                                 :group-id (group-1 :id)
-                                 :thread-id (msg :thread-id)
-                                 :user-id (user-2 :id)
+                                 :content "Hello?"
+                                 :mentioned-tag-ids [(tag-1 :id)]})
+        _ (db/create-message! {:id (db/uuid)
+                               :group-id (group-1 :id)
+                               :thread-id (msg :thread-id)
+                               :user-id (user-2 :id)
+                               :created-at (java.util.Date.)
+                               :content "Hi!"})
+        _ (db/create-message! {:id (db/uuid)
+                               :thread-id (msg :thread-id)
+                               :group-id (group-1 :id)
+                               :user-id (user-1 :id)
+                               :created-at (java.util.Date.)
+                               :content "Oh, great, someone else is here."})
+        _ (db/create-message! {:id (db/uuid)
+                               :group-id (group-1 :id)
+                               :thread-id (msg :thread-id)
+                               :user-id (user-2 :id)
+                               :created-at (java.util.Date.)
+                               :content "Yep"})
+
+        tag-3 (db/create-tag! {:id (db/uuid) :group-id (group-2 :id) :name "abcde"})
+
+        _ (db/user-subscribe-to-tag! (user-1 :id) (tag-3 :id))
+        _ (db/user-subscribe-to-tag! (user-2 :id) (tag-3 :id))
+
+        msg (db/create-message! {:id (db/uuid)
+                                 :user-id (user-1 :id)
+                                 :group-id (group-2 :id)
+                                 :thread-id (db/uuid)
                                  :created-at (java.util.Date.)
-                                 :content "Yep"})
-
-          tag-3 (db/create-tag! {:id (db/uuid) :group-id (group-2 :id) :name "abcde"})
-
-          _ (db/user-subscribe-to-tag! (user-1 :id) (tag-3 :id))
-          _ (db/user-subscribe-to-tag! (user-2 :id) (tag-3 :id))
-
-          msg (db/create-message! {:id (db/uuid)
-                                   :user-id (user-1 :id)
-                                   :group-id (group-2 :id)
-                                   :thread-id (db/uuid)
-                                   :created-at (java.util.Date.)
-                                   :content "Hello?"
-                                   :mentioned-tag-ids [(tag-3 :id)]})
-          _ (db/create-message! {:id (db/uuid)
-                                 :group-id (group-2 :id)
-                                 :thread-id (msg :thread-id)
-                                 :user-id (user-2 :id)
-                                 :created-at (java.util.Date.)
-                                 :content "Hi!"})]
-      (println "users" user-1 user-2)
-      (println "tags" tag-2 tag-2))))
+                                 :content "Hello?"
+                                 :mentioned-tag-ids [(tag-3 :id)]})
+        _ (db/create-message! {:id (db/uuid)
+                               :group-id (group-2 :id)
+                               :thread-id (msg :thread-id)
+                               :user-id (user-2 :id)
+                               :created-at (java.util.Date.)
+                               :content "Hi!"})]
+    (println "users" user-1 user-2)
+    (println "tags" tag-2 tag-2)))


wasn't passing opts in the compile path for core.cljs

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -383,7 +383,7 @@
   [^File file {:keys [output-file] :as opts}]
   (if output-file
     (let [out-file (io/file (output-directory opts) output-file)]
-      (compiled-file (comp/compile-file file out-file)))
+      (compiled-file (comp/compile-file file out-file opts)))
     (compile-form-seq (comp/forms-seq file))))

 (defn compile-dir


don't overwrite the original Closure Compiler optimized source map, just erases useful information

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -725,11 +725,12 @@

 (defn emit-optimized-source-map
   [^com.google.javascript.jscomp.Compiler closure-compiler sources name opts]
-  (with-open [out (io/writer name)]
-    (.appendTo (.getSourceMap closure-compiler) out name))
-  (let [preamble (make-preamble opts)
+  (let [name' (str name ".closure")
+        _ (with-open [out (io/writer name')]
+            (.appendTo (.getSourceMap closure-compiler) out name'))
+        preamble (make-preamble opts)
         preamble-line-count (- (count (.split #"\r?\n" preamble -1)) 1)
-        sm-json (-> (io/file name) slurp
+        sm-json (-> (io/file name') slurp
                     (json/read-str :key-fn keyword))
         closure-source-map (sm/decode-reverse sm-json)]
     (loop [sources (seq sources)
@@ -771,7 +772,7 @@
             {:preamble-line-count (+ preamble-line-count
                                      (or (:foreign-deps-line-count opts) 0))
              :lines (+ (:lineCount sm-json) preamble-line-count 2)
-             :file (:file sm-json)
+             :file name
              :output-dir (util/output-directory opts)
              :source-map (:source-map opts)
              :source-map-path (:source-map-path opts)


Implemented a gasEq function for testing the equality of gas instructions ignoring the new ID paramter (intended for test cases).

--- src/clj/minijava/gas.clj
+++ src/clj/minijava/gas.clj
@@ -10,6 +10,15 @@
 		(reset! *uniqueID* (inc  @*uniqueID*))
 		(@*uniqueID*))
 )
+
+;;Equality test for gas types that ignores the unique ID parameter.
+;;Useful for testing.
+(defn gasEq[g1 g2]
+	(or (= g1 g2)
+	;;compare each key-value pair EXCEPT for id.
+	(= (dissoc g1 :id) (dissoc g2 :id)))
+)
+

 ;;this is NOT an x86 instruction - it is a constant argument to an
 ;;instruction (ie addl $2 %eax)


update tax rate

update tax rate

--- src/cljs/banco/core.cljs
+++ src/cljs/banco/core.cljs
@@ -1,5 +1,5 @@
 (ns banco.core
-  (:require [banco.calculations :as calc]
+  (:require #_[banco.calculations :as calc]
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]))

@@ -11,7 +11,7 @@
       (reify
         om/IRender
         (render [_]
-          (dom/h2 nil 10 #_(calc/calculate-tax :nz :2013-2014 10000))
+          (dom/h2 nil "Your tax rate is $10" #_(calc/calculate-tax :nz :2013-2014 10000))
           #_(dom/h2 nil (:text app))

           )))


removed debug log in map

removed debug log in map

--- src/cljs/lokate/map.cljs
+++ src/cljs/lokate/map.cljs
@@ -31,13 +31,15 @@
   (-> icon .-options .-icon (set! "ion-ios-circle-filled"))
   icon)

+(defn reset-markers [owner]
+  (let [markers (om/get-state owner :markers)]
+    (dorun
+      (map #(.setIcon (:marker %) (reset-ico (:icon %))) markers))))
+
 (defn activate-marker
   [owner id]
   (let [l-map (om/get-state owner :map)
-        markers (om/get-state owner :markers)
         active (om/get-state owner [:markers id])]
-    (dorun
-      (map #(.setIcon (:marker %) (reset-ico (:icon %))) markers))
     (when active
       (do (.setIcon (:marker active) (activate-ico (:icon active)))
           (.panTo l-map (.getLatLng (:marker active)))))))
@@ -56,7 +58,6 @@

     (.on marker "click"
       (fn []
-        (.log js/console (path-to-route (om/path point)))
         (om/update! data [:drawer :open] true)
         (put! (om/get-shared owner :nav)
           [:route (path-to-route (om/path point))])))
@@ -106,6 +107,7 @@

         ;(delete-markers owner to-delete)
         (add-markers data owner to-add)
+        (reset-markers owner)
         (when (re-matches #"/collections/(\d+)/points/(\d+)" (:route-name next-props))
           (let [point-id (get-in next-props [:route-opts :point-id])]
             (activate-marker owner point-id)))))


Cleanup

Cleanup

--- src/cljs/ufo/client.cljs
+++ src/cljs/ufo/client.cljs
@@ -97,45 +97,6 @@
         [:tbody (map tbody-row rows)]]]))))
 (def table (om/factory Table))

-
-
-
-
-
-
-
-
-
-
-
-
-(defui Person
-  static om/Ident
-  (ident [this {:keys [name]}]
-         [:person/by-name name])
-  static om/IQuery
-  (query [this]
-         '[:name :points :age])
-  Object
-  (render [this]
-          #_(println "Render Person" (-> this om/props :name))
-          (let [{:keys [points name] :as props} (om/props this)]
-            (html
-             [:li
-              [:label (str name ", points: " points)]
-              [:button {:onClick
-                        (fn [e]
-                          (om/transact! this
-                                        `[(points/increment ~props)]))}
-               "+"]
-              [:button {:onClick
-                        (fn [e]
-                          (om/transact! this
-                                        `[(points/decrement ~props)]))}
-               "-"]]))))
-
-(def person (om/factory Person {:keyfn :name}))
-
 (defui ThreePListView
   Object
   (render [this]
@@ -148,18 +109,6 @@
                (map threep list)]]))))

 (def threep-list-view (om/factory ThreePListView))
-
-(defui ListView
-  Object
-  (render [this]
-          #_(println "Render ListView" (-> this om/path first))
-          (let [list (om/props this)]
-            (html
-             [:ul
-              (map person list)]))))
-
-(def list-view (om/factory ListView))
-

 (defn add-person! [widget {:keys [id fname lname] :as prm}]
   (println "prm" prm)
@@ -174,14 +123,8 @@
   static om/IQuery
   (query
    [this]
-   (let [subquery (om/get-query Person)
-         qthreep (om/get-query ThreeP)
-         qtvals (om/get-query TCols)
-         ]
-     `[{:list/one ~subquery} {:list/two ~subquery}
-       {:list/three ~qthreep}
-       {:list/tvals ~qtvals}
-       ]))
+   (let [qthreep (om/get-query ThreeP) qtvals (om/get-query TCols)]
+     `[{:list/three ~qthreep} {:list/tvals ~qtvals}]))

   Object
   (render
@@ -192,10 +135,6 @@
                  ]} (om/props this)]
      (html
       [:div
-       ;; [:h2 "List A"]
-       ;; (list-view one)
-       ;; [:h2 "List B"]
-       ;; (list-view two)
        [:h2 "Table ThreeP"]
        ;; TODO transact from 'outside'
        (threep-list-view three)


Hack more

Hack more

--- src/clojush/evaluate.clj
+++ src/clojush/evaluate.clj
@@ -623,7 +623,7 @@
                                              sum (reduce + (mapv * improvements weights))]
                                          (- sum)))))))
                           ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;HACKED STABILITY
-                          #_(if (not (:print-history argmap))
+                          (if (not (:print-history argmap))
                             (throw
                               (Exception.
                                 ":print-history must be true for :case-stagnation"))
@@ -638,27 +638,6 @@
                                                                     (if (= newer-error older-error)
                                                                       0.0
                                                                       -1.0)))
-                                                                (partition 2 1 case-history))
-                                             weights (take (count improvements)
-                                                           (iterate (partial * (- 1 improvement-discount)) 1))
-                                             sum (reduce + (mapv * improvements weights))]
-                                         (- sum)))))))
-                          ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;HACKED STABILITY
-                          (if (not (:print-history argmap))
-                            (throw
-                              (Exception.
-                                ":print-history must be true for :case-stagnation"))
-                            (if (empty? (rest (:history ind)))
-                              (vec (repeat (count (:errors ind)) 1000000))
-                              (vec (for [case-history (apply map list (:history ind))]
-                                     (if (zero? (first case-history))
-                                       -100000  ;; solved, improvement doesn't matter
-                                       (let [improvements (mapv (fn [[newer-error older-error]]
-                                                                  (if (< newer-error older-error)
-                                                                    1.0
-                                                                    (if (= newer-error older-error)
-                                                                      -2
-                                                                      0)))
                                                                 (partition 2 1 case-history))
                                              weights (take (count improvements)
                                                            (iterate (partial * (- 1 improvement-discount)) 1))


CMR-2566 removes println statements

CMR-2566 removes println statements

--- access-control-app/src/cmr/access_control/api/routes.clj
+++ access-control-app/src/cmr/access_control/api/routes.clj
@@ -47,10 +47,7 @@
 (defn- validate-params
   "Throws a service error when any keys exist in params other than those in allowed-param-names."
   [params & allowed-param-names]
-  (println "removed params:")
-  (prn (remove (set allowed-param-names) (keys params)))
   (when-let [invalid-param (first (remove (set allowed-param-names) (keys params)))]
-    (println "invalid param found:" (pr-str params) (pr-str invalid-param))
     (errors/throw-service-error :bad-request (format "Parameter [%s] was not recognized."
                                                      (name invalid-param)))))


clear relay state to prevent open redirect issue in okta login

--- src/clj/conference_rating/handler.clj
+++ src/clj/conference_rating/handler.clj
@@ -110,8 +110,18 @@
       (assoc-in [:security :ssl-redirect] (not ssl-redirect-disabled))
       (assoc :proxy true)))

+(defn prevent-open-redirect-through-relay-state [handler]
+  (fn [request]
+    (let [clean-request (-> request
+                            (assoc-in [:params :RelayState] nil)
+                            (assoc-in [:form-params :RelayState] nil))]
+      (println "request coming in: " request)
+      (println "clean request coming in: " clean-request)
+      (handler clean-request))))
+
 (defn app [db ssl-redirect-disabled]
   (let [handler (-> (create-routes db)
+                    (prevent-open-redirect-through-relay-state)
                     (wrap-defaults (ring-settings ssl-redirect-disabled))
                     (json/wrap-json-response)
                     (json/wrap-json-body {:keywords? true}))]


Fix merge session

Fix merge session

--- src/clj/org/openforis/ceo/handler.clj
+++ src/clj/org/openforis/ceo/handler.clj
@@ -2,6 +2,7 @@
   (:require [clojure.data.json :as json]
             [clojure.edn       :as edn]
             [clojure.string    :as str]
+            [clojure.set       :refer [intersection]]
             [ring.middleware.absolute-redirects :refer [wrap-absolute-redirects]]
             [ring.middleware.content-type       :refer [wrap-content-type]]
             [ring.middleware.default-charset    :refer [wrap-default-charset]]
@@ -190,8 +191,11 @@
         (handler (assoc request :params (merge params get-params post-params))))
       (handler request))))

-(defn wrap-session-params [handler]
-  (fn [{:keys [session] :as request}]
+(defn wrap-merge-session [handler]
+  (fn [{:keys [params session] :as request}]
+    (let [intersection (intersection (set (keys params)) (set (keys session)))]
+      (when-not (empty? intersection)
+        (log-str "WARNING! The following params are being overwritten by session values: " intersection)))
     (handler (update request :params merge session))))

 (defn wrap-exceptions [handler]
@@ -207,12 +211,12 @@
 (defn wrap-common [handler]
   (-> handler
       wrap-request-logging
+      wrap-merge-session
       wrap-keyword-params
       wrap-edn-params
       wrap-json-params
       wrap-nested-params
       wrap-multipart-params
-      wrap-session-params
       wrap-params
       wrap-session
       wrap-absolute-redirects


fix arg

fix arg

--- src/cljc/commos/delta/compscribe.cljc
+++ src/cljc/commos/delta/compscribe.cljc
@@ -436,10 +436,9 @@
   "Caches on endpoints.  Sends the current sum to a new subscriber,
   continues with deltas."
   [service]
-  (cached-service service {:accumulate
-                           (fn [cache v]
-                             (update (or cache [:is]) 1
-                                     delta/add v))}))
+  (cached-service service (fn [cache v]
+                            (update (or cache [:is]) 1
+                                    delta/add v))))

 (defn compscriber
   [service]