Better Camel Case inputs

Better Camel Case inputs

--- src/clojush/problems/software/benchmarks_v2/camel_case.clj
+++ src/clojush/problems/software/benchmarks_v2/camel_case.clj
@@ -10,23 +10,34 @@
         clojure.math.numeric-tower)
     (:require [clojure.string :as str]))

+(defn word-generator
+  "Generates words at a nice distribution for Camel Case
+   All words will have length [1, 5]."
+  []
+  (let [chars-between #(map char (range (int %1) (inc (int %2))))
+        chars (chars-between \a \z)
+        word-len (inc (rand-int 5))]
+    (apply str (repeatedly word-len #(rand-nth chars)))))
+
+(defn cleanup-length
+  [string len]
+  (let [result (take len string)]
+    (if (or (= (last result) \space)
+            (= (last result) \-))
+      (apply str (butlast result))
+      (apply str result))))
+
 ;; Define test cases
 (defn camel-case-input
-  "Makes a Camel Case input of length len."
-  ; Code found from https://stackoverflow.com/questions/27053726/how-to-generate-random-password-with-the-fixed-length-in-clojure
+  "Makes a Camel Case input of length len.
+   Note that 2/3 of spaces/dashes are dashes."
   [len]
-  (let [chars-between #(map char (range (int %1) (inc (int %2))))
-        chars (concat (chars-between \a \z)
-                      " "
-                      "-")
-        word (take len (repeatedly #(rand-nth chars)))]
-    (apply str word)))
-
-(comment
-  (camel-case-input 20)
-
-  (first (test-and-train-data-from-domains camel-case-data-domains))
-  )
+  (loop [result-string (word-generator)]
+    (if (>= (count result-string) len)
+      (cleanup-length result-string len)
+      (recur (str result-string
+                  (if (< (lrand) 0.66) \- \space)
+                  (word-generator))))))

 ; Atom generators
 (def camel-case-atom-generators
@@ -51,17 +62,21 @@
 ;; random element of the set.
 (def camel-case-data-domains
   [[(list ""
-          "oneword"
+          "nospaceordash"
           "two-words"
-          "two-words and-a-space"
+          "two words"
           "all separate words"
-          "all-one-word-with-th-dash"
-          "saaaaaaaaaaaaaaaaaaaaaame") 7 0] ;; "Special" inputs covering some base cases
-   [(fn [] (camel-case-input (inc (lrand-int 20)))) 193 2000]
+          "all-one-word-dashed"
+          "loooooong-wooooords"
+          "loooooong wooooords"
+          "a-b-c-d-e-f-g-h-i-j"
+          "a b c d e f g h i j"
+          "saaaaaaaaaaaaaaaaame") 11 0] ;; "Special" inputs covering some base cases
+   [(fn [] (camel-case-input (inc (lrand-int 20)))) 189 2000]
    ])

 ;;Can make Camel Case test data like this:
-;(test-and-train-data-from-domains camel-case-data-domains)
+(comment (test-and-train-data-from-domains camel-case-data-domains))

 ; Helper function for error function
 (defn camel-case-test-cases
@@ -101,9 +116,8 @@
                                                     [])]
                        (let [final-state (run-push (:program individual)
                                                    (->> (make-push-state)
-                                                     (push-item input :input)
-                                                     (push-item "" :output)))
-                             result (stack-ref :output 0 final-state)]
+                                                        (push-item input :input)))
+                             result (stack-ref :string 0 final-state)]
                          (when print-outputs
                            (println (format "\n| Correct output: %s\n| Program output: %s" (pr-str correct-output) (pr-str result))))
                          ; Record the behavior
@@ -152,7 +166,7 @@
 ; Define the argmap
 (def argmap
  {:error-function (make-camel-case-error-function-from-cases (first camel-case-train-and-test-cases)
-                                                                     (second camel-case-train-and-test-cases))
+                                                             (second camel-case-train-and-test-cases))
   :atom-generators camel-case-atom-generators
   :max-points 2000
   :max-genome-size-in-initial-program 250
@@ -173,4 +187,4 @@
   :report-simplifications 0
   :final-report-simplifications 5000
   :max-error 10000
-  })
+  })


dropping jetty component thing for standard jetty/run-jetty in custom component


do print final newline when writing to file

--- src/nml/core.clj
+++ src/nml/core.clj
@@ -206,10 +206,10 @@
       (if (and (:in-place options) (not file)) (warn (msgs 0)))
       (if debug (println tree))
       (cond gets  (nml-gets tree gets (:no-prefix options))
-            sets  (let [out (string/trim (nml-str (nml-sets tree sets)))]
+            sets  (let [out (nml-str (nml-sets tree sets))]
                     (if (and file (:in-place options))
                       (try (spit file out)
                            (catch Exception e
                              (fail (str "Could not write to file '" file "'."))))
-                      (println out)))
+                      (println (string/trim out))))
             :else (println (string/trim (nml-str tree)))))))


Add http://

Add http://

--- src/nube/app.clj
+++ src/nube/app.clj
@@ -41,7 +41,8 @@
 (defn notify-routers [] (redis! (car/publish "updates" (java.util.Date.))))

 (defn load-apps [] (redis! (car/smembers :apps)))
-(defn add-app [app] (redis! (car/sadd :apps app)))
+(defn add-app [app] (redis! (car/sadd :apps app)
+                            (redis! (car/rpush (str "frontend:" app) app))))
 (defn remove-app [app] (redis! (car/srem :apps app)))

 (defn add-app-env [app env val] (redis! (car/hset (str app ":envs") env val)))
@@ -49,8 +50,8 @@
 (defn load-app-envs [app] (apply hash-map (redis! (car/hgetall (str app ":envs")))))

 (defn load-app-instances [app] (redis! (car/lrange (str "frontend:" app) 0 -1)))
-(defn add-app-instance [app instance] (redis! (car/rpush (str "frontend:" app) instance)))
-(defn remove-app-instance [app instance] (redis! (car/lrem (str "frontend:" app) 0 instance)))
+(defn add-app-instance [app instance] (redis! (car/rpush (str "frontend:" app) (str "http://" instance))))
+(defn remove-app-instance [app instance] (redis! (car/lrem (str "frontend:" app) 0 (str "http://" instance))))

 (defn load-pending-app-instances [app] (redis! (car/smembers (str app ":pending-instances"))))
 (defn add-pending-app-instance [app instance] (redis! (car/sadd (str app ":pending-instances") instance)))


add coercion rule for item action

add coercion rule for item action

--- src/clj/clj_money/models/transactions.clj
+++ src/clj/clj_money/models/transactions.clj
@@ -171,7 +171,8 @@
    (coercion/rule :local-date [:original-transaction-date])])

 (def ^:private item-coercion-rules
-  [(coercion/rule :decimal [:quantity])])
+  [(coercion/rule :decimal [:quantity])
+   (coercion/rule :keyword [:action])])

 (defn- expand-simplified-items
   [{:keys [items quantity debit-account-id credit-account-id] :as transaction}]


change icons to buttons

change icons to buttons

--- src/cljs/salava/badge/ui/endorsement.cljs
+++ src/cljs/salava/badge/ui/endorsement.cljs
@@ -371,15 +371,24 @@
                                    [:hr.line]
                                    [:div.text-center
                                     [:ul.list-inline.buttons.buttons
-                                     [:a.button {:href "#"
-                                                 :on-click #(do
-                                                              (.preventDefault %)
-                                                              (update-status id "accepted" user_badge_id state init-user-badge-endorsement)
-                                                              )} [:li [:i.fa.fa-check {:title (t :badge/Acceptendorsement)}] ]]
-                                     [:a.button {:href "#"
-                                                 :on-click #(do
-                                                              (.preventDefault %)
-                                                              (update-status id "declined" user_badge_id state init-user-badge-endorsement))}[:li.cancel [:i.fa.fa-remove {:title (t :badge/Declineendorsement)}]]]]]])
+                                     [:button.btn.btn-primary {:href "#"
+                                                               :on-click #(do
+                                                                            (.preventDefault %)
+                                                                            (update-status id "accepted" user_badge_id state init-user-badge-endorsement)
+                                                                            )} (t :badge/Acceptendorsement)]
+                                     [:button.btn.btn-warning.cancel {:href "#"
+                                                                      :on-click #(do
+                                                                                (.preventDefault %)
+                                                                                (update-status id "declined" user_badge_id state init-user-badge-endorsement))} (t :badge/Declineendorsement)]
+                                     #_[:a.button {:href "#"
+                                                   :on-click #(do
+                                                                (.preventDefault %)
+                                                                (update-status id "accepted" user_badge_id state init-user-badge-endorsement)
+                                                                )} [:li [:i.fa.fa-check {:title (t :badge/Acceptendorsement)}] ]]
+                                     #_[:a.button {:href "#"
+                                                   :on-click #(do
+                                                                (.preventDefault %)
+                                                                (update-status id "declined" user_badge_id state init-user-badge-endorsement))}[:li.cancel [:i.fa.fa-remove {:title (t :badge/Declineendorsement)}]]]]]])
                                 ]]))

                     ) [:div] @(cursor state [:user-badge-endorsements]))]]))))


Benchmark should only load sample catalogs that end in .json

Signed-off-by: Deepak Giridharagopal <d11186354d1ef01ca06ae37d7e23e827da13e85f@puppetlabs.com>

--- src/com/puppetlabs/cmdb/cli/benchmark.clj
+++ src/com/puppetlabs/cmdb/cli/benchmark.clj
@@ -131,17 +131,16 @@
 (defn -main
   [& args]
   (let [[options _] (cli! args
-                          ["-d" "--dir" "Path to a directory containing sample JSON catalogs"]
+                          ["-d" "--dir" "Path to a directory containing sample JSON catalogs (files must end with .json)"]
                           ["-u" "--url" "URL to REST endpoint for commands"]
                           ["-i" "--runinterval" "What runinterval (in minutes) to use during simulation"]
                           ["-n" "--numhosts" "How many hosts to use during simulation"]
                           ["-rp" "--rand-perc" "What percentage of submitted catalogs are tweaked (int between 0 and 100)"])

         dir         (:dir options)
-        catalogs    (->> (for [file (fs/list-dir dir)
-                               :let [fname (str dir File/separator file)]]
+        catalogs    (->> (for [file (fs/glob (fs/file dir "*.json"))]
                            (try
-                             (json/parse-string (slurp fname))
+                             (json/parse-string (slurp file))
                              (catch Exception e
                                (log/error (format "Error parsing %s; skipping" file)))))
                          (remove nil?)


Fix borked migration

Fix borked migration

--- src/status_im/data_store/realm/schemas/account/v19/core.cljs
+++ src/status_im/data_store/realm/schemas/account/v19/core.cljs
@@ -87,7 +87,7 @@
           (.filtered (str "content-type = \"" content-type "\""))
           (.map (fn [object _ _]
                   (let [content (reader/read-string (aget object "content"))
-                        new-props (get owner-command->new-props (selector content))
+                        new-props (get mapping (selector content))
                         new-content (merge content new-props)]
                     (log/debug "migrating v19 command/request database, updating: " content " with: " new-props)
                     (aset object "content" (pr-str new-content)))))))
@@ -96,5 +96,5 @@
   (log/debug "migrating v19 account database: " old-realm new-realm)
   (remove-contact! new-realm "transactor-personal")
   (remove-contact! new-realm "transactor-group")
-  (update-commands owner-command->new-props (juxt :bot :command) new-realm "command")
-  (update-commands console-requests->new-props (juxt :command) new-realm "command-request"))
+  (update-commands (juxt :bot :command) owner-command->new-props new-realm "command")
+  (update-commands (juxt :command) console-requests->new-props new-realm "command-request"))


updated server docs

updated server docs

--- src/tutorial/untangled_tutorial/H_Server_Interactions.cljs
+++ src/tutorial/untangled_tutorial/H_Server_Interactions.cljs
@@ -80,21 +80,32 @@

   ### Query Narrowing

-  The load functions allow you to elide parts of the query using `:without set`
-
+  The load functions allow you to elide parts of the query using `:without set`. This is useful when you have a query
+  that would load way more than you need right now. Using the `:without` parameter on a `load` function will cause it
+  to elide the portions of the query (properties/joins) that use the given keywords. See the loading sections below.

   ## Mutations

   ### Optimistic (client) changes

+  TODO: Just like Om
+
   ### Server Writes

+  TODO: Just like Om
+
   #### Updating an existing item

+  TODO: Just like Om
+
   #### New Item Creation – Temporary IDs

+  TODO: Similar to Om, but `{ :tempids tempidmap }` can be returned from `:action` of server mutation and it will
+  just work. The plumbing is pre-written.
+
   #### Reading results after a mutation

+  See notes on built-in call (app/load)

   ## Differences from stock Om (next)

@@ -211,6 +222,49 @@

   Untangled has supplied all of the Om plumbing for you.

+  #### How Reads Work : `app/load`
+
+  The helper functions described above simply trigger a built-in Untangled mutation called `app/load`, which you are
+  allowed (and sometimes encouraged) to use directly. It is the Untangled method of doing follow-on reads after a remote
+  mutation:
+
+  ```
+  (om/transact! this '[(app/do-some-thing) (app/load {:query [:a]})])
+  ```
+
+  The normal form of follow-on keywords (for re-rendering the UI) works fine, it will just never trigger remote
+  reads.
+
+  The `app/load` mutation does a very simple thing: It puts a state marker in a well-known location in your app state
+  to indicate that you're wanting to load something (and returns `:remote true`). This causes the network
+  plumbing to be triggered. The network plumbing only receives mutations that are marked remote, so it does the following:
+
+  - It looks for the special mutations `app/load` and `tx/fallback`. The latter is part of the unhappy path handling.
+     - For each load, it places a state marker in the app state at the target destination for the query data
+     - All loads that are present are combined together into a single Om query
+  - It looks for other mutations
+  - It puts the 'other mutations' on the send queue
+  - It puts the derived query from the `app/loads` onto the send queue
+
+  A separate \"thread\" (core async go block) watches the send queue, and sends things one-at-a-time (e.g. each entry
+  in the queue is processed in a sequence, ensuring you can reason about things sequentially). The one-at-a-time
+  semantics are very important for handling tempid reassignment, rational optimistic updates, and unhappy path handling.
+
+  The send processing block (uses core async to make a thread-like infinite loop):
+
+  - Pulls an item from the queue (or \"blocks\" when empty)
+  - Sends it over the network
+  - Updates the marker in the app state to `loading` (which causes a re-render, so you can render loading UI)
+  - \"waits\" for the response
+      - On success: merges the data
+      - On error: updates the state marker to an error state (which re-renders allowing the UI to show error UI)
+  - Repeats in an infinite loop
+
+  #### Using `app/load` directly
+
+  TODO: See the helper functions `load-collection` and `load-field`. We might add more specific versions of `app/load`
+  that provide a clearer end-user API.
+
   ### Remote Reads after a Mutation

   In Om, you can list properties after your mutation to indicate re-renders. You can force them to be remote reads by


Editor now evaluates CLJS immediately

Editor now evaluates CLJS immediately

Makes for more immediate feedback

--- src/webapp/framework/client/webhosting/hostmain.cljs
+++ src/webapp/framework/client/webhosting/hostmain.cljs
@@ -23,30 +23,39 @@

+
+
+
+
+(defn reeval [app-id]
+  (go
+    (let [code (js/getCodeMirrorValue)]
+      (remote !savecode {:id app-id :code code})
+      (js/sendcode (str code))
+      )))
+
+
+
+
+
+
+
 (defn-ui-component     editor-component   [app]
- {:on-mount
-  (do  (go (if  (read-ui app [:app-id])
-             (let [x (remote  !getfilecontents  {:id (read-ui app [:app-id]) })]
-               (js/createEditor)
-               (js/populateEditor (get x :value))))))}
-
-
-  (div {}
-            (div {:style {:display "inline-block" :width "1200" :height "800" :verticalAlign "top"}}
-                 (textarea {:id "cm" :style {:display "inline-block" :width "1200" :height "800"}} ""))
-
-       (iframe {:id "appframe" :style {:display "inline-block"} :src
-                (str (cond
-                      @c/debug-mode
-                      "http://127.0.0.1:3449"
-
-                      :else
-                      "http://appshare.co/appshare")
-                     "/devclient.html") :width "600" :height "800"})))
-
-
-
-
+  {:on-mount
+   (do  (go (if  (read-ui app [:app-id])
+              (let [x (remote  !getfilecontents  {:id (read-ui app [:app-id]) })]
+
+                (js/createEditor)
+                (js/populateEditor (get x :value))
+                (reeval (read-ui app [:app-id]))
+                ;(js/populateEditor (str "Loaded: " (read-ui app [:app-id])))
+                ;(js/alert (str "loaded" (read-ui app [:app-id])))
+                ))))}
+
+
+  (div nil
+       (div nil (str (read-ui app [:app-id])))
+       (textarea {:id "cm" :style {:display "inline-block" :width "1200" :height "800"}} "")))

@@ -93,12 +102,14 @@
                                          ))))

+                      ; if we select a different app
                       :else
-                      (div {:onClick     #(go  (write-ui app [:submode] "editappname")
-                                               (write-ui app [:app-id] (<-- :id)))
-
-                            :style {:display "inline-block" :fontFamily "Ubuntu" :fontWeight "700" :fontSize "1.3em" ::marginTop "0.7em"}}
-                           (str (<-- :application_name))))
+                      (do
+                        (div {:onClick     #(go  (write-ui app [:submode] "editappname")
+                                                 (write-ui app [:app-id] (<-- :id)))
+
+                              :style {:display "inline-block" :fontFamily "Ubuntu" :fontWeight "700" :fontSize "1.3em" ::marginTop "0.7em"}}
+                             (str (<-- :application_name)))))

@@ -110,9 +121,9 @@
                                              (write-ui app [:app-id] (<-- :id))
                                              (remote !loadapp {:id (<-- :id)})
                                              )
-                             } "Edit")
-
-                    ))))
+                             } "Edit")))))
+
+

@@ -124,10 +135,7 @@

 (defn-ui-component     main-hosting-component   [app]
-  {:on-mount
-   (do  (go (let [x (remote  !getfilecontents  {:file-name nil})]
-              (js/createEditor)
-              (js/populateEditor (get x :value)))))}
+  {}

   (div nil
@@ -156,28 +164,40 @@

                (button {:className    "btn btn-default"
                         :style       {:display "inline-block" :marginLeft "30px" :fontFamily "Ubuntu" :fontSize "1em" :marginTop "-0.3em"  }
-                        :onClick     #(go
-                                       (let [code (js/getCodeMirrorValue)]
-                                         (remote !savecode {:id (read-ui app [:app-id]) :code code})
-                                         (js/sendcode (str code))
-                                         ))}
+                        :onClick     #(reeval  (read-ui app [:app-id]))}
                        "Save")))

             (a {:target       "appshare.co"
                 :style       {:textDecoration "underline" :float "right"  :display "inline-block" :marginRight "30px" :fontFamily "Ubuntu" :fontSize "2em" :marginTop "0.3em"}
                 :href         (str "http://canlabs.com")}
-               "AppShare.co")
-
-            )
-       (cond
-         (or (= (read-ui app [:mode]) nil) (= (read-ui app [:mode]) "browse"))
-         (component browser-component app [])
-
-         (= (read-ui app [:mode]) "edit")
-         (component editor-component app [])
-
-         :else
-         (div {} "Nothing selected"))))
+               "AppShare.co"))
+
+
+
+
+       (div {}
+            (div {:style {:display "inline-block" :width "1200" :height "800" :verticalAlign "top"}}
+                 (cond
+                   (or (= (read-ui app [:mode]) nil) (= (read-ui app [:mode]) "browse"))
+                   (component browser-component app [])
+
+                   (= (read-ui app [:mode]) "edit")
+                   (component editor-component app [])
+
+                   :else
+                   (div {} "Nothing selected")))
+
+
+
+       (iframe {:id "appframe" :style {:display "inline-block"} :src
+                (str (cond
+                      @c/debug-mode
+                      "http://127.0.0.1:3449"
+
+                      :else
+                      "http://appshare.co/appshare")
+                     "/devclient.html") :width "600" :height "800"}))
+       ))


Control visibility of tabs

Control visibility of tabs

--- src/day8/re_frame_10x/view/container.cljs
+++ src/day8/re_frame_10x/view/container.cljs
@@ -236,19 +236,38 @@
                    [rc/hyperlink
                     :label "Dismiss"
                     :on-click #(rf/dispatch [:errors/dismiss-popup-failed])]])
-                [rc/box
+                [rc/h-box
                  :v-scroll :on
                  :height "100%"
                  :style {:margin-left common/gs-19s}
-                 :child (case @selected-tab
-                          :event [event/render]
-                          :fx [fx/render]
-                          :app-db [app-db/render db/app-db]
-                          :subs [subs/render]
-                          :views [views/render]
-                          :parts [parts/render]
-                          :timing [timing/render]
-                          :traces [traces/render]
-                          :debug [debug/render]
-                          :settings [settings/render]
-                          [app-db/render db/app-db])]]]))+                 :children
+                 [[rc/box
+                   :style (if (not= @selected-tab :event) {:display "none" :visibility "hidden"} {})
+                   :child [event/render]]
+                  [rc/box
+                   :style (if (not= @selected-tab :fx) {:display "none" :visibility "hidden"} {})
+                   :child [fx/render]]
+                  [rc/box
+                   :style (if (not= @selected-tab :app-db) {:display "none" :visibility "hidden"} {})
+                   :child [app-db/render db/app-db]]
+                  [rc/box
+                   :style (if (not= @selected-tab :subs) {:display "none" :visibility "hidden"} {})
+                   :child [subs/render]]
+                  [rc/box
+                   :style (if (not= @selected-tab :views) {:display "none" :visibility "hidden"} {})
+                   :child [views/render]]
+                  [rc/box
+                   :style (if (not= @selected-tab :parts) {:display "none" :visibility "hidden"} {})
+                   :child [parts/render]]
+                  [rc/box
+                   :style (if (not= @selected-tab :timing) {:display "none" :visibility "hidden"} {})
+                   :child [timing/render]]
+                  [rc/box
+                   :style (if (not= @selected-tab :traces) {:display "none" :visibility "hidden"} {})
+                   :child [traces/render]]
+                  [rc/box
+                   :style (if (not= @selected-tab :debug) {:display "none" :visibility "hidden"} {})
+                   :child [debug/render]]
+                  [rc/box
+                   :style (if (not= @selected-tab :settings) {:display "none" :visibility "hidden"} {})
+                   :child [settings/render]]]]]]))


fix devcards minor bug

fix devcards minor bug

--- src/devcards/compassus/devcards/core.cljs
+++ src/devcards/compassus/devcards/core.cljs
@@ -339,7 +339,7 @@
                 "ItemList"))
             (dom/li #js {:style #js {:marginTop "5px"}}
               (dom/a #js {:href "#"
-                          :style (when (= route :item/by-id)
+                          :style (when (= route [:item/by-id 0])
                                    #js {:color "black"
                                         :cursor "text"})
                           :onClick #(change-route owner [:item/by-id 0] %)}


refactor loader creation; print warning if unsuccessful. (see #71)

--- src/leiningen/ancient/artifact/options.clj
+++ src/leiningen/ancient/artifact/options.clj
@@ -9,41 +9,46 @@
   (->> (quot (- (System/nanoTime) start) 1000000)
        (format "\u0394 %4dms")))

-(defn- wrap-loaders
-  "Wrap loaders with logging."
-  [loaders]
-  (->> (for [[repo-id f] loaders]
-         (->> (fn [group id]
-                (let [start (System/nanoTime)
-                      vs (f group id)
-                      tag (->> (vector
-                                 (format "[%s]" repo-id)
-                                 (format-delta start))
-                               (apply format "%-9s - %-7s -"))]
-                  (cond (instance? Throwable vs)
-                        (warnf "%s failure when checking %s/%s: %s" tag group id vs)
-                        (empty? vs)
-                        (debugf "%s no results for %s/%s." tag group id)
-                        :else
-                        (debugf "%s %d versions found for %s/%s." tag (count vs) group id))
-                  vs))
-              (vector repo-id)))
-       (into {})))
+(defn- wrap-single-loader
+  [f repo-id]
+  (fn [group id]
+    (let [start (System/nanoTime)
+          vs (f group id)
+          tag (->> (vector
+                     (format "[%s]" repo-id)
+                     (format-delta start))
+                   (apply format "%-9s - %-7s -"))]
+      (cond (instance? Throwable vs)
+            (warnf "%s failure when checking %s/%s: %s" tag group id vs)
+            (empty? vs)
+            (debugf "%s no results for %s/%s." tag group id)
+            :else
+            (debugf "%s %d versions found for %s/%s." tag (count vs) group id))
+      vs)))
+
+(defn- create-repository-loader
+  [repo-id spec]
+  (when spec
+    (some-> (if (fn? spec)
+              spec
+              (-> (if (string? spec) {:url spec} spec)
+                  (user/profile-auth)
+                  (user/resolve-credentials)))
+            (ancient/maybe-create-loader)
+            (wrap-single-loader repo-id))))

 (defn prepare-repositories
   "Prepate the repositories for usage with ancient-clj."
   [repositories]
   (debugf "repositories: %s" (pr-str repositories))
-  (-> (for [[k spec] repositories
-            :when spec]
-        (->> (if (fn? spec)
-               spec
-               (-> (if (string? spec) {:url spec} spec)
-                   (user/profile-auth)
-                   (user/resolve-credentials)))
-             (vector k)))
-      (ancient/create-loaders)
-      (wrap-loaders)))
+  (->> (for [[repo-id spec] repositories
+             :let [loader (create-repository-loader repo-id spec)]]
+         (if loader
+           [repo-id loader]
+           (warnf "[%s] could not create repository loader: %s"
+                  repo-id
+                  (pr-str spec))))
+       (into {})))

 (defn- select-mirror
   "Select a mirror for the given repository name/URL."


Remove unused file.

Remove unused file.

--- src/uxbox/xforms.cljs
+++ src/uxbox/xforms.cljs
@@ -1,10 +0,0 @@
-;; This Source Code Form is subject to the terms of the Mozilla Public
-;; License, v. 2.0. If a copy of the MPL was not distributed with this
-;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
-;;
-;; Copyright (c) 2015-2016 Andrey Antukh <niwi@niwi.nz>
-;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>
-
-(ns uxbox.xforms
-  "A collection of usefull transducers that are usefull
-  in more than one place in the application.")


moving to password and asserting

moving to password and asserting

--- src/vsphere/guest.clj
+++ src/vsphere/guest.clj
@@ -28,8 +28,9 @@

 (defn- npa
    "converts auth map to new pass auth"
-   [{:keys [user pass] }]
-  (doto (NamePasswordAuthentication.) (.setUsername user) (.setPassword pass)))
+   [{:keys [user password] }]
+   {:pre [user password]}
+  (doto (NamePasswordAuthentication.) (.setUsername user) (.setPassword password)))

 (defn- manager
   "file manage of vm"


correct bug ensuring reconciled items are not deleted

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -532,8 +532,8 @@
   [transaction]
   (let [reconciled-items (->> transaction
                               :items
-                              (map :reconciled?))]
-    (when   (seq reconciled-items)
+                              (filter :reconciled?))]
+    (when (seq reconciled-items)
       (throw (ex-info "A transaction with reconciled items cannot be deleted."
                       {:reconciled-items reconciled-items})))))


minor cleanup

minor cleanup

--- src/cljs/lesezeichen/client/core.cljs
+++ src/cljs/lesezeichen/client/core.cljs
@@ -64,7 +64,6 @@

 ;; --- NAVBAR ---
-
 (deftemplate nav "templates/navbar.html"
   [app owner state]
   {[:#brand] (content "Lesezeichen")


fix out-of-bound exception

fix out-of-bound exception

--- src/main/clojure/clojure/tools/reader.clj
+++ src/main/clojure/clojure/tools/reader.clj
@@ -594,7 +594,7 @@
         (case form
           :short
           (loop [i 0]
-            (if (> i ctors-num)
+            (if (>= i ctors-num)
               (reader-error rdr "Unexpected number of constructor arguments to " (str class)
                             ": got" numargs)
               (if (== (count (.getParameterTypes ^Constructor (aget all-ctors i)))


rename transform morph

rename transform morph

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -160,7 +160,7 @@
   ;; TODO: accept ready-made View
   (insert *metamodel* (do-filter tgt-view src-model attr-keys filter-fn)))

-(defn dtransform [#^Model src-model #^String suffix & #^Collection attribute-descrips]
+(defn dmorph [#^Model src-model #^String suffix & #^Collection attribute-descrips]
   ;; TOODO: accept ready-made View ?
   (insert *metamodel* (apply do-transform suffix src-model attribute-descrips)))

@@ -182,6 +182,7 @@
   )

 ;; try to lose key-to-valua and vice-versa then define dpivot...
+;; TODO: should mutability be part of metadata ?
 (defn dsplit [#^Model src-model #^Keyword key #^boolean mutable #^IFn value-to-keys #^IFn key-to-value #^IFn tgt-hook]
   (do-split
    src-model
@@ -219,16 +220,16 @@
 ;;----------------------------------------

 (def longer-whales-weight
-     (dtransform longer-whales "weight" :time :version :time :version :weight))
+     (dmorph longer-whales "weight" :time :version :time :version :weight))

 (def #^Model heavier-whales-length
-     (dtransform heavier-whales "length" :time :version :time :version :length))
+     (dmorph heavier-whales "length" :time :version :time :version :length))

 ;;----------------------------------------
 ;; demonstrate transformation - a synthetic field - metric tons per metre
 ;;----------------------------------------

-(dtransform
+(dmorph
  whales
  "tonsPerMetre"
  :time
@@ -248,7 +249,7 @@
 ;;----------------------------------------

 (def narwhals-length
-     (dtransform
+     (dmorph
       (dfilter
        whales
        "type=narwhal"


Fix compilation error on 0.94 profile

Fix compilation error on 0.94 profile

UserGroupInformation/loginUserFromSubject does not exist on 0.94
dependencies

--- src/main/hbase_region_inspector/hbase.clj
+++ src/main/hbase_region_inspector/hbase.clj
@@ -82,7 +82,11 @@
           (UserGroupInformation/setConfiguration hbc)
           (if useKeyTab
             (UserGroupInformation/loginUserFromKeytab principal keyTab)
-            (UserGroupInformation/loginUserFromSubject nil))
+            (let [method
+                  (.getMethod UserGroupInformation
+                              "loginUserFromSubject"
+                              (into-array Class [javax.security.auth.Subject]))]
+              (.invoke method nil (object-array [nil]))))
           (util/debug "Current user: " (UserGroupInformation/getCurrentUser)))
         hbc))))


Document that ack-process tests.

Document that ack-process tests.

--- test/com/farmlogs/conduit/subscription/ack_process_test.clj
+++ test/com/farmlogs/conduit/subscription/ack_process_test.clj
@@ -27,62 +27,99 @@
   (testing "Happy Path"
     (let [input (a/chan 1)
           ack-process (ack-process input nil)
-          output (a/chan 1)
+          output (a/chan 1) ;; Capture results sent to the msg broker
           send-result (partial result output)
           result-chan (a/chan 1)]

+      ;; Simulate arrival of a message with headers :foo
       (a/>!! input [result-chan :foo])
+
+      ;; Simulate a worker finishing work on the message
       (a/>!! result-chan (send-result :ack))
+
+      ;; Begin shutdown sequence for the ack-process
       (a/close! input)
-      (is (= [:ack :foo] (take-with-timeout output 10)))
-      (is (nil? (a/<!! ack-process)))))
+      (is (= [:ack :foo] (take-with-timeout output 10))
+          "We should ACK the :foo message.")
+      (is (nil? (a/<!! ack-process))
+          "The ack-process should be terminated")))

   (testing "Messages get the correct acknowledgement."
     (let [input (a/chan 1)
           ack-process (ack-process input nil)
-          output (a/chan 1)
+          output (a/chan 1) ;; Capture results sent to the msg broker
           send-result (partial result output)
           result-chan1 (a/chan 1)
           result-chan2 (a/chan 1)]

+      ;; Simulate the arrival of w messages
       (a/>!! input [result-chan1 :foo])
       (a/>!! input [result-chan2 :bar])
+
+      ;; Simulate workers finishing processing the messages
       (a/>!! result-chan1 (send-result :ack))
       (a/>!! result-chan2 (send-result :nack))
+
+      ;; Begin shutdown sequence for the ack-process
       (a/close! input)
-      (is (nil? (a/<!! ack-process)))
+
+      (is (nil? (a/<!! ack-process))
+          "The ack-process should be terminated.")
       (a/close! output)
       (is (= #{[:ack :foo] [:nack :bar]}
-             (a/<!! (a/into #{} output))))))
+             (a/<!! (a/into #{} output)))
+          "We should ACK :foo and NACK :bar.")))

   (testing "All messages get ack'd even if ack input closes before worker result."
     (let [input (a/chan 1)
           ack-process (ack-process input nil)
-          output (a/chan 1)
+          output (a/chan 1) ;; Capture results sent to the msg broker
           send-result (partial result output)
           result-chan (a/chan 1)]

+      ;; Simulate the arrival of a message
       (a/>!! input [result-chan :foo])
+
+      ;; Begin shutdown sequence for the ack-process
       (a/close! input)
-      (is (= ::timeout (take-with-timeout ack-process 10)))
+      (is (= ::timeout (take-with-timeout ack-process 10))
+          "ack-process should still be running, b/c not all messages
+          have been processed.")
+
+      ;; Simulate the result of processing the message
       (a/>!! result-chan (send-result :ack))
-      (is (= [:ack :foo] (take-with-timeout output 10)))
-      (is (nil? (a/<!! ack-process)))))
+      (is (= [:ack :foo] (take-with-timeout output 10))
+          "We should ACK the :foo message.")
+      (is (nil? (a/<!! ack-process))
+          "Now that all messages have been processed, the ack-process
+          should be terminated.")))

   (testing "Ack process keeps working if there's an exception in WorkerResult."
     (let [input (a/chan 1)
           ack-process (ack-process input nil)
-          output (a/chan 2)
+          output (a/chan 2) ;; Capture results sent to the msg broker
           send-result (partial result output)
           result-chan1 (a/chan 1)
           result-chan2 (a/chan 1)]

+      ;; Simulate the arrival of 2 messages
       (a/>!! input [result-chan1 :foo])
       (a/>!! input [result-chan2 :bar])
+
+      ;; Begin shutdown sequence for the ack-process
       (a/close! input)
-      (is (= ::timeout (take-with-timeout ack-process 10)))
+
+      (is (= ::timeout (take-with-timeout ack-process 10))
+          "The ack-process should still be running, b/c there are
+          unhandled messages.")
+
+      ;; Simulate a worker returning some sort of unexpected result.
       (a/>!! result-chan2 (broken-result))
+
+      ;; Simulate a worker :ack'ing :foo
       (a/>!! result-chan1 (send-result :ack))
-      (is (nil? (a/<!! ack-process)))
+      (is (nil? (a/<!! ack-process))
+          "ack-process should be termainated.")
       (a/close! output)
-      (is (= #{[:ack :foo]} (a/<!! (a/into #{} output)))))))
+      (is (= #{[:ack :foo]} (a/<!! (a/into #{} output)))
+          "The :foo message should be ACK'd."))))


Starting to centralize weird variable-like functions.

--- src/midje/util/thread_safe_var_nesting.clj
+++ src/midje/util/thread_safe_var_nesting.clj
@@ -5,3 +5,6 @@

 (defn pop-safely [the-var]
   (alter-var-root the-var rest))
+
+(defn set-namespace-pseudovariable [key-name newval]
+  (alter-meta! *ns* merge {key-name newval}))


Added a lambda to avoid double partial madness.

--- src/overtunes/songs/canone_alla_quarta.clj
+++ src/overtunes/songs/canone_alla_quarta.clj
@@ -68,7 +68,7 @@
 ;            ))

 (defn accumulate [series] (reductions + (cons 0 series)))
-(def repeats (partial mapcat (partial apply repeat)))
+(def repeats (partial mapcat #(apply repeat %)))
 (def runs (partial mapcat run))


-- update test-multiple-async-requests (#84)

- introduce delete assertions
 - move assertions to test thread

--- waiter/integration/waiter/async_request_integration_test.clj
+++ waiter/integration/waiter/async_request_integration_test.clj
@@ -187,21 +187,20 @@
           request-processing-time-ms 60000
           num-threads 20
           num-requests-to-delete 10
-          status-locations
-          (parallelize-requests
-            num-threads 1
-            (fn []
-              (log/info "making kitchen request")
-              (let [async-request-headers
-                    (assoc request-headers :x-kitchen-delay-ms (int (* (max 0.5 (double (rand))) request-processing-time-ms))
-                                           :x-kitchen-store-async-response-ms 600000)
-                    {:keys [headers] :as response}
-                    (make-kitchen-request waiter-url async-request-headers :http-method-fn http/get :body "" :path "/async/request")
-                    status-location (get (pc/map-keys str/lower-case headers) "location")]
-                (assert-response-status response 202)
-                (is (not (str/blank? status-location)))
-                status-location))
-            :verbose true)]
+          async-responses (parallelize-requests
+                            num-threads 1
+                            (fn []
+                              (log/info "making kitchen request")
+                              (let [async-request-headers
+                                    (assoc request-headers :x-kitchen-delay-ms (int (* (max 0.5 (double (rand))) request-processing-time-ms))
+                                                           :x-kitchen-store-async-response-ms 600000)]
+                                (make-kitchen-request waiter-url async-request-headers :http-method-fn http/get :body "" :path "/async/request")))
+                            :verbose true)
+          status-locations (for [{:keys [headers] :as response} async-responses]
+                             (let [status-location (get (pc/map-keys str/lower-case headers) "location")]
+                               (assert-response-status response 202)
+                               (is (not (str/blank? status-location)))
+                               status-location))]

       (testing "validate-pending-request-counters"
         (Thread/sleep inter-router-metrics-interval-ms) ;; allow routers to sync metrics
@@ -216,7 +215,10 @@
       (testing "delete-arbitrary-requests"
         (let [kitchen-delete-headers {:x-kitchen-allow-async-cancel true, :x-kitchen-204-on-async-cancel false}]
           (doseq [status-location (take num-requests-to-delete status-locations)]
-            (make-request waiter-url status-location :http-method-fn http/delete :headers kitchen-delete-headers :cookies cookies)))
+            (let [{:keys [body] :as response} (make-request waiter-url status-location :http-method-fn http/delete
+                                                            :headers kitchen-delete-headers :cookies cookies)]
+              (assert-response-status response 200)
+              (is (str/includes? body "Deleted request-id")))))
         (Thread/sleep inter-router-metrics-interval-ms) ;; allow routers to sync metrics
         (let [service-data (service-settings waiter-url service-id)
               {:keys [async outstanding] :as request-counts}


Fix namespace

Fix namespace

--- test/clojure/clojurewerkz/cassaforte/client_test.clj
+++ test/clojure/clojurewerkz/cassaforte/client_test.clj
@@ -2,7 +2,7 @@
   (:refer-clojure :exclude [update])
   (:require [clojurewerkz.cassaforte.client :as client]
             [clojurewerkz.cassaforte.cql    :refer :all]
-            [clojurewerkz.cassaforte.query  :refer :all]
+            [clojurewerkz.cassaforte.query.dsl :refer :all]
             [clojure.test                   :refer :all])
   (:import [com.datastax.driver.core.policies TokenAwarePolicy RoundRobinPolicy]))


add detailed output on failure

add detailed output on failure

--- test/clj_money/import_test.clj
+++ test/clj_money/import_test.clj
@@ -11,7 +11,8 @@
             [clj-money.io :refer [read-bytes]]
             [clj-money.serialization :as serialization]
             [clj-money.factories.user-factory]
-            [clj-money.test-helpers :refer [reset-db]]
+            [clj-money.test-helpers :refer [reset-db
+                                            pprint-diff]]
             [clj-money.models.entities :as entities]
             [clj-money.models.commodities :as commodities]
             [clj-money.models.accounts :as accounts]
@@ -161,12 +162,16 @@
                                                 (:id entity))]
     (is entity "It returns a value")
     (is (= "Personal" (:name entity)) "It returns the new entity")
+    (pprint-diff expected-accounts actual-accounts)
     (is (= expected-accounts actual-accounts)
         "The correct accounts are created")
+    (pprint-diff expected-inc-stmt actual-inc-stmt)
     (is (= expected-inc-stmt actual-inc-stmt)
         "The income statement is correct after import")
+    (pprint-diff expected-bal-sheet actual-bal-sheet)
     (is (= expected-bal-sheet actual-bal-sheet)
         "The balance sheet is correct after import")
+    (pprint-diff expected-updates @updates)
     (is (= expected-updates @updates)
         "The import record is updated at each insert")))

@@ -234,6 +239,7 @@
                                      250M 275M 275M
                                      200M 200M 250M
                                      250M 275M 275M]}]}]
+    (pprint-diff expected actual)
     (is (= expected actual) "The budget exists after import with correct values")))

 (def gnucash-commodities-sample


Change to breakable to mirror Flash source

--- totem-destroyer/desktop/src-common/totem_destroyer/core.clj
+++ totem-destroyer/desktop/src-common/totem_destroyer/core.clj
@@ -66,7 +66,7 @@
 (defn get-entity-at-cursor
   [screen entities]
   (let [coords (input->screen screen (input! :get-x) (input! :get-y))]
-    (find-first (fn [{:keys [body width height brick?] :as entity}]
+    (find-first (fn [{:keys [body width height breakable?] :as entity}]
                   (let [rot (body! body :get-angle)
                         x-pos (x (body! body :get-position))
                         y-pos (y (body! body :get-position))]
@@ -79,7 +79,7 @@
                                  :set-origin 0 0
                                  :set-position x-pos y-pos)
                         (polygon! :contains (:x coords) (:y coords))
-                        (and brick?))))
+                        (and breakable?))))
                 entities)))

 (defscreen main-screen
@@ -92,7 +92,7 @@
                           :camera (orthographic :set-to-ortho true game-w game-h)
                           :world (box-2d 0 5)
                           :debug-renderer (Box2DDebugRenderer.))
-          brick (texture "1x1-transparent.png")
+          brick (texture "1x1.png")
           brick-1 (doto (create-brick-entity! screen brick 30 30)
                     (body-position! (/ 275 world-scale) (/ 435 world-scale) 0))
           brick-2 (doto (create-brick-entity! screen brick 30 30)
@@ -110,12 +110,12 @@
       (width! screen game-w)

       ; Return the entities
-      [(assoc brick-1 :brick? true)
-       (assoc brick-2 :brick? true)
-       (assoc brick-3 :brick? true)
-       (assoc brick-4 :brick? true)
-       (assoc brick-5 :brick? true)
-       (assoc brick-6 :brick? true)
+      [(assoc brick-1 :breakable? true)
+       (assoc brick-2 :breakable? true)
+       (assoc brick-3 :breakable? true)
+       (assoc brick-4 :breakable? false)
+       (assoc brick-5 :breakable? true)
+       (assoc brick-6 :breakable? false)
        (assoc idol :idol? true)
        (assoc floor :floor? true)]))

@@ -132,7 +132,7 @@

   :on-touch-down
   (fn [screen entities]
-    (let [brick (get-entity-at-cursor screen entities)]
+    (if-let [brick (get-entity-at-cursor screen entities)]
       (remove #(= brick %) entities))))

 (defgame totem-destroyer-game


Check that lein task has :target-path option

--- lein-less4j/src/leiningen/less4j.clj
+++ lein-less4j/src/leiningen/less4j.clj
@@ -45,6 +45,8 @@
    {:keys [source-paths target-path]
     :as options}
    watch?]
+  (when-not target-path
+    (main/abort "Lein-less4j requires :target-path option."))
   (let [project' (project/merge-profiles project [less4j-profile])
         main-files (vec (find-main-files source-paths))]
     (eval-in-project


Fixing CMR-4210 Clean up the error message for ShortName and Characteristics Name and Value. I added some more function documentation

--- umm-spec-lib/src/cmr/umm_spec/validation/platform.clj
+++ umm-spec-lib/src/cmr/umm_spec/validation/platform.clj
@@ -34,7 +34,9 @@
    with the model number. So the short name is not specific enough to identify
    specific platform instances. Therefore we are adding Characteristic names and values
    so that specific aircraft tail numbers, or boat IDS, etc. can be specified with the
-   short name."
+   short name. The |-| string is also added as a delimiter between the fields. This is used
+   in the getErrorString parameter-parser to parse out the different fields, so that a
+   meaningful error string can be suppplied back to the user."
   [values unique-fields]
   (let [{:keys [ShortName Characteristics Name Value]} unique-fields]
     (map (fn [value]
@@ -46,7 +48,7 @@

 (defn- getErrorString
   "Creates the error string for platforms depending on which elements (ShortName, Characteristic/Name, Characteristic/Value) are present.
-   The element order is ShortName, Name, Value"
+   The element order is ShortName, Name, Value. The values are separated by the |-| string."
   [duplicate-name]
   (let [platformElements (clojure.string/split duplicate-name #"\|-\|")
         platCounts (count platformElements)]


Fix contents of .dir-locals.el

Fix contents of .dir-locals.el

--- edge-app-template/src/clj/new/edge_app_template.clj
+++ edge-app-template/src/clj/new/edge_app_template.clj
@@ -23,7 +23,7 @@
              ["src/config.edn" (render "config.edn" data)]
              ["dev/dev.clj" (render "dev.clj" data)]
              ["dev/log_dev_app.properties" (render "log_dev_app.properties" data)]
-             [".dir-locals.el" (render "dir-locals.el")])
+             [".dir-locals.el" (render "dir-locals.el" data)])
     (binding [*force?* true]
       (when (:kick data)
         (->files data


Fix wrong call backend constructor on session example.

--- examples/sessionexample/src/sessionexample/core.clj
+++ examples/sessionexample/src/sessionexample/core.clj
@@ -81,7 +81,7 @@
   [& args]
   (let [;; Create new backend overwriting the default exception
         ;; handler for authorization handler.
-        backend (session-backend :unauthorized-handler unauthorized-handler)
+        backend (session-backend {:unauthorized-handler unauthorized-handler})

         ;; Wrap a routers handler with some middlewares
         ;; such as authorization, authentication, params


removed unused replica-query peer-allocation spec.

--- src/lib_onyx/replica_query_server.clj
+++ src/lib_onyx/replica_query_server.clj
@@ -81,15 +81,6 @@
     :f (fn [request log-subscriber replica]
          (let [peer-id (get-in request [:query-params "peer-id"])]
            (rq/peer-state replica (parse-uuid peer-id))))}
-
-   {:uri "/replica/peer-allocation"
-    :request-method :get}
-   {:doc (:doc (meta #'rq/peer-allocation))
-    :query-params-schema
-    {"peer-id" String}
-    :f (fn [request log-subscriber replica]
-         (let [peer-id (get-in request [:query-params "peer-id"])]
-           (rq/peer-allocation replica (parse-uuid peer-id))))}

    {:uri "/replica/job-scheduler"
     :request-method :get}


New tests: test-render-html-header-existence, test-render-html-footer-existence, test-search-href-existence, test-render-search-field-existence, and test-render-name-field-existence

--- test/zg/html_renderer_test.clj
+++ test/zg/html_renderer_test.clj
@@ -7,7 +7,7 @@
 ;  http://www.eclipse.org/legal/epl-v10.html
 ;
 ;  Contributors:
-;      Pavel Tisnovsky
+;      Pavel Tisnovsky
 ;

 (ns zg.html-renderer-test
@@ -23,3 +23,37 @@
     [function-name]
     (clojure.test/function? function-name))

+;
+; Test for existence of several functions.
+;
+
+(deftest test-render-html-header-existence
+    "Check that the zg.html-renderer/render-html-header definition exists."
+    (testing "if the zg.html-renderer/render-html-header definition exists."
+        (is (callable? 'zg.html-renderer/render-html-header))))
+
+
+(deftest test-render-html-footer-existence
+    "Check that the zg.html-renderer/render-html-footer definition exists."
+    (testing "if the zg.html-renderer/render-html-footer definition exists."
+        (is (callable? 'zg.html-renderer/render-html-footer))))
+
+
+(deftest test-search-href-existence
+    "Check that the zg.html-renderer/search-href definition exists."
+    (testing "if the zg.html-renderer/search-href definition exists."
+        (is (callable? 'zg.html-renderer/search-href))))
+
+
+(deftest test-render-search-field-existence
+    "Check that the zg.html-renderer/render-search-field definition exists."
+    (testing "if the zg.html-renderer/render-search-field definition exists."
+        (is (callable? 'zg.html-renderer/render-search-field))))
+
+
+(deftest test-render-name-field-existence
+    "Check that the zg.html-renderer/render-name-field definition exists."
+    (testing "if the zg.html-renderer/render-name-field definition exists."
+        (is (callable? 'zg.html-renderer/render-name-field))))
+
+


Add ability to execute shell command

Add ability to execute shell command

--- src/ui/core.cljs
+++ src/ui/core.cljs
@@ -1,6 +1,7 @@
 (ns ui.core
   (:require [figwheel.client :as fw :include-macros true]
-            [reagent.core :as reagent :refer [atom]]))
+            [reagent.core :as reagent :refer [atom]]
+            [clojure.string :as string]))

 (enable-console-print!)

@@ -9,6 +10,18 @@
   :jsload-callback (fn [] (print "reloaded")))

 (defonce state (atom 0))
+(defonce shell-result (atom ""))
+(defonce command (atom ""))
+
+(defonce proc (js/require "child_process"))
+
+(defn run-process []
+  (let [[cmd & args] (string/split @command #"\s")
+        p (.spawn proc cmd (clj->js args))]
+    (.on (.-stdout p)
+         "data"
+         #(swap! shell-result (fn [v] (str % v)))))
+  (reset! command ""))

 (defn root-component []
   [:div
@@ -25,7 +38,20 @@
     {:on-click #(swap! state inc)}
     (str "You clicked me "
          @state
-         " times")]])
+         " times")]
+   [:p
+    [:form
+     {:on-submit (fn [e]
+                   (run-process)
+                   (.preventDefault e))}
+     [:input#command
+      {:type :text
+       :on-change (fn [e]
+                    (reset! command
+                            (.-value (.-target e))))
+       :value @command
+       :placeholder "type in shell command"}]]]
+   [:pre @shell-result]])

 (reagent/render
   [root-component]


Continue to skip noir test under 1.5.x.

Continue to skip noir test under 1.5.x.

--- integration-tests/src/test/clojure/immutant/integs/web/noir.clj
+++ integration-tests/src/test/clojure/immutant/integs/web/noir.clj
@@ -23,7 +23,7 @@
 (defn run-tests? []
   (not (.startsWith
         (:full immutant.integs/*current-clojure-version*)
-        "1.5.0")))
+        "1.5")))

 (let [file *file*]
   (use-fixtures :once #(if (run-tests?)


updated display.cljs to use macro

updated display.cljs to use macro

--- resources/leiningen/new/threejs_game/src/cljs/display.cljs
+++ resources/leiningen/new/threejs_game/src/cljs/display.cljs
@@ -6,9 +6,9 @@
   "Given a camera, initiliaze it in scene (Three.Scene object) with
   [x y z] vector for initial position"
   [camera scene position]
-  (.add scene camera)
-  (apply #(.position.set camera %1 %2 %3) position)
-  (.lookAt camera (.-position scene))
+  ($ scene add camera)
+  (apply #($ camera position.set %1 %2 %3) position)
+  ($ camera lookAt ($ scene :position))
   camera)

 (defn create-perspective-camera
@@ -24,13 +24,13 @@
 (defn change-position!
   "Change the position of camera by delta vector [x y z]"
   [camera delta]
-  (let [x (.-position.x camera)
-        y (.-position.y camera)
-        z (.-position.z camera)]
-    (.position.set camera
-                   (+ x (nth delta 0))
-                   (+ y (nth delta 1))
-                   (+ z (nth delta 2)))))
+  (let [x ($ camera :position.x)
+        y ($ camera :position.y)
+        z ($ camera :position.z)]
+    ($ camera position.set
+       (+ x (nth delta 0))
+       (+ y (nth delta 1))
+       (+ z (nth delta 2)))))

 ;; sometimes there are issues with specific chrome builds
 ;; and you will get the console error
@@ -41,14 +41,14 @@
 (defn create-renderer
   []
   (let [renderer (js/THREE.WebGLRenderer. (clj->js {:antialias true}))]
-    (.setSize renderer
-              (.-innerWidth js/window)
-              (.-innerHeight js/window))
+    ($ renderer setSize
+       ($ js/window :innerWidth)
+       ($ js/window :innerHeight))
     renderer))

 (defn render
   [renderer scene camera]
-  (fn [] (.render renderer scene camera)))
+  (fn [] ($ renderer render scene camera)))

 (defn window-resize!
   "Update the renderer size and camera aspect based upon window size"


Handle thumbnails click.

Handle thumbnails click.

--- src/cljs/nonojure/puzzlebrowser.cljs
+++ src/cljs/nonojure/puzzlebrowser.cljs
@@ -56,6 +56,7 @@
         rating (get nono "rating")
         puzzle-id (get nono "id")]
     [:div.thumbnail
+     {:data-id puzzle-id}
      [:div.canvas-holder-outer
       [:div.canvas-holder-inner
        [:canvas {:width (* (inc width) cell-size)
@@ -132,7 +133,21 @@
           (reload-thumbnails )))))
   filter-div)

+(defn show-puzzle [puzzle]
+  (log (clj->js puzzle)))
+
+(defn add-thumbnail-listener []
+  (dommy/listen! [@root :.thumbnail] :click
+    (fn [event]
+      (let [thumb (.-selectedTarget event)
+            id (dommy/attr thumb :data-id)
+            url (str "/api/nonograms/" id)]
+        (ajax url {:success #(show-puzzle (js->clj %))
+                   :error #(do (log "Error loading puzzle")
+                               (log %))})))))
+
 (defn ^:export init []
   (reset! root (sel1 :#browser))
   (dommy/append! @root (add-filtering-listener (filtering)))
+  (add-thumbnail-listener)
   (reload-thumbnails))


Parses and logs a request from API gateway


documented D3 example

documented D3 example

--- src/tutorial/untangled_tutorial/B_UI.cljs
+++ src/tutorial/untangled_tutorial/B_UI.cljs
@@ -212,32 +212,6 @@
          {:number 42 :people [{:name "Sally"}] :b false}
          {:inspect-data true
           :history      true})
-
-(defcard-doc
-  "
-
-  ## Stateful Components
-
-  Earlier we stress that your components should be stateless whenever possible. There are a few
-  notable exceptions that we have found useful (or even necessary):
-
-  - The Untangled support viewer shows each app state change. User input (each letter they type) can
-  be quite tedious to watch in a support viewer. Moving these kinds of interstitial form interactions
-  into local state causes little harm, and greatly enhances support. Om automatically hooks up local
-  state to input fields.
-  - External library integration. We use stateful components to make things like D3 visualizations.
-
-  ### Form inputs
-
-  Om already hooks local state to form elements. So, in fact, you have to override this to *not* use
-  component local state. For text controls we'd recommend you leave it this way. For other controls like
-  checkboxes it is probably best to override this (demonstrated later).
-
-  ### External Library State (a D3 example)
-
-  Say you want to draw something with D3. D3 has it's own DOM diffing algorithms, and you want to
-  make sure React doesn't muck with the DOM. The following component demonstrates1G
-  ")

 (defn render-squares [component props]
   (let [svg (-> js/d3 (.select (dom/node component)))
@@ -272,9 +246,51 @@
       (render-squares this props)
       false))
   (render [this]
-    (dom/svg #js {:width 100 :height 100 :viewBox "0 0 1000 1000"})))
+    (dom/svg (clj->js {:style   {:backgroundColor "rgb(240,240,240)"}
+                       :width   200 :height 200
+                       :viewBox "0 0 1000 1000"}))))

 (def d3-thing (om/factory D3Thing))
+
+
+(defcard-doc
+  "
+
+  ## Stateful Components
+
+  Earlier we stress that your components should be stateless whenever possible. There are a few
+  notable exceptions that we have found useful (or even necessary):
+
+  - The Untangled support viewer shows each app state change. User input (each letter they type) can
+  be quite tedious to watch in a support viewer. Moving these kinds of interstitial form interactions
+  into local state causes little harm, and greatly enhances support. Om automatically hooks up local
+  state to input fields.
+  - External library integration. We use stateful components to make things like D3 visualizations.
+
+  ### Form inputs
+
+  Om already hooks local state to form elements. So, in fact, you have to override this to *not* use
+  component local state. For text controls we'd recommend you leave it this way. For other controls like
+  checkboxes it is probably best to override this (demonstrated later).
+
+  ### External Library State (a D3 example)
+
+  Say you want to draw something with D3. D3 has it's own DOM diffing algorithms, and you want to
+  make sure React doesn't muck with the DOM. The following component demonstrates how you would go about it.
+
+  First, the actual rendering code that expects the component and the props (which have to
+  be converted to JS data types to work) (See D3 Tutorials on the Web):
+  "
+
+  (dc/mkdn-pprint-source render-squares)
+
+  "And the component itself:"
+
+  (dc/mkdn-pprint-source D3Thing)
+  (dc/mkdn-pprint-source d3-thing)
+
+  "Here it is integrated into a dev card with some controls to manipulate the data:"
+  )

 (defn random-square []
   {
@@ -296,12 +312,22 @@
            (dom/div nil
                     (dom/button #js {:onClick #(add-square state-atom)} "Add Random Square")
                     (dom/button #js {:onClick #(reset! state-atom {:squares []})} "Clear")
+                    (dom/br nil)
+                    (dom/br nil)
                     (d3-thing @state-atom)))
          {:squares []}
          {:inspect-data true})

 (defcard-doc
   "
+
+  The things to note for this example are:
+
+  - We override the React lifecycle method `shouldComponentUpdate` to do the actual D3 update, and then return false.
+  This ensures React and D3 don't fight over the DOM for the component.
+  - We also override `componentDidMount` to do an initial render in D3.
+  - Note: As of Om 1.0.0 Alpha 30 the method of obtaining the properties differs a bit, as shown. This may have
+  changed since this writing.

   ## Important Notes and Further Reading


Fixed SQL error

Fixed SQL error

Which would stop us making a new app

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -2104,7 +2104,7 @@
               "select   fk_appshare_publisher_id   from   appshare_users_publishers   where fk_appshare_user_id = ? and default_publisher = 'T'" [user-id]))

           publisher
-          (if publisher-id (sql-1 "select id, publisher_name, from appshare_publishers where id = ?" [publisher-id]))]
+          (if publisher-id (sql-1 "select   id, publisher_name   from appshare_publishers where id = ?" [publisher-id]))]

       publisher)))

@@ -2114,8 +2114,8 @@

 (defn get-user-for-session-id   [session-id]
   (if session-id
-    (let [user-id  (:fk_appshare_user_id (sql-1 "select fk_appshare_user_id from appshare_web_sessions where session_id = ?" [session-id]))
-          user     (if user-id (sql-1 "select id, user_name, from appshare_users where id = ?" [user-id]))]
+    (let [user-id  (:fk_appshare_user_id (sql-1 "select  fk_appshare_user_id  from  appshare_web_sessions  where  session_id = ?" [session-id]))
+          user     (if user-id (sql-1 "select  id, user_name  from appshare_users where id = ?" [user-id]))]
       user)))


Remove commas, use zero?

Remove commas, use zero?

--- clojure/beer-song/beer.clj
+++ clojure/beer-song/beer.clj
@@ -3,9 +3,9 @@

 (defn- count-string [count]
   (cond
-    (= count 0) "no more bottles"
-    (= count 1) "1 bottle"
-    :else (str/join [count, " bottles"])))
+    (zero? count) "no more bottles"
+    (= count 1)   "1 bottle"
+    :else         (str/join [count, " bottles"])))

 (defn- beer-string [count]
   (if (= count 1)
@@ -14,24 +14,24 @@

 (defn- first-strophe [count]
   (str/capitalize
-    (str/join [(count-string count),
-      " of beer on the wall, ",
-      (count-string count),
+    (str/join [(count-string count)
+      " of beer on the wall, "
+      (count-string count)
       " of beer."])))

 (defn- second-strophe [count]
-  (if (= 0 count)
+  (if (zero? count)
     "Go to the store and buy some more, 99 bottles of beer on the wall.\n"
-    (str/join ["Take ",
-      (beer-string count),
-      " down and pass it around, ",
-      (count-string (- count 1)),
+    (str/join ["Take "
+      (beer-string count)
+      " down and pass it around, "
+      (count-string (- count 1))
       " of beer on the wall.\n"])))

 (defn verse [count]
-  (str/join "\n" [(first-strophe count), (second-strophe count)]))
+  (str/join "\n" [(first-strophe count) (second-strophe count)]))

 (defn sing
   ([begin] (sing begin 0))
-  ([begin,end]
+  ([begin end]
     (str/join [(str/join "\n" (map verse (range begin (- end 1) -1))) "\n"])))


Tidy up namespaces

Tidy up namespaces

--- backend/specs/akvo/lumen/specs/aggregation.clj
+++ backend/specs/akvo/lumen/specs/aggregation.clj
@@ -4,26 +4,20 @@
             [akvo.lumen.lib.aggregation.bubble :as aggregation.bubble]
             [akvo.lumen.lib.aggregation.line :as aggregation.line]
             [akvo.lumen.lib.aggregation.pie :as aggregation.pie]
+            [akvo.lumen.lib.aggregation.pivot :as aggregation.pivot]
             [akvo.lumen.lib.aggregation.scatter :as aggregation.scatter]
-            [akvo.lumen.lib.aggregation.pivot :as aggregation.pivot]
             [akvo.lumen.postgres.filter :as postgres.filter]
-            [akvo.lumen.specs :as lumen.s :refer (sample)]
             [akvo.lumen.specs.db :as db.s]
-            [akvo.lumen.specs.db :as db.s]
-            [akvo.lumen.util :as u]
-            [clojure.spec.alpha :as s]
-            [clojure.spec.gen.alpha :as gen]
-            [clojure.string :as string]
-            [clojure.tools.logging :as log]))
+            [clojure.spec.alpha :as s]))

 (create-ns  'akvo.lumen.specs.aggregation.query)
 (alias 'aggregation.query.s 'akvo.lumen.specs.aggregation.query)

-(alias 'db.dsv.column 'akvo.lumen.specs.db.dataset-version.column)
-(alias 'db.dsv 'akvo.lumen.specs.db.dataset-version)
+(alias 'db.dsv.column.s 'akvo.lumen.specs.db.dataset-version.column)
+(alias 'db.dsv.s 'akvo.lumen.specs.db.dataset-version)

-(s/def ::aggregation/dataset (s/keys :req-un [::db.dsv/columns ::db.dsv/table-name]))
-(s/def ::aggregation.pie/bucketColumn ::db.dsv.column/columnName)
+(s/def ::aggregation/dataset (s/keys :req-un [::db.dsv.s/columns ::db.dsv.s/table-name]))
+(s/def ::aggregation.pie/bucketColumn ::db.dsv.column.s/columnName)
 (s/def ::aggregation.pie/query (s/keys :req-un [::postgres.filter/filters
                                                 ::aggregation.pie/bucketColumn]))

@@ -34,9 +28,9 @@
 	 :query ::aggregation.pie/query)
   :ret any?)

-(s/def ::aggregation.pivot/categoryColumn ::db.dsv.column/columnName)
-(s/def ::aggregation.pivot/rowColumn ::db.dsv.column/columnName)
-(s/def ::aggregation.pivot/valueColumn ::db.dsv.column/columnName)
+(s/def ::aggregation.pivot/categoryColumn ::db.dsv.column.s/columnName)
+(s/def ::aggregation.pivot/rowColumn ::db.dsv.column.s/columnName)
+(s/def ::aggregation.pivot/valueColumn ::db.dsv.column.s/columnName)
 (s/def ::aggregation.pivot/aggregation #{"mean"
                                          "sum"
                                          "min"
@@ -56,9 +50,9 @@
 	 :query ::aggregation.pivot/query)
   :ret any?)

-(s/def ::aggregation.bar/bucketColumn (s/nilable ::db.dsv.column/columnName))
-(s/def ::aggregation.bar/subBucketColumn (s/nilable ::db.dsv.column/columnName))
-(s/def ::aggregation.bar/metricColumnY (s/nilable ::db.dsv.column/columnName))
+(s/def ::aggregation.bar/bucketColumn (s/nilable ::db.dsv.column.s/columnName))
+(s/def ::aggregation.bar/subBucketColumn (s/nilable ::db.dsv.column.s/columnName))
+(s/def ::aggregation.bar/metricColumnY (s/nilable ::db.dsv.column.s/columnName))
 (s/def ::aggregation.bar/metricAggregation (s/nilable #{"mean"
                                                         "sum"
                                                         "min"
@@ -85,8 +79,8 @@
 	 :query ::aggregation.bar/query)
   :ret any?)

-(s/def ::aggregation.bubble/bucketColumn ::db.dsv.column/columnName)
-(s/def ::aggregation.bubble/metricColumn (s/nilable ::db.dsv.column/columnName))
+(s/def ::aggregation.bubble/bucketColumn ::db.dsv.column.s/columnName)
+(s/def ::aggregation.bubble/metricColumn (s/nilable ::db.dsv.column.s/columnName))
 (s/def ::aggregation.bubble/metricAggregation ::aggregation.bar/metricAggregation)

 (s/def ::aggregation.bubble/query (s/keys :req-un [::postgres.filter/filters
@@ -101,8 +95,8 @@
 	 :query ::aggregation.bubble/query)
   :ret any?)

-(s/def ::aggregation.line/metricColumnX ::db.dsv.column/columnName)
-(s/def ::aggregation.line/metricColumnY ::db.dsv.column/columnName)
+(s/def ::aggregation.line/metricColumnX ::db.dsv.column.s/columnName)
+(s/def ::aggregation.line/metricColumnY ::db.dsv.column.s/columnName)
 (s/def ::aggregation.line/metricAggregation (s/nilable ::aggregation.bar/metricAggregation))

 (s/def ::aggregation.line/query (s/keys :req-un [::postgres.filter/filters
@@ -117,12 +111,12 @@
 	 :query ::aggregation.line/query)
   :ret any?)

-(s/def ::aggregation.scatter/metricColumnX ::db.dsv.column/columnName)
-(s/def ::aggregation.scatter/metricColumnY ::db.dsv.column/columnName)
-(s/def ::aggregation.scatter/metricColumnSize (s/nilable ::db.dsv.column/columnName))
-(s/def ::aggregation.scatter/bucketColumnCategory (s/nilable ::db.dsv.column/columnName))
-(s/def ::aggregation.scatter/datapointLabelColumn (s/nilable ::db.dsv.column/columnName))
-(s/def ::aggregation.scatter/bucketColumn (s/nilable ::db.dsv.column/columnName))
+(s/def ::aggregation.scatter/metricColumnX ::db.dsv.column.s/columnName)
+(s/def ::aggregation.scatter/metricColumnY ::db.dsv.column.s/columnName)
+(s/def ::aggregation.scatter/metricColumnSize (s/nilable ::db.dsv.column.s/columnName))
+(s/def ::aggregation.scatter/bucketColumnCategory (s/nilable ::db.dsv.column.s/columnName))
+(s/def ::aggregation.scatter/datapointLabelColumn (s/nilable ::db.dsv.column.s/columnName))
+(s/def ::aggregation.scatter/bucketColumn (s/nilable ::db.dsv.column.s/columnName))
 (s/def ::aggregation.scatter/metricAggregation (s/nilable ::aggregation.bar/metricAggregation))

 (s/def ::aggregation.scatter/query (s/keys :req-un [::postgres.filter/filters


Handle k8s watch resourceVersion too old errors gracefully (#568)

--- waiter/src/waiter/scheduler/kubernetes.clj
+++ waiter/src/waiter/scheduler/kubernetes.clj
@@ -91,14 +91,18 @@
 (defn replicaset->Service
   "Convert a Kubernetes ReplicaSet JSON response into a Waiter Service record."
   [replicaset-json]
-  (try
-    (pc/letk
-      [[spec
-        [:metadata name namespace [:annotations waiter/service-id]]
-        [:status {replicas 0} {availableReplicas 0} {readyReplicas 0} {unavailableReplicas 0}]]
-       replicaset-json
-       requested (get spec :replicas 0)
-       staged (- replicas (+ availableReplicas unavailableReplicas))]
+  (if (contains? replicaset-json :error)
+    (do
+      (log/info "encountered error response in ReplicaSet query:" replicaset-json)
+      nil)
+    (try
+      (pc/letk
+        [[spec
+          [:metadata name namespace [:annotations waiter/service-id]]
+          [:status {replicas 0} {availableReplicas 0} {readyReplicas 0} {unavailableReplicas 0}]]
+         replicaset-json
+         requested (get spec :replicas 0)
+         staged (- replicas (+ availableReplicas unavailableReplicas))]
         (scheduler/make-Service
           {:id service-id
            :instances requested
@@ -109,8 +113,8 @@
                         :running (- replicas staged)
                         :staged staged
                         :unhealthy (- replicas readyReplicas staged)}}))
-    (catch Throwable t
-      (log/error t "error converting ReplicaSet to Waiter Service"))))
+      (catch Throwable t
+        (log/error t "error converting ReplicaSet to Waiter Service")))))

 (defn k8s-object->id
   "Get the id (name) from a ReplicaSet or Pod's metadata"
@@ -432,8 +436,13 @@
                          (service-description->namespace service-description) "/replicasets")
         response-json (api-request request-url scheduler
                                    :body (utils/clj->json spec-json)
-                                   :request-method :post)]
-    (some-> response-json replicaset->Service)))
+                                   :request-method :post)
+        service (some-> response-json replicaset->Service)]
+    (when-not service
+      (throw (ex-info "failed to create service"
+                      {:service-description service-description
+                       :service-id service-id})))
+    service))

 (defn- delete-service
   "Delete the Kubernetes ReplicaSet corresponding to a Waiter Service.


made rest of translating.clj use the new translate function; also renames

--- src/midje/midje_forms/translating.clj
+++ src/midje/midje_forms/translating.clj
@@ -14,20 +14,28 @@
         [midje.util.form-utils :only (pairs)])
   (:require [clojure.zip :as zip]))

+
+(defn first-true [preds & args]
+  (when (seq preds)
+    (if (apply (first preds) args)
+        (first preds)
+        (apply first-true (rest preds) args))))
+
+(defn translate [form & preds+translate-fns]
+  (loop [loc (zip/seq-zip form)]
+      (if (zip/end? loc)
+          (zip/root loc)
+          (if-let [true-fn (first-true (map first (partition 2 preds+translate-fns)) loc)]
+            (recur (zip/next ((get (apply hash-map preds+translate-fns) true-fn) loc)))
+            (recur (zip/next loc))))))
+
 ;; Translating a form into an equivalent form with all arrow sequences given
 ;; line numbers.

 (defn add-line-numbers [form]
-  (loop [loc (zip/seq-zip form)]
-    (if (zip/end? loc)
-      (zip/root loc)
-      (recur (zip/next (cond (namespacey-match all-arrows loc)
-                             (add-line-number-to-end-of-arrow-sequence__then__no-movement
-                               (arrow-line-number loc) loc)
-
-                             :else loc))))))
-
-
+  (translate form
+    (fn [loc] (namespacey-match all-arrows loc))
+    (fn [loc] (add-line-number-to-end-of-arrow-sequence__then__no-movement (arrow-line-number loc) loc))))

  ;; Translating sweet forms into their semi-sweet equivalent
@@ -37,23 +45,8 @@
         fake-bodies (partition-arrow-forms fakes)]
     (map make-fake fake-bodies)))

-
-(defn first-true-fn [ preds arg]
-  (when (seq preds)
-    (if ((first preds) arg)
-        (first preds)
-        (first-true-fn (rest preds) arg))))
-
-(defn transform [form & more]
-  (loop [loc (zip/seq-zip form)]
-      (if (zip/end? loc)
-          (zip/root loc)
-          (if-let [true-fn (first-true-fn (map first (partition 2 more)) loc)]
-            (recur (zip/next ((get (apply hash-map more) true-fn) loc)))
-            (recur (zip/next loc))))))
-
 (defn translate-fact-body [multi-form]
-  (transform multi-form
+  (translate multi-form
     is-start-of-check-sequence?
     wrap-with-expect__then__at-rightmost-expect-leaf

@@ -64,7 +57,6 @@

     is-semi-sweet-keyword?
     skip-to-rightmost-leaf))
-

 (declare midjcoexpand)

@@ -220,7 +212,7 @@

 (defn unfold-prerequisites [form]
   (with-fresh-generated-metadata-names
-    (transform form
+    (translate form
         loc-is-at-full-expect-form?
         unfold-expect-form__then__stay_put)))

@@ -258,10 +250,10 @@
     (str "{" (str-join ", " entries) "}")))

 (defn add-one-binding-note [expect-containing-form ordered-binding-map]
-  (transform expect-containing-form
-  	  loc-is-at-full-expect-form?
-  	  (fn [loc] (skip-to-rightmost-leaf
-             (add-key-value-within-arrow-branch__then__at_arrow :binding-note (binding-note ordered-binding-map) loc)))))
+  (translate expect-containing-form
+    loc-is-at-full-expect-form?
+    (fn [loc] (skip-to-rightmost-leaf
+      (add-key-value-within-arrow-branch__then__at_arrow :binding-note (binding-note ordered-binding-map) loc)))))

 (defn add-binding-notes [expect-containing-forms ordered-binding-maps]
   (map (partial apply add-one-binding-note)


Improve error message.

Improve error message.

--- src/onyx/windowing/window_compile.clj
+++ src/onyx/windowing/window_compile.clj
@@ -55,7 +55,7 @@
           (filter-ns-key-map "trigger")
           (into locals)
           (assoc :trigger trigger)
-          (assoc :idx (or (get indices [id window-id]) (throw (Exception.))))
+          (assoc :idx (or (get indices [id window-id]) (throw (Exception. "Could not find state index for window id."))))
           (assoc :id (:trigger/id trigger))
           (assoc :sync-fn sync-fn)
           (assoc :emit-fn emit-fn)


Replace implementation of term-frequency with frequencies function.

--- project/analyze-data/src/analyze_data/tf_idf/term_frequency.clj
+++ project/analyze-data/src/analyze_data/tf_idf/term_frequency.clj
@@ -3,7 +3,7 @@
 (defn term-frequency
   "Return a map from term to number of times it appears in terms."
   [terms]
-  (reduce (fn [m term] (assoc m term (inc (get m term 0)))) {} terms))
+  (frequencies terms))

 (defn calc-normalized-term-frequency
   "Normalize term-frequency based on max-term-frequency."


[ISSUE #3429] Use proper etherscan URLs

[ISSUE #3429] Use proper etherscan URLs

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/utils/transactions.cljs
+++ src/status_im/utils/transactions.cljs
@@ -1,27 +1,32 @@
 (ns status-im.utils.transactions
   (:require [status-im.utils.utils :as utils]
-            [status-im.utils.types :as types]
-            [status-im.utils.money :as money]))
+            [status-im.utils.types :as types]))
+
+(defn- get-network-subdomain [network]
+  (case network
+    ("testnet" "testnet_rpc") "ropsten"
+    ("mainnet" "mainnet_rpc") nil
+    ("rinkeby" "rinkeby_rpc") "rinkeby"))
+
+(defn get-transaction-details-url [network hash]
+  (let [network-subdomain (get-network-subdomain network)]
+    (str "https://" (when network-subdomain (str network-subdomain ".")) "etherscan.io/tx/" hash)))

 (def etherscan-api-key "DMSI4UAAKUBVGCDMVP3H2STAMSAUV7BYFI")

-(defn get-network-subdomain [network]
+(defn- get-api-network-subdomain [network]
   (case network
     ("testnet" "testnet_rpc") "api-ropsten"
     ("mainnet" "mainnet_rpc") "api"
     ("rinkeby" "rinkeby_rpc") "api-rinkeby"))

-(defn get-transaction-details-url [network hash]
-  (let [network-subdomain (get-network-subdomain network)]
-    (str "https://" network-subdomain ".etherscan.io/tx/" hash)))
-
 (defn get-transaction-url [network account]
-  (let [network-subdomain (get-network-subdomain network)]
+  (let [network-subdomain (get-api-network-subdomain network)]
     (str "https://" network-subdomain ".etherscan.io/api?module=account&action=txlist&address=0x"
          account "&startblock=0&endblock=99999999&sort=desc&apikey=" etherscan-api-key "?q=json")))

 (defn- format-transaction [account {:keys [value timeStamp blockNumber hash from to gas gasPrice gasUsed nonce confirmations input]}]
-  (let [inbound?    (= (str "0x" account) to)]
+  (let [inbound? (= (str "0x" account) to)]
     {:value value
      ;; timestamp is in seconds, we convert it in ms
      :timestamp (str timeStamp "000")


Add support for cleaning up afterglow-max bindings

--- src/afterglow/web/routes/web_repl.clj
+++ src/afterglow/web/routes/web_repl.clj
@@ -59,9 +59,27 @@
       (store-bindings-for ~session-key)
       r#)))

-(defn do-eval [txt session-key]
+(defn discard-bindings
+  "Clean up the thread-local bindings stored for a non-web hosted repl
+  session, such as those used by
+  [afterglow-max](https://github.com/brunchboy/afterglow-max#afterglow-max),
+  which are not automatically timed out. `session-key` is the unique,
+  non-String key used to identify the REPL session to [[do-eval]]."
+  [session-key]
+  (dosync
+   (commute repl-sessions dissoc session-key)))
+
+(defn do-eval
   "Evaluate an expression sent to the web REPL and return the result
-  or an error description."
+  or an error description. Also supports evaluation of expressions in
+  non-web hosting contexts like
+  [afterglow-max](https://github.com/brunchboy/afterglow-max#afterglow-max)
+  by passing in a unique non-String value for `session-key`. In such
+  cases the thread local bindings will not be automatically cleaned
+  up, and it is the responsibility of the hosting implementation to
+  call [[discard-bindings]] when they are no longer needed."
+  {:doc/format :markdown}
+  [txt session-key]
   (with-session session-key
     (let [form (binding [*read-eval* false] (read-string txt))]
       (with-open [writer (java.io.StringWriter.)]
@@ -91,6 +109,7 @@
   environment like
   [afterglow-max](https://github.com/brunchboy/afterglow-max#afterglow-max),
   which does not expire."
+  {:doc/format :markdown}
   [web-sessions [id _]]
   (or (not (string? id))
       (some? (web-sessions id))))


CMR-688: Added tests for opendata spatial.

--- system-int-test/test/cmr/system_int_test/search/collection_search_format_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_search_format_test.clj
@@ -300,8 +300,8 @@
            [-180 90 0 -90] [g2]))))

 (deftest search-collection-various-formats
-  (let [ru1 (dc/related-url "GET DATA" "http://example.com")
-        ru2 (dc/related-url "GET DATA" "http://example2.com")
+  (let [ru1 (dc/related-url "GET DATA" "application/json" "http://example.com")
+        ru2 (dc/related-url "GET DATA" "text/xml" "http://example2.com")
         ru3 (dc/related-url "GET RELATED VISUALIZATION" "application/xml" "http://example.com/browse")
         op1 {:swath-width 1450.0
              :period 98.88
@@ -359,20 +359,62 @@
         coll4 (d/ingest "PROV1"
                         (dc/collection {:entry-title "Dataset4"}) :iso-smap)
         coll5 (d/ingest "PROV1"
-                        (dc/collection {:entry-title "Dataset5"}) :dif)]
+                        (dc/collection {:entry-title "Dataset5"}) :dif)
+        coll6 (d/ingest "PROV1"
+                        (dc/collection {:entry-title "Dataset6"
+                                        :short-name "ShortName#6"
+                                        :version-id "Version6"
+                                        :summary "Summary of coll6"
+                                        :organizations [(dc/org :archive-center "Larc")]
+                                        :beginning-date-time "2010-01-01T12:00:00Z"
+                                        :ending-date-time "2010-01-11T12:00:00Z"
+                                        :spatial-coverage
+                                        (dc/spatial {:sr :cartesian
+                                                     :gsr :cartesian
+                                                     :geometries [(p/point 1 2)
+                                                                  (p/point -179.9 89.4)]})}))
+        coll7 (d/ingest "PROV1"
+                        (dc/collection {:entry-title "Dataset7"
+                                        :short-name "ShortName#7"
+                                        :version-id "Version7"
+                                        :summary "Summary of coll7"
+                                        :organizations [(dc/org :archive-center "Larc")]
+                                        :beginning-date-time "2010-01-01T12:00:00Z"
+                                        :ending-date-time "2010-01-11T12:00:00Z"
+                                        :spatial-coverage
+                                        (dc/spatial {:sr :cartesian
+                                                     :gsr :cartesian
+                                                     :geometries [(l/ords->line-string nil 0 0, 0 1, 0 -90, 180 0)
+                                                                  (l/ords->line-string nil 1 2, 3 4, 5 6, 7 8)]})}))
+        coll8 (d/ingest "PROV1"
+                        (dc/collection {:entry-title "Dataset8"
+                                        :short-name "ShortName#8"
+                                        :version-id "Version8"
+                                        :summary "Summary of coll8"
+                                        :organizations [(dc/org :archive-center "Larc")]
+                                        :beginning-date-time "2010-01-01T12:00:00Z"
+                                        :ending-date-time "2010-01-11T12:00:00Z"
+                                        :spatial-coverage
+                                        (dc/spatial {:sr :cartesian
+                                                     :gsr :cartesian
+                                                     :geometries [(m/mbr -180 90 180 -90)
+                                                                  (m/mbr -10 20 30 -40)]})}))]

     (index/refresh-elastic-index)

     (testing "kml"
       (let [results (search/find-concepts-kml :collection {})]
-        (dk/assert-collection-kml-results-match [coll1 coll2 coll3 coll4 coll5] results)))
+        (dk/assert-collection-kml-results-match [coll1 coll2 coll3 coll4 coll5 coll6 coll7
+                                                 coll8] results)))

     (testing "opendata"
       (let [results (search/find-concepts-opendata :collection {})]
-        (od/assert-collection-opendata-results-match [coll1 coll2 coll3 coll4 coll5] results))
+        (od/assert-collection-opendata-results-match [coll1 coll2 coll3 coll4 coll5 coll6 coll7
+                                                      coll8] results))
       (testing "as extension"
         (let [results (search/find-concepts-opendata :collection {} {:url-extension "opendata"})]
-          (od/assert-collection-opendata-results-match [coll1 coll2 coll3 coll4 coll5] results)))
+          (od/assert-collection-opendata-results-match [coll1 coll2 coll3 coll4 coll5 coll6 coll7
+                                                        coll8] results)))
       (testing "no opendata support for granules"
         (is (= {:errors ["The mime type [application/opendata+json] is not supported for granules."],
                 :status 400}
@@ -384,7 +426,8 @@
             {:keys [status results]} response]
         (is (= [200 coll-atom] [status results])))

-      (let [coll-atom (da/collections->expected-atom [coll1 coll2 coll3 coll4 coll5] "collections.atom")
+      (let [coll-atom (da/collections->expected-atom [coll1 coll2 coll3 coll4 coll5 coll6 coll7
+                                                      coll8] "collections.atom")
             response (search/find-concepts-atom :collection {})
             {:keys [status results]} response]
         (is (= [200 coll-atom] [status results])))
@@ -410,7 +453,8 @@
             {:keys [status results]} response]
         (is (= [200 coll-json] [status results])))

-      (let [coll-json (da/collections->expected-atom [coll1 coll2 coll3 coll4 coll5] "collections.json")
+      (let [coll-json (da/collections->expected-atom [coll1 coll2 coll3 coll4 coll5 coll6 coll7
+                                                      coll8] "collections.json")
             response (search/find-concepts-json :collection {})
             {:keys [status results]} response]
         (is (= [200 coll-json] [status results])))


Update to ClojureScript 0.0-3053

Update to ClojureScript 0.0-3053

--- Clojure/project.clj
+++ Clojure/project.clj
@@ -4,7 +4,7 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-3030"]
+                 [org.clojure/clojurescript "0.0-3053"]
                  [com.github.rickyclarkson/jmdns "3.4.2-r353-1"]]
   :source-paths ["src"]
   :compiler {


a little more documentation

a little more documentation

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

--- plugins/SlideExplorer2/src/slide_explorer/setup.clj
+++ plugins/SlideExplorer2/src/slide_explorer/setup.clj
@@ -25,6 +25,11 @@
   1: Hide or show 1x view

 For live data sets:
+
+  Channels and z-stack settings are
+  borrowed from the multi-dimensional acquisition
+  window.
+
   Ctrl/Cmd + Click: Add/remove positions
   Double-click: Navigate to location


Fix a duplicate key error

Fix a duplicate key error

--- src/circle/backend/project/circle.clj
+++ src/circle/backend/project/circle.clj
@@ -23,8 +23,7 @@
                    (checkout)
                    (bash [(lein deps)])
                    (bash [(lein midje)])
-                   (stop-nodes)]
-         :group circle/circle-group))
+                   (stop-nodes)]))

 (defn circle-deploy []
   (->
@@ -33,7 +32,7 @@
           :type :deploy
           :vcs-type :git
           :vcs-url "git@github.com:arohner/CircleCI.git"
-          :vcs-revision "981961d3ab114ba7e3ed299c202c5874ac4ea8f7"
+          :vcs-revision "ecbf093e526ec7e4388f947469cb1224acef59f9"
           :aws-credentials circle.aws-credentials/AWS-access-credentials
           :r53-zone-id "ZBVDNEPFXWZR2"
           :num-nodes 1


refactoring or arithmetic dsl

refactoring or arithmetic dsl


add default-commodity-id to entities validation

--- src/clj/clj_money/models/entities.clj
+++ src/clj/clj_money/models/entities.clj
@@ -22,7 +22,8 @@
 (s/def ::user-id integer?)
 (s/def ::monitored-account-ids (s/coll-of integer?))
 (s/def ::inventory-method #{:fifo :lifo})
-(s/def ::settings (s/keys :opt-un [::inventory-method ::monitored-account-ids]))
+(s/def ::default-commodity-id integer?)
+(s/def ::settings (s/keys :opt-un [::inventory-method ::monitored-account-ids ::default-commodity-id]))
 (s/def ::new-entity (s/keys :req-un [::name ::user-id] :opt-un [::settings]))
 (s/def ::existing-entity (s/keys :req-un [::id ::name] :opt-un [::user-id ::settings]))


use new criteria style for partitioning

use new criteria style for partitioning

--- src/clj_money/models/transactions.clj
+++ src/clj_money/models/transactions.clj
@@ -665,9 +665,9 @@
   [storage-spec account-id date]
   (with-storage [s storage-spec]
     (first (select-transaction-items s
-                                     {:i.account-id account-id
-                                      :t.transaction-date [:<= date]}
-                                     {:sort [[:t.transaction-date :desc] [:i.index :desc]]
+                                     {:account-id account-id
+                                      :transaction-date [:between nil date]}
+                                     {:sort [[:i.transaction-date :desc] [:i.index :desc]]
                                       :limit 1}))))

 (defn balance-delta


Simplify context code

Simplify context code

--- src/clojure/nightcode/completions.clj
+++ src/clojure/nightcode/completions.clj
@@ -3,10 +3,7 @@
             [clojure.java.io :as io]
             [compliment.core :as compliment]
             [nightcode.ui :as ui]
-            [nightcode.utils :as utils]
-            [paredit.loc-utils :as loc-utils]
-            [paredit.static-analysis :as static-analysis]
-            [paredit.parser :as parser])
+            [nightcode.utils :as utils])
   (:import [java.awt.event KeyEvent KeyListener]
            [javax.swing JComponent KeyStroke]
            [org.fife.ui.autocomplete
@@ -29,13 +26,7 @@
         all-text (.getText text-area)
         first-str (subs all-text 0 (- caretpos (count prefix)))
         second-str (subs all-text caretpos)]
-    (-> (str first-str "__prefix__" second-str)
-        parser/parse
-        loc-utils/parsed-root-loc
-        (static-analysis/top-level-code-form caretpos)
-        first
-        loc-utils/node-text
-        (try (catch Exception _)))))
+    (str first-str "__prefix__" second-str)))

 (defn get-clojure-completions
   [prefix ns context]


update server to use release

update server to use release

--- src/meta/boot.clj
+++ src/meta/boot.clj
@@ -57,7 +57,7 @@
   [d develop bool "Development mode will compile with optomizations `:none`."]
   (cond-> (njs/nodejs)
     (:develop *opts*)       (comp (shadow/compile :build :server))
-    (not (:develop *opts*)) (comp (shadow/compile :build :server))))
+    (not (:develop *opts*)) (comp (shadow/release :build :server))))

 (boot/deftask teardown
   "Teardown cross project builds."


Added a new 'immediate-exit' flag to support redirects that must not cause any matching web function to be called.

--- src/main/clojure/plugboard/webfunction/plugboards.clj
+++ src/main/clojure/plugboard/webfunction/plugboards.clj
@@ -84,7 +84,7 @@
      (number? s) (= s status)
      ;; if there is no status declared we select the function if the
      ;; status is not an error.
-     :otherwise (< status 300))))
+     :otherwise (< status 400))))

 (defn by-status [status]
   (fn [^ContentFunction cf]
@@ -98,35 +98,37 @@
                          (initialize-state req))
         webfns (get state ::uri-matching-web-functions)
         matching-webfns (filter (by-status status) webfns)]
-    (if-let [^ContentFunction cf (first matching-webfns)]
-      (let [webfn (:webfn cf)
-            content-type (:content-type cf) ; TODO: Add a bit of
+    (if (:immediate-exit state)
+      {:status status :headers (get-in state [:response :headers]) :body ""}
+      (if-let [^ContentFunction cf (first matching-webfns)]
+        (let [webfn (:webfn cf)
+              content-type (:content-type cf) ; TODO: Add a bit of
                                         ; destructuring here.
-            headers (merge (get-headers-from-webfn webfn)
-                           (get-in state [:response :headers]))]
-        (try
-          (let [body (get-body status state req webfn content-type)]
-            (if (map? body)
-              {:status (or (:status body) status) :headers (merge headers (:headers body)) :body (:body body)}
-              {:status status :headers headers :body body}))
-          (catch Exception e
-            (let [status 500
-                  matching-webfns (filter (by-status status) webfns)]
-              (if-let [^ContentFunction cf (first matching-webfns)]
-                ;; TODO: Test this, release it, use the error handler to log the support ticket, and add the support ticket id
-                ;; into the state
-                (let [body (get-body status (error-hook (assoc state :exception e)) req (:webfn cf) content-type)]
-                  (if (map? body)
-                    {:status (or (:status body) status) :headers (merge headers (:headers body)) :body (:body body)}
-                    {:status status :headers headers :body body}))
-                ;; Otherwise just rethrow
-                (throw e))))))
-      ;; If there is no web-fn...
-      {:status status
-       :headers (assoc (get-in state [:response :headers]) "Content-Type" "text/html")
-       :body (with-out-str
-               (clojure.contrib.prxml/prxml [:body [:p "No web-functions match request"]
-                                             [:hr] [:p {:style "font-size: smaller"} "Served by plugboard"]]))})))
+              headers (merge (get-headers-from-webfn webfn)
+                             (get-in state [:response :headers]))]
+          (try
+            (let [body (get-body status state req webfn content-type)]
+              (if (map? body)
+                {:status (or (:status body) status) :headers (merge headers (:headers body)) :body (:body body)}
+                {:status status :headers headers :body body}))
+            (catch Exception e
+              (let [status 500
+                    matching-webfns (filter (by-status status) webfns)]
+                (if-let [^ContentFunction cf (first matching-webfns)]
+                  ;; TODO: Test this, release it, use the error handler to log the support ticket, and add the support ticket id
+                  ;; into the state
+                  (let [body (get-body status (error-hook (assoc state :exception e)) req (:webfn cf) content-type)]
+                    (if (map? body)
+                      {:status (or (:status body) status) :headers (merge headers (:headers body)) :body (:body body)}
+                      {:status status :headers headers :body body}))
+                  ;; Otherwise just rethrow
+                  (throw e))))))
+        ;; If there is no web-fn...
+        {:status status
+         :headers (assoc (get-in state [:response :headers]) "Content-Type" "text/html")
+         :body (with-out-str
+                 (clojure.contrib.prxml/prxml [:body [:p "No web-functions match request"]
+                                               [:hr] [:p {:style "font-size: smaller"} "Served by plugboard"]]))}))))

 ;; This creates a handler that can be wrapped in ring middleware.
 (defn create-response-handler [plugboard & opts]


escape html with backend rendering (react made me lazy)

--- src/pc/render.clj
+++ src/pc/render.clj
@@ -1,6 +1,6 @@
 (ns pc.render
   (:require [pc.svg :as svg]
-            [hiccup.core :refer (html)]))
+            [hiccup.core :refer (h html)]))

 (defmulti svg-element (fn [layer] (:layer/type layer)))

@@ -10,7 +10,7 @@

 (defmethod svg-element :layer.type/text
   [layer]
-  [:text (svg/layer->svg-text layer) (:layer/text layer)])
+  [:text (svg/layer->svg-text layer) (h (:layer/text layer))])

 (defmethod svg-element :layer.type/line
   [layer]


Drop obsolete web -> file-page-extractor dependency

--- src/pepa/core.clj
+++ src/pepa/core.clj
@@ -35,7 +35,7 @@
                   [:config :db :bus])
        :web (component/using
              (web/make-component)
-             [:config :db :bus :file-page-extractor])
+             [:config :db :bus])
        :smtp (component/using
               (smtp/make-component)
               [:config :db])


Add texture-wrap function.

Add texture-wrap function.

--- src/quil/core.clj
+++ src/quil/core.clj
@@ -2848,7 +2848,7 @@
     :processing-name "quadraticVertex()"
     :category "Shape"
     :subcategory "Vertex"
-    :added "1.0"}
+    :added "2.0"}
   quadratic-vertex
   "Specifies vertex coordinates for quadratic Bezier curves. Each call to
   quadratic-vertex defines the position of one control points and one anchor
@@ -4027,10 +4027,10 @@

 (defn
     ^{:requires-bindings true
-    :processing-name "textureMode()"
-    :category "Shape"
-    :subcategory "Vertex"
-    :added "1.0"}
+     :processing-name "textureMode()"
+     :category "Shape"
+     :subcategory "Vertex"
+     :added "1.0"}
   texture-mode
   "Sets the coordinate space for texture mapping. There are two
   options, :image and :normal.
@@ -4044,6 +4044,24 @@
   [mode]
   (let [mode (resolve-constant-key mode texture-modes)]
     (.textureMode (current-surface) (int mode))))
+
+(def ^{:private true}
+  texture-wrap-modes {:clamp PApplet/CLAMP
+                      :repeat PApplet/REPEAT})
+
+(defn
+    ^{:requires-bindings true
+     :processing-name "textureWrap()"
+     :category "Shape"
+     :subcategory "Vertex"
+     :added "2.0"}
+  texture-wrap
+  "Defines if textures repeat or draw once within a texture map. The two
+  parameters are :clamp (the default behavior) and :repeat. This function
+  only works with the :p2d and :p3d renderers."
+  [mode]
+  (let [mode (resolve-constant-key mode texture-wrap-modes)]
+    (.textureWrap (current-surface) mode)))

 (defn
   ^{:requires-bindings true