♻ Deduplicate test data

♻ Deduplicate test data

--- test/territory_bro/congregation_test.clj
+++ test/territory_bro/congregation_test.clj
@@ -159,6 +159,11 @@
                        :congregation/id cong-id
                        :congregation/name "old name"
                        :congregation/schema-name ""}
+        rename-command {:command/type :congregation.command/rename-congregation
+                        :command/time (Instant/ofEpochSecond 2)
+                        :command/user user-id
+                        :congregation/id cong-id
+                        :congregation/name "new name"}
         renamed-event {:event/type :congregation.event/congregation-renamed
                        :event/version 1
                        :event/time (Instant/ofEpochSecond 2)
@@ -169,24 +174,13 @@
     (testing "name changed"
       (is (= [renamed-event]
              (handle-command [created-event]
-                             {:command/type :congregation.command/rename-congregation
-                              :command/time (Instant/ofEpochSecond 2)
-                              :command/user user-id
-                              :congregation/id cong-id
-                              :congregation/name "new name"}))))
+                             rename-command))))

     (testing "name not changed"
       (testing "from original"
         (is (= [] (handle-command [created-event]
-                                  {:command/type :congregation.command/rename-congregation
-                                   :command/time (Instant/ofEpochSecond 3)
-                                   :command/user user-id
-                                   :congregation/id cong-id
-                                   :congregation/name "old name"}))))
+                                  (assoc rename-command :congregation/name "old name")))))
+
       (testing "from previous rename"
         (is (= [] (handle-command [created-event renamed-event]
-                                  {:command/type :congregation.command/rename-congregation
-                                   :command/user user-id
-                                   :command/time (Instant/ofEpochSecond 3)
-                                   :congregation/id cong-id
-                                   :congregation/name "new name"})))))))
+                                  rename-command)))))))


wikidata: fixed language label key propagation

--- src/main/clojure/conexp/fca/applications/wikidata.clj
+++ src/main/clojure/conexp/fca/applications/wikidata.clj
@@ -115,7 +115,7 @@
   "retrieve labels for all entities"
   [entities & {:keys [lang] :or {lang "en"}}]
   (apply merge
-   (map (fn [ents] (find-labels-for-some-entities ents :delay *query-delay*))
+   (map (fn [ents] (find-labels-for-some-entities ents :lang lang :delay *query-delay*))
         (partition *max-entities-per-query*
                    *max-entities-per-query*
                    [] entities))))


fix bug to add brokers when topic is added

--- kafka-clj/src/kafka_clj/consumer.clj
+++ kafka-clj/src/kafka_clj/consumer.clj
@@ -202,7 +202,7 @@
   "
   (let [locked-partitions (get-locked-partitions topic-offsets)]
       (do
-	      (prn "!!!!!!send fetch " (:broker producer) " "  locked-partitions)
+	      (info "!!!!!!send fetch " (:broker producer) " "  locked-partitions)
 			  (send-fetch producer locked-partitions)

 			  (let [
@@ -542,10 +542,9 @@
                                                                    (into {} (for [[broker topics] broker-offsets1
                                                                                [topic1 offsets] topics :when (= topic1 topic) ] [broker {topic offsets}]))
                                                                    conf)))
-             producers2  (doall (create-producers-if-needed broker-offsets2 producers conf))
-             _ (do (prn "prodcers2 "  (map :broker producers2)))
-               timer-ctx (.time m-consume-cycle)
-               q (consume-brokers! producers2 group-conn broker-offsets2 msg-ch conf)]
+              producers2  (doall (create-producers-if-needed broker-offsets2 producers conf))
+              timer-ctx (.time m-consume-cycle)
+              q (consume-brokers! producers2 group-conn broker-offsets2 msg-ch conf)]

 	       (let [[v errors] q]


ignore index out of bounds execption

ignore index out of bounds execption

--- kafka-clj/src/kafka_clj/metadata.clj
+++ kafka-clj/src/kafka_clj/metadata.clj
@@ -168,6 +168,9 @@
                          (locking conn
                            (try
                              (send-recv-metadata-request conn conf)
+                             (catch IndexOutOfBoundsException ie (do
+                                                                   (warn "Error in reading medata from producer " conn " error: " ie)
+                                                                   nil))
                              (catch Exception e (do
                                                   (error "Error retreiving metadata " e)
                                                   (throw e))))))
@@ -218,7 +221,6 @@

   (defn blacklisted? [{:keys [driver] :as st} host-address]
     {:pre [driver (:host host-address) (:port host-address)]}
-    (info "blacklisted from " (keys st))
     (tcp-driver/blacklisted? driver host-address))

   (defn connector


`imports-and-refers-analysis`: remove tracking and caching

Tracking was excessively obstrusive (it monkey-patched clojure.repl) and coupled (to nrepl middleware).

Now `symbols->ns-syms` doesn't use caching at all, as it ran in less than 1ms anyway.

Similarly `all-ns-imports` has been removed of any caching. This function was a little more expensive (100ms for a medium-sized project), but parallelizing it brings that cost down to 20ms which seems more than acceptable for an end user.

These changes are backed by `refactor-nrepl.ns.imports-and-refers-analysis-test`.

--- src/refactor_nrepl/ns/imports_and_refers_analysis.clj
+++ src/refactor_nrepl/ns/imports_and_refers_analysis.clj
@@ -4,54 +4,23 @@
 (ns refactor-nrepl.ns.imports-and-refers-analysis
   "Formerly known as `refactor-nrepl.ns.slam.hound.regrow`."
   (:require
-   [nrepl.middleware.interruptible-eval :refer [*msg*]]
    [refactor-nrepl.ns.class-search :as class-search]))

-(def ^:dynamic *cache* (atom {}))
-(def ^:dynamic *dirty-ns* (atom #{}))
+;; Benefits from `pmap` because ns-imports is somewhat expensive.
+(defn- all-ns-imports
+  ([]
+   (all-ns-imports {} (all-ns)))
+  ([init namespaces]
+   (->> namespaces
+        (pmap (fn [ns]
+                [ns, (ns-imports ns)]))
+        (into init))))

-(defn wrap-clojure-repl [f]
-  (fn [& args]
-    (when-let [ns (some-> *msg* :ns symbol find-ns)]
-      (swap! *dirty-ns* conj ns))
-    (apply f args)))
-
-;; XXX remove this if possible, we shouldn't be this sort of stuff.
-(alter-var-root #'clojure.main/repl wrap-clojure-repl)
-
-(defn cache-with-dirty-tracking
-  "The function to be cached, f, should have two signatures. A zero-operand
-  signature which computes the result for all namespaces, and a two-operand
-  version which takes the previously computed result and a list of dirty
-  namespaces, and returns an updated result."
-  [k f]
-  (if *cache*
-    (if-let [cached (get @*cache* k)]
-      (if-let [dirty (seq @*dirty-ns*)]
-        (k (swap! *cache* assoc k (f cached dirty)))
-        cached)
-      (k (swap! *cache* assoc k (f))))
-    (f)))
-
-(defn clear-cache! []
-  (when *cache*
-    (reset! *cache* {})
-    (reset! *dirty-ns* #{})))
-
-(defn- all-ns-imports*
+;; Doesn't need parallelization (unlike `all-ns-imports`),
+;; as this defn is instantaneous.
+(defn- symbols->ns-syms
   ([]
-   (all-ns-imports* {} (all-ns)))
-  ([init namespaces]
-   (reduce (fn [imports ns]
-             (assoc imports ns (ns-imports ns)))
-           init namespaces)))
-
-(defn- all-ns-imports []
-  (cache-with-dirty-tracking :all-ns-imports all-ns-imports*))
-
-(defn- symbols->ns-syms*
-  ([]
-   (symbols->ns-syms* {} (all-ns)))
+   (symbols->ns-syms {} (all-ns)))
   ([init namespaces]
    (reduce
     (fn [m ns] (let [ns-sym (ns-name ns)]
@@ -60,9 +29,6 @@
                     (assoc m k (conj (or (m k) #{}) ns-sym)))
                   m (keys (ns-publics ns)))))
     init namespaces)))
-
-(defn- symbols->ns-syms []
-  (cache-with-dirty-tracking :symbols->ns-syms symbols->ns-syms*))

 (defn- ns-import-candidates
   "Search (all-ns) for imports that match missing-sym, returning a set of


Upgrade dependencies

Upgrade dependencies

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -10,8 +10,8 @@

   :source-paths ["src-server"]

-  :dependencies [[org.clojure/clojure "1.7.0-beta2"]
-                 [org.clojure/clojurescript "0.0-3269"]
+  :dependencies [[org.clojure/clojure "1.7.0-RC2"]
+                 [org.clojure/clojurescript "0.0-3308"]
                  [com.ksmpartners/sql-file "0.1.0"]
                  [ring/ring-jetty-adapter "1.3.2"]
                  [compojure "1.3.4"]
@@ -27,7 +27,9 @@

   :cljsbuild {:builds [{:source-paths ["src-client"]
                         :compiler {:output-to "resources/public/metlog.js"
-                                   :optimizations :advanced}}]}
+                                   :optimizations :advanced
+                                   ; :optimizations :whitespace :pretty-print true
+                                   }}]}

   :jar-name "metlog-vault.jar"
   :uberjar-name "metlog-vault-standalone.jar")


Comment

Comment

--- lein-less4j/src/leiningen/less4j.clj
+++ lein-less4j/src/leiningen/less4j.clj
@@ -113,6 +113,8 @@
 :inline-javascript    Enable inline Javascript plugin.
 :verbosity            Set verbosity level, valid values are 1 and 2.

+Other options are passed as is to less4clj.
+
 Command arguments:
 Add `:debug` as subtask argument to enable debugging output."
   {:help-arglists '([once auto])


One more fix

One more fix

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspaces_list.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspaces_list.cljs
@@ -46,7 +46,7 @@
                       (let [desc (common/get-text refs "wsDescription")
                             [ns n] (input/get-text refs "wsNamespace" "wsName")
                             attributes (if (clojure.string/blank? desc) {} {:description desc})]
-                        (swap! state assoc :creating-wf true :error nil)
+                        (swap! state assoc :creating-wf true :error nil :validation-error nil)
                         (endpoints/call-ajax-orch
                           {:endpoint (endpoints/create-workspace ns n)
                            :payload {:namespace ns :name n :attributes attributes}


Update credentials.clj

Update credentials.clj

--- lein/credentials.clj
+++ lein/credentials.clj
@@ -2,5 +2,5 @@
 ;; --------------------------
 ;; gpg --default-recipient-self -e ~/.lein/credentials.clj > ~/.lein/credentials.clj.gpg

-{#"my\.datomic\.com" {:username "evansp2@gmail.com" :password <PASSWORD>}
- #"https://clojars.org/repo" {:username "evanspa" :password <PASSWORD>}}
+{#"my\.datomic\.com" {:username <USERNAME> :password <PASSWORD>}
+ #"https://clojars.org/repo" {:username <USERNAME> :password <PASSWORD>}}


Add docstring to build task.

Add docstring to build task.

--- project/scrape-summitpost-data/build.boot
+++ project/scrape-summitpost-data/build.boot
@@ -12,5 +12,7 @@
          :version "0.0.0"}
     jar {:main 'scrape-summitpost-data.core})

-(deftask build []
+(deftask build
+  "Build scrape-summitpost-data uberjar."
+  []
   (comp (aot) (pom) (uber) (jar) (target)))


style fix

style fix

--- src/main/clojure/clojure/tools/analyzer/passes/js/infer_tag.clj
+++ src/main/clojure/clojure/tools/analyzer/passes/js/infer_tag.clj
@@ -163,14 +163,14 @@
   [{:keys [class] :as ast}]
   (let [class (or (first (:raw-forms class))
                   (:form class))]
-   (assoc ast :tag (case class
-                     js/Object   'object
-                     js/String   'string
-                     js/Array    'array
-                     js/Number   'number
-                     js/Function 'function
-                     js/Boolean  'boolean
-                     class))))
+    (assoc ast :tag (case class
+                      js/Object   'object
+                      js/String   'string
+                      js/Array    'array
+                      js/Number   'number
+                      js/Function 'function
+                      js/Boolean  'boolean
+                      class))))
 (defn infer-tag
   [{:keys [tag] :as ast}]
   (merge (-infer-tag ast)


Display the first 2 entries for the top level nil.

--- src/app/cljs/one/sample/view.cljs
+++ src/app/cljs/one/sample/view.cljs
@@ -1,6 +1,6 @@
 (ns ^{:doc "Render the views for the application."}
   one.sample.view
-  (:use [domina :only (set-html! set-styles! styles by-id set-style!
+  (:use [domina :only (set-html! append! set-styles! styles by-id set-style!
                        by-class value set-value! set-text! nodes single-node)]
         [domina.xpath :only (xpath)]
         [one.browser.animation :only (play)])
@@ -142,9 +142,16 @@
   (fx/initialize-views-fnx (:ns-nav snippets) (:fn-display snippets) (:spinner snippets)))

 (defmethod render-fnx :ns-navigating [{:keys [state all-ns ns-nav]}]
-  (js/alert (pr-str (all-ns ns-nav)))
-  (set-styles! (by-id "spinner") {:display "none"})
-  (set-styles! (by-id "ns-nav") {:display "block"}))
+  (let [lns (second  (all-ns ns-nav))
+        nsn (by-id "ns-nav")]
+    (js/alert (str  "list of namespaces for " (pr-str ns-nav) ":" (pr-str lns)))
+
+    (set-styles! (by-id "spinner") {:display "none"})
+
+    (set-styles! nsn {:display "block"})
+
+    (set-html! nsn (str "
"  (first lns) "
"))
+    (append! nsn (str "
"  (second lns) "
"))))

 (dispatch/react-to #{:state-change-fnx} (fn [_ m] (render-fnx m)))


add comment about mtime <-> lastmodified conversions

--- src/brainbot/nozzle/esconnect.clj
+++ src/brainbot/nozzle/esconnect.clj
@@ -46,12 +46,20 @@
            :parent {:index "not_analyzed", :type "string", :store "yes"}},
           :_source {:enabled false}}})

+;;; when sending around messages via rabbitmq we pass the lastmodified
+;;; date as unix time (as integer). the field is called mtime while in
+;;; rabbitmq. elasticsearch has a dedicated date type, and we store
+;;; the lastmodified date under the lastmodified field.
+;;; mtime->lastmodied and lastmodified->mtime convert between these
+;;; two representations.

 (defn mtime->lastmodified
+  "convert unix timestamp to elasticsearch compatible string representation"
   [mtime]
   (str (tcoerce/from-long (* 1000 (long mtime)))))

 (defn lastmodified->mtime
+  "convert elasticsearch date string to unix timestamp"
   [lastmodified]
   (quot (tcoerce/to-long (tcoerce/from-string lastmodified)) 1000))


fix wrongly reducing into nil

fix wrongly reducing into nil

--- src/bzzz/query.clj
+++ src/bzzz/query.clj
@@ -61,7 +61,8 @@
     (assoc doc :_result_state
            (reduce (fn [sum ^TermPayloadClojureScoreQuery query]
                      (if-let [state (bzzz.queries.term-payload-clj-score/extract-result-state query doc-id)]
-                       (conj sum state)))
+                       (conj sum state)
+                       sum))
                    []
                    queries))
     doc))


refine profile: dev/pro

refine profile: dev/pro

--- ext/chrome/project.clj
+++ ext/chrome/project.clj
@@ -7,6 +7,7 @@
                  [compojure "1.2.1"]
                  [ring/ring-defaults "0.1.3"]
                  [hiccup "1.0.5"]
+                 [enlive "1.1.5"]
                  [domina "1.0.3"]
                  ]
   :plugins [[lein-cljsbuild "1.0.3"]
@@ -17,8 +18,10 @@
   :ring {:handler owl.web.routes/app
          :init owl.web.routes/init
          :destroy owl.web.routes/destroy}
-  :profiles {:dev {;:plugins [[com.cemerick/austin "0.1.6"]]
-                   :repl-options {:repl-listen-port 9000}
+  :profiles {:dev {:plugins []
+                   :dependencies []
+                   :repl-options {:repl-listen-port 9000
+                                  :init-ns owl.web.brepl}
                    :cljsbuild {:builds
                                [{:source-paths ["src/cljs" "src/brepl"]
                                  :compiler {:output-to


Update pom [skip ci]

Update pom [skip ci]

--- build.boot
+++ build.boot
@@ -40,11 +40,12 @@
 (def +version+ "0.6.1-SNAPSHOT")

 (task-options!
-  pom  {:project     'moxaj/mikron
-        :version     +version+
-        :description "mikron is a schema-based serialization library for Clojure and ClojureScript"
-        :url         "https://github.com/moxaj/mikron"
-        :licence     {"Eclipse Public License" "http://www.eclipse.org/legal/epl-v10.html"}})
+  pom {:project     'moxaj/mikron
+       :version     +version+
+       :description "mikron is a schema-based serialization library for Clojure and ClojureScript"
+       :url         "http://github.com/moxaj/mikron"
+       :licence     {:name "Eclipse Public License"
+                     :url  "http://www.eclipse.org/legal/epl-v10.html"}})

 (bootlaces/bootlaces! +version+
   :dont-modify-paths? true)


Add dev task

Add dev task

For including the dev folders only when needed

--- build.boot
+++ build.boot
@@ -2,17 +2,17 @@
 (def version "0.0.1-SNAPSHOT")

 (set-env! :resource-paths #{"src/clojure"}
-          :source-paths   #{"dev" "dev-resources" "src/java" "test"}
-          :dependencies   '[[adzerk/boot-test "RELEASE" :scope "test"]
-                            [aleph "0.4.3"]
-                            [org.apache.logging.log4j/log4j-core "2.8.2" :scope "test"]
-                            [org.apache.logging.log4j/log4j-1.2-api "2.8.2" :scope "test"]
-                            [org.clojure/clojure "1.9.0-beta1"]
-                            [org.clojure/spec.alpha "0.1.123"]
-                            [org.clojure/test.check "0.10.0-alpha2" :scope "test"]
-                            [org.clojure/tools.logging "0.4.0"]
-                            [samestep/boot-refresh "0.1.0" :scope "test"]
-                            [tolitius/boot-check "0.1.4" :scope "test"]])
+          :dependencies '[[adzerk/boot-test "RELEASE" :scope "test"]
+                          [aleph "0.4.3"]
+                          [org.apache.logging.log4j/log4j-core "2.8.2" :scope "test"]
+                          [org.apache.logging.log4j/log4j-1.2-api "2.8.2" :scope "test"]
+                          [org.clojure/clojure "1.9.0-beta1"]
+                          [org.clojure/spec.alpha "0.1.123"]
+                          [org.clojure/test.check "0.10.0-alpha2" :scope "test"]
+                          [org.clojure/tools.logging "0.4.0"]
+                          [samestep/boot-refresh "0.1.0" :scope "test"]
+                          [tolitius/boot-check "0.1.4" :scope "test"]]
+          :source-paths   #{"src/java" "test"})

 (task-options!
  aot {:namespace   #{'frereth-cp.server 'frereth-cp.client}}
@@ -41,11 +41,16 @@
   (let [dir (if (seq dir) dir #{"target"})]
     (comp (javac) (aot) (pom) (uber) (jar) (target :dir dir))))

+(deftask dev
+  []
+  (merge-env! :source-paths #{"dev" "dev-resources"})
+  identity)
+
 (deftask cider-repl
   "Set up a REPL for connecting from CIDER"
   []
   ;; Just because I'm prone to forget one of the vital helper steps
-  (comp (cider) (javac) (repl)))
+  (comp (dev) (cider) (javac) (repl)))

 (deftask run
   "Run the project."


Fix travis config

Fix travis config

--- build.boot
+++ build.boot
@@ -136,10 +136,12 @@
         (target)
         (with-pass-thru _
           (host-process
-            (conch/proc "cmd" "/c" "lumo"
-                        "-c" (System/getProperty "fake.class.path")
-                        "-k" "lumo_cache"
-                        "target/mikron/node.cljs"))))
+            (conch/proc
+              (format-commands
+                ["lumo"
+                 "-c" (System/getProperty "fake.class.path")
+                 "-k" "lumo_cache"
+                 "target/mikron/node.cljs"])))))
       (comp
         (compile-cljs :id "node\\index")
         (target)


onto 0.1.8

onto 0.1.8

--- build.boot
+++ build.boot
@@ -1,4 +1,4 @@
-(def +version+ "0.1.7")
+(def +version+ "0.1.8-SNAPSHOT")

 (set-env!
   :source-paths #{"src"}


Use funcool/bootutils.

Use funcool/bootutils.

--- build.boot
+++ build.boot
@@ -2,6 +2,7 @@
  :source-paths #{"src"}
  :resource-paths #{"assets"}
  :dependencies '[[cats "0.4.0"]
+                 [funcool/bootutils "0.1.0-SNAPSHOT" :scope "test"]
                  [adzerk/boot-cljs "0.0-2814-3" :scope "test"]
                  [boot-cljs-test/node-runner "0.1.0" :scope "test"]
                  [org.clojure/clojurescript "0.0-3123"  :scope "test"]
@@ -10,62 +11,18 @@

 (require
  '[adzerk.boot-cljs :refer [cljs]]
+ '[bootutils.core :refer :all]
  '[boot-cljs-test.node-runner :refer :all])

 (def +version+ "0.1.2")

-(deftask clojars-credentials
-  []
-  (fn [next-handler]
-    (fn [fileset]
-      (let [clojars-creds (atom {})]
-        (print "Username: ")
-        (swap! clojars-creds assoc :username (read-line))
-        (print "Password: ")
-        (swap! clojars-creds assoc :password
-               (apply str (.readPassword (System/console))))
-        (merge-env!
-         :repositories [["deploy-clojars" (merge @clojars-creds {:url "https://clojars.org/repo"})]])
-        (next-handler fileset)))))
-
-(deftask push-snapshot
-  "Deploy snapshot version to Clojars."
-  [f file PATH str "The jar file to deploy."]
-  (comp (clojars-credentials)
-        (push :file file
-              :ensure-snapshot true
-              :repo "deploy-clojars"
-              :ensure-version +version+
-              :ensure-clean false
-              :ensure-branch "master")))
-
-(deftask push-release
-  "Deploy snapshot version to Clojars."
-  [f file PATH str "The jar file to deploy."]
-  (comp (clojars-credentials)
-        (push :file file
-              :ensure-release true
-              :repo "deploy-clojars"
-              :ensure-version +version+
-              :ensure-clean true
-              :ensure-branch "master")))
-
-(deftask build []
-  (comp (pom :project     'funcool/promesa
-             :version     +version+
-             :description "A promise library for ClojureScript"
-             :url         "https://github.com/funcool/promesa"
-             :scm         {:url "https://github.com/funcool/promesa"}
-             :license     {"BSD (2 Clause)" "http://opensource.org/licenses/BSD-2-Clause"})
-        (jar)))
-
-(deftask deploy-snapshot []
-  (comp (build)
-        (push-snapshot)))
-
-(deftask deploy-release []
-  (comp (build)
-        (push-release)))
+(task-options!
+ pom {:project     'funcool/promesa
+      :version     +version+
+      :description "A promise library for ClojureScript"
+      :url         "https://github.com/funcool/promesa"
+      :scm         {:url "https://github.com/funcool/promesa"}
+      :license     {"BSD (2 Clause)" "http://opensource.org/licenses/BSD-2-Clause"}})

 (deftask dev []
   (set-env! :source-paths #{"src" "test" "assets"})


cut v0.0.3

cut v0.0.3

--- build.boot
+++ build.boot
@@ -19,7 +19,7 @@
          '[boot.core        :as core :refer [deftask]]
          '[nha.run])

-(def +version+ "0.0.3-SNAPSHOT")
+(def +version+ "0.0.3")

 (bootlaces! +version+)


CMR-4390: Fix failing test

CMR-4390: Fix failing test

--- system-int-test/test/cmr/system_int_test/search/collection_with_new_granule_search_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_with_new_granule_search_test.clj
@@ -89,8 +89,9 @@
       (let [range-references (search/find-concepts-with-param-string
                                "collection"
                                "has_granules_created_at=2014-01-01T10:00:00Z,2016-02-01T10:00:00Z")
+            ;; TODO test that an end date before a start date throws a 400 error
             none-found (client/get (str "http://localhost:3003/collections"
-                                        "?has-granules-created-at=2017-02-01T10:00:00Z,2016-02-01T10:00:00Z"))]
+                                        "?has-granules-created-at=2016-02-01T10:00:00Z,2017-02-01T10:00:00Z"))]
         (d/refs-match? [regular-collection] range-references)
         (and (= (:body none-found) "")
              (= (get (:headers none-found) "CMR-Hits") 0))))


remove inspect

remove inspect

--- frontend/scroll.cljs
+++ frontend/scroll.cljs
@@ -13,7 +13,7 @@

 (defn setup-scroll-handler []
   (go-loop []
-    (when-let [event (utils/inspect (<! scroller-ch))]
+    (when-let [event (<! scroller-ch)]
       (doseq [[key callback] (:callbacks @scroller-state)]
         (utils/swallow-errors (callback event)))
       (recur))))


pr comments

pr comments

--- access-control-app/src/cmr/access_control/services/auth_util.clj
+++ access-control-app/src/cmr/access_control/services/auth_util.clj
@@ -72,7 +72,7 @@
                          ;; for single instance acls
                          (= action-description "read") [:update :delete]
                          (= action-description "delete") [:delete]
-                         :else permission)]
+                         :else [permission])]
    (when (or legacy-guid concept-id)
      (doseq [permission permissions]
        (filter #(or (= concept-id (-> % :single-instance-object-identity :target-guid))


Minor fix: wrong API params

Minor fix: wrong API params

--- src/photon/api.clj
+++ src/photon/api.clj
@@ -165,7 +165,7 @@
              (:current-value (projection stm "__streams__"))))})

 (defn projections [stm]
-  (projections-without-val (:queries @(:state stm))))
+  (projections-without-val stm))

 (defn map->hashmap [^Map m]
   (java.util.HashMap. m))


Changed blosum-metric to blosum-score

Changed blosum-metric to blosum-score

--- src/pscan/core.clj
+++ src/pscan/core.clj
@@ -81,8 +81,8 @@
   [s]
   (Float/parseFloat s))

-(defn blosum-metric
-  "BLOSUM pseudo-metric; returns negative of the similarity score
+(defn blosum-score
+  "Returns the BLOSUM score of a aligned to b
    BLOSUM62 matrix, gap penalty 11, extension penalty 1 (BLAST defaults)"
   [a b]
   (match.Match2/blosum62 a b))


Fikset opp Clojure-løsning på Cryptocraphic Cipher

--- cryptocraphic_cipher/larstvei.clj
+++ cryptocraphic_cipher/larstvei.clj
@@ -24,19 +24,18 @@
     (when (every? seq seqs)
       (lazy-seq (step v-original-seqs)))))

-(defn matches? [img k]
-  (= signature
-     (map bit-xor (cycle k) img)))
+(defn decode [img key]
+  (map bit-xor (cycle key) img))
+
+(defn matches? [img key]
+  (= signature (decode (take 8 img) key)))

 (defn get-key [img]
   (let [alphabet (map (partial + 97) (range 26))
         keys ((fn ! [n] (lazy-cat (->> alphabet (repeat n)
                                       (apply cartesian-product))
                           (! (inc n)))) 1)]
-    (->> (filter (partial matches? (take 8 img)) keys) first)))
-
-(defn decode [img key]
-  (map bit-xor (cycle key) img))
+    (->> (filter (partial matches? img) keys) first)))

 (let [img (decode64 (slurp *in*))
       key (get-key img)]


fix cljs inst bug

fix cljs inst bug

--- src/tick/core.cljc
+++ src/tick/core.cljc
@@ -170,7 +170,7 @@
   (zoned-date-time [f] (zoned-date-time (f)))

   Instant
-  (inst [i] #?(:clj (Date/from i) :cljs (new Date. (.toEpochMilli i))))
+  (inst [i] #?(:clj (Date/from i) :cljs (Date. (.toEpochMilli i))))
   (instant [i] i)
   (offset-date-time [i] (. OffsetDateTime ofInstant i (current-zone)))
   (zoned-date-time [i] (. ZonedDateTime ofInstant i (current-zone)))


lein-release plugin: preparing 0.1.5 release

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject re-view-material "0.1.5-SNAPSHOT"
+(defproject re-view-material "0.1.5"
   :description "Material design components in re-view"
   :url "https://www.github.com/re-view/re-view-material"
   :license {:name "MIT License"


Wire up main.

Wire up main.

--- project.clj
+++ project.clj
@@ -12,4 +12,5 @@
                com.draines.postal.date
                com.draines.postal.main
                com.draines.postal.sendmail
-               com.draines.postal.smtp])
+               com.draines.postal.smtp]
+  :main com.draines.postal.main)


Bumped main dependecies: clojurescript (.170), lein-cljsbuild and lein-figwheel.

--- project.clj
+++ project.clj
@@ -1,6 +1,6 @@
 (defproject cljs-browser-repl "0.1.0-SNAPSHOT"
   :dependencies [[org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "1.7.145"]
+                 [org.clojure/clojurescript "1.7.170"]
                  [replumb/replumb "0.1.0"]
                  [cljsjs/jqconsole "2.13.1-0"]
                  [cljsjs/highlight "8.4-0"]
@@ -13,7 +13,7 @@
                  [markdown-clj "0.9.78"]
                  [hickory "0.5.4"]]

-  :plugins [[lein-cljsbuild "1.1.0"]
+  :plugins [[lein-cljsbuild "1.1.1"]
             [lein-codox "0.9.0"]
             ;; [lein-simpleton "1.4.0-SNAPSHOT"]
             ]
@@ -68,7 +68,7 @@
   :profiles {:dev {:dependencies [[com.cemerick/piggieback "0.1.5"]
                                   [org.clojure/tools.nrepl "0.2.11"]]
                    :plugins [[lein-doo "0.1.6-SNAPSHOT"]
-                             [lein-figwheel "0.4.1" :exclusions [cider/cider-nrepl]]]
+                             [lein-figwheel "0.5.0" :exclusions [cider/cider-nrepl]]]
                    :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
                    :figwheel {:nrepl-port 5088
                               :repl true


0.5.0.

--- project.clj
+++ project.clj
@@ -3,5 +3,5 @@
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.6.0"]
                  [org.clojure/core.async "0.1.303.0-886421-alpha"]
-                 [com.mdrogalis/onyx "0.5.0-SNAPSHOT"]
-                 [com.mdrogalis/onyx-core-async "0.5.0-SNAPSHOT"]])
+                 [com.mdrogalis/onyx "0.5.0"]
+                 [com.mdrogalis/onyx-core-async "0.5.0"]])


Add output-dir and :optimizations :none to make node tests work

--- project.clj
+++ project.clj
@@ -38,9 +38,12 @@
                                    :pretty-print false}}
                        {:id "node-test"
                         :source-paths ["src/cljs" "src/node" "test/cljs" "test/node" "test/doo"]
-                        :compiler {:main launcher.runner
+                        :compiler {:target :nodejs
+                                   :main launcher.runner
                                    :output-to "dev-resources/private/test/node/compiled/nodejs-test.js"
-                                   :target :nodejs}}
+                                   :output-dir "dev-resources/private/test/node/compiled/out"
+                                   :asset-path "dev-resources/private/test/node/compiled/out"
+                                   :optimizations :none}}
                        {:id "node-repl"
                         :source-paths ["src/cljs" "src/node" "repl-demo/node/cljs"]
                         :compiler {:target :nodejs


figwheel.repl: test for zero length output

--- figwheel-repl/src/figwheel/repl.cljc
+++ figwheel-repl/src/figwheel/repl.cljc
@@ -358,7 +358,7 @@
                                  (pr-str result-value)
                                  result-value)
                   output-str (str sb)]
-              (when print-to-console?
+              (when (and print-to-console? (not (zero? (.getLength sb))))
                 (js/setTimeout #(out-print :console [output-str]) 0))
               {:status :success
                :out output-str


fixes; planning

fixes; planning


Fix numbers

Fix numbers


Remove error test code again.

Remove error test code again.

--- src/posthere/app.clj
+++ src/posthere/app.clj
@@ -40,9 +40,6 @@

   ; Resource requests (in development only, otherwise handled by nginx)
   (route/resources "/")
-
-  ;; Force an error for testing Sentry error reporting
-  (GET "/_/force_error" [] (/ 42 0))

   ;; Home page for development, handled by nginx in production
   (GET "/" [] (slurp "./resources/public/index"))


Add selection of non-favorite pokemon, related #5

--- frontend/src/cruncher/views.cljs
+++ frontend/src/cruncher/views.cljs
@@ -10,6 +10,17 @@
             [cruncher.utils.lib :as lib]
             [cruncher.utils.views :as vlib]))

+;;;; Selections
+(defn select-all-but-favorite
+  []
+  (let [rows (gdom/getElementsByClass "poketable-row")]
+    (doall (map (fn [row]
+                  (let [id (.getAttribute row "data-id")
+                        favorite (.getAttribute row "data-favorite")
+                        checkbox (gdom/getElement (str "poketable-checkbox-" id))]
+                    (when-not (= "true" favorite)
+                      (set! (.. checkbox -checked) true)))) rows))))
+
 ;;;; Controls
 (defui Controls
   Object
@@ -18,7 +29,9 @@
              (dom/span #js {:className "pull-right"} (vlib/loader (om/props this)))
              (vlib/button-primary #(com/route :get-all-pokemon) "Get all Pokemon")
              " "
-             (vlib/button-primary #(shredder/power-on this) (vlib/fa-icon "fa-eraser") " Crunch selected Pokemon")
+             (vlib/button-primary #(shredder/power-on this) (dom/span nil (vlib/fa-icon "fa-eraser") " Crunch selected Pokemon"))
+             " "
+             (vlib/button-primary select-all-but-favorite "Select all but favorite")
              (dom/br nil)
              (dom/br nil)
              (dom/div nil (progress/progress-bar (om/props this))))))
@@ -54,18 +67,24 @@
                (lib/get-info)))))
 (def info-message (om/factory InfoMessage))

+
 ;;;; Poketable
 (defui PokeTableEntry
   Object
   (render [this]
     (let [pokemon (om/props this)]
-      (dom/tr nil
+      (dom/tr #js {:id            (str "poketable-row-" (:id pokemon))
+                   :className     "poketable-row"
+                   :data-favorite (:favorite pokemon)
+                   :data-id       (:id pokemon)
+                   :data-iv-perfect (:individual_percentage pokemon)}
               (dom/td nil
-                      (dom/div #js {:className "checkbox"}
-                               (dom/label nil
-                                          (dom/input #js {:className "poketable-checkbox"
-                                                          :type      "checkbox"
-                                                          :value     (:id pokemon)}))))
+                      (dom/div #js {:className "checkbox"})
+                      (dom/label nil
+                                 (dom/input #js {:id        (str "poketable-checkbox-" (:id pokemon))
+                                                 :className "poketable-checkbox"
+                                                 :type      "checkbox"
+                                                 :value     (:id pokemon)})))
               (dom/td nil (if (:favorite pokemon) (vlib/fa-icon "fa-star") (vlib/fa-icon "fa-star-o")))
               (dom/td nil (:pokemon_id pokemon))
               (dom/td nil (:name pokemon))


Implement PGP signature verification.

Implement PGP signature verification.


Use malli to validate client-id in dev mode.


Unused function is unused

Unused function is unused

--- src-cljs/frontend/components/account.cljs
+++ src-cljs/frontend/components/account.cljs
@@ -24,10 +24,6 @@
             [om.core :as om :include-macros true])
   (:require-macros
    [frontend.utils :refer [component defrender element html]]))
-
-(defn active-class-if-active [current-subpage subpage-link]
-  (if (= current-subpage subpage-link)
-    {:class "active"}))

 (defn handle-email-notification-change [owner pref]
   (raise! owner [:preferences-updated {:basic_email_prefs pref}]))


Don't use h1 tags for subheaders on landing (SEO penalty)

--- src-cljs/frontend/components/landing.cljs
+++ src-cljs/frontend/components/landing.cljs
@@ -226,7 +226,7 @@
           [:figure drawings/drawing-dashboard]]
          [:div.home-articles
           [:article {:ref "purpose-article"}
-           [:h1 "Launches are dead, long live iteration."]
+           [:h2 "Launches are dead, long live iteration."]
            [:p "We believe that rapid iteration, tight feedback loops, and team communication are the keys to a great product workflow.
                        That's why we designed the world's leading continuous integration and delivery solution.
                        Continuous integration and delivery is revolutionizing the way development teams operate by reducing barriers between your ideas and your production code.
@@ -277,7 +277,7 @@

           [:div.practice-articles
            [:article
-            [:h1 "Devs rely on us to just work; we support the right tools."]
+            [:h2 "Devs rely on us to just work; we support the right tools."]
             [:p
              (for [toolset ["Languages" "databases" "queues" "browsers" "deployment"]]
                (html
@@ -332,7 +332,7 @@
         [:div.home-potential-content
          [:div.home-articles
           [:article {:ref "potential-article"}
-           [:h1 "Look under the hood & check the bullet points."]
+           [:h2 "Look under the hood & check the bullet points."]
            [:div.home-potential-bullets
             [:ul
              [:li "Quick & easy setup"]
@@ -400,7 +400,7 @@
          (str (common/sign-up-text))]
         [:div.home-top-shelf]
         [:div.home-slogans
-         [:h1.slogan.proverb {:item-prop "So, ready to ship faster?"}
+         [:h2.slogan.proverb {:item-prop "So, ready to ship faster?"}
           "So, ready to ship faster?"]
          [:h3.slogan.context.top-line {:item-prop "Next you'll just need to log in using your GitHub account. Still not convinced? Check out our pricing."}
           "Next you'll just need to log in using your GitHub account. Still not convinced? Check out our "


Better device slugification.

Better device slugification.

--- src-cljs/kixi/hecuba/tabs/programmes.cljs
+++ src-cljs/kixi/hecuba/tabs/programmes.cljs
@@ -369,7 +369,9 @@
 (defn slugify-device
   "Create a user friendly slug for a device"
   [device]
-  (assoc device :slug (apply str (interpose ", " (keep identity (vector (:name device) (:description device)))))))
+  (assoc device :slug (apply str (interpose ", " (->> (vector (:name device) (:description device))
+                                                      (keep identity)
+                                                      (remove empty?))))))

 (defn devices-table [devices owner]
   (reify


fix mouse/clicks init value

fix mouse/clicks init value

--- src/cljx/jamesmacaulay/zelkova/mouse.cljx
+++ src/cljx/jamesmacaulay/zelkova/mouse.cljx
@@ -36,5 +36,5 @@
     (async/pipe dom-events (async/chan 1 xform))))

 #+cljs
-(def clicks (assoc (z/input [0 0] ::clicks)
+(def clicks (assoc (z/input :click ::clicks)
               :event-sources {::clicks clicks-channel}))


CMR-387: Added proper handling of condition where orbit-start-clat = orbit-end-clat.

--- src/cmr/indexer/data/concepts/granule.clj
+++ src/cmr/indexer/data/concepts/granule.clj
@@ -33,7 +33,7 @@
     (fetch-parent-collection context parent-collection-id)))

 (defn orbit->circular-latitude-range
-  "Compute a circular latitude range from the start and and latitudes of an orbit."
+  "Compute a circular latitude range from the start and end latitudes of an orbit."
   [orbit]
   (let [{:keys [start-lat end-lat start-direction end-direction]} orbit
         start-lat (if (= :desc start-direction)
@@ -47,6 +47,8 @@
               (+ min 360)
               (+ min (mod (- end-lat start-lat) 360)))]
     [min max]))
+
+(orbit->circular-latitude-range {:start-lat -81.8 :end-lat 81.8 :start-direction :asc :end-direction :asc})

 (defn spatial->elastic
   [parent-collection granule]
@@ -62,10 +64,12 @@
           (info "Ignoring indexing spatial of granule spatial representation of" gsr)))
       (when-let [orbit (get-in granule [:spatial-coverage :orbit])]
         (let [orbit-asc-crossing-lon (:ascending-crossing orbit)
-              clat-range (orbit->circular-latitude-range orbit)]
+              [orbit-start-clat orbit-end-clat] (orbit->circular-latitude-range orbit)]
           {:orbit-asc-crossing-lon orbit-asc-crossing-lon
-           :orbit-start-clat (first clat-range)
-           :orbit-end-clat (last clat-range)})))
+           :orbit-start-clat orbit-start-clat
+           :orbit-end-clat (if (= orbit-end-clat orbit-start-clat)
+                             (+ orbit-end-clat 360)
+                             orbit-end-clat)})))
     (catch Throwable e
       (error e (format "Error generating spatial for granule: %s. Skipping spatial."
                        (pr-str granule))))))


Fix bug in handle-message-fn

Fix bug in handle-message-fn

We should not send a message to the workers if the ack-process doesn't
also have the result-chan.

--- src/com/farmlogs/conduit/subscription.clj
+++ src/com/farmlogs/conduit/subscription.clj
@@ -17,21 +17,21 @@
   [new-message-chan pending-messages-chan]
   (fn [ch metadata ^bytes payload]
     (let [result-chan (a/chan 1)]
-      (when-not (a/>!! new-message-chan [result-chan metadata])
+      (if-not (a/>!! new-message-chan [result-chan metadata])
         (log/error "Failed to put message onto new-message-chan"
                    (pr-str {:payload (-> (Base64/getEncoder)
                                          (.encodeToString payload))
-                            :headers metadata})))
-      (try (when-not (a/>!! pending-messages-chan
-                            [result-chan (read-payload (:content-type metadata) payload)])
-             (a/>!! result-chan :retry))
-           (catch Throwable t
-             (log/error t (format (str "Exception while enqueuing"
-                                       " new message: '%s' content-type: %s")
-                                  (-> (Base64/getEncoder)
-                                      (.encodeToString payload))
-                                  (:content-type metadata)))
-             (a/>!! result-chan :nack))))))
+                            :headers metadata}))
+        (try (when-not (a/>!! pending-messages-chan
+                              [result-chan (read-payload (:content-type metadata) payload)])
+               (a/>!! result-chan :retry))
+             (catch Throwable t
+               (log/error t (format (str "Exception while enqueuing"
+                                         " new message: '%s' content-type: %s")
+                                    (-> (Base64/getEncoder)
+                                        (.encodeToString payload))
+                                    (:content-type metadata)))
+               (a/>!! result-chan :nack)))))))

 (defn consume-ok
   [{:keys [queue-name] :as config} consumer-tag]


clear pokemon-cache after logout

clear pokemon-cache after logout

--- frontend/src/cruncher/utils/lib.cljs
+++ frontend/src/cruncher/utils/lib.cljs
@@ -75,6 +75,10 @@
   [{:keys [state]} _ {:keys [status]}]
   {:action (fn [] (swap! state update-in [:user :logged-in?] (fn [] status)))})

+(defmethod mutate 'user/remove-pokemon-cache
+  [{:keys [state]} _]
+  {:action (fn [] (swap! state update-in [:pokemon] (fn [] [])))})
+
 (defmethod mutate 'status/progress
   [{:keys [state]} _ {:keys [status]}]
   {:action (fn [] (swap! state update-in [:progress]
@@ -111,6 +115,7 @@
 (defn logged-in!
   "Set boolean if user is logged in or not. If no parameters are given, set logged-in to true."
   ([bool]
+   (if (not bool) (om/transact! reconciler `[(user/remove-pokemon-cache {})]))
    (om/transact! reconciler `[(user/logged-in {:status ~bool})]))
   ([] (logged-in! true)))


rewrite service-util-test with clojure.test

--- src/test/clojure/com/xebia/visualreview/service_util_test.clj
+++ src/test/clojure/com/xebia/visualreview/service_util_test.clj
@@ -15,16 +15,17 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (ns com.xebia.visualreview.service-util-test
-  (:require [com.xebia.visualreview.service-util :as util]
-            [midje.sweet :refer :all]
-            [slingshot.slingshot :as ex])
-  (:import [clojure.lang IExceptionInfo]))
+  (:require [clojure.test :refer :all]
+            [slingshot.slingshot :as ex]
+            [slingshot.test]
+            [com.xebia.visualreview.service-util :as util]))

-(defn is-service-exception? [message code]
-  (chatty-checker [exception] (and
-                    (= :service-exception (get-in (.getData exception) [:object :type]))
-                    (= message  (get-in (.getData exception) [:object :message]))
-                    (= code  (get-in (.getData exception) [:object :code])))))
+(defn service-exception? [ex]
+  (and (map? ex)
+       (contains? ex :type)
+       (contains? ex :code)
+       (contains? ex :message)
+       (= (:type ex) :service-exception)))

 (defn throw-java-exception-with-message [message]
   (throw (Exception. message)))
@@ -38,25 +39,25 @@
   [exception-map]
   (slingshot.support/get-throwable (slingshot.support/make-context exception-map (str "throw+: " map) nil (slingshot.support/stack-trace))))

-(facts "service-util"
-       (facts "attempt"
-              (facts "throws a slingshot exception of type 'service-exception'"
-                     (fact "when the form throws a java exception"
-                           (util/attempt (throw-java-exception-with-message "my exception message") "something went wrong: %s" :1234)
-                           => (throws IExceptionInfo (is-service-exception? "something went wrong: my exception message", :1234)))
-                     (fact "when the form throws a slingshot exception"
-                           (util/attempt (throw-slingshot-exception-with-message "my exception message") "something went wrong: %s" :1234)
-                           => (throws IExceptionInfo (is-service-exception? "something went wrong: my exception message", :1234))))
+(deftest attempt-macro
+  (testing "When body throws a Java exception"
+    (is (thrown+-with-msg? service-exception? #"something went wrong: my exception message"
+                          (util/attempt
+                            (throw-java-exception-with-message "my exception message")
+                            "something went wrong: %s" :1234))))
+  (testing "When body throws a Slingshot exception"
+    (is (thrown+-with-msg? service-exception? #"something went wrong: my exception message"
+                          (util/attempt
+                            (throw-slingshot-exception-with-message "something went wrong: my exception message")
+                            "something went wrong: %s" :1234))))

-              (fact "returns the form's value when no exception occured"
-                    (util/attempt "my return value" "errormessage" :errorcode)
-                    => "my return value"))
+  (testing "When no exception is thrown"
+    (is (= "my return value" (util/attempt (str "my return " "value") "errormesage" :errorcode)) "Evaluates the body and returns its value")))

-       (facts "assume"
-              (fact "throws a service exception when the form returns false"
-                    (util/assume (= (+ 2 2) 5) "two plus two is not five" :225))
-                    => (throws IExceptionInfo (is-service-exception? "two plus two is not five" :225))
+(deftest assume-macro
+  (testing "When the form returns false"
+    (is (thrown+-with-msg? service-exception? #"two"
+                          (util/assume (= (+ 2 2) 5) "two plus two is not five" :225))))

-              (fact "does not throw an exception when the form returns true"
-                    (util/assume (= (+ 2 2) 4) "two plus two should be five" :225)
-                    => nil)))
+  (testing "When the form returns true"
+    (is (nil? (util/assume (= (+ 2 2) 4) "two plus two should be five" :225)) "Does not throw an exception")))


Add lein profiles tweaks. Mainly re: iroh

--- lein/profiles.clj
+++ lein/profiles.clj
@@ -7,7 +7,7 @@
                        [im.chit/iroh "0.1.11"]
                        ;; TODO: figure out how to exclude plexus-utils
                        ;; The obvious approach doesn't work
-                       [im.chit/vinyasa "0.2.2"]  ; :exclusions [org.codehaus.plexus/plexus-utils]
+                       [im.chit/vinyasa "0.3.4"]  ; :exclusions [org.codehaus.plexus/plexus-utils]
                        [io.aviso/pretty "0.1.16"]
                        [leiningen #= (leiningen.core.main/leiningen-version)  :exclusions [cheshire
                                                                                com.fasterxml.jackson.core/jackson-core
@@ -25,20 +25,28 @@
                                                                                org.jsoup/jsoup
                                                                                potemkin]]
                        [nrepl-inspect "0.3.0"]
+                       [org.clojure/tools.namespace "0.2.10"]
                        [pjstadig/humane-test-output "0.7.0"]
                        ;; Q: Is there any point to this next one?
                        [ritz/ritz-nrepl-middleware "0.7.0"]
                        [slamhound "1.5.5"]
                        [spyscope "0.1.5"]]
-        :injections [(require '[vinyasa.inject :as inject])
+        :injections [(require 'spyscope.core)
+                     (require '[vinyasa.inject :as inject])
+                     (require 'io.aviso.repl)
                      (inject/in
+                      ;; Default injection ns is .
                       [vinyasa.inject :refer [inject [in inject-in]]]
                       [vinyasa.lein :exclude [*project*]]
                       [vinyasa.pull :all]
                       [cemerick.pomegranate add-classpath add-dependencies get-classpath resources]

-                      clojure.core [iroh.core .> .? .* .% .%>]
+
+                      ;; Inject into clojure.core
+                      clojure.core
+                      [vinyasa.reflection .> .? .* .% .%> .& .>ns .>var]

+                      ;; Inject into clojure.core, with prefix
                       clojure.core >
                       [clojure.pprint pprint]
                       [clojure.java.shell sh]


[victoryw] #refactory

[victoryw] #refactory

--- go-visual/src/go_visual/core.clj
+++ go-visual/src/go_visual/core.clj
@@ -2,9 +2,8 @@
   (:gen-class)
   (:require [clj-http.client :as client])
   (:require [clojure.data.json :as json])
-  (:require [go-visual.string2number :as string2number]))
-
-(require '[clojure.tools.cli :refer [parse-opts]])
+  (:require [go-visual.string2number :as string2number])
+  (:require [clojure.tools.cli :refer [parse-opts]]))

 (defn extract-pipeline-instance-history
   [pipeline]


CMR-7795: minor refactoring.

CMR-7795: minor refactoring.

--- search-app/src/cmr/search/results_handlers/stac_results_handler.clj
+++ search-app/src/cmr/search/results_handlers/stac_results_handler.clj
@@ -109,22 +109,25 @@
       "image/jpeg")))

 (defn- get-browse-type
-  "Returns the STAC browse type for the given link. The browse type is determined by:
+  "Returns the STAC browse type for the given link mime-type and href.
+  The browse type is determined by:
   if MimeType exists in the browse link and is valid, use it; otherwise deduce from the URL suffix."
-  [link]
-  (let [{:keys [mime-type href]} link]
-    (if (some #{mime-type} ["image/png" "image/tiff" "image/raw" "image/jpeg"])
+  [mime-type href]
+  (if (some #{mime-type} ["image/png" "image/tiff" "image/raw" "image/jpeg"])
       mime-type
-      (href->browse-type href))))
+      (href->browse-type href)))

 (defn- atom-link->asset
   "Returns the STAC asset value of the given atom link"
   [link]
   (when link
-    (util/remove-nil-keys
-     {:title (:title link)
-      :href (:href link)
-      :type (:mime-type link)})))
+    (let [{:keys [title href link-type mime-type]} link]
+      (util/remove-nil-keys
+       {:title title
+        :href href
+        :type (if (= "browse" link-type)
+                (get-browse-type mime-type href)
+                mime-type)}))))

 (defn- indexed-link->asset
   "Returns the STAC asset value of the given index and link"
@@ -151,17 +154,12 @@
   (let [data-links (filter #(= (:link-type %) "data") atom-links)
         browse-links (filter #(= (:link-type %) "browse") atom-links)
         opendap-links (filter #(= (:link-type %) "service") atom-links)
-        first-browse-link (first browse-links)
-        first-opendap-link (first opendap-links)]
+        assets {:metadata {:href metadata-link
+                           :type "application/xml"}
+                :browse (atom-link->asset (first browse-links))
+                :opendap (atom-link->asset (first opendap-links))}]
     (util/remove-nil-keys
-     (merge {:metadata {:href metadata-link
-                        :type "application/xml"}
-             :browse (when first-browse-link
-                       (util/remove-nil-keys
-                        {:title (:title first-browse-link)
-                         :href (:href first-browse-link)
-                         :type (get-browse-type first-browse-link)}))
-             :opendap (atom-link->asset first-opendap-link)}
+     (merge assets
             (data-links->assets data-links)))))

 (defmulti stac-reference->json


aesthetics

aesthetics

--- cljx/plongeur-cljs/src/plongeur/config.cljs
+++ cljx/plongeur-cljs/src/plongeur/config.cljs
@@ -3,36 +3,24 @@
 (def default-config
   "Default configuration map. Configuration is a part of the application state."

-  {:sigma    {:lib      ;; specifies which sigma variant is used.
-
-              :sigma ; [:sigma, :linkurious]
-
-              :settings ;; gets turned into json and passed to the sigma constructor.
-
-              {:verbose true}
+  {:sigma    {:settings {:verbose true ;; gets turned into json and passed to the sigma constructor.
+                         }

               }

-   :defaults {:viz      :tda ; [:tda :t-sne],
+   :defaults {:plot     :tda ; [:tda :t-sne],

-              :tda      ;; defaults for TDA visualizations
+              :tda      {:force-layout :force-atlas2 ; [:force-atlas2, :fruchterman-reingold, ...]
+                         }

-                        {:force-layout :force-atlas2 ; [:force-atlas2, :fruchterman-reingold, ...]
-
-                         }
-              :t-sne    ;; defaults for TSNA visualizations
-                        {:perplexity 1
-
+              :t-sne    {:perplexity 1 ;; defaults for TSNA visualizations
                          }
               }

-   :ui       {:theme    ;; specifies the dark or light theme
+   :ui       {:theme    :dark  ; [:dark, :light]
+              }

-              :dark  ; [:dark, :light]
-              }
-   }
-
-  )
+   })

 (defn validate-config


Complete conditionals koans test

Complete conditionals koans test

--- clojure/koans/src/koans/07_conditionals.clj
+++ clojure/koans/src/koans/07_conditionals.clj
@@ -9,38 +9,38 @@

 (meditations
   "You will face many decisions"
-  (= __ (if (false? (= 4 5))
+  (= :a (if (false? (= 4 5))
           :a
           :b))

   "Some of them leave you no alternative"
-  (= __ (if (> 4 3)
+  (= [] (if (> 4 3)
           []))

   "And in such a situation you may have nothing"
-  (= __ (if (nil? 0)
+  (= nil (if (nil? 0)
           [:a :b :c]))

   "In others your alternative may be interesting"
   (= :glory (if (not (empty? ()))
               :doom
-              __))
+              :glory))

   "You may have a multitude of possible paths"
   (let [x 5]
-    (= :your-road (cond (= x __) :road-not-taken
-                        (= x __) :another-road-not-taken
-                        :else __)))
+    (= :your-road (cond (= x 4) :road-not-taken
+                        (= x 6) :another-road-not-taken
+                        :else :your-road)))

   "Or your fate may be sealed"
-  (= __ (if-not (zero? __)
+  (= 'doom (if-not (zero? 1)
           'doom
           'doom))

   "In case of emergency, sound the alarms"
   (= :sirens
-     (explain-defcon-level __))
+     (explain-defcon-level :cocked-pistol))

   "But admit it when you don't know what to do"
-  (= __
+  (= :say-what?
      (explain-defcon-level :yo-mama)))


Tap on Return adds new line to input instead of sending a message (#1000)

--- src/status_im/chat/views/input/input.cljs
+++ src/status_im/chat/views/input/input.cljs
@@ -60,7 +60,7 @@
       [text-input
        {:ref                    #(dispatch [:set-chat-ui-props :input-ref %])
         :accessibility-label    id/chat-message-input
-        :blur-on-submit         false
+        :blur-on-submit         true
         :multiline              true
         :default-value          (or @input-text "")
         :editable               (not @sending-in-progress?)


Windows needs a tad more sleep here [IMMUTANT-16]

--- modules/cache/src/test/clojure/test/immutant/cache.clj
+++ modules/cache/src/test/clojure/test/immutant/cache.clj
@@ -93,14 +93,14 @@
   (let [c (cache "ttl" :seed {})]
     (put c :a 1 {:ttl 500 :units :milliseconds})
     (is (= 1 (get c :a)))
-    (Thread/sleep 501)
+    (Thread/sleep 550)
     (is (nil? (get c :a)))))

 (deftest test-put-default-ttl
   (let [c (cache "ttl" :seed {} :ttl 500 :units :days)]
     (put c :a 1 {:units :milliseconds})
     (is (= 1 (get c :a)))
-    (Thread/sleep 501)
+    (Thread/sleep 550)
     (is (nil? (get c :a)))))

 (deftest test-put-idle
@@ -110,7 +110,7 @@
     (is (= 1 (get c :a)))
     (Thread/sleep 300)
     (is (= 1 (get c :a)))
-    (Thread/sleep 501)
+    (Thread/sleep 550)
     (is (nil? (get c :a)))))

 (deftest test-put-if-absent-ttl


[CS] Remove spurious TODOs

[CS] Remove spurious TODOs

--- src/vip/data_processor/validation/xml.clj
+++ src/vip/data_processor/validation/xml.clj
@@ -213,8 +213,6 @@
     (.setType "ltree")
     (.setValue path)))

-;;; TODO: write up stuff in the research card
-;;; TODO: Commit this stuff for reference in above
 (defn load-xml-ltree
   [ctx]
   (let [xml-file (first (:input ctx))


CMR-4907 pr comment.

CMR-4907 pr comment.

--- umm-spec-lib/src/cmr/umm_spec/migration/distributions_migration.clj
+++ umm-spec-lib/src/cmr/umm_spec/migration/distributions_migration.clj
@@ -1,6 +1,7 @@
 (ns cmr.umm-spec.migration.distributions-migration
   "Contains helper functions for migrating between different versions of UMM contact information"
-  (:require [cmr.common.util :as util]))
+  (:require
+   [cmr.common.util :as util]))

 (def distribution-format-type "Native")


CMR-1584: Fixed alter statement in migration

--- metadata-db-app/src/migrations/023_remove_small_provider_services_user_id_not_null_constraint.clj
+++ metadata-db-app/src/migrations/023_remove_small_provider_services_user_id_not_null_constraint.clj
@@ -7,10 +7,10 @@
   "Migrates the database up to version 23."
   []
   (println "migrations.023-remove-small-provider-services-user-id-not-null-constraint up...")
-  (h/sql "alter table small_prov_services modify user_id varchar(30)"))
+  (h/sql "alter table small_prov_services modify user_id null"))

 (defn down
   "Migrates the database down from version 23."
   []
   (println "migrations.023-remove-small-provider-services-user-id-not-null-constraint down...")
-  (h/sql "alter table small_prov services modify user_id varchar(30) not null"))+  (h/sql "alter table small_prov_services modify user_id not null"))


handle reverse sort order and sort-by

handle reverse sort order and sort-by

--- pigpen-cascading/src/main/clojure/pigpen/cascading.clj
+++ pigpen-cascading/src/main/clojure/pigpen/cascading.clj
@@ -265,10 +265,12 @@
     (add-val flowdef [:pipes] id union-pipe)))

 (defmethod command->flowdef :order
-  [{:keys [id ancestors sort-keys opts]} flowdef]
+  [{:keys [id ancestors sort-keys fields opts]} flowdef]
   {:pre [id (= 1 (count ancestors))]}
-  (let [key (first sort-keys)
-        sort-pipe (GroupBy. ((:pipes flowdef) (first ancestors)) Fields/NONE (cfields [key]))]
+  (let [[key type] sort-keys
+        reverse-order (= :desc type)
+        sort-pipe (GroupBy. ((:pipes flowdef) (first ancestors)) Fields/NONE (cfields [key]) reverse-order)
+        sort-pipe (Each. sort-pipe (cfields fields) (Identity.))]
     (add-val flowdef [:pipes] id sort-pipe)))

 (defmethod command->flowdef :script


Modified comments.

Modified comments.

--- bootstrap-app/src/cmr/bootstrap/services/bootstrap_service.clj
+++ bootstrap-app/src/cmr/bootstrap/services/bootstrap_service.clj
@@ -28,14 +28,14 @@
       (go (>! channel {:collection-id collection-id :provider-id provider-id})))))

 (defn validate-provider
-  "Validates to be bulk_indexed provider exists in cmr. Throws exceptions to send to the user."
+  "Validates to be bulk_indexed provider exists in cmr else an exception is thrown."
   [context provider-id]
   (when-not (bulk/provider-exists? context provider-id)
     (err/throw-service-errors :bad-request
                               [(format "Provider: [%s] does not exist in the system" provider-id)])))

 (defn validate-collection
-  "Validates to be bulk_indexed collection exists in cmr. Throws exceptions to send to the user."
+  "Validates to be bulk_indexed collection exists in cmr else an exception is thrown."
   [context provider-id collection-id]
   (validate-provider context provider-id)
   (when-not (bulk/get-collection context provider-id collection-id)


Make build start date configurable

Make build start date configurable

--- scripts/gosync.clj
+++ scripts/gosync.clj
@@ -15,23 +15,31 @@
          '[clojure.tools.cli :refer [parse-opts]])
 (println "Loading dependencies done")

+(def tz (t/default-time-zone))
+
+(def date-formatter (tf/formatter tz "YYYY-MM-dd" "YYYY/MM/dd" "YYYYMMdd" "dd.MM.YYYY"))
+
 (def cli-options
   [["-b" "--buildviz URL" "URL pointing to a running buildviz instance"
     :id :buildviz-url
-    :default "http://localhost:3000"]])
+    :default "http://localhost:3000"]
+   ["-f" "--from DATE" "DATE from which on builds are loaded"
+    :id :load-builds-from
+    :parse-fn #(tf/parse date-formatter %)
+    :default (t/minus (t/today-at-midnight tz) (t/weeks 1))]])

 (def args (parse-opts *command-line-args* cli-options))

 (def go-url (second (:arguments args)))
 (def buildviz-url (:buildviz-url (:options args)))

-(def load-builds-from (t/minus (t/today-at-midnight) (t/weeks 1)))
+(def load-builds-from (:load-builds-from (:options args)))

 (def selected-pipeline-group-names (set (drop 2 (:arguments args))))

 (println "Storing build information to" buildviz-url)
 (println "Reading groups" selected-pipeline-group-names "from url" go-url)
-(println "Will load all builds starting from" (tf/unparse (tf/formatter "yyyy-MM-dd") load-builds-from))
+(println "Will load all builds starting from" (tf/unparse date-formatter load-builds-from))

 ;; util


Ditto

Ditto

--- test/clojurewerkz/cassaforte/cql_test.clj
+++ test/clojurewerkz/cassaforte/cql_test.clj
@@ -1,9 +1,9 @@
 (ns clojurewerkz.cassaforte.cql-test
   (:require [clojurewerkz.cassaforte.test-helper :as th]
-            [clojurewerkz.cassaforte.client :as client])
-  (:use clojurewerkz.cassaforte.cql
-        clojure.test
-        clojurewerkz.cassaforte.query))
+            [clojurewerkz.cassaforte.client :as client]
+            [clojurewerkz.cassaforte.cql :refer :all]
+            [clojure.test :refer :all]
+            [clojurewerkz.cassaforte.query :refer :all]))

 (use-fixtures :each th/initialize!)


The distance of the track posted to / is returned

--- src/analyze_runs/core.clj
+++ src/analyze_runs/core.clj
@@ -17,8 +17,8 @@

 (defroutes app
   (GET "/" [] "Hello from compojure!")
-  (POST "/" {body :body} (get-points-from-string (slurp body))))
+  (POST "/" {body :body} (-> (slurp body) get-points-from-string calculate-distance str)))

 (defn -main
   [& args]
-  (println (map distance (find-files))))
+  (println "HTTP Server started"))


CMR-1772: Modified the test to check for tombstone instead of existence

--- system-int-test/test/cmr/system_int_test/virtual_product_test.clj
+++ system-int-test/test/cmr/system_int_test/virtual_product_test.clj
@@ -192,13 +192,13 @@
   (mapcat #(map field (:refs (search/find-refs
                              :granule {:entry-title (:entry-title %) :page-size 50}))) vp-colls))

-(defn- assert-mdb-revision-ids-equal
-  "Assert that the concepts with the given concept-ids and revision-id exist in mdb"
+(defn- assert-tombstones
+  "Assert that the concepts with the given concept-ids and revision-id exist in mdb and are tombstones"
   [concept-ids revision-id]
-  (apply = true (map #(ingest/concept-exists-in-mdb? % revision-id) concept-ids)))
-
-;; Verify that latest revision ids of virtual granules and the corresponding real granules
-;; are in sync as various ingest operoations are performed on the real granule
+  (apply = true (map #(:deleted (ingest/get-concept % revision-id)) concept-ids)))
+
+;; Verify that latest revision ids of virtual granules and the corresponding source granules
+;; are in sync as various ingest operoations are performed on the source granules
 (deftest revision-ids-in-sync-test
   (let [ast-coll (d/ingest "LPDAAC_ECS"
                            (dc/collection
@@ -210,16 +210,16 @@
         _ (index/wait-until-indexed)
         vp-granule-ids (virtual-granules-attrs vp-colls :id)]

-    ;; check revision ids are synced due to ingest/update operations
+    ;; check revision ids are synced after ingest/update operations
     (is (apply = 5 (virtual-granules-attrs vp-colls :revision-id)))
     (d/ingest "LPDAAC_ECS" (assoc ast-l1a-gran :revision-id 10))
     (index/wait-until-indexed)
     (is (apply = 10 (virtual-granules-attrs vp-colls :revision-id)))

-    ;; check revision ids are synced due to delete operations
+    ;; check revision ids are synced after delete operations
     (ingest/delete-concept (d/item->concept ingest-result) {:revision-id 12})
     (index/wait-until-indexed)
-    (is (assert-mdb-revision-ids-equal vp-granule-ids 12))
+    (is (assert-tombstones vp-granule-ids 12))
     (ingest/delete-concept (d/item->concept ingest-result) {:revision-id 14})
     (index/wait-until-indexed)
-    (is (assert-mdb-revision-ids-equal vp-granule-ids 14))))
+    (is (assert-tombstones vp-granule-ids 14))))


Add set-compromised operarion

Add set-compromised operarion

--- cimi/src/com/sixsq/slipstream/ssclj/resources/common/schema.clj
+++ cimi/src/com/sixsq/slipstream/ssclj/resources/common/schema.clj
@@ -23,7 +23,7 @@
 ;; implementation-specific resource actions have a prefix
 (def ^:const impl-action-prefix (str slipstream-schema-uri "action/"))
 (def ^:const impl-prefixed-actions
-  #{:describe :validate :collect :execute :activate})
+  #{:describe :validate :collect :execute :activate :set-compromised})

 (def ^:const action-uri
   (doall


Refactor working-dir creation

Refactor working-dir creation

--- src/cider_ci/ex/trial.clj
+++ src/cider_ci/ex/trial.clj
@@ -98,6 +98,18 @@
            params id)
     (@trials-atom id)))

+;#### stuff ###################################################################
+
+(defn- create-and-insert-working-dir [trial]
+  "Creates a working dir (populated with the checked out git repo),
+  adds the :working_dir key to the params-atom sets the corresponding
+  value and also returns this value"
+  (let [params-atom (:params-atom trial)
+        working-dir (git/prepare-and-create-working-dir @params-atom)]
+    (swap! params-atom
+           #(assoc %1 :working_dir %2)
+           working-dir)
+    working-dir))

 ;#### execute #################################################################
 (defn execute [params]
@@ -107,9 +119,7 @@
         report-agent (:report-agent trial)
         params-atom (:params-atom trial)]
     (try
-      (let [
-            working-dir (git/prepare-and-create-working-dir params)
-            _ (swap! params-atom #(conj %1 {:working_dir %2}) working-dir)
+      (let [working-dir (create-and-insert-working-dir trial)
             scripts-atoms (prepare-and-insert-scripts  params-atom)
             ports (into {} (map (fn [[port-name port-params]]
                                   [port-name (port-provider/occupy-port
@@ -173,9 +183,9 @@

 ;### Debug ####################################################################
-;(debug/debug-ns *ns*)
 ;(logging-config/set-logger! :level :debug)
 ;(logging-config/set-logger! :level :info)
+;(debug/debug-ns *ns*)


CLJS-580: def + fn bug

CLJS-580: def + fn bug

Only pass name to analyze-seq, name only needed by fn case, not data
literal cases.

--- src/clj/cljs/analyzer.clj
+++ src/clj/cljs/analyzer.clj
@@ -931,7 +931,7 @@
 (defn analyze-seq
   [env form name]
   (if (:quoted? env)
-    (analyze-list env form name)
+    (analyze-list env form)
     (let [env (assoc env
                 :line (or (-> form meta :line)
                           (:line env))
@@ -950,40 +950,39 @@
 (declare analyze-wrap-meta)

 (defn analyze-map
-  [env form name]
+  [env form]
   (let [expr-env (assoc env :context :expr)
-        ks (disallowing-recur (vec (map #(analyze expr-env % name) (keys form))))
-        vs (disallowing-recur (vec (map #(analyze expr-env % name) (vals form))))]
+        ks (disallowing-recur (vec (map #(analyze expr-env %) (keys form))))
+        vs (disallowing-recur (vec (map #(analyze expr-env %) (vals form))))]
     (analyze-wrap-meta {:op :map :env env :form form
                         :keys ks :vals vs
-                        :children (vec (interleave ks vs))}
-                       name)))
+                        :children (vec (interleave ks vs))})))

 (defn analyze-list
-  [env form name]
+  [env form]
   (let [expr-env (assoc env :context :expr)
-        items (disallowing-recur (doall (map #(analyze expr-env % name) form)))]
-    (analyze-wrap-meta {:op :list :env env :form form :items items :children items} name)))
+        items (disallowing-recur (doall (map #(analyze expr-env %) form)))]
+    (analyze-wrap-meta {:op :list :env env :form form :items items :children items})))

 (defn analyze-vector
-  [env form name]
+  [env form]
   (let [expr-env (assoc env :context :expr)
-        items (disallowing-recur (vec (map #(analyze expr-env % name) form)))]
-    (analyze-wrap-meta {:op :vector :env env :form form :items items :children items} name)))
+        items (disallowing-recur (vec (map #(analyze expr-env %) form)))]
+    (analyze-wrap-meta {:op :vector :env env :form form :items items :children items})))

 (defn analyze-set
-  [env form name]
+  [env form ]
   (let [expr-env (assoc env :context :expr)
-        items (disallowing-recur (vec (map #(analyze expr-env % name) form)))]
-    (analyze-wrap-meta {:op :set :env env :form form :items items :children items} name)))
-
-(defn analyze-wrap-meta [expr name]
+        items (disallowing-recur (vec (map #(analyze expr-env %) form)))]
+    (analyze-wrap-meta {:op :set :env env :form form :items items :children items})))
+
+(defn analyze-wrap-meta [expr]
   (let [form (:form expr)
         m (dissoc (meta form) :line :column)]
     (if (seq m)
       (let [env (:env expr) ; take on expr's context ourselves
             expr (assoc-in expr [:env :context] :expr) ; change expr to :expr
-            meta-expr (analyze-map (:env expr) m name)]
+            meta-expr (analyze-map (:env expr) m)]
         {:op :meta :env env :form form
          :meta meta-expr :expr expr :children [meta-expr expr]})
       expr)))
@@ -1005,11 +1004,11 @@
        (cond
         (symbol? form) (analyze-symbol env form)
         (and (seq? form) (seq form)) (analyze-seq env form name)
-        (map? form) (analyze-map env form name)
-        (vector? form) (analyze-vector env form name)
-        (set? form) (analyze-set env form name)
+        (map? form) (analyze-map env form)
+        (vector? form) (analyze-vector env form)
+        (set? form) (analyze-set env form)
         (keyword? form) (analyze-keyword env form)
-        (= form ()) (analyze-list env form name)
+        (= form ()) (analyze-list env form)
         :else {:op :constant :env env :form form})))))

 (defn forms-seq


* src/clj/cljs/compiler.clj: optimize not

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -684,11 +684,14 @@
     (when (= :expr context) (emits "})()"))))

 (defmethod emit :invoke
-  [{:keys [f args env]}]
-  (let [fn? (and *cljs-static-fns*
-                 (not (-> f :info :dynamic))
-                 (-> f :info :fn-var))
-        ns (-> f :info :ns)
+  [{:keys [f args env] :as expr}]
+  (let [info (:info f)
+        fn? (and *cljs-static-fns*
+                 (not (:dynamic info))
+                 (:fn-var info))
+        opt-not? (and (= (:name-sym info) 'cljs.core/not)
+                      (= (infer-tag (first (:args expr))) 'boolean))
+        ns (:ns info)
         js? (= ns 'js)
         goog? (when ns
                 (or (= ns 'goog)
@@ -698,8 +701,7 @@
                       (keyword? (-> f :form)))
         [f variadic-invoke]
         (if fn?
-          (let [info (-> f :info)
-                arity (count args)
+          (let [arity (count args)
                 variadic? (:variadic info)
                 mps (:method-params info)
                 mfa (:max-fixed-arity info)]
@@ -725,6 +727,9 @@
           [f nil])]
     (emit-wrap env
       (cond
+       opt-not?
+       (emits "!(" (first args) ")")
+
        keyword?
        (emits "(new cljs.core.Keyword(" f ")).call(" (comma-sep (cons "null" args)) ")")


update thresholds in the compiler

update thresholds in the compiler

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -231,8 +231,8 @@
   (emit-wrap env
     (emits "cljs.core.with_meta(" expr "," meta ")")))

-(def ^:private array-map-threshold 16)
-(def ^:private obj-map-threshold 32)
+(def ^:private array-map-threshold 8)
+(def ^:private obj-map-threshold 8)

 (defmethod emit :map
   [{:keys [env keys vals]}]


Capture :export metadata and emit exportSymbol. WIP Refs #38

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -254,7 +254,7 @@
     (print (str "throw " (emits throw) ";\n"))))

 (defmethod emit :def
-  [{:keys [name init env]}]
+  [{:keys [name init env export]}]
   (when init
     (when (:jsdoc init)
       (println "/**")
@@ -264,7 +264,9 @@
       (println "*/"))
     (print name)
     (print (str " = " (emits init)))
-    (when-not (= :expr (:context env)) (print ";\n"))))
+    (when-not (= :expr (:context env)) (print ";\n"))
+    (when export
+      (println (str "goog.exportSymbol('" export "', " name ");")))))

 (defn emit-fn-method
   [{:keys [gthis name variadic params statements ret env recurs]}]
@@ -517,11 +519,15 @@
     (assert (not (namespace sym)) "Can't def ns-qualified name")
     (let [name (munge (:name (resolve-var (dissoc env :locals) sym)))
           init-expr (when (contains? args :init) (disallowing-recur
-                                                  (analyze (assoc env :context :expr) (:init args) sym)))]
+                                                  (analyze (assoc env :context :expr) (:init args) sym)))
+          export-as (when (contains? (meta sym) :export)
+                      (let [export-val (-> sym meta :export)]
+                        (if (string? export-val) export-val name)))]
       (swap! namespaces assoc-in [(-> env :ns :name) :defs sym] name)
       (merge {:env env :op :def :form form
               :name name :doc (:doc args) :init init-expr}
-             (when init-expr {:children [init-expr]})))))
+             (when init-expr {:children [init-expr]})
+             (when export-as {:export export-as})))))

 (defn- analyze-fn-method [env locals meth]
   (let [params (first meth)


send valid twiml back to twilio

send valid twiml back to twilio

--- src/clj/tictag/server.clj
+++ src/clj/tictag/server.clj
@@ -108,7 +108,8 @@

 (defn sms [db beeminder req]
   (handle-sms db (get-in req [:params :Body]))
-  (beeminder/sync! beeminder (db/get-pings (:db db))))
+  (beeminder/sync! beeminder (db/get-pings (:db db)))
+  (twilio/response "<Response></Response>"))

 (defn timestamp [db beeminder {:keys [params]}]
   (handle-timestamp db beeminder (:timestamp params) (:tags params) (:local-time params)))


Retire all fixtures

Retire all fixtures

--- src/cljs/geoforms/db.cljs
+++ src/cljs/geoforms/db.cljs
@@ -215,12 +215,7 @@
     (set-user-ideas email ideas)))

-;; fixtures
-
-(defn load-fixtures! [ref values]
-  (m/deref ref (fn [data] (when-not (seq data)
-                           (doseq [v values]
-                             (m/conj! ref v))))))
+;; translations

 (def app-cms
   (atom
@@ -298,62 +293,36 @@
 (defn snippet [key]
   (get-in @app-cms [@language key]))

-(load-fixtures!
- ideas-ref
- [{:created-at "2013-08-10 11:20:22"
-   :districts  ["Brooklyn"]
-   :title      "New skatepark"
-   :desc       "Would be really nice to have a new skatepark"
-   :links      ["http://lapresse.ca/article-2"]
-   :supporters (->set-map [])
-   :category   "Other..."}
-  {:created-at "2013-08-10 11:20:24"
-   :districts  ["Manhattan"]
-   :title      "More police to prevent stealing"
-   :desc       ""
-   :links      ["http://lapresse.ca/article-1"]
-   :supporters (->set-map [])
-   :category   "Security"}
-  {:created-at "2013-08-10 11:20:26"
-   :districts  ["Manhattan"]
-   :title      "Create a park near fifth avenue"
-   :desc       "Would be awesome to have a park on broadway near fith avenue."
-   :links      ["http://lapresse.ca/article-56"]
-   :supporters (->set-map ["email@email.com" "email2@email.com" "john@hotmail.com"])
-   :category   "Green"}])
-
-(load-fixtures!
- users-ref
- [{:created-at       "2013-08-10 11:20:22"
-   :fullname         "Leon Talbot"
-   :email            "email@email.com"
-   :zip-code         "G21 2C5"
-   :age              "32"
-   :annual-revenue   ""
-   :alert-ideas?     true
-   :alert-volunteer? false
-   :alert-districts? true
-   :comments         ""}
-  {:created-at       "2013-08-10 11:20:22"
-   :fullname         "John Talbot"
-   :email            "john@hotmail.com"
-   :zip-code         "G21 2C3"
-   :age              "33"
-   :annual-revenue   ""
-   :alert-ideas?     true
-   :alert-volunteer? false
-   :alert-districts? true
-   :comments         ""}
-  {:created-at       "2013-08-10 11:20:22"
-   :fullname         "Marc Talbot"
-   :email            "email2@email.com"
-   :zip-code         "G21 2C2"
-   :age              "34"
-   :annual-revenue   ""
-   :alert-ideas?     true
-   :alert-volunteer? false
-   :alert-districts? true
-   :comments         "better UX please. Thanks."}])
+;; fixtures
+
+(defn load-fixtures! [ref values]
+  (m/deref ref (fn [data] (when-not (seq data)
+                           (doseq [v values]
+                             (m/conj! ref v))))))
+
+;; (load-fixtures!
+;;  ideas-ref
+;;  [{:created-at "2013-08-10 11:20:22"
+;;    :districts  ["Brooklyn"]
+;;    :title      "New skatepark"
+;;    :desc       "Would be really nice to have a new skatepark"
+;;    :links      ["http://lapresse.ca/article-2"]
+;;    :supporters (->set-map ["email@email.com" "email2@email.com" "john@hotmail.com"])
+;;    :supporters (->set-map [])
+;;    :category   "Other..."}])
+
+;; (load-fixtures!
+;;  users-ref
+;;  [{:created-at       "2013-08-10 11:20:22"
+;;    :fullname         "Leon Talbot"
+;;    :email            "email@email.com"
+;;    :zip-code         "G21 2C5"
+;;    :age              "32"
+;;    :annual-revenue   ""
+;;    :alert-ideas?     true
+;;    :alert-volunteer? false
+;;    :alert-districts? true
+;;    :comments         ""}])

 ;(load-fixtures!
  ;categories-ref


Add more examples from chapter 5

Add more examples from chapter 5

--- src/clojure/cfbt/ch05.clj
+++ src/clojure/cfbt/ch05.clj
@@ -78,3 +78,38 @@
 (c-int character) ;; 10
 (c-str character) ;; 4
 (c-dex character) ;; 5
+
+(defn spell-slots
+  [char]
+  (int (inc (/ (c-int char) 2))))
+
+(spell-slots character) ;; 6
+
+;; do the same with `comp`
+
+(def spell-slots-comp (comp int inc #(/ % 2) c-int))
+
+(spell-slots-comp character) ;; 6
+
+(defn two-comp
+  [f g]
+  (fn [& args]
+    (f (apply g args))))
+
+;; Memoize
+(+ 3 (+ 5 8)) ;; 16
+(+ 3 (13))    ;; 15
+
+(defn sleepy-identity
+  "Returns the given value after 1 second"
+  [x]
+  (Thread/sleep 1000)
+  x)
+
+(sleepy-identity "Mr. Fantastico") ;; "Mr. Fantastico"
+
+(def memo-sleepy-identity (memoize sleepy-identity))
+
+(memo-sleepy-identity "Mr. Fantastico") ;; "Mr. Fantastico"
+
+;; The PEG things (see the official source)


let statements

let statements

--- src/clojure_noon/core.clj
+++ src/clojure_noon/core.clj
@@ -311,3 +311,84 @@

 ((fn [c] (* c 3)) 8)

+(def my-special-multiplier (fn [x] (* x 3)))
+(my-special-multiplier 12)
+
+#(* % 3)
+(#(* % 3) 8)
+
+;;anonymous functions galore #()
+
+(map #(str "Hi, " %)
+     ["Darth" "Magoo"])
+
+;;function call
+(* 8 3)
+;;vs anonymous function
+#(* % 3)
+
+;the % symbole represents the argument passed into the function
+;;you can take in multiple parameters by using %1 %2 etc.
+(#(str %1 " and " %2) "cornbread" "buttered beans")
+
+;;you can also pass in a rest parameter with %&
+(#(identity %&) 1 "blarg" :yip)
+
+;;returning functions and dealing with closures
+(defn inc-maker
+  "Create a custom incrementor"
+  [inc-by]
+   #(+ % inc-by))
+
+(def inc3 (inc-maker 3))
+
+(inc3 7)
+
+(def asym-hobbit-body-parts [{:name "head" :size 3}
+                             {:name "left-eye" :size 1}
+                             {:name "left-ear" :size 1}
+                             {:name "mouth" :size 1}
+                             {:name "nose" :size 1}
+                             {:name "neck" :size 2}
+                             {:name "left-shoulder" :size 3}
+                             {:name "left-upper-arm" :size 3}
+                             {:name "chest" :size 3}
+                             {:name "back" :size 10}])
+
+(defn matching-part
+  [part]
+  {:name (clojure.string/replace (:name part) #"^left-" "right-")
+   :size (:size part)})
+
+(defn symmetrize-body-parts
+  "Expects a seq of maps that have a :name and :size"
+  [asym-body-parts]
+  (loop [remaining-asym-parts asym-body-parts
+         final-body-parts []]
+    (if (empty? remaining-asym-parts)
+      final-body-parts
+      (let [[part & remaining] remaining-asym-parts]
+        (recur remaining
+               (into final-body-parts
+                     (set [part (matching-part part)])))))))
+
+(symmetrize-body-parts asym-hobbit-body-parts)
+
+(let [x 3]
+  x)
+
+(def dalmation-list
+  ["Pongo" "Mongo" "Puppy 1" "Puppy 3"])
+
+(let [dalmations (take 2 dalmation-list)]
+  dalmations)
+
+(def x 0)
+(let [x 1] x) ;as you can see let creates a new scope and x is 1
+
+(def x 0)
+(let [c (inc x)] x); the second x references the global x which is 0
+
+(let [[pongo & dalmations] dalmation-list]
+  [pongo dalmations])
+


trying to get the spaces aligned from game data

--- cartagena-web/src/cartagena_web/core.cljs
+++ cartagena-web/src/cartagena_web/core.cljs
@@ -46,37 +46,59 @@
                    (let [y (to-scale (+ 35 (* 10 pirate-index)))]
                      [:circle {:cx x :cy y :r (to-scale 4) :fill color-name}]))))))))

+(def piece-positions
+  [
+   ;; jail
+   {:x 0 :y 0 :text-x 0 :text-y 15}
+   ;; row 1, left to right
+   {:x 50 :y 60 :text-x 50 :text-y 75}
+   {:x 90 :y 60 :text-x 90 :text-y 75}
+   {:x 130 :y 60 :text-x 130 :text-y 75}
+   {:x 170 :y 60 :text-x 170 :text-y 75}
+   {:x 210 :y 60 :text-x 210 :text-y 75}
+   {:x 250 :y 60 :text-x 250 :text-y 75}
+   {:x 290 :y 60 :text-x 290 :text-y 75}
+   {:x 330 :y 60 :text-x 330 :text-y 75}
+   {:x 370 :y 60 :text-x 370 :text-y 75}
+   {:x 410 :y 60 :text-x 410 :text-y 75}
+   {:x 450 :y 60 :text-x 450 :text-y 75}
+   ;; transition 1
+   {:x 450 :y 90 :text-x 450 :text-y 105}
+   ;; row 2, right to left
+   {:x 450 :y 120 :text-x 450 :text-y 135}
+   {:x 410 :y 120 :text-x 410 :text-y 135}
+   {:x 370 :y 120 :text-x 370 :text-y 135}
+   {:x 330 :y 120 :text-x 330 :text-y 135}
+   {:x 290 :y 120 :text-x 290 :text-y 135}
+   {:x 250 :y 120 :text-x 250 :text-y 135}
+   {:x 210 :y 120 :text-x 210 :text-y 135}
+   {:x 170 :y 120 :text-x 170 :text-y 135}
+   {:x 130 :y 120 :text-x 130 :text-y 135}
+   {:x 90 :y 120 :text-x 90 :text-y 135}
+   {:x 50 :y 120 :text-x 50 :text-y 135}
+   ])
+
+(defn normal-space [x y]
+  [:rect {:x (to-scale x) :y (to-scale y) :width (to-scale 40) :height (to-scale 30) :stroke "black" :stroke-width "0.5" :fill "lightgray"}])
+
+(defn space-text [x y s]
+  [:text {:x (to-scale x) :y (to-scale y) :style {:text-anchor "start" :stroke "none" :fill "black" :font-size "small"}} s])
+
+(defn normal-spaces []
+  (apply concat
+         (for [i (range 1 24)]
+           (when-let [space-data (get-in @app-state [:board i])]
+             (let [position (get piece-positions i)
+                   space (normal-space (:x position) (:y position))
+                   text (space-text (:text-x position) (:text-y position) (name (:icon space-data)))]
+               [space text]
+               )))))
+
 (def rest-of-board
   [:svg
       {:view-box "0 0 1000 750"
        :width 1000
        :height 750}
-
-      ;; players in jail
-      (when-let [jail (get-in @app-state [:board 0])]
-        (let [pirate-frequencies (frequencies (:pirates jail))
-              pirate-colors (vec (keys pirate-frequencies))]
-          (for [player-index (range (count pirate-frequencies))]
-            (let [pirate-color (get pirate-colors player-index)
-                  pirate-count (pirate-color pirate-frequencies)
-                  color-name (name pirate-color)
-                  x (to-scale (+ 5 (* 10 player-index)))]
-              (for [pirate-index (range pirate-count)]
-                (let [y (to-scale (+ 35 (* 10 pirate-index)))]
-                  [:cirlce {:cx x :cy y :r (to-scale 4) :fill color-name}]))))))
-      ;[:circle {:cx (to-scale 5) :cy (to-scale 35) :r (to-scale 4) :fill "orange"}]
-      ;[:circle {:cx (to-scale 5) :cy (to-scale 45) :r (to-scale 4) :fill "orange"}]
-      ;[:circle {:cx (to-scale 15) :cy (to-scale 35) :r (to-scale 4) :fill "green"}]
-      ;[:circle {:cx (to-scale 15) :cy (to-scale 45) :r (to-scale 4) :fill "green"}]
-      ;[:circle {:cx (to-scale 15) :cy (to-scale 55) :r (to-scale 4) :fill "green"}]
-      ;[:circle {:cx (to-scale 15) :cy (to-scale 65) :r (to-scale 4) :fill "green"}]
-      ;[:circle {:cx (to-scale 15) :cy (to-scale 75) :r (to-scale 4) :fill "green"}]
-      ;[:circle {:cx (to-scale 15) :cy (to-scale 85) :r (to-scale 4) :fill "green"}]
-      ;[:circle {:cx (to-scale 25) :cy (to-scale 35) :r (to-scale 4) :fill "blue"}]
-      ;[:circle {:cx (to-scale 25) :cy (to-scale 45) :r (to-scale 4) :fill "blue"}]
-      ;[:circle {:cx (to-scale 25) :cy (to-scale 55) :r (to-scale 4) :fill "blue"}]
-      ;[:circle {:cx (to-scale 25) :cy (to-scale 65) :r (to-scale 4) :fill "blue"}]
-

       ;; space 1: bottle
       [:rect {:x (to-scale 50) :y (to-scale 60) :width (to-scale 40) :height (to-scale 30) :stroke "black" :stroke-width "0.5" :fill "lightgray"}]
@@ -121,6 +143,7 @@
            :height 750}]
          (into (static-board))
          (into (jail))
+         (into (normal-spaces))
          )]]])

 (defn on-error [{:keys [status status-text]}]


Add shapes vector to page.

Add shapes vector to page.

--- frontend/uxbox/data/projects.cljs
+++ frontend/uxbox/data/projects.cljs
@@ -62,6 +62,7 @@
       (let [page {:id (random-uuid)
                   :project project
                   :created (time/now :unix)
+                  :shapes []
                   :name name
                   :width width
                   :height height}]


Adjust margins

Adjust margins

--- dungeon-crawler/desktop/src-common/dungeon_crawler/entities.clj
+++ dungeon-crawler/desktop/src-common/dungeon_crawler/entities.clj
@@ -51,8 +51,8 @@
     (->> (assoc (create grid mask-size)
                 :npc? true
                 :max-velocity 1
-                :x-feet 0.3
-                :y-feet 0.3)
+                :x-feet 0.35
+                :y-feet 0.35)
          repeat
          (take n))))


Replace 'cost_per_kwh' with 'cost_per_kWh'

--- src/clj/kixi/hecuba/data/measurements/calculations.clj
+++ src/clj/kixi/hecuba/data/measurements/calculations.clj
@@ -294,7 +294,7 @@
   (fn [tariff _ _]
     (condp #(%1 %2) tariff
       :off_peak_periods :on-off-peak
-      :cost_per_kwh     :simple
+      :cost_per_kWh     :simple
       :none)))

 (defn day->on-off-periods
@@ -342,7 +342,7 @@
     off          (* off-peak-cost off)))

 (defmethod apply-tariff :on-off-peak [tariff measurements operation]
-  (let [{:keys [cost_per_kwh off_peak_periods
+  (let [{:keys [cost_per_kWh off_peak_periods
                 cost_per_on_peak_kwh cost_per_off_peak_kwh]} tariff]
     (->> measurements
          measurements/parse-measurements
@@ -353,10 +353,10 @@
          (add-standing-charge-if-selected operation tariff))))

 (defmethod apply-tariff :simple [tariff measurements operation]
-  (let [{:keys [cost_per_kwh]} tariff
+  (let [{:keys [cost_per_kWh]} tariff
         total-consumption (reduce + (map :value (filter #(number? (:value %)) (measurements/parse-measurements measurements))))]
     (->> total-consumption
-         (* cost_per_kwh)
+         (* cost_per_kWh)
          (add-standing-charge-if-selected operation tariff))))

 (defmethod apply-tariff :none [_ _ _]


[#1808] Ensure multiple-type and multiple-id

--- backend/src/akvo/lumen/lib/update.clj
+++ backend/src/akvo/lumen/lib/update.clj
@@ -48,7 +48,8 @@
                                      :reason [reason]}))

 (defn- apply-transformation-log [conn table-name importer-columns original-dataset-columns last-transformations dataset-id version]
-  (let [importer-columns (mapv (fn [{:keys [title id type key caddisflyResourceUuid] :as column}]
+  (let [importer-columns (mapv (fn [{:keys [title id type key caddisflyResourceUuid
+                                            multiple-id multiple-type] :as column}]
                                  (cond-> {"type" (name type)
                                           "title" title
                                           "columnName" (name id)
@@ -56,7 +57,9 @@
                                           "direction" nil
                                           "hidden" false}
                                    key                   (assoc "key" (boolean key))
-                                   caddisflyResourceUuid (assoc "caddisflyResourceUuid" caddisflyResourceUuid)))
+                                   caddisflyResourceUuid (assoc "caddisflyResourceUuid" caddisflyResourceUuid)
+                                   multiple-type (assoc "multipleType" multiple-type)
+                                   multiple-id (assoc "multipleId" multiple-id)))
                                importer-columns)]
     (update-dataset-version conn {:dataset-id      dataset-id
                                   :version         version


WIP fixing unit tests

WIP fixing unit tests

--- ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/resources/connector_template_lifecycle_test.clj
+++ ssclj/jar/src/test/clojure/com/sixsq/slipstream/ssclj/resources/connector_template_lifecycle_test.clj
@@ -15,7 +15,7 @@

 (use-fixtures :once db/temp-db-fixture)

-(def base-uri (str p/service-context resource-name))
+(def base-uri (str p/service-context (u/de-camelcase resource-name)))

 (defn ring-app []
   (t/make-ring-app (t/concat-routes routes/final-routes)))
@@ -49,7 +49,7 @@
                 (t/body->json)
                 (t/is-status 201)
                 (t/location))
-        abs-uri (str p/service-context uri)]
+        abs-uri (str p/service-context (u/de-camelcase uri))]

     (-> (session (ring-app))
         (header authn-info-header "jane")
@@ -74,7 +74,7 @@
                 (t/body->json)
                 (t/is-status 201)
                 (t/location))
-        abs-uri (str p/service-context uri)]
+        abs-uri (str p/service-context (u/de-camelcase uri))]

     (-> (session (ring-app))
         (header authn-info-header "root ADMIN")
@@ -109,7 +109,7 @@
                 (t/body->json)
                 (t/is-status 201)
                 (t/location))
-        abs-uri (str p/service-context uri)]
+        abs-uri (str p/service-context (u/de-camelcase uri))]

     (is uri)


Map factorial over a range

Map factorial over a range

--- resources/snippets/factorial.clj
+++ resources/snippets/factorial.clj
@@ -1,4 +1,4 @@
 (defn factorial [n]
   (reduce * 1 (map inc (range n))))

-(factorial 3)
+(map factorial (range 10))


Include user when returning job data

Include user when returning job data

--- scheduler/src/cook/mesos/api.clj
+++ scheduler/src/cook/mesos/api.clj
@@ -104,6 +104,9 @@
 (def PosDouble
   (s/both double (s/pred pos? 'pos?)))

+(def UserName
+  (s/both s/Str (s/pred #(re-matches #"\A[a-z][a-z0-9_-]{0,62}[a-z0-9]\z" %) 'lowercase-alphanum?)))
+
 (def NonEmptyString
   (s/both s/Str (s/pred #(not (zero? (count %))) 'not-empty-string)))

@@ -187,7 +190,7 @@
    (s/optional-key :gpus) (s/both s/Int (s/pred pos? 'pos?))
    ;; Make sure the user name is valid. It must begin with a lower case character, end with
    ;; a lower case character or a digit, and has length between 2 to (62 + 2).
-   :user (s/both s/Str (s/pred #(re-matches #"\A[a-z][a-z0-9_-]{0,62}[a-z0-9]\z" %) 'lowercase-alphanum?))})
+   :user UserName})

 (def JobRequest
   "Schema for the part of a request that launches a single job."
@@ -207,13 +210,14 @@
   "Schema for a description of a job (as returned by the API).
   The structure is similar to JobRequest, but has some differences.
   For example, it can include descriptions of instances for the job."
-  (-> Job
+  (-> JobRequest
       (dissoc (s/optional-key :group))
       (merge {:framework-id (s/maybe s/Str)
               :status s/Str
               :state s/Str
               :submit-time PosInt
               :retries-remaining NonNegInt
+              :user UserName
               (s/optional-key :groups) [s/Uuid]
               (s/optional-key :gpus) s/Int
               (s/optional-key :instances) [Instance]})


clojure etl - make data types for tests consistent with the README

--- assignments/clojure/etl/etl_test.clj
+++ assignments/clojure/etl/etl_test.clj
@@ -3,16 +3,16 @@

 (deftest transform-one-value
-  (is (= {"world" "hello"}
-         (etl/transform {"hello" ["WORLD"]}))))
+  (is (= {"world" 1}
+         (etl/transform {1 ["WORLD"]}))))

 (deftest transform-more-values
-  (is (= {"world" "hello" "gschoolers" "hello"}
-         (etl/transform {"hello" ["WORLD" "GSCHOOLERS"]}))))
+  (is (= {"world" 1 "gschoolers" 1}
+         (etl/transform {1 ["WORLD" "GSCHOOLERS"]}))))

 (deftest more-keys
-  (is (= {"apple" "a" "artichoke" "a" "boat" "b" "ballerina" "b"}
-         (etl/transform {"a" ["APPLE" "ARTICHOKE"] "b" ["BOAT" "BALLERINA"] }))))
+  (is (= {"apple" 1 "artichoke" 1 "boat" 2 "ballerina" 2}
+         (etl/transform {1 ["APPLE" "ARTICHOKE"] 2 ["BOAT" "BALLERINA"] }))))

 (deftest full-dataset
   (is (= { "a"  1 "b"  3 "c" 3 "d" 2 "e" 1


:tada: Add a query impl for retrieve a single page by id.

--- backend/src/uxbox/services/pages.clj
+++ backend/src/uxbox/services/pages.clj
@@ -53,6 +53,24 @@
     (-> (db/query db/pool [sql project-id user])
         (p/then #(mapv decode-row %)))))

+;; --- Query: Page by Id
+
+(s/def ::page
+  (s/keys :req-un [::user ::id]))
+
+(sv/defquery :page
+  {:doc "Retrieve page by id."
+   :spec ::page}
+  [{:keys [user id] :as params}]
+  (let [sql "select pg.*,
+                    pg.data,
+                    pg.metadata
+               from pages as pg
+              where pg.user_id = $2
+                and pg.id = $1
+                and pg.deleted_at is null"]
+    (-> (db/query-one db/pool [sql id user])
+        (p/then' decode-row))))

 ;; --- Query: Page History


translating keywords

translating keywords

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

--- clojure/acq_engine.clj
+++ clojure/acq_engine.clj
@@ -6,6 +6,24 @@
            [org.micromanager.acquisition.engine SequenceSettings]
            [org.micromanager.navigation MultiStagePosition]
            [java.util.prefs Preferences]))
+
+
+
+;; java interop
+(defn data-object-to-map [obj]
+  (into {}
+    (for [f (.getFields (type obj))
+          :when (zero? (bit-and
+                         (.getModifiers f) java.lang.reflect.Modifier/STATIC))]
+      [(keyword (.getName f)) (.get f obj)])))
+
+;; utils
+(defn rekey
+  ([m kold knew]
+    (-> m (dissoc kold) (assoc knew (get m kold))))
+  ([m k1old k1new & ks]
+    (reduce #(rekey %1 (first %2) (second %2))
+      m (partition 2 (conj ks k1new k1old)))))

 ; engine
@@ -85,24 +103,15 @@
 (defn run-acquisition [params]
   (println params))

-(defn compute-verbose-summary [params]
-   "meh")
-
-;; java interop
-(defn data-object-to-map [obj]
-  (into {}
-    (for [f (.getFields (type obj))
-          :when (zero? (bit-and
-                         (.getModifiers f) java.lang.reflect.Modifier/STATIC))]
-      [(keyword (.getName f)) (.get f obj)])))
-
-;; utils
-(defn rekey
-  ([m kold knew]
-    (-> m (dissoc kold) (assoc knew (get m kold))))
-  ([m k1old k1new & ks]
-    (reduce #(rekey %1 (first %2) (second %2))
-      m (partition 2 (conj ks k1new k1old)))))
+(defn run-acquisition-from-settings [^SequenceSettings settings]
+  (println
+  (rekey (data-object-to-map settings)
+    :numFrames :frames
+    :keepShutterOpenSlices :keep-shutter-open-slices
+    :keepShutterOpenChannels :keep-shutter-open-channels
+    :timeFirst :time-first
+    :slicesFirst :slices-first)))
+

 ;; AcquisitionEngine implementation
@@ -112,7 +121,7 @@
   (doto
     (proxy [AcquisitionWrapperEngine] []
       (runPipeline [^SequenceSettings settings]
-        (def acq-settings (data-object-to-map settings))))
+        (run-acquisition-from-settings settings)))
     (.setCore mmc (.getAutofocusManager gui))
     (.setParentGUI gui)))

@@ -120,6 +129,9 @@
   (.show (AcqControlDlg. eng (Preferences/userNodeForPackage (.getClass gui)) gui)))

 (comment
+(defn compute-verbose-summary [params]
+   "meh")
+
 (defn create-acq-eng []
   (let [params (atom {:autofocus-skip-interval 0})
        set-param! #(swap! params assoc %1 %2)