cleanup and optimize get-expander

cleanup and optimize get-expander

--- src/main/clojure/cljs/analyzer.cljc
+++ src/main/clojure/cljs/analyzer.cljc
@@ -1946,35 +1946,56 @@
               (resolve-var env sym)))
           (assoc ret :op :var :info (resolve-var env sym)))))))

+(defn excluded?
+  #?(:cljs {:tag boolean})
+  [env sym]
+  (if-not (nil? (get-in env [:ns :excludes sym]))
+    true
+    (not (nil? (get-in @env/*compiler* [::namespaces (get-in env [:ns :name]) :excludes sym])))))
+
+(defn used?
+  #?(:cljs {:tag boolean})
+  [env sym]
+  (if-not (nil? (get-in env [:ns :use-macros sym]))
+    true
+    (not (nil? (get-in @env/*compiler* [::namespaces (get-in env [:ns :name]) :use-macros sym])))))
+
+(defn get-expander-ns [env ^String nstr]
+  (cond
+    (identical? "clojure.core" nstr)
+    #?(:clj  (find-ns 'cljs.core)
+       :cljs (find-macros-ns 'cljs.core))
+    (identical? "clojure.repl" nstr)
+    #?(:clj  (find-ns 'cljs.repl)
+       :cljs (find-macros-ns 'cljs.repl))
+    #?@(:clj  [(.contains nstr ".") (find-ns (symbol nstr))]
+        :cljs [(goog.string/contains nstr ".") (find-macros-ns (symbol nstr))])
+    :else
+    (some-> env :ns :require-macros (get (symbol nstr)) find-ns)))
+
+(defn get-expander* [sym env]
+  (when-not (or (not (nil? (get-in env [:locals sym]))) ; locals hide macros
+                (and (excluded? env sym) (not (used? env sym))))
+    (let [nstr (namespace sym)]
+      (if-not (nil? nstr)
+        (let [ns (get-expander-ns env nstr)]
+          (when-not (nil? ns)
+            (.findInternedVar ^clojure.lang.Namespace ns (symbol (name sym)))))
+        (let [nsym (get-in env [:ns :use-macros sym])]
+          (if-not (nil? nsym)
+            (.findInternedVar ^clojure.lang.Namespace
+            #?(:clj (find-ns nsym) :cljs (find-macros-ns nsym)) sym)
+            (.findInternedVar ^clojure.lang.Namespace
+            #?(:clj (find-ns 'cljs.core) :cljs (find-macros-ns 'cljs.core)) sym)))))))
+
 (defn get-expander
   "Given a sym, a symbol identifying a macro, and env, an analysis environment
    return the corresponding Clojure macroexpander."
   [sym env]
-  (let [mvar
-        (when-not (or (-> env :locals sym)        ;locals hide macros
-                      (and (or (-> env :ns :excludes sym)
-                               (get-in @env/*compiler* [::namespaces (-> env :ns :name) :excludes sym]))
-                           (not (or (-> env :ns :use-macros sym)
-                                    (get-in @env/*compiler* [::namespaces (-> env :ns :name) :use-macros sym])))))
-          (if-let [nstr (namespace sym)]
-            (when-let [ns (cond
-                            (= "clojure.core" nstr)
-                            #?(:clj (find-ns 'cljs.core)
-                               :cljs (find-macros-ns 'cljs.core))
-                            (= "clojure.repl" nstr)
-                            #?(:clj (find-ns 'cljs.repl)
-                               :cljs (find-macros-ns 'cljs.repl))
-                            #?@(:clj  [(.contains nstr ".") (find-ns (symbol nstr))]
-                                :cljs [(goog.string/contains nstr ".") (find-macros-ns (symbol nstr))])
-                            :else
-                            (some-> env :ns :require-macros (get (symbol nstr)) find-ns))]
-              (.findInternedVar ^clojure.lang.Namespace ns (symbol (name sym))))
-            (if-let [nsym (-> env :ns :use-macros sym)]
-              (.findInternedVar ^clojure.lang.Namespace
-                #?(:clj (find-ns nsym) :cljs (find-macros-ns nsym)) sym)
-              (.findInternedVar ^clojure.lang.Namespace
-                #?(:clj (find-ns 'cljs.core) :cljs (find-macros-ns 'cljs.core)) sym))))]
-    (when (and mvar (.isMacro ^clojure.lang.Var mvar))
+  (let [mvar (get-expander* sym env)]
+    (when (and (not (nil? mvar))
+            #?(:clj  (.isMacro ^clojure.lang.Var mvar)
+               :cljs ^boolean (.isMacro mvar)))
       mvar)))

 (defn macroexpand-1


Update to latest ClojureScript

Update to latest ClojureScript

--- ClojureScript/project.clj
+++ ClojureScript/project.clj
@@ -1,7 +1,7 @@
 (defproject shrimp "0.1.0-SNAPSHOT"
             :description "Demo project for Goby."
             :dependencies [[org.clojure/clojure "1.6.0"]
-                           [org.clojure/clojurescript "0.0-2719"]
+                           [org.clojure/clojurescript "0.0-2723"]
                            [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                            [goby "0.1.0"]
                            [weasel "0.5.0"]]


tweak classpath ignore patterns to parse fewer .js files

closure compiler ships with quite a bunch of .js files we won't
ever access directly. nashorn has a few too. some of them use
"for each (..." which closure complains about.

--- src/main/shadow/build/classpath.clj
+++ src/main/shadow/build/classpath.clj
@@ -57,6 +57,8 @@
         :module-type (or module-type "goog"))))

 (defn inspect-js [{:keys [compiler] :as state} {:keys [resource-name url] :as rc}]
+
+  (prn [:js resource-name])
   (let [source
         (slurp url)

@@ -736,11 +738,21 @@

         index
         {:ignore-patterns
-         #{#"^node_modules/"
+         #{#"node_modules/"
+           ;; cljs.core aot
+           #"\.aot\.js$"
+           ;; closure library test files
            #"^goog/demos/"
-           #".aot.js$"
-           #"^goog/(.+)_test.js$"
+           #"^goog/(.+)_test\.js$"
+           ;; closure compiler support and test files
+           #"^com/google/javascript"
+           ;; way too many jars contain a public folder
            #"^public/"
+           ;; these files fail to parse correctly but we don't need them anyways
+           #"^jdk/nashorn/*"
+           #"goog/transpile\.js"
+           ;; don't need to parse cljsjs files, not going to use them
+           #"^cljsjs(.+)\.js"
            ;; just in case the :output-dir of a dev build is on the classpath
            #"/cljs-runtime/"}


remove file didn't mean to add

remove file didn't mean to add

--- src/metabase/api/common/dynamic.clj
+++ src/metabase/api/common/dynamic.clj
@@ -1,13 +0,0 @@
-(ns metabase.api.common.dynamic
-  "Dynamic variables that get bound by middleware for each HTTP request.")
-
-(def ^:dynamic *current-user-id*
-  "Int ID or nil of user associated with current API call."
-  nil)
-
-;; TODO - This would probably be slightly nicer if we rewrote it as a delay
-(def ^:dynamic *current-user*
-  "Delay that returns `User` (or nil) associated with the current API call."
-  (atom nil)) ; default binding just returns nil when you dereference it
-
-(def TEST 100)


(PE-4496) Change errant throw call to throw+

This commit changes an unintended call to the `throw` function into a call
to the `throw+` function for an exception intended to be thrown with
Slingshot.

--- src/puppetlabs/kitchensink/core.clj
+++ src/puppetlabs/kitchensink/core.clj
@@ -152,9 +152,9 @@

             (let [success (.mkdir dir)]
               (when-not success
-                (throw {:type ::io-error
-                        :message (format "Unable to create directory '%s'"
-                                         parent)})))))))))
+                (throw+ {:type ::io-error
+                         :message (format "Unable to create directory '%s'"
+                                          parent)})))))))))

 ;; ## Math


Use pretty printer in compile test

Use pretty printer in compile test

--- test/minijava/test_compile.clj
+++ test/minijava/test_compile.clj
@@ -1,6 +1,7 @@
 (ns minijava.test-compile
   (:use clojure.test
         clojure.contrib.def
+        clojure.contrib.pprint
         (minijava compile)))

 (deftest tests-files-convert-without-exception
@@ -8,4 +9,4 @@
                  (accept [_ name] (not (nil? (re-find #"java$" name)))))
         files (-> "resources/sample" java.io.File. (.listFiles filter))]
     (doseq [f files]
-      (compile-program f))))
+      (pprint (compile-program f)))))


Two tests for function config/get-currently-building-view

--- test/emender_jenkins/config_test.clj
+++ test/emender_jenkins/config_test.clj
@@ -512,6 +512,23 @@
             (get-in-queue-view {:configuration {:jenkins nil}})                  nil
             (get-in-queue-view {:configuration nil})                             nil)))

+(deftest test-get-currently-building-view-1
+    "Check the behaviour of function emender-jenkins.config/get-currently-building-view."
+    (testing "the behaviour of function emender-jenkins.config/get-currently-building-view."
+        (are [x y] (= x y)
+            (get-currently-building-view {:configuration {:jenkins {:currently-building-view nil}}}) nil
+            (get-currently-building-view {:configuration {:jenkins {:currently-building-view false}}}) false
+            (get-currently-building-view {:configuration {:jenkins {:currently-building-view true}}}) true
+            (get-currently-building-view {:configuration {:jenkins {:currently-building-view "Queue"}}}) "Queue")))
+
+(deftest test-get-currently-building-view-2
+    "Check the behaviour of function emender-jenkins.config/get-currently-building-view."
+    (testing "the behaviour of function emender-jenkins.config/get-currently-building-view."
+        (are [x y] (= x y)
+            (get-currently-building-view {:configuration {:jenkins {:currently-building-view nil}}}) nil
+            (get-currently-building-view {:configuration {:jenkins nil}})                            nil
+            (get-currently-building-view {:configuration nil})                                       nil)))
+
 (deftest test-override-options-by-cli-1
     "Check the behaviour of function emender-jenkins.config/override-options-by-cli."
     (testing "the behaviour of function emender-jenkins.config/override-options-by-cli."


decouple env from test

decouple env from test

--- test/gh_waiting_room/github_test.clj
+++ test/gh_waiting_room/github_test.clj
@@ -19,6 +19,7 @@
              (has-args ["cldwalker" "repo" 10 body-expects])
              (times once))]
            (with-redefs [github/viewable-issues (constantly issues)
+                         config/app-domain (constantly "http://localhost:8080")
                          config/gh-auth (constantly "user:pass")]
              (github/create-issue-comment {} id 10)))))


Fix tests to work with new greeting page format.

--- test/one/sample/test/integration.clj
+++ test/one/sample/test/integration.clj
@@ -12,8 +12,10 @@
              (fx/enable-button "greet-button")
              (clojure.browser.dom/click-element :greet-button))
   (cljs-wait-for #(= % :greeting) one.sample.model (:state @state))
-  (is (= (cljs-eval one.sample.view (.innerHTML (by-id "name")))
+  (is (= (cljs-eval one.sample.view (.innerHTML (first (nodes (by-class "name")))))
          "Ted"))
+  (is (= (cljs-eval one.sample.view (.innerHTML (first (nodes (by-class "again")))))
+         ""))
   (is (= (cljs-eval one.sample.model @state)
          {:state :greeting, :name "Ted", :exists false}))
   (is (true? (contains? @*database* "Ted"))))
@@ -26,8 +28,10 @@
              (fx/enable-button "greet-button")
              (clojure.browser.dom/click-element :greet-button))
   (cljs-wait-for #(= % :greeting) one.sample.model (:state @state))
-  (is (= (cljs-eval one.sample.view (.innerHTML (by-id "name")))
-         " again Ted"))
+  (is (= (cljs-eval one.sample.view (.innerHTML (first (nodes (by-class "name")))))
+         "Ted"))
+  (is (= (cljs-eval one.sample.view (.innerHTML (first (nodes (by-class "again")))))
+         "again"))
   (is (= (cljs-eval one.sample.model @state)
          {:state :greeting, :name "Ted", :exists true}))
   (is (true? (contains? @*database* "Ted"))))


leave group chat fix (#13463)

leave group chat fix (#13463)

--- src/status_im/group_chats/core.cljs
+++ src/status_im/group_chats/core.cljs
@@ -21,7 +21,8 @@
   {:events [:chat-removed]}
   [cofx response]
   (fx/merge cofx
-            {:dispatch-n [[:sanitize-messages-and-process-response response]
+            {:db (dissoc (:db cofx) :current-chat-id)
+             :dispatch-n [[:sanitize-messages-and-process-response response]
                           [:pop-to-root-tab :chat-stack]]}
             (notification-center/get-activity-center-notifications-count)))


RS | Refactor user.clj requires

RS | Refactor user.clj requires

--- src/stonecutter/controller/user.clj
+++ src/stonecutter/controller/user.clj
@@ -1,9 +1,9 @@
 (ns stonecutter.controller.user
-  (:require [clauth.client :as client]
-            [clauth.token :as token]
+  (:require [clauth.client :as cl-client]
+            [clauth.token :as cl-token]
+            [clauth.endpoints :as cl-ep]
             [ring.util.response :as r]
-            [clauth.endpoints :as ep]
-            [stonecutter.routes :refer [routes path]]
+            [stonecutter.routes :as routes]
             [stonecutter.view.sign-in :as sign-in]
             [stonecutter.validation :as v]
             [stonecutter.db.storage :as s]
@@ -12,7 +12,7 @@
             [stonecutter.view.profile :as profile]
             [stonecutter.view.delete-account :as delete-account]
             [stonecutter.view.authorise :as authorise]
-            [stonecutter.helper :refer :all]))
+            [stonecutter.helper :as sh]))

 (declare redirect-to-profile redirect-to-profile-created redirect-to-profile-deleted)

@@ -21,8 +21,8 @@
     (and (:user session) (:access_token session))))

 (defn redirect-to-authorisation [return-to user client-id]
-  (if-let [client (client/fetch-client client-id)]
-    (assoc (r/redirect return-to) :session {:user user :access_token (:token (token/create-token client user))})
+  (if-let [client (cl-client/fetch-client client-id)]
+    (assoc (r/redirect return-to) :session {:user user :access_token (:token (cl-token/create-token client user))})
     (throw (Exception. "Invalid client"))))

 (defn register-user [request]
@@ -34,7 +34,7 @@
     (if (empty? err)
       (-> (s/store-user! email password)
           redirect-to-profile-created)
-      (html-response (register/registration-form request)))))
+      (sh/html-response (register/registration-form request)))))

 (defn sign-in [request]
   (let [client-id (get-in request [:session :client-id])
@@ -52,16 +52,16 @@
         (->> {:credentials :invalid}
              (assoc-in request [:context :errors])
              sign-in/sign-in-form
-             html-response))
-      (html-response (sign-in/sign-in-form request)))))
+             sh/html-response))
+      (sh/html-response (sign-in/sign-in-form request)))))

 (defn sign-out [request]
   (-> request
       (update-in [:session] dissoc :user)
-      ep/logout-handler))
+      cl-ep/logout-handler))

 (defn show-confirm-account-confirmation [request]
-  (html-response (delete-account/delete-account-confirmation request)))
+  (sh/html-response (delete-account/delete-account-confirmation request)))

 (defn delete-account [request]
   (let [email (get-in request [:session :user :login])]
@@ -69,18 +69,18 @@
     (redirect-to-profile-deleted)))

 (defn redirect-to-profile [user]
-  (assoc (r/redirect (path :show-profile)) :session {:user user
-                                                     :access_token (:token (token/create-token nil user))}))
+  (assoc (r/redirect (routes/path :show-profile)) :session {:user user
+                                                            :access_token (:token (cl-token/create-token nil user))}))

 (defn redirect-to-profile-created [user]
-  (assoc (r/redirect (path :show-profile-created)) :session {:user user
-                                                             :access_token (:token (token/create-token nil user))}))
+  (assoc (r/redirect (routes/path :show-profile-created)) :session {:user user
+                                                                    :access_token (:token (cl-token/create-token nil user))}))

 (defn redirect-to-profile-deleted []
-  (assoc (r/redirect (path :show-profile-deleted)) :session nil))
+  (assoc (r/redirect (routes/path :show-profile-deleted)) :session nil))

 (defn show-registration-form [request]
-  (html-response (register/registration-form request)))
+  (sh/html-response (register/registration-form request)))

 (defn preserve-session [response request]
   (-> response
@@ -88,20 +88,20 @@

 (defn show-sign-in-form [request]
   (if (signed-in? request)
-    (-> (r/redirect (path :home)) (preserve-session request))
-    (html-response (sign-in/sign-in-form request))))
+    (-> (r/redirect (routes/path :home)) (preserve-session request))
+    (sh/html-response (sign-in/sign-in-form request))))

 (defn show-profile [request]
-  (html-response (profile/profile request)))
+  (sh/html-response (profile/profile request)))

 (defn show-profile-created [request]
-  (html-response (profile-created/profile-created request)))
+  (sh/html-response (profile-created/profile-created request)))

 (defn show-profile-deleted [request]
-  (html-response (delete-account/profile-deleted request)))
+  (sh/html-response (delete-account/profile-deleted request)))

 (defn show-authorise-form [request]
-  (html-response (authorise/authorise-form request)))
+  (sh/html-response (authorise/authorise-form request)))

 (defn home [request]
-  (r/redirect (path :show-profile)))
+  (r/redirect (routes/path :show-profile)))


Moved code calculating summary data into a separate function.

--- src/validation_benchmark/report.clj
+++ src/validation_benchmark/report.clj
@@ -7,34 +7,39 @@
   (:gen-class))

-(declare render-html)
+(declare calculate-summary
+         render-html)

 (defn create-report [groups results report-path]
   (let [current-directory (System/getProperty "user.dir")
         html-path (str report-path "/index.html")
         chart-path (str report-path "/chart.png")
-        summary (->> (for [[group fns] groups
-                           [lib-name lib-data] results
-                           valid? [:valid :invalid]]
-                       [[group valid?]
-                        lib-name
-                        (->> lib-data
-                             (filter (comp (partial contains? fns) first))
-                             (vals)
-                             (map valid?)
-                             (map (comp (partial * 1e9) :mean))
-                             (apply +))])
-                     (filter (comp some? last))
-                     ;; (= v :invalid) returns false for :valid,
-                     ;; so it's sorted before :invalid.
-                     (sort-by (fn [[[n v] l _]] [n (= v :invalid) l])))]
+        summary (calculate-summary groups results)]
     (println "Summary: "
              (str "file://" current-directory "/" html-path))
     (make-parents html-path)
     (with-open [w (writer html-path)]
       (.write w (render-html summary)))
     (make-chart summary chart-path)))
+
+
+(defn calculate-summary [groups results]
+  (->> (for [[group fns] groups
+             [lib-name lib-data] results
+             valid? [:valid :invalid]]
+         [[group valid?]
+          lib-name
+          (->> lib-data
+               (filter (comp (partial contains? fns) first))
+               (vals)
+               (map valid?)
+               (map (comp (partial * 1e9) :mean))
+               (apply +))])
+       (filter (comp some? last))
+       ;; (= v :invalid) returns false for :valid,
+       ;; so it's sorted before :invalid.
+       (sort-by (fn [[[n v] l _]] [n (= v :invalid) l]))))

 (defn- about []


+(generate) (use grammar 'medium')

+(generate) (use grammar 'medium')

--- src/babel/workbook/it.clj
+++ src/babel/workbook/it.clj
@@ -1,7 +1,7 @@
 (ns babel.workbook.it
   (:refer-clojure :exclude [get-in merge resolve find parents])
   (:require
-   [babel.engine :refer [generate]]
+   [babel.engine :as engine]
    [babel.forest :refer [lightning-bolt]]
    [babel.italiano.grammar :refer :all]
    [babel.italiano.lexicon :refer :all]
@@ -213,3 +213,6 @@
                           (get (get request :query-params) "attrs"))
          :headers {"Content-Type" "text/html;charset=utf-8"}})
   ))
+
+(defn generate [spec]
+  (engine/generate spec medium))


beginings of repl

beginings of repl

--- src/bitsplit_cli/core.clj
+++ src/bitsplit_cli/core.clj
@@ -1,14 +1,34 @@
 (ns bitsplit-cli.core
     (:use bitsplit.client.protocol
           bitsplit.storage.protocol
+          bitsplit-cli.commands
           bitsplit-cli.bitcoind
           bitsplit-cli.filesystem))

+(defn read-prompt [prompt]
+    (print prompt)
+    (flush)
+    (read-line))
+
+(def read-in (partial read-prompt "bitsplit> "))
+
+(defn start-repl []
+    (loop []
+        (let [commmand (read-in)]
+            (if-not (= commmand "exit")
+                (do
+                    (println "sup" commmand)
+                    (recur))))))
+
 (defn -main [& args]
-    (let [fs (->File "FAKE")
-          bd (->Bitcoind "")]
-        (save! fs "address1" {"address2" 8})
-        (save! fs "yo" {"address1" 2})
-        (println (lookup fs "yo"))
-        (println (addresses bd))
-        (println (unspent-amounts bd))))
+    (if (empty? args)
+        (println "empty" args)
+        (start-repl)))
+
+; A plan:
+;  define a spec for the shell, then functions to handle each commmand
+;  then, just stick things in a loop and you're good. some kind
+;  of rpc-daemonization would be dope, too
+
+; the spec
+;


Send message to bots that subscribe to all msgs

--- src/braid/server/sync.clj
+++ src/braid/server/sync.clj
@@ -151,7 +151,11 @@
   ; Notify bots subscribed to the thread
   (doseq [bot (bot/bots-watching-thread (new-message :thread-id))]
     (timbre/debugf "notifying bot %s" bot)
-    (bots/send-message-notification bot new-message)))
+    (bots/send-message-notification bot new-message))
+  ; Notify bots subscribed to all messages
+  (doseq [bot (bot/bots-for-message (new-message :group-id))]
+    (when (thread/user-can-see-thread? (bot :user-id) (new-message :thread-id))
+      (bots/send-message-notification bot new-message))))

 (defn broadcast-new-user-to-group
   [user-id group-id]


Fix creation of extra temp folders

Fix creation of extra temp folders

--- test/refactor_nrepl/integration_tests.clj
+++ test/refactor_nrepl/integration_tests.clj
@@ -70,7 +70,8 @@
                               :line 11 :column 3
                               :name "thre" :dir (str tmp-dir))
         result (remove keyword? response)]
-    (is (= 3 (count result)) (format "expected 3 results but got %d" (count result)))))
+    (is (= 3 (count result)) (format "expected 3 results but got %d" (count result)))
+    (.delete tmp-dir)))

 (deftest test-find-fn-in-dashed-ns
   (let [tmp-dir (create-test-project)
@@ -80,7 +81,8 @@
                               :line 14 :column 4
                               :name "stuff" :dir (str tmp-dir))
         result (remove keyword? response)]
-    (is (= 3 (count result)) (format "expected 3 results but got %d" (count result)))))
+    (is (= 3 (count result)) (format "expected 3 results but got %d" (count result)))
+    (.delete tmp-dir)))

 (deftest test-find-dashed-fn
   (let [tmp-dir (create-test-project)
@@ -90,7 +92,8 @@
                               :line 16 :column 4
                               :name "more-stuff" :dir (str tmp-dir))
         result (remove keyword? response)]
-    (is (= 3 (count result)) (format "expected 3 results but got %d" (count result)))))
+    (is (= 3 (count result)) (format "expected 3 results but got %d" (count result)))
+    (.delete tmp-dir)))

 (deftest test-rename-foo
   (let [tmp-dir (create-test-project)
@@ -148,7 +151,8 @@
 "]
     (remove-debug-invocations :transport transport :file three-file)

-    (is (= new-three (slurp three-file)) "remove println failed")))
+    (is (= new-three (slurp three-file)) "remove println failed")
+    (.delete tmp-dir)))

 (defrecord Foo [])
 (deftype Bar [])
@@ -188,7 +192,8 @@
         transport (connect :port 7777)
         response (find-usages :transport transport :name "a" :file three-file :line 3 :column 24)
         result (remove keyword? response)]
-    (is (= 5 (count result)) (format "expected 5 results but got %d" (count result)))))
+    (is (= 5 (count result)) (format "expected 5 results but got %d" (count result)))
+    (.delete tmp-dir)))

 (deftest find-local-let
   (let [tmp-dir (create-test-project)
@@ -214,11 +219,10 @@

     (is (= (find-unbound :transport transport :file five-file :line 34 :column 8)
            '#{name}))
-    ))
+    (.delete tmp-dir)))

 (deftest find-unbound-fails-on-cljs
-  (let [tmp-dir (create-test-project)
-        cljs-file (str tmp-dir "/src/com/example/file.cljs")
+  (let [cljs-file "/tmp/src/com/example/file.cljs"
         transport (connect :port 7777)]
     (is (:error (find-unbound :transport transport :file cljs-file
                               :line 12 :column 6)))))


Trying to avoid merge as its falsely implicated as buggy.

--- src/cbfg/world-store.cljs
+++ src/cbfg/world-store.cljs
@@ -12,44 +12,44 @@
 (defn make-store-cmd-handlers [store]
   {"get"
    [["key"]
-    (fn [c] {:rq #(store/store-get % store (:opaque c) (:key c))})]
+    (fn [c] #(store/store-get % store (:opaque c) (:key c)))]
    "set"
    [["key" "val"]
-    (fn [c] {:rq #(store/store-set % store (:opaque c) (:key c) (:cas c)
-                                   (:val c) :set)})]
+    (fn [c] #(store/store-set % store (:opaque c) (:key c) (:cas c)
+                              (:val c) :set))]
    "del"
    [["key"]
-    (fn [c] {:rq #(store/store-del % store (:opaque c) (:key c) (:cas c))})]
+    (fn [c] #(store/store-del % store (:opaque c) (:key c) (:cas c)))]
    "add"
    [["key" "val"]
-    (fn [c] {:rq #(store/store-set % store (:opaque c) (:key c) (:cas c)
-                                   (:val c) :add)})]
+    (fn [c] #(store/store-set % store (:opaque c) (:key c) (:cas c)
+                              (:val c) :add))]
    "replace"
    [["key" "val"]
-    (fn [c] {:rq #(store/store-set % store (:opaque c) (:key c) (:cas c)
-                                   (:val c) :replace)})]
+    (fn [c] #(store/store-set % store (:opaque c) (:key c) (:cas c)
+                              (:val c) :replace))]
    "append"
    [["key" "val"]
-    (fn [c] {:rq #(store/store-set % store (:opaque c) (:key c) (:cas c)
-                                   (:val c) :append)})]
+    (fn [c] #(store/store-set % store (:opaque c) (:key c) (:cas c)
+                              (:val c) :append))]
    "prepend"
    [["key" "val"]
-    (fn [c] {:rq #(store/store-set % store (:opaque c) (:key c) (:cas c)
-                                   (:val c) :prepend)})]
+    (fn [c] #(store/store-set % store (:opaque c) (:key c) (:cas c)
+                              (:val c) :prepend))]
    "scan"
    [["from" "to"]
-    (fn [c] {:rq #(store/store-scan % store (:opaque c)
-                                    (:from c) (:to c))})]
+    (fn [c] #(store/store-scan % store (:opaque c)
+                               (:from c) (:to c)))]
    "changes"
    [["from" "to"]
-    (fn [c] {:rq #(store/store-changes % store (:opaque c)
-                                       (js/parseInt (:from c))
-                                       (js/parseInt (:to c)))})]
+    (fn [c] #(store/store-changes % store (:opaque c)
+                                  (js/parseInt (:from c))
+                                  (js/parseInt (:to c))))]
    "noop"
-   [[] (fn [c] {:rq #(ago store-cmd-noop %
-                          {:opaque (:opaque c) :status :ok})})]
+   [[] (fn [c] #(ago store-cmd-noop %
+                     {:opaque (:opaque c) :status :ok}))]
    "test"
-   [[] (fn [c] {:rq #(cbfg.store-test/test % (:opaque c))})]})
+   [[] (fn [c] #(cbfg.store-test/test % (:opaque c)))]})

 (def store-max-inflight (atom 10))

@@ -85,12 +85,14 @@
                                                      cmd2 (-> v
                                                               (assoc :opaque ts)
                                                               (assoc :fence op-fence))
-                                                     cmd3 (reduce #(cljs.core/merge {(keyword %2) (get-el-value (str op "-" %2))}
-                                                                                %1) ; Using merge so cmd2 has precedence.
+                                                     cmd3 (reduce #(if (get %1 (keyword %2))
+                                                                     %1 ; Allows cmd2 to have precedence.
+                                                                     (assoc %1 (keyword %2)
+                                                                            (get-el-value (str op "-" %2))))
                                                                   cmd2 params)]
                                                  (render-client-hist (swap! client-hist
                                                                             #(assoc % ts [cmd3 nil])))
-                                                 (aput client in-ch (cljs.core/merge cmd3 (handler cmd3)))
+                                                 (aput client in-ch (assoc cmd3 :rq (handler cmd3)))
                                                  (recur (inc num-ins) num-outs)))
                                (= ch out-ch) (do (render-client-hist (swap! client-hist
                                                                             #(update-in % [(:opaque v) 1]


remove extraneous (do ...)

remove extraneous (do ...)

--- src/cheshire/generate.clj
+++ src/cheshire/generate.clj
@@ -16,28 +16,26 @@

 (defmacro number-dispatch [^JsonGenerator jg obj ^Exception e]
   (if (< 2 (:minor *clojure-version*))
-    (do
-      `(condp instance? ~obj
-         Integer (.writeNumber ~jg (int ~obj))
-         Long (.writeNumber ~jg (long ~obj))
-         Double (.writeNumber ~jg (double ~obj))
-         Float (.writeNumber ~jg (double ~obj))
-         BigInteger (.writeNumber ~jg ^BigInteger ~obj)
-         BigDecimal (.writeNumber ~jg ^BigDecimal ~obj)
-         Ratio (.writeNumber ~jg (double ~obj))
-         clojure.lang.BigInt (.writeNumber ~jg ^clojure.lang.BigInt
-                                           (.toBigInteger (bigint ~obj)))
-         (fail ~obj ~e)))
-    (do
-      `(condp instance? ~obj
-         Integer (.writeNumber ~jg (int ~obj))
-         Long (.writeNumber ~jg (long ~obj))
-         Double (.writeNumber ~jg (double ~obj))
-         Float (.writeNumber ~jg (float ~obj))
-         BigInteger (.writeNumber ~jg ^BigInteger ~obj)
-         BigDecimal (.writeNumber ~jg ^BigDecimal ~obj)
-         Ratio (.writeNumber ~jg (double ~obj))
-         (fail ~obj ~e)))))
+    `(condp instance? ~obj
+       Integer (.writeNumber ~jg (int ~obj))
+       Long (.writeNumber ~jg (long ~obj))
+       Double (.writeNumber ~jg (double ~obj))
+       Float (.writeNumber ~jg (double ~obj))
+       BigInteger (.writeNumber ~jg ^BigInteger ~obj)
+       BigDecimal (.writeNumber ~jg ^BigDecimal ~obj)
+       Ratio (.writeNumber ~jg (double ~obj))
+       clojure.lang.BigInt (.writeNumber ~jg ^clojure.lang.BigInt
+                                         (.toBigInteger (bigint ~obj)))
+       (fail ~obj ~e))
+    `(condp instance? ~obj
+       Integer (.writeNumber ~jg (int ~obj))
+       Long (.writeNumber ~jg (long ~obj))
+       Double (.writeNumber ~jg (double ~obj))
+       Float (.writeNumber ~jg (float ~obj))
+       BigInteger (.writeNumber ~jg ^BigInteger ~obj)
+       BigDecimal (.writeNumber ~jg ^BigDecimal ~obj)
+       Ratio (.writeNumber ~jg (double ~obj))
+       (fail ~obj ~e))))

 (declare generate)


Fixed the doc-string of the ns-form in ctrl.cljs

--- src/chessground/ctrl.cljs
+++ src/chessground/ctrl.cljs
@@ -1,8 +1,6 @@
 (ns chessground.ctrl
-  "Changes to state.
-   Each function returns a new state
-   and a function taking a root element and channels,
-   and mutating the dom"
+  "Changes to state. Each function returns a new state and a function
+  taking a root element and channels, and mutating the dom."
   (:require [chessground.common :as common :refer [pp]]
             [chessground.show :as show]
             [chessground.data :as data]


CLJS-991: Wrong inference - inconsistent behavior?

`cljs.analyzer/infer-tag` was missing `:js` case

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -542,6 +542,7 @@
              (infer-tag env (:init e))
              (infer-tag env (:info e)))
       :dot 'any
+      :js 'any
       nil)))

 (defmulti parse (fn [op & rest] op))


take in 'system for helmsman-definition

take in 'system for helmsman-definition

--- src/clj/traveler/core.clj
+++ src/clj/traveler/core.clj
@@ -37,22 +37,23 @@

 (defn helmsman-definition
   "Main helmsman definition"
-  [db-conn]
-  [^{:id :traveler/resources}
-   [:resources "/"]
-   ^{:name "Traveler"
-     :id :traveler/root
-     :main-menu true}
-   [:any "/" (:dashboard liberator-resources)]
-   ^{:name "Dashboard" :id :traveler/dashboard}
-   [:any "/dashboard" (:dashboard liberator-resources)]
-   ^{:name "Manage Users" :id :traveler/users}
-   [:any "/users" (:users liberator-resources)]
-   ^{:name "Manage User" :id :traveler/user}
-   [:any "/user/:id-sk" (:user liberator-resources)]
-   ^{:name "View System" :id :traveler/system}
-   [:any "/system" (:system liberator-resources)]
-   (into [:context "/api"] (api-routes db-conn))
-   ;;middleware
-   [wrap-params]
-   ])
+  [system]
+  (let [db-conn (:db-conn system)]
+    [^{:id :traveler/resources}
+     [:resources "/"]
+     ^{:name "Traveler"
+       :id :traveler/root
+       :main-menu true}
+     [:any "/" (:dashboard liberator-resources)]
+     ^{:name "Dashboard" :id :traveler/dashboard}
+     [:any "/dashboard" (:dashboard liberator-resources)]
+     ^{:name "Manage Users" :id :traveler/users}
+     [:any "/users" (:users liberator-resources)]
+     ^{:name "Manage User" :id :traveler/user}
+     [:any "/user/:id-sk" (:user liberator-resources)]
+     ^{:name "View System" :id :traveler/system}
+     [:any "/system" (:system liberator-resources)]
+     (into [:context "/api"] (api-routes db-conn))
+     ;;middleware
+     [wrap-params]
+     ]))


Adding mortar, ranger, and tank unit types

Still need to add Humvees, but it needs a fix to the state machine
loading code to work.

--- src/clj/zetawar/data.cljs
+++ src/clj/zetawar/data.cljs
@@ -14,19 +14,36 @@
    :deep-water    {:name "Deep Water"
                    :image "tilesets/elite-command/terrains/deep-water.png"}})

+;; TODO: remove redundancy between state map and unit/can-capture flag (?)
 (def unit-state-maps
-  {:basic
+  {:move-attack
    {:start-state :start
     :built-state :done
     :states
-    {:start      {:move-unit    :moved-once
-                  :attack-unit  :done
-                  :repair-unit  :done
-                  :capture-base :done}
-     :moved-once {:attack-unit  :done
-                  :capture-base :done}
-     :done       {}}}})
+    {:start {:move-unit    :moved
+             :attack-unit  :done
+             :repair-unit  :done
+             :capture-base :done}
+     :moved {:attack-unit  :done
+             :capture-base :done}
+     :done  {}}}
+   ;; :free-attack-twice
+   ;; {:start-state :start
+   ;;  :built-state :done
+   ;;  :states
+   ;;  {:start              {:move-unit    :moved-1-attacked-0
+   ;;                        :attack-unit  :moved-0-attacked-1
+   ;;                        :repair-unit  :done}
+   ;;   :moved-0-attacked-1 {:attack-unit  :moved-0-attacked-2
+   ;;                        :move-unit    :moved-1-attacked-1}
+   ;;   :moved-0-attacked-2 {:move-unit    :done}
+   ;;   :moved-1-attacked-0 {:attack-unit  :moved-1-attacked-1}
+   ;;   :moved-1-attacked-1 {:attack-unit  :done}
+   ;;   :done               {}}}
+   })

+;; TODO: check how capturing armor works in Elite Command
+;; TODO: check how repair amount works in Elite Command
 (def units
   {:infantry {:name "Infantry"
               :cost 75
@@ -38,7 +55,7 @@
               :armor 6
               :capturing-armor 2
               :repair 1
-              :state-map :basic
+              :state-map :move-attack
               :image "tilesets/elite-command/units/infantry-COLOR.png"
               :terrain-effects
               {:plains    {:movement-cost 3 :attack-bonus 0 :armor-bonus 0}
@@ -46,7 +63,8 @@
                :woods     {:movement-cost 4 :attack-bonus 2 :armor-bonus 3}
                :base      {:movement-cost 2 :attack-bonus 2 :armor-bonus 3}}
               :attack-strengths
-              {:personnel 6}}
+              {:personnel 6
+               :armored 3}}
    :grenadier {:name "Grenadier"
                :cost 150
                :movement 9
@@ -57,7 +75,7 @@
                :armor 8
                :capturing-armor 2
                :repair 1
-               :state-map :basic
+               :state-map :move-attack
                :image "tilesets/elite-command/units/grenadier-COLOR.png"
                :terrain-effects
                {:plains    {:movement-cost 4 :attack-bonus 0  :armor-bonus 0}
@@ -65,7 +83,87 @@
                 :woods     {:movement-cost 4 :attack-bonus -1 :armor-bonus 3}
                 :base      {:movement-cost 3 :attack-bonus -1 :armor-bonus 3}}
                :attack-strengths
-               {:personnel 8}}})
+               {:personnel 8
+                :armored 9}}
+   :mortar {:name "Mortar"
+            :cost 200
+            :movement 9
+            :can-capture true
+            :min-range 2
+            :max-range 3
+            :armor-type :personnel
+            :armor 6
+            :capturing-armor 2
+            :repair 1
+            :state-map :move-attack
+            :image "tilesets/elite-command/units/mortar-COLOR.png"
+            :terrain-effects
+            {:plains    {:movement-cost 4 :attack-bonus  0 :armor-bonus 0}
+             :mountains {:movement-cost 9 :attack-bonus  3 :armor-bonus 5}
+             :woods     {:movement-cost 4 :attack-bonus -2 :armor-bonus 3}
+             :base      {:movement-cost 3 :attack-bonus -2 :armor-bonus 3}}
+            :attack-strengths
+            {:personnel 10
+             :armored 10}}
+   :ranger {:name "Ranger"
+            :cost 200
+            :movement 9
+            :can-capture true
+            :min-range 1
+            :max-range 1
+            :armor-type :personnel
+            :armor 6
+            :capturing-armor 2
+            :repair 1
+            :state-map :move-attack
+            :image "tilesets/elite-command/units/ranger-COLOR.png"
+            :terrain-effects
+            {:plains    {:movement-cost 3 :attack-bonus 0 :armor-bonus 0}
+             :mountains {:movement-cost 6 :attack-bonus 2 :armor-bonus 5}
+             :woods     {:movement-cost 3 :attack-bonus 2 :armor-bonus 4}
+             :base      {:movement-cost 2 :attack-bonus 2 :armor-bonus 3}}
+            :attack-strengths
+            {:personnel 9
+             :armored 4}}
+   ;; :humvee {:name "Humvee"
+   ;;          :cost 300
+   ;;          :movement 15
+   ;;          :can-capture false
+   ;;          :min-range 1
+   ;;          :max-range 1
+   ;;          :armor-type :armored
+   ;;          :armor 8
+   ;;          :capturing-armor 2
+   ;;          :repair 1
+   ;;          :state-map :free-attack-twice
+   ;;          :image "tilesets/elite-command/units/humvee-COLOR.png"
+   ;;          :terrain-effects
+   ;;          {:plains    {:movement-cost 3 :attack-bonus  0 :armor-bonus  0}
+   ;;           :woods     {:movement-cost 6 :attack-bonus -2 :armor-bonus -2}
+   ;;           :base      {:movement-cost 2 :attack-bonus  0 :armor-bonus  0}}
+   ;;          :attack-strengths
+   ;;          {:personnel 9
+   ;;           :armored 3}}
+   :tank {:name "Tank"
+          :cost 350
+          :movement 12
+          :can-capture false
+          :min-range 1
+          :max-range 1
+          :armor-type :armored
+          :armor 12
+          :capturing-armor 2
+          :repair 1
+          :state-map :move-attack
+          :image "tilesets/elite-command/units/tank-COLOR.png"
+          :terrain-effects
+          {:plains    {:movement-cost 3 :attack-bonus 0 :armor-bonus  0}
+           :woods     {:movement-cost 6 :attack-bonus 0 :armor-bonus -3}
+           :base      {:movement-cost 2 :attack-bonus 0 :armor-bonus -2}}
+          :attack-strengths
+          {:personnel 10
+           :armored 10}}
+   })

 ;; TODO: rename to maps
 (def map-definitions


Fix accumulator tree size

Fix accumulator tree size

My logic was wrong - the accumulator tree needs to be one less than
the _second_ power of two greater than the number of nodes in the
smallest layer. Adjusted accordingly.

--- src/cljs/fatlip/core.cljs
+++ src/cljs/fatlip/core.cljs
@@ -350,16 +350,16 @@
          (map #(-> [(get next-order-map (:dest %)) %])))))

-(defn- next-power-of-2-minus-1
-  "A helper for cross counting; the size of the accumulator tree needs to be 1
-  less than the first power of 2 greater than the number of nodes in one layer.
+(defn- next-power-of-2
+  "A helper for cross counting; the number of leaf nodes in the accumulator tree
+  needs to be the first power of 2 greater than the number of nodes in one layer.
   This function sets all the bits to the right of the first bit set in a 32 bit
-  number, which is the same thing"
+  number, and then increments, which is the same thing"
   [x]
   (loop [num x
          exp 0]
     (if (> exp 4)
-      num
+      (inc num)
       (let [shifted (bit-shift-right num (.pow js/Math 2 exp))]
         (recur (bit-or num shifted)
                (inc exp))))))
@@ -424,8 +424,9 @@
                                   [minus-qs minus-ps (:preds graph)]
                                   [minus-ps minus-qs (:succs graph)])
         edge-order (sorted-edge-order layer-1 layer-2 edges)
-        tree-size (next-power-of-2-minus-1 (count layer-2))
-        first-leaf (/ (dec tree-size) 2)]
+        num-leaf-nodes (next-power-of-2 (count layer-2))
+        tree-size (dec (* num-leaf-nodes 2))
+        first-leaf (dec num-leaf-nodes)]
     (loop [graph graph
            tree (vec (repeat tree-size (AccumulatorNode. 0 #{} false)))
            crossings 0


trivial

trivial

--- src/cljs/ji/ui/board.cljs
+++ src/cljs/ji/ui/board.cljs
@@ -25,6 +25,8 @@
   (merge-with - (dom/bounding-client-rect a) (dom/bounding-client-rect b)))

 ;;
+
+(def transition-duration 500) ;; ms, defined in app.scss

 (defn card-selector [card] (str ".card[data-card-id='" (card/card-id card) "']"))
 (defn player-selector [player-id] (str "[data-player-id='" player-id "']"))
@@ -77,17 +79,15 @@
       others)
     board-data))

-(letfn [(on-card-click [e]
+(letfn [(click-handler [e]
           (.preventDefault e)
           (-> (.-target e)
               (dom/closest :.card-target)
               (dom/toggle-class! "selected")))]
   (defn listen-cards! [board-el]
-    (dom/listen! [board-el :a] :click on-card-click))
+    (dom/listen! [board-el :a] :click click-handler))
   (defn unlisten-cards! [board-el]
-    (dom/unlisten! [board-el :a] :click on-card-click)))
-
-(def transition-duration 500) ;; ms, defined in app.scss
+    (dom/unlisten! [board-el :a] :click click-handler)))

 (defn transition-set! ;; TODO pass container
   "Returns updated board-data after removing the cards assocated with the set


Add more example

Add more example

--- src/clojure/cfbt/ch06.clj
+++ src/clojure/cfbt/ch06.clj
@@ -44,6 +44,16 @@
 (clojure.core/get (clojure.core/ns-map clojure.core/*ns*) 'cheddars) ;; #'cheese.taxonomy/cheddars

 (clojure.core/refer 'cheese.taxonomy :only ['bries])
-bries ;; ["Wisconsin" "Somerset" "Brie de Meaux" "Brie de Melun"]
+bries ;; ["Wisconsin" "Somerset" "Brie de Meaux"  "Brie de Melun"]

-;; Page :131 (TBC)
+(in-ns 'cheese.analysis)
+;; Notice the dash after "defn"
+(defn- private-function
+  "Just an example function that does nothing!"
+  [])
+
+(in-ns 'cheese.taxonomy)
+(clojure.core/refer-clojure)
+;(cheese.analysis/private-function) ;; Exception
+;(refer 'cheese.analysis :only ['private-function]) ;; Exception..
+


Fixing oversight

Fixing oversight

Changes:
- Final tag in tags list is now encoded as well

--- src/clojure_blog/tags.clj
+++ src/clojure_blog/tags.clj
@@ -31,5 +31,5 @@
       preceding-tags (butlast tags-list)
       last-tag (last tags-list)
       formatted-preceding (reduce str (map #(reduce str ["" % ", "]) preceding-tags))
-      formatted-last (reduce str ["" last-tag ""])]
+      formatted-last (reduce str ["" last-tag ""])]
       (reduce str ["Tags: " formatted-preceding formatted-last]))))


Added navigation with profile panel and login/logout button.

--- web/src/sound_effector/views/layout.clj
+++ web/src/sound_effector/views/layout.clj
@@ -1,7 +1,34 @@
 (ns sound-effector.views.layout
-  (:require [hiccup.page :as page]))
+  (:require
+    [cemerick.friend :as friend]
+    [hiccup.page :as page]))

-(defn common [title & content]
+(defn profile-image [user]
+  ; TODO: implements more social networks' profiles later.
+  (let [first-provider (first (:providers user))
+        first-provider-id (first first-provider)
+        first-provider-user-id (second first-provider)]
+    (cond
+      (= 1 first-provider-id)
+      (str "http://graph.facebook.com/" first-provider-user-id "/picture?type=square"))))
+
+(defn navigation [request]
+  [:div {:class "nav"}
+   (let [current-user-id (get-in request [:session ::friend/identity :current])]
+     (if-let [user (get-in request [:session ::friend/identity :authentications current-user-id :user])]
+       [:div {:class "col-md-3 col-sm-4 col-xs-4 pull-right"}
+        [:div {:class "media"}
+         [:div {:class "media-left"}
+          [:img {:class "media-object img-circle" :src (profile-image user)}]]
+         [:div {:class "media-body"}
+          [:h4 {:class "media-heading"} (:name user)]
+          [:a {:class "btn btn-default" :href "/logout"} "Logout"]]]]
+       [:div {:class "col-md-3 col-sm-4 col-xs-4 pull-right"}
+        "Join or login with" [:br]
+        [:a {:class "btn btn-fb" :href "/sound-effects"}
+         [:i {:class "fa fa-facebook"} " Facebook"]]]))])
+
+(defn common [request title & content]
   (page/html5
     [:head
      [:meta {:charset "utf-8"}]
@@ -13,7 +40,9 @@
      (page/include-css "/lib/font-awesome/css/font-awesome.min.css")
      (page/include-css "/css/sound_effector.css")]
     [:body
-     [:div {:id "content" :class "container"} content]]))
+     [:div {:id "content" :class "container"}
+      (navigation request)
+      content]]))

 (defn response-404 []
   (common "Page Not Found"


Fixed data domains

Fixed data domains

--- src/clojush/problems/software/benchmarks_v2/cut_vector.clj
+++ src/clojush/problems/software/benchmarks_v2/cut_vector.clj
@@ -31,7 +31,7 @@
 (defn cut-vector-input
   "Makes a Cut Vector input vector of length len."
   [len]
-  (vec (repeatedly len #(rand-int 10000))))
+  (vec (repeatedly len #(rand-int 10001))))

 ; Atom generators
 (def cut-vector-atom-generators
@@ -51,13 +51,13 @@
 ;; inputs is either a list or a function that, when called, will create a
 ;; random element of the set.
 (def cut-vector-data-domains
-  [[(list [0] [100] [-100] [1000] [-1000]) 5 0] ;; Length-1 vectors
+  [[(list [0] [10] [100] [1000] [10000]) 5 0] ;; Length-1 vectors
    [(fn [] (cut-vector-input 1)) 20 250] ;; Random Length-1 vectors
    [(list [2 129]
-          [1 -4]
-          [999 74]
-          [987 995]
-          [-788 -812]) 5 0] ;; Length-2 vectors
+          [0 40]
+          [9999 74]
+          [9879 9950]
+          [9225 9994]) 5 0] ;; Length-2 vectors
    [(fn [] (cut-vector-input 2)) 20 250] ;; Random Length-2 vectors
    [(fn [] (cut-vector-input (+ 3 (lrand-int 3)))) 50 500] ;; Random Length-3, -4, and -5 vectors
    [(fn [] (cut-vector-input 20)) 5 50] ;; Random Length-20 vectors


stray if -> when

stray if -> when

--- src/crawler/extractor.clj
+++ src/crawler/extractor.clj
@@ -88,14 +88,11 @@

         page-sim         (page/signature-similarity
                           signature in-host-xpath-hs)]
-    (if xpaths-hrefs'
+    (when xpaths-hrefs'
      (do
        (update-df xpaths-hrefs')
        (update-hrefs xpaths-hrefs')
-       (swap! *visited* conj sampled)
-
-       ;; do something about enumeration here)
-     nil)))
+       (swap! *visited* conj sampled)))))

 (defn process-new-page
   "Store the page signature"


Fixing backwards expected/actual error message for single child case

--- web-client/test/test_burgerboard/huh.cljs
+++ web-client/test/test_burgerboard/huh.cljs
@@ -84,7 +84,7 @@
           )
         (if (not= 1 test-count) ;; Children is actually just one child
           {:msg "Wrong number of child elements"
-           :expected 1 :actual test-count}
+           :expected test-count :actual 1}
           ((nth tests 0) children)
           )
         )


Comment out incomplete junit code

Comment out incomplete junit code

--- src/circleci/backend/project/circleci.clj
+++ src/circleci/backend/project/circleci.clj
@@ -4,7 +4,8 @@
   (:use [circleci.backend.build :only (build)])
   (:use [circleci.backend.action.vcs :only (checkout)])
   (:use [circleci.backend.action.bash :only (bash)])
-  (:use [circleci.backend.action.junit :only (junit)]))
+  ;; (:use [circleci.backend.action.junit :only (junit)])
+  )

 (def circle-build (build :project-name "CircleCI"
                          :build-num 1


Use daemon to start

Use daemon to start

--- src/circleci/backend/project/circleci.clj
+++ src/circleci/backend/project/circleci.clj
@@ -20,6 +20,6 @@
                           :group circle/circleci-group
                           :actions [(checkout "git@github.com:arohner/CircleCI.git")
                                     (bash [(lein deps)
-                                           (lein run)])
+                                           (lein daemon start :web)])
                                     ;;; Load Balancer
                                     ]))


cleanup

cleanup

--- tutorial/decomposing_a_query.clj
+++ tutorial/decomposing_a_query.clj
@@ -5,11 +5,9 @@
 ;   By using this software in any fashion, you are agreeing to be bound by
 ;   the terms of this license.
 ;   You must not remove this notice, or any other, from this software.
-(require '[datomic.client.api :as d]
-         '[datomic.samples.repl :as repl])
+(require '[datomic.client.api :as d])

 (def client (d/client {:server-type :dev-local :system "datomic-samples"}))
-(d/create-database client {:db-name "decomposing-a-query"})
 (def conn (d/connect client {:db-name "decomposing-a-query"}))

 (def db (d/db conn))
@@ -93,4 +91,4 @@
                :in $ ?e1
                :where [?e2 :a ?e1]]
       :args [db e]
-      :timeout 10000}))
+      :timeout 10000})


get token paths for records and lists

get token paths for records and lists

--- src/com/billpiel/sayid/string_output2.clj
+++ src/com/billpiel/sayid/string_output2.clj
@@ -553,8 +553,11 @@
     (let [parent (z/node up)]
       (case (-> parent :type first)
         :map (get-path up)
+        :record (get-path up)
         :map-entry (conj (get-path up) (some-> up z/down z/node :string))
         :vector (get-path-of-vec-child z)
+        :list (get-path-of-vec-child z)
+        :listp (get-path-of-vec-child z)
         :seq  (get-path-of-vec-child z)))
     []))


CMR-4537: Resolved jar file conflicts for bootstrap app.

--- bootstrap-app/project.clj
+++ bootstrap-app/project.clj
@@ -1,19 +1,31 @@
 (defproject nasa-cmr/cmr-bootstrap-app "0.1.0-SNAPSHOT"
   :description "Bootstrap is a CMR application that can bootstrap the CMR with data from Catalog REST."
   :url "https://github.com/nasa/Common-Metadata-Repository/tree/master/bootstrap-app"
-  :dependencies [[org.clojure/clojure "1.8.0"]
-                 [clj-http "2.0.0"]
-                 [nasa-cmr/cmr-access-control-app "0.1.0-SNAPSHOT"]
-                 [nasa-cmr/cmr-oracle-lib "0.1.0-SNAPSHOT"]
-                 [nasa-cmr/cmr-metadata-db-app "0.1.0-SNAPSHOT"]
-                 [nasa-cmr/cmr-indexer-app "0.1.0-SNAPSHOT"]
-                 [nasa-cmr/cmr-common-app-lib "0.1.0-SNAPSHOT"]
-                 [nasa-cmr/cmr-virtual-product-app "0.1.0-SNAPSHOT"]
-                 [compojure "1.5.1"]
-                 [ring/ring-core "1.5.0"]
-                 [ring/ring-json "0.4.0"]
-                 [org.clojure/tools.nrepl "0.2.12"]
-                 [nasa-cmr/cmr-transmit-lib "0.1.0-SNAPSHOT"]]
+  :exclusions [
+    [cheshire]
+    [clj-time]
+    [commons-io]
+    [org.clojure/tools.reader]
+    [potemkin]]
+  :dependencies [
+    [cheshire "5.8.0"]
+    [clj-http "2.0.0"]
+    [clj-time "0.14.2"]
+    [commons-io "2.6"]
+    [compojure "1.5.1"]
+    [nasa-cmr/cmr-access-control-app "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-common-app-lib "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-indexer-app "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-metadata-db-app "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-oracle-lib "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-transmit-lib "0.1.0-SNAPSHOT"]
+    [nasa-cmr/cmr-virtual-product-app "0.1.0-SNAPSHOT"]
+    [org.clojure/clojure "1.8.0"]
+    [org.clojure/tools.nrepl "0.2.12"]
+    [org.clojure/tools.reader "1.1.1"]
+    [potemkin "0.4.4"]
+    [ring/ring-core "1.5.0"]
+    [ring/ring-json "0.4.0"]]
   :plugins [[drift "1.5.3"]
             [lein-exec "0.3.2"]
             [lein-shell "0.4.0"]


Pull out config repo create into common function

--- test/civil_ci/data_test.clj
+++ test/civil_ci/data_test.clj
@@ -9,13 +9,19 @@
 (defn join [& args] (fs/absolute-path (apply io/file args)))
 (def test-dir (join (fs/absolute-path fs/*cwd*) "test-fixtures"))

+(defn read-json-file [path]
+  (if (fs/file? path) (json/parse-string (slurp path) true)))
+
+(defn make-config-repo
+  ([destination] (make-config-repo destination "fixtures/spec-config"))
+  ([destination source]
+    (fs/copy-dir (io/resource source) destination)
+    (git/git-init destination)))
+
 (defn test-dir-fixture [fn]
   (fs/mkdir test-dir)
   (fn)
   (fs/delete-dir test-dir))
-
-(defn read-json-file [path]
-  (if (fs/file? path) (json/parse-string (slurp path) true)))

 (use-fixtures :each test-dir-fixture)

@@ -54,11 +60,10 @@
 (deftest test-get-server-config

   (testing "given a file it populates"
-    (let [path (join test-dir "server-config")]
-      (fs/mkdir path)
-      (fs/copy (io/resource "fixtures/server.json") (join path "server.json"))
+    (let [path (join test-dir "server-config")
+          repo (make-config-repo path)]
       (let [server-config @(get-server-config path)]
-        (is (= (:jobs server-config) [])))))
+        (is (= (:jobs server-config) ["some-id"])))))

   (testing "nil when file is non-existant"
     (let [path (join test-dir "liuhgq4")]
@@ -66,34 +71,33 @@

   (testing "file config changes then file should reflect it"
     (let [path (join test-dir "server-config-change")
-          config-path (join path "server.json")]
-      (fs/mkdir path)
-      (fs/copy (io/resource "fixtures/server.json") config-path)
+          config-path (join path "server.json")
+          repo (make-config-repo path)]
       (let [mutable-server-config (get-server-config path)]
         (swap! mutable-server-config assoc :key "value")
         (is (= (read-json-file config-path)
-               {:jobs [] :key "value"}))))))
+               {:jobs ["some-id"] :key "value"}))))))

 (deftest test-get-job-config

   (testing "given the spec config, load it"
-    (let [path (join test-dir "job-config")]
-      (fs/copy-dir (io/resource "fixtures/spec-config") path)
+    (let [path (join test-dir "job-config")
+          repo (make-config-repo path)]
       (let [server-config (get-server-config path)
             job-config @(get-job-config path server-config)]
         (is (= (-> job-config keys count) 1))
         (is (= (-> (job-config "some-id") deref :name) "Some Job")))))

   (testing "if there as missing job configs those jobs should just be dropped"
-    (let [path (join test-dir "invalid-job-config")]
-      (fs/copy-dir (io/resource "fixtures/invalid-job-config") path)
+    (let [path (join test-dir "invalid-job-config")
+          repo (make-config-repo path "fixtures/invalid-job-config")]
       (let [server-config (get-server-config path)
             job-config @(get-job-config path server-config)]
         (is (= (-> job-config keys count) 1)))))

   (testing "if a job's config is changed it is reflected in the json file"
-    (let [path (join test-dir "changing-job-config")]
-      (fs/copy-dir (io/resource "fixtures/spec-config") path)
+    (let [path (join test-dir "changing-job-config")
+          repo (make-config-repo path)]
       (let [server-config (get-server-config path)
             job-config (get-job-config path server-config)
             some-id-config (@job-config "some-id")]
@@ -102,8 +106,8 @@
                {:name "Some Job" :key "value"})))))

   (testing "if a jobs added files should change"
-    (let [path (join test-dir "add-job-config")]
-      (fs/copy-dir (io/resource "fixtures/spec-config") path)
+    (let [path (join test-dir "add-job-config")
+          repo (make-config-repo path)]
       (let [server-config (get-server-config path)
             job-config (get-job-config path server-config)
             new-job-config (atom {:name "New Job"})]
@@ -114,8 +118,8 @@
                {:name "New Job"})))))

   (testing "if job is removed files should change"
-    (let [path (join test-dir "remove-job-config")]
-      (fs/copy-dir (io/resource "fixtures/spec-config") path)
+    (let [path (join test-dir "remove-job-config")
+          repo (make-config-repo path)]
       (let [server-config (get-server-config path)
             job-config (get-job-config path server-config)]
         (swap! job-config dissoc "some-id")
@@ -123,8 +127,8 @@
         (is (not (fs/directory? (join path "some-id")))))))

   (testing "when a job is added, changes should be reflected in the fs"
-    (let [path (join test-dir "add-job-and-change-config")]
-      (fs/copy-dir (io/resource "fixtures/spec-config") path)
+    (let [path (join test-dir "add-job-and-change-config")
+          repo (make-config-repo path)]
       (let [server-config (get-server-config path)
             job-config (get-job-config path server-config)
             new-job-config (atom {:name "New Job"})]


added test-generate-accepts-float (can't add float to test-string-round-trip because the float will become a double)

--- test/clj_json/core_test.clj
+++ test/clj_json/core_test.clj
@@ -9,6 +9,9 @@
              "vec" [1 2 3] "map" {"a" "b"} "list" (list "a" "b")}]
     (is (= obj (json/parse-string (json/generate-string obj))))))

+(deftest test-generate-accepts-float
+  (is (= "3.14" (json/generate-string (float 3.14)))))
+
 (deftest test-key-coercion
   (is (= {"foo" "bar" "1" "bat" "2" "bang" "3" "biz"}
          (json/parse-string


Remove misleading test.

Remove misleading test.

--- test/decl_ui/core_test.cljs
+++ test/decl_ui/core_test.cljs
@@ -126,13 +126,6 @@
                 {'ui/upcase (fn [_ text]
                               (str/upper-case text))})
       (is (= "HELLO WORLD" (text (sel1 "#result")))))
-    (testing "to callback should not pass atoms just values"
-      (install! {:text "Hello world"}
-                "{:upcased-text #= (ui/upcase #= :text)}"
-                "[:div#result #= :upcased-text]"
-                {}
-                {'ui/upcase (fn [_ text]
-                              (is (not (satisfies? IAtom text))))}))
     (testing "to callback should automatically recalculate"
       (install! {:text (atom "Hello world")}
                 "{:text #= :text
@@ -144,7 +137,6 @@
                 {'ui/upcase      (fn [_ text]
                                    (str/upper-case @text))
                  'ui/change-text (fn [_ text]
-                                   (prn text)
                                    (reset! text "Bye!")
                                    nil)})
       (click! (sel1 "#btn"))


nested filterer/selected? test with params

--- test/com/rpl/specter/core_test.cljc
+++ test/com/rpl/specter/core_test.cljc
@@ -17,8 +17,6 @@

 ;;TODO:
 ;; test walk, codewalk
-;; test keypath
-

 (defn limit-size [n {gen :gen}]
   (gen/->Generator
@@ -477,9 +475,19 @@
            v))
       )))

-;;TODO: test using params path
-;; using filterer, transformed, selected? with parameterized paths
-;; using cond-path parameterized paths
-;; parameterized filterer can be composed with other parmaterized paths
-;; parameterized cond-path can be composed with other parammed paths
-;; nested selected? takes params correctly
+(deftest nested-param-paths
+  (let [p (s/filterer s/keypath (s/selected? s/ALL s/keypath (s/filterer s/keypath even?) s/ALL))
+        p2 (p :a :b :c)
+        p3 (s/filterer :a (s/selected? s/ALL :b (s/filterer :c even?) s/ALL))
+        data [{:a [{:b [{:c 4 :d 5}]}]}
+              {:a [{:c 3}]}
+              {:a [{:b [{:c 7}] :e [1]}]}]
+        ]
+    (is (= (s/select p2 data)
+           (s/select p3 data)
+           [[{:a [{:b [{:c 4 :d 5}]}]}]]
+           ))
+    ))
+
+;; TODO: test multi-path with params
+


Fitting layouts with zero width/height now works

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

--- src/conexp/contrib/draw/scene_layouts.clj
+++ src/conexp/contrib/draw/scene_layouts.clj
@@ -68,7 +68,13 @@
   ([^GScene scene, layout]
      (let [[x_min y_min x_max y_max] (edges-of-points (vals (positions layout))),
            width  (- x_max x_min),
-           height (- y_max y_min)]
+           height (- y_max y_min),
+           width  (if (zero? width)
+                    1
+                    width),
+           height (if (zero? height)
+                    1
+                    height)]
        (.setWorldExtent scene
                         (double (- x_min (* 0.05 width)))
                         (double (- y_min (* 0.05 height)))


Fix failing `lein test`

Fix failing `lein test`

--- test/latte/simple_types.clj
+++ test/latte/simple_types.clj
@@ -1,6 +1,7 @@
 (ns latte.simple-types
   (:require [clojure.test :as test :refer [deftest is]])
-  (:require [latte.core :as l :refer [=== type-of term check-type?]])
+  (:require [latte.core :as l :refer [==> term lambda type-of type-check?]])
+  (:require [latte.kernel.norm :as n :refer [beta-eq?]])
   )

 ;;{
@@ -16,32 +17,28 @@
 ;;}

 (deftest basic-terms
-  (is (=== (type-of [sigma :type]
-                    (lambda [x sigma] x))
-           (term [sigma :type] (==> sigma sigma))))
+  ;; Examples 2.2.6
+  ;; (1) When x has type σ, then the identity function λx . x has type σ → σ
+  (is (beta-eq? (type-of [sigma :type] (lambda [x sigma] x)) ; (Π [x sigma] sigma)
+                (term [sigma :type] (==> sigma sigma))       ; (Π [⇧ sigma] sigma)
+                ))

-  (is (check-type? [sigma :type]
-                   (lambda [x sigma] x)
+  (is (type-check? [sigma :type] (lambda [x sigma] x)
                    (==> sigma sigma)))
-
-  (is (=== (type-of [sigma :type]
-                    [tau :type]
-                    [y (--> sigma tau)]
-                    [x sigma]
-                    (y x))
-          'tau))

-  (is (=== (type-of [alpha :type] [beta :type] [gamma :type]
-                    [x (--> alpha alpha)]
-                    [y (--> (--> alpha alpha) beta)]
-                    (lambda [u gamma] (y x)))
-           (term [beta :type] [gamma :type]
-                 (--> gamma beta))))
+  (is (beta-eq? (type-of [sigma :type]
+                         [tau :type]
+                         [y (==> sigma tau)]
+                         [x sigma]
+                         (y x))      ; tau
+                'tau                 ; tau
+                ))
+
+  (is (beta-eq? (type-of [alpha :type] [beta :type] [gamma :type]
+                         [x (==> alpha alpha)]
+                         [y (==> (==> alpha alpha) beta)]
+                         (lambda [u gamma] (y x)))   ; (Π [u gamma] beta)
+                   (term [beta :type] [gamma :type]
+                         (==> gamma beta))           ; (Π [⇧ gamma] beta)
+                   ))
   )
-
-
-
-
-
-
-


AB + JU + CW | #0 | add function to seed test questions

--- dev/user.clj
+++ dev/user.clj
@@ -80,6 +80,15 @@
                              :comment-text (str i " seed comment")})
         (recur (inc i))))))

+(defn seed-questions []
+  (let [objective (sh/store-an-open-objective)
+        user (sh/store-a-user)]
+    (loop [i 0]
+      (when (< i 120)
+        (sh/store-a-question {:user user
+                             :objective objective})
+        (recur (inc i))))))
+
 (defn seed-data []
   (seed-answers)
   (seed-comments))


macro for adding dependencies with pomegranate

--- dev/user.clj
+++ dev/user.clj
@@ -52,12 +52,10 @@

 ;; You can use this to add dependencies without rebooting your repl.
-;; Perhaps wrap into a helpful function which takes the lib name and version (ideally just optionally; newest would
-;; default) and installs that attribute using the code below.
-;; TODO XXX
-(comment
-  (use '[cemerick.pomegranate :only (add-dependencies)])
-  (add-dependencies :coordinates '[[slingshot "0.12.2"]]
-                       :repositories (merge cemerick.pomegranate.aether/maven-central
-                                            {"clojars" "http://clojars.org/repo"})))
-
+(defmacro add-dependency [dependency]
+  "A macro for adding a dependency via Pomegranate.
+   Usage: (add-dependency [incanter \"1.2.3\"])"
+  `(do (~'use '[cemerick.pomegranate :only (~'add-dependencies)])
+       (~'add-dependencies :coordinates '[~dependency]
+         :repositories (~'merge cemerick.pomegranate.aether/maven-central
+                         {"clojars" "http://clojars.org/repo"}))))


Document prod client build better [ci skip]

--- dev/user.clj
+++ dev/user.clj
@@ -3,7 +3,7 @@
    [com.rpl.specter :as s]
    [figwheel-sidecar.repl-api :as fw-repl]
    [figwheel-sidecar.config :as fw-config]
-   [taoensso.timbre :as timbre :refer [info]]))
+   [taoensso.timbre :as log]))

 (defn- set-closure-define
@@ -25,12 +25,14 @@

 (defn start-ui!
-  [& {:keys [ui-only?] :or {ui-only? false}}]
-  (let [environment (if ui-only? "prod" "dev")
+  "Start the client build.
+  Passing {:prod-config? true} points the client to the production server and logging service!"
+  [& {:keys [:prod-config?]}]
+  (let [environment (if prod-config? "prod" "dev")
         fig-config  (fw-config/fetch-config)]
-    (when ui-only? (info "Performing ui-only build..."))
+    (when prod-config? (log/info "Performing ui-only build..."))
     (fw-repl/start-figwheel!
-     (set-closure-define fig-config "dev-ui" 'name-bazaar.ui.db.environment environment)
+     (set-closure-define fig-config "dev-ui" 'name-bazaar.ui.config.environment environment)
      "dev-ui")
     (fw-repl/cljs-repl "dev-ui")))


Don't use deprecated API name

Don't use deprecated API name

--- test/caesium/crypto/box_test.clj
+++ test/caesium/crypto/box_test.clj
@@ -17,18 +17,18 @@

 (deftest keypair-generation-test
   (testing "generates new keypairs"
-    (is (let [kp1 (b/generate-keypair)
-              kp2 (b/generate-keypair)]
+    (is (let [kp1 (b/keypair!)
+              kp2 (b/keypair!)]
           (and (not (u/array-eq (:public kp1) (:public kp2)))
                (not (u/array-eq (:secret kp1) (:secret kp2)))))))
   (testing "generate public key from seed"
     (let [seed (bb/->indirect-byte-buf (r/randombytes b/seedbytes))
-          kp1 (b/generate-keypair seed)
-          kp2 (b/generate-keypair seed)]
+          kp1 (b/keypair! seed)
+          kp2 (b/keypair! seed)]
       (is (u/array-eq (:public kp1) (:public kp2)))
       (is (u/array-eq (:secret kp1) (:secret kp2)))))
   (testing "generate public key from secret key"
-    (let [kp1 (b/generate-keypair)
+    (let [kp1 (b/keypair!)
           kp2 (b/sk->keypair (:secret kp1))]
       (is (u/array-eq (:public kp1) (:public kp2)))
       (is (u/array-eq (:secret kp1) (:secret kp2))))))


Add not-and test

Add not-and test

--- test/cljc/precept/rule_test.cljc
+++ test/cljc/precept/rule_test.cljc
@@ -85,7 +85,19 @@
             [:attr-3 (= ?e (:e this)) (= ?v (:v this))]]
            [:and
             [:attr-4 (= ?e (:e this)) (= ?v (:v this))]
-            [:attr-5 (= ?e (:e this)) (= ?v (:v this))]]])))
+            [:attr-5 (= ?e (:e this)) (= ?v (:v this))]]]))
+
+  (is (= (macros/parse-with-op '[:not
+                                 [:and [?e :attr-2 ?v]
+                                       [?e :attr-3 ?v]
+                                       [?e :attr-4 ?v]
+                                       [?e :attr-5 ?v]]])
+        '[:not
+          [:and
+           [:attr-2 (= ?e (:e this)) (= ?v (:v this))]
+           [:attr-3 (= ?e (:e this)) (= ?v (:v this))]
+           [:attr-4 (= ?e (:e this)) (= ?v (:v this))]
+           [:attr-5 (= ?e (:e this)) (= ?v (:v this))]]])))

 (deftest parse-sexpr-test
   (testing "Correct order (no cached variables)"


remove hornetq-host and port from output-test entirely

Repl state fail.. sorry.

--- test/onyx/plugin/output_test.clj
+++ test/onyx/plugin/output_test.clj
@@ -84,8 +84,8 @@
     :onyx/medium :hornetq
     :onyx/consumption :concurrent
     :hornetq/queue-name in-queue
-    :hornetq/host hornetq-host
-    :hornetq/port hornetq-port
+    :hornetq/host (:host (:non-clustered (:hornetq config)))
+    :hornetq/port (:port (:non-clustered (:hornetq config)))
     :onyx/batch-size 2}

    {:onyx/name :identity


Created tests for average-concept-robustness

--- src/test/clojure/conexp/fca/more_test.clj
+++ src/test/clojure/conexp/fca/more_test.clj
@@ -157,4 +157,21 @@
       (= (concept-robustness cpt conceptsr2 (/ 1 2)) (concept-stability rctx2 cpt)))))

 ;;;
+
+(deftest test-average-concept-robustness
+  (let [ctx1 (make-context-from-matrix 3 3
+                                    [0 0 1
+                                     1 0 1
+                                     1 1 0])]
+    (is (= (average-concept-robustness (concepts ctx1) 0.5) 0.5))
+    (is (= (average-concept-robustness (concepts ctx1) (/ 1 3)) (/ 10 27))))
+
+  (with-testing-data [ctx (random-contexts 5 8)]
+    (let [cpts (concepts ctx)]
+      (= (average-concept-robustness cpts (/ 1 2))
+         (/ (reduce (fn [y cpt] (+ y (concept-stability ctx cpt))) 0 cpts)
+            (count cpts))))))
+
+
+;;;
 nil


fixed netcat issue#9

fixed netcat issue#9

--- main/src/dda/pallet/dda_serverspec_crate/infra/fact/netcat.clj
+++ main/src/dda/pallet/dda_serverspec_crate/infra/fact/netcat.clj
@@ -55,9 +55,9 @@
      (:host config-val)
      " "
      (:port config-val)
-     " -w "
+     " -z -w "
      (:timeout config-val)
-     " && echo $?")))
+     "; echo $?")))

 (s/defn parse-result [out-raw-line :- s/Str]
   (let [split-raw (clojure.string/split out-raw-line  #",")


:bug: Fix context menu handling on image shapes.

--- frontend/src/uxbox/main/ui/shapes/image.cljs
+++ frontend/src/uxbox/main/ui/shapes/image.cljs
@@ -25,9 +25,17 @@
   [{:keys [shape frame] :as props}]
   (let [selected (mf/deref refs/selected-shapes)
         selected? (contains? selected (:id shape))
-        on-mouse-down #(common/on-mouse-down % shape)]
+        on-mouse-down   (mf/use-callback
+                         (mf/deps shape)
+                         #(common/on-mouse-down % shape))
+
+        on-context-menu (mf/use-callback
+                         (mf/deps shape)
+                         #(common/on-context-menu % shape))]
+
     [:g.shape {:class (when selected? "selected")
-               :on-mouse-down on-mouse-down}
+               :on-mouse-down on-mouse-down
+               :on-context-menu on-context-menu}
      [:& image-shape {:shape (geom/transform-shape frame shape)}]]))

 ;; --- Image Shape


Support for Linux

Support for Linux

Add sample showing mount.davfs

--- Clojure/src/ambly/core.clj
+++ Clojure/src/ambly/core.clj
@@ -25,6 +25,7 @@
     (cond
       (substring-exists? os-name "mac") :mac
       (substring-exists? os-name "win") :win
+      (substring-exists? os-name "linux") :linux
       :else :unknown)))

 (defn sh
@@ -394,6 +395,11 @@
   {:pre [(keyword? os) (string? webdav-mount-point)]}
   (zero? (sh 5000 -1 false "net" "use" webdav-mount-point "/delete")))

+(defmethod umount-webdav :linux
+  [os webdav-mount-point]
+  {:pre [(string? webdav-mount-point)]}
+  (umount-webdav :unknown webdav-mount-point))
+
 (defmethod umount-webdav :unknown
   [os webdav-mount-point]
   {:pre [(string? webdav-mount-point)]}
@@ -449,6 +455,17 @@
    (or
      (extract-drive-letter (subs shell-result 0 (min 28 (count shell-result))))
      (throw (IOException. shell-result)))))
+
+(defmethod mount-webdav :linux
+  [os bonjour-name endpoint-address endpoint-port]
+  {:pre [(keyword? os) (is-ambly-bonjour-name? bonjour-name)
+         (string? endpoint-address) (number? endpoint-port)]}
+  (let [webdav-endpoint (create-http-url endpoint-address endpoint-port)]
+    (println)
+    (println "Example mount command (when prompted, hit enter for username/password):")
+    (println "  sudo mount.davfs -o uid=$UID" webdav-endpoint "/mnt/ambly")
+    (println)
+    (mount-webdav :unknown bonjour-name endpoint-address endpoint-port)))

 (defmethod mount-webdav :unknown
   [os bonjour-name endpoint-address endpoint-port]


4 peer tesT

4 peer tesT

--- test/onyx/coordinator/multi_peer_test.clj
+++ test/onyx/coordinator/multi_peer_test.clj
@@ -131,6 +131,10 @@
             peers (take n (repeatedly (fn [] (extensions/create sync :peer))))
             payloads (take n (repeatedly (fn [] (extensions/create sync :payload))))
             sync-spies (take n (repeatedly (fn [] (chan 1))))
+
+            status-spy (chan (* n 5))
+            offer-ch-spy (chan (* n 5))
+            ack-ch-spy (chan (* n 5))

             catalog [{:onyx/name :in
                       :onyx/direction :input
@@ -149,10 +153,74 @@
                       :hornetq/queue-name "out-queue"}]
             workflow {:in {:inc :out}}]

+        (tap (:offer-mult coordinator) offer-ch-spy)
+        (tap (:ack-mult coordinator) ack-ch-spy)
+
         (doseq [[peer payload sync-spy] (map vector peers payloads sync-spies)]
           (extensions/write-place sync peer payload)
-          (extensions/on-change sync payload #(>!! sync-spy %)))))
-
+          (extensions/on-change sync payload #(>!! sync-spy %)))
+
+        (doseq [peer peers]
+          (>!! (:born-peer-ch-head coordinator) peer))
+
+        (doseq [_ (range n)]
+          (<!! offer-ch-spy))
+
+
+        (>!! (:planning-ch-head coordinator) {:catalog catalog :workflow workflow})
+        (<!! offer-ch-spy)
+
+        (alts!! sync-spies)
+        (alts!! sync-spies)
+        (alts!! sync-spies)
+
+        (let [db (d/db (:conn log))]
+
+          (testing "Three peers are :acking"
+            (let [query '[:find (count ?peer) :where
+                          [?peer :peer/status :acking]]
+                  result (ffirst (d/q query db))]
+              (is (= result 3))))
+
+          (testing "One peer is idle"
+            (let [query '[:find (count ?peer) :where
+                          [?peer :peer/status :idle]]
+                  result (ffirst (d/q query db))]
+              (is (= result 1))))
+
+          (let [query '[:find ?node :where
+                        [?peer :peer/status :acking]
+                        [?peer :node/payload ?node]]
+                payload-nodes (map first (d/q query db))]
+
+            (doseq [payload-node payload-nodes]
+              (let [payload (extensions/read-place sync payload-node)]
+                (extensions/on-change sync (:status (:nodes payload)) #(>!! status-spy %))
+                (extensions/touch-place sync (:ack (:nodes payload)))))
+
+            (doseq [_ (range 3)]
+              (<!! ack-ch-spy)
+              (<!! status-spy))
+
+            (doseq [payload-node payload-nodes]
+              (let [payload (extensions/read-place sync payload-node)]
+                (extensions/touch-place sync (:completion (:nodes payload)))
+                (<!! offer-ch-spy)))))
+
+        (let [db (d/db (:conn log))]
+
+          (testing "Four peers are :idle"
+            (let [query '[:find (count ?peer) :where
+                          [?peer :peer/status :idle]]
+                  result (ffirst (d/q query db))]
+              (is (= result 4))))
+
+          (testing "All three tasks are complete"
+            (let [query '[:find (count ?task) :where
+                          [?task :task/complete? true]]
+                  result (ffirst (d/q query db))]
+              (is (= result 3)))))))
     {:eviction-delay 50000}))

 (run-tests 'onyx.coordinator.multi-peer-test)
+


proper wording for role descriptions

proper wording for role descriptions

--- src/cljs/conference_rating/conference_detail_page/conference_detail_page.cljs
+++ src/cljs/conference_rating/conference_detail_page/conference_detail_page.cljs
@@ -1,6 +1,6 @@
 (ns conference-rating.conference-detail-page.conference-detail-page
   (:require [reagent.core :as reagent :refer [atom]]
-            [conference-rating.view-utils.header :as header]
+            [conference-rating.view-utils.navbar :as navbar]
             [conference-rating.conference-detail-page.rating-list :as rating-list]
             [conference-rating.conference-detail-page.conference-information :as conference-information]
             [conference-rating.conference-detail-page.aggregated-ratings :as aggregated-ratings]
@@ -12,7 +12,7 @@

 (defn display-conference-detail-page [conference ratings]
   [:div
-   (header/nav-bar)
+   (navbar/nav-bar)
    [:div {:class "container-fluid content-container pad-top conference-container"}
     [:div {:class "row"}
      [:div {:class "col-lg-1 col-md-1"}]


removing temp emacs file

removing temp emacs file


fix key normalization in :- for keymaps

fix key normalization in :- for keymaps

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/lt/objs/settings.cljs
+++ src/lt/objs/settings.cljs
@@ -256,23 +256,27 @@
            "shift-")
          char)))

-(defn fix-keys [[k v]]
+
+(defn fix-key [k]
   (let [k (string/replace k "pmeta" kb/meta)
         keys (string/split k " ")]
     ;;ctrl cmd alt altgr shift
-    [(reduce #(str % " " %2) (map ->ordered-keystr keys)) v]))
+    (reduce #(str % " " %2) (map ->ordered-keystr keys))))
+
+(defn fix-key-entry [[k v]]
+  [(fix-key k) v])

 (defn +keys [cur m]
   (reduce (fn [res [k v]]
-            (update-in res [k] #(into (or % {}) (map fix-keys v))))
+            (update-in res [k] #(into (or % {}) (map fix-key-entry v))))
           cur
           m))

 (defn -keys [cur m]
   (reduce (fn [res [k v]]
-            (update-in res [k] #(apply dissoc % (if (map? v)
-                                                  (keys v)
-                                                  v))))
+            (update-in res [k] #(apply dissoc % (map fix-key (if (map? v)
+                                                                (keys v)
+                                                                v)))))
           cur
           m))


Include `favorite` info with `GET /api/card`

--- src/metabase/api/card.clj
+++ src/metabase/api/card.clj
@@ -31,6 +31,36 @@
       (assoc card :labels (for [card-label (card-id->card-labels (:id card))] ; TODO - do these need to be sorted ?
                             (label-id->label (:label_id card-label)))))))

+(defn- hydrate-favorites
+  "Efficiently add `favorite` status for a large collection of `Cards`."
+  [cards]
+  (let [favorite-card-ids (set (sel :many :field [CardFavorite :card_id], :owner_id *current-user-id*, :id [in (map :id cards)]))]
+    (for [card cards]
+      (assoc card :favorite (contains? favorite-card-ids (:id card))))))
+
+(defn- cards:all []
+  (sel :many Card (k/order :name :ASC) (k/where (or {:creator_id *current-user-id*}
+                                                    {:public_perms [> common/perms-none]}))))
+
+(defn- cards:mine []
+  (sel :many Card :creator_id *current-user-id* (k/order :name :ASC)))
+
+(defn- cards:fav []
+  (->> (hydrate (sel :many [CardFavorite :card_id] :owner_id *current-user-id*)
+                :card)
+       (map :card)
+       (sort-by :name)))
+
+(defn- cards:database [database-id]
+  (sel :many Card (k/order :name :ASC) (k/where (and {:database_id database-id}
+                                                     (or {:creator_id *current-user-id*}
+                                                         {:public_perms [> common/perms-none]})))))
+
+(defn- cards:table [table-id]
+  (sel :many Card (k/order :name :ASC) (k/where (and {:table_id table-id}
+                                                     (or {:creator_id *current-user-id*}
+                                                         {:public_perms [> common/perms-none]})))))
+
 (defendpoint GET "/"
   "Get all the `Cards`. With param `f` (default is `all`), restrict cards as follows:

@@ -50,21 +80,14 @@
       :database (read-check Database model_id)
       :table    (read-check Database (:db_id (sel :one :fields [Table :db_id] :id model_id)))))
   (-> (case (or f :all) ; default value for `f` is `:all`
-        :all      (sel :many Card (k/order :name :ASC) (k/where (or {:creator_id *current-user-id*}
-                                                                    {:public_perms [> common/perms-none]})))
-        :mine     (sel :many Card :creator_id *current-user-id* (k/order :name :ASC))
-        :fav      (->> (hydrate (sel :many [CardFavorite :card_id] :owner_id *current-user-id*)
-                                :card)
-                       (map :card)
-                       (sort-by :name))
-        :database (sel :many Card (k/order :name :ASC) (k/where (and {:database_id model_id}
-                                                                  (or {:creator_id *current-user-id*}
-                                                                      {:public_perms [> common/perms-none]}))))
-        :table    (sel :many Card (k/order :name :ASC) (k/where (and {:table_id model_id}
-                                                                     (or {:creator_id *current-user-id*}
-                                                                         {:public_perms [> common/perms-none]})))))
+        :all      (cards:all)
+        :mine     (cards:mine)
+        :fav      (cards:fav)
+        :database (cards:database model_id)
+        :table    (cards:table model_id))
       (hydrate :creator)
-      hydrate-labels))
+      hydrate-labels
+      hydrate-favorites))

 (defendpoint POST "/"
   "Create a new `Card`."


wiring up initial RSVP and final RSVP

wiring up initial RSVP and final RSVP

--- src/neo4j_meetup/core.clj
+++ src/neo4j_meetup/core.clj
@@ -187,15 +187,32 @@
 (defn create-rsvp [rsvp]
   (tx/statement "MATCH (e:Event {id: {event}.id})
                  MATCH (m:MeetupProfile {id: {member}.member_id})
-                 MERGE (rsvp:RSVP {id: {id}})
-                 SET rsvp.response = {response}, rsvp.guests = {guests}
-                 MERGE (m)-[:RSVPD]->(rsvp)-[:TO]->(e)
-                 RETURN ID(rsvp)"
+                 FOREACH(response IN [{responses}[-1]] |
+                   CREATE (rsvp:RSVP {id: {id}})
+                   SET rsvp.response = response.response,
+                       rsvp.guests = response.guests,
+                       rsvp.time = response.time
+                   MERGE (m)-[:RSVPD]->(rsvp)-[:TO]->(e))
+                 FOREACH(response IN {responses}[..-1] |
+                   CREATE (rsvp:RSVP {id: {id}})
+                   SET rsvp.response = response.response,
+                       rsvp.guests = response.guests,
+                       rsvp.time = response.time
+                   MERGE (m)-[:INITIALLY_RSVPD]->(rsvp)-[:TO]->(e))
+                 WITH m, e
+                 MATCH (m)-[:INITIALLY_RSVPD|:RSVPD]->(rsvp)-[:TO]->(e)
+                 WITH rsvp
+                 ORDER BY rsvp.time
+                 WITH COLLECT(rsvp) AS rsvps
+                 FOREACH(i in RANGE(0, length(rsvps)-2) |
+                   FOREACH(rsvp1 in [rsvps[i]] |
+                     FOREACH(rsvp2 in [rsvps[i+1]] |
+                       CREATE UNIQUE (rsvp1)-[:NEXT]->(rsvp2))))"
                 {:group (:group rsvp)
                  :event (:event rsvp)
                  :member (:member rsvp)
                  :id (:rsvp_id rsvp)
-                 :response (:response rsvp)
+                 :responses (:responses rsvp)
                  :guests (:guests rsvp)
                  }))

@@ -205,10 +222,10 @@
 (defn responses [rsvp]
   (if (changed-mind? rsvp)
     (if (= "yes" (:response rsvp))
-      [{:response (:response rsvp) :time (:created rsvp)}]
-      [{:response "yes" :time (:created rsvp)}
-       {:response (:response rsvp) :time (:mtime rsvp)}])
-    [{:response (:response rsvp) :time (:created rsvp)}]))
+      [{:response (:response rsvp) :time (:created rsvp) :guests (:guests rsvp)}]
+      [{:response "yes" :time (:created rsvp) :guests (:guests rsvp)}
+       {:response (:response rsvp) :time (:mtime rsvp) :guests 0}])
+    [{:response (:response rsvp) :time (:created rsvp) :guests (:guests rsvp)}]))

 (defn rsvps-with-responses [rsvps]
   (map #(assoc % :responses (responses %)) rsvps))
@@ -225,7 +242,7 @@
   (changed-mind 153596532 (load "data/rsvps-2014-04-19.json")))

 (defn load-into-neo4j []
-  (create-time-time 2011 2014)
+  (create-time-tree 2011 2014)
   (tx-api create-member  (load "data/members.json"))
   (tx-api create-event  (load "data/events.json"))
   (tx-api create-rsvp (rsvps-with-responses (load "data/rsvps-2014-04-19.json"))))


Refactor join-elements

Refactor join-elements

--- src/obb_rules/element.clj
+++ src/obb_rules/element.clj
@@ -32,7 +32,7 @@

 (defn join-elements
   "Joins several elements"
-  [e1 e2]
-  (let [q1 (element-quantity e1)
-        q2 (element-quantity e2)]
-    (assoc e1 :quantity (+ q1 q2))))
+  [& elements]
+  (let [quantities (map (fn [e] (element-quantity e)) elements)
+        template (first elements)]
+    (assoc template :quantity (apply + quantities))))


adds timers for individual operations in the service-chan-responder (#371)

--- waiter/src/waiter/state.clj
+++ waiter/src/waiter/state.clj
@@ -550,6 +550,12 @@
                                   (max 1)
                                   int)
         responder-timer (metrics/service-timer service-id "service-chan-responder-iteration")
+        responder-reserve-timer (metrics/service-timer service-id "service-chan-responder-reserve")
+        responder-release-timer (metrics/service-timer service-id "service-chan-responder-release")
+        responder-kill-timer (metrics/service-timer service-id "service-chan-responder-kill")
+        responder-update-timer (metrics/service-timer service-id "service-chan-responder-update")
+        responder-blacklist-timer (metrics/service-timer service-id "service-chan-responder-blacklist")
+        responder-unblacklist-timer (metrics/service-timer service-id "service-chan-responder-unblacklist")
         slots-available-counter (metrics/service-counter service-id "instance-counts" "slots-available")
         slots-assigned-counter (metrics/service-counter service-id "instance-counts" "slots-assigned")
         slots-in-use-counter (metrics/service-counter service-id "instance-counts" "slots-in-use")
@@ -642,21 +648,28 @@

                          reserve-instance-chan
                          (let [{:keys [current-state' response-chan response]}
-                               (handle-reserve-instance-request current-state service-id update-slot-state-fn data)]
+                               (timers/start-stop-time!
+                                 responder-reserve-timer
+                                 (handle-reserve-instance-request current-state service-id update-slot-state-fn data))]
                            (async/>! response-chan response)
                            current-state')

                          kill-instance-chan
                          (let [{:keys [current-state' response-chan response]}
-                               (handle-kill-instance-request current-state update-status-tag-fn lingering-request-threshold-ms data)]
+                               (timers/start-stop-time!
+                                 responder-kill-timer
+                                 (handle-kill-instance-request current-state update-status-tag-fn lingering-request-threshold-ms data))]
                            (async/>! response-chan response)
                            current-state')

                          release-instance-chan
-                         (handle-release-instance-request current-state service-id update-slot-state-fn update-status-tag-fn
-                                                          update-state-by-blacklisting-instance-fn update-instance-id->blacklist-expiry-time-fn
-                                                          work-stealing-received-in-flight-counter max-blacklist-time-ms
-                                                          blacklist-backoff-base-time-ms max-backoff-exponent data)
+                         (timers/start-stop-time!
+                           responder-release-timer
+                           (handle-release-instance-request
+                             current-state service-id update-slot-state-fn update-status-tag-fn
+                             update-state-by-blacklisting-instance-fn update-instance-id->blacklist-expiry-time-fn
+                             work-stealing-received-in-flight-counter max-blacklist-time-ms
+                             blacklist-backoff-base-time-ms max-backoff-exponent data))

                          query-state-chan
                          (let [{:keys [cid response-chan service-id]} data]
@@ -666,31 +679,39 @@
                            current-state)

                          update-state-chan
-                         (let [[_ data-time] data]
-                           (-> current-state
-                               (handle-update-state-request
-                                 data update-responder-state-timer update-responder-state-meter slots-assigned-counter
-                                 slots-available-counter slots-in-use-counter)
-                               ;; cleanup items from blacklist map in-case they have not been cleaned
-                               (handle-unblacklist-cleanup-request
-                                 data-time update-status-tag-fn update-instance-id->blacklist-expiry-time-fn)))
+                         (timers/start-stop-time!
+                           responder-update-timer
+                           (let [[_ data-time] data]
+                             (-> current-state
+                                 (handle-update-state-request
+                                   data update-responder-state-timer update-responder-state-meter slots-assigned-counter
+                                   slots-available-counter slots-in-use-counter)
+                                 ;; cleanup items from blacklist map in-case they have not been cleaned
+                                 (handle-unblacklist-cleanup-request
+                                   data-time update-status-tag-fn update-instance-id->blacklist-expiry-time-fn))))

                          blacklist-instance-chan
                          (let [{:keys [current-state' response-chan response]}
-                               (handle-blacklist-request
-                                 current-state update-status-tag-fn update-state-by-blacklisting-instance-fn
-                                 lingering-request-threshold-ms data)]
+                               (timers/start-stop-time!
+                                 responder-blacklist-timer
+                                 (handle-blacklist-request
+                                   current-state update-status-tag-fn update-state-by-blacklisting-instance-fn
+                                   lingering-request-threshold-ms data))]
                            (async/put! response-chan response)
                            current-state')

                          unblacklist-instance-chan
-                         (handle-unblacklist-request current-state update-status-tag-fn update-instance-id->blacklist-expiry-time-fn data))
+                         (timers/start-stop-time!
+                           responder-unblacklist-timer
+                           (handle-unblacklist-request
+                             current-state update-status-tag-fn update-instance-id->blacklist-expiry-time-fn data)))

                        ;; cleanup items from work-stealing queue one at a time if they are not needed
                        (and (seq work-stealing-queue)
                             (not (contains? #{query-state-chan, reserve-instance-chan, work-stealing-chan} chan-selected)))
-                       (release-unneeded-work-stealing-offers! service-id slots-in-use-counter slots-available-counter
-                                                               work-stealing-received-in-flight-counter requests-outstanding-counter)))]
+                       (release-unneeded-work-stealing-offers!
+                         service-id slots-in-use-counter slots-available-counter
+                         work-stealing-received-in-flight-counter requests-outstanding-counter)))]
             (do
               (metrics/reset-counter in-use-instance-counter (count (:instance-id->request-id->use-reason-map new-state)))
               (timers/stop timer-context)


[#1450] Fix lint and refactor

[#1450] Fix lint and refactor

--- backend/dev/src/dev.clj
+++ backend/dev/src/dev.clj
@@ -47,10 +47,10 @@
 (defn go []
   (alter-var-root #'flow/adapter (fn [f]
                                    (fn [{:keys [version rows-cols instance survey-id form-id]} data]
-                                     (doall (map (fn [d]
-                                                   (let [file-name (format "./dev/resources/%s/%s-%s-%s.edn" dev-flow-datasets-dir (format "%s-%s-%s" instance survey-id form-id) (name rows-cols) version)]
-                                                     (spit file-name data :append true)
-                                                     d)) data))
+                                     (let [file-name (->> (format "%s-%s-%s-%s-%s" instance survey-id form-id (name rows-cols) version)
+                                                          (format "./dev/resources/%s/%s.edn" dev-flow-datasets-dir))]
+                                       (doseq [d data]
+                                         (spit file-name data :append true)))
                                      (f nil data))))
   (commons/config)
   (ir/go))


use exposure, not generic settings

use exposure, not generic settings

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

--- acqEngine/src/org/micromanager/control.clj
+++ acqEngine/src/org/micromanager/control.clj
@@ -30,11 +30,11 @@
             1 (mm/core setPosition stage (first pos))
             2 (mm/core setPosition stage (first pos) (second pos)))))))

-(defn set-camera-settings!
-  "Sets the specified camera settings. The input argument should be something like
-   {\"Camera\" {:exposure 10}}."
-  [camera-settings]
-  (doseq-parallel [[camera {:keys [exposure]}] camera-settings]
+(defn set-camera-exposures!
+  "Sets the specified camera exposure settings. The input argument should be something like
+   {\"Camera\" 10}."
+  [camera-exposures]
+  (doseq-parallel [[camera exposure] camera-exposures]
     (mm/core setExposure camera exposure)))

 (defn set-hardware-state!
@@ -46,12 +46,12 @@
    :stage-positions
    {\"Z\" 3.0
     \"XY\" [10 20]}
-   :camera-settings
-   {\"Camera\" {:exposure 10}}}"
-  [{:keys [properties stage-positions camera-settings] :as state}]
+   :camera-exposures
+   {\"Camera\" exposure}}"
+  [{:keys [properties stage-positions camera-exposures] :as state}]
   (future (set-properties! properties))
   (future (set-stage-positions! stage-positions))
-  (future (set-camera-settings! camera-settings))
+  (future (set-camera-exposures! camera-exposures))
   nil)

 (defn new-values
@@ -81,8 +81,8 @@
    :stage-positions
    {"Z" 3.0
     "XY" [10 20]}
-   :camera-settings
-   {"Camera" {:exposure 10}}})
+   :camera-exposures
+   {"Camera" 10}})

 (def test-state-2
   {:properties
@@ -92,5 +92,5 @@
    :stage-positions
    {"Z" 5.0
     "XY" [30 10]}
-   :camera-settings
-   {"Camera" {:exposure 20}}})+   :camera-exposures
+   {"Camera" 20}})