CMR-512: Moved method out of this API to where it is used in indexer.

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


preventing form submit on location selection

--- src/cljs/conference_rating/add_conference_page/add_conference_page.cljs
+++ src/cljs/conference_rating/add_conference_page/add_conference_page.cljs
@@ -47,6 +47,11 @@
                           :display identity
                           :async true
                           :templates {:suggestion conference-series-template}})))
+(def enter-char-code 13)
+
+(defn prevent-form-submit [e]
+  (if (= enter-char-code (.-charCode e))
+    (.preventDefault e)))

 (defn location-render [data-atom]
   (fn []
@@ -56,6 +61,7 @@
              :placeholder  "Location of the conference"
              :data-e2e     "input-conference-location"
              :defaultValue (get-in @data-atom [:location :name])
+             :on-key-press prevent-form-submit
              :required     true}]))

 (defn- convert-location [place]


[#1993] Remove debug code

[#1993] Remove debug code

--- backend/src/akvo/lumen/lib/transformation.clj
+++ backend/src/akvo/lumen/lib/transformation.clj
@@ -45,7 +45,6 @@

 (defn- execute-tx [{:keys [tenant-conn] :as deps} job-execution-id dataset-id command]
   (future
-    (Thread/sleep 5000)
     (try
       (jdbc/with-db-transaction [tx-conn tenant-conn]
         (let [tx-deps (assoc deps :tenant-conn tx-conn)]


ensure proper exit when building

ensure proper exit when building

--- pedestal-app/app/src/semtag_web/tasks.clj
+++ pedestal-app/app/src/semtag_web/tasks.clj
@@ -48,4 +48,5 @@

     (when-let [uri (System/getenv "API_URI")]
       (println "Writing" (str "out/public/generated-js/" js-file))
-      (modify-file (str "out/public/generated-js/" js-file) #(string/replace-first % "http://localhost:3000/api" uri)))))
+      (modify-file (str "out/public/generated-js/" js-file) #(string/replace-first % "http://localhost:3000/api" uri))))
+  (System/exit 0))


Adding area measurement to branch point counter

--- src/plugins/Scripts/Funimage/Morphology/Branch_Point_Counter.clj
+++ src/plugins/Scripts/Funimage/Morphology/Branch_Point_Counter.clj
@@ -25,6 +25,15 @@

 (ij.IJ/run mask "Analyze Particles..." "size=1000-Infinity pixel show=Masks display clear add")

+(def roi-info
+  (let [rt (ij.measure.ResultsTable/getResultsTable)]
+    {:num-regions (.getCounter rt)
+     :area (apply + (map #(.getValue rt "Area" %) (range (.getCounter rt))))}))
+
+;(let [rm (ij.plugin.frame.RoiManager.)
+;      num-rois (.getCount rm)]
+
+
 (def new-mask (ij.WindowManager/getImage (str "Mask of " (str "C2-" orig-name ))))

 (ij.IJ/run new-mask "Invert LUT" "")
@@ -40,6 +49,23 @@
 (set! (.changes new-mask) false)
 (.close new-mask)

+#_(let [rt (ij.measure.ResultsTable/getResultsTable)]
+   (.setValue rt "Area" 0 (double (:area roi-info)))
+   (.setValue rt "NumRegions" 0 (double (:num-regions roi-info)))
+   (.updateResults rt))
+
+(let [tp (ij.IJ/getTextPanel)
+      rt (.getResultsTable tp)
+      ;tmp (println (clojure.string/join "\t" (.getHeadings rt)))
+      line (.getLine tp 0)
+      [image-name num-intersections] (clojure.string/split line #"\t")
+      ;image-name (.getValue rt "Image name" 0)
+      ;num-intersections (.getValue rt "Num of intersections" 0)
+      ]
+  (ij.IJ/setColumnHeadings "Image name\tNum of intersections\tArea\tNum regions")
+  (.append (ij.IJ/getTextPanel)
+    (str image-name "\t" num-intersections "\t" (:area roi-info) "\t" (:num-regions roi-info))))
+
 ;(println "saving as" (str (string/replace (string/replace orig-name ".tif" "") " " "_") "_labeled_branches.tif"))
 ;(ij.IJ/saveAsTiff imp (str directory "/" (string/replace orig-name ".tif" "") "_labeled_branches.tif"))


Fix protocol leakage to native printer

Fix protocol leakage to native printer

--- src/derive/nativestore.cljs
+++ src/derive/nativestore.cljs
@@ -89,7 +89,7 @@
                   (let [v (aget native k)
                         k (keyword k)]
                     (when-not (or (fn? v)
-                                  (#{:cljs$lang$protocol_mask$partition0$ :cljs$lang$protocol_mask$partition1$ :__ro} k))
+                                  (#{:cljs$lang$protocol_mask$partition0$ :cljs$lang$protocol_mask$partition1$ :__ro :derive$nativestore$IReadOnly$} k))
                       [k v])))))
      pr-writer writer opts))


get ks from state & only deref once

get ks from state & only deref once

--- src/desdemona/ui/table.cljs
+++ src/desdemona/ui/table.cljs
@@ -4,8 +4,10 @@

 (defn table-component
   []
-  (let [rows (:results @session/state)
-        all-keys (-> (mapcat wd/get-all-keys rows) distinct wd/prepare-keys)]
+  (let [state-deref @session/state]
     [:div {:class "container-fluid"}
      [:div {:class "table-responsive table-sorted"}
-      [wd/sorted-table all-keys rows session/state]]]))
+      [wd/sorted-table
+       (:table-toggled-ks state-deref)
+       (:results state-deref)
+       session/state]]]))


Migrate docs generation tool to handle cljc files.

--- dev-resources/utils/docs.clj
+++ dev-resources/utils/docs.clj
@@ -5,13 +5,13 @@
             [clojure.set :refer [union]]
             [quil.helpers.docs :refer [link-to-processing-reference]]))

-(defn read-all [file]
+(defn read-all [file feature]
   (let [reader (->> file
                     io/resource
                     io/input-stream
                     input-stream-push-back-reader)
         endof (gensym)]
-    (->> #(rdr/read reader false endof)
+    (->> #(rdr/read {:eof endof :read-cond :allow :features #{feature}} reader)
          (repeatedly)
          (take-while #(not= % endof))
          (doall))))
@@ -55,13 +55,12 @@
 (defn merge-all-metas [metas1 metas2]
   (merge-with merge-metas metas1 metas2))

-(def clj-files ["quil/core.clj" "quil/middleware.clj"])
-(def cljs-files ["quil/core.cljs" "quil/middleware.cljs"])
+(def files ["quil/core.cljc" "quil/middleware.cljc"])

 (defn generate-metas-to-file [file]
-  (let [clj (-> (mapcat read-all clj-files)
+  (let [clj (-> (mapcat #(read-all % :clj) files)
                 (get-metas :clj))
-        cljs (-> (mapcat read-all cljs-files)
+        cljs (-> (mapcat #(read-all % :cljs) files)
                  (get-metas :cljs))
         merged (merge-all-metas clj cljs)]
     (with-open [wtr (io/writer file)]


Fix: should serve files but from a different path

--- src/pathfinder/service.clj
+++ src/pathfinder/service.clj
@@ -72,5 +72,5 @@
                                     present)))]
       (routes
        (context "/projects" [] project-routes)
-       (route/resources "/")
+       (route/files "/" {:root "resources/public"})
        (route/not-found "Not Found")))))


thru rm_cl_device_usage

thru rm_cl_device_usage

--- src/pg_demo/table_defs.clj
+++ src/pg_demo/table_defs.clj
@@ -3030,6 +3030,207 @@
               PRIMARY KEY (ENTERPRISE_ID,REPORT_STATE_ID)
           ); " }

+    { "rm_cfg_templates"
+          "CREATE TABLE rm_cfg_templates (
+              ENTERPRISE_ID numeric NOT NULL,
+              TEMPLATE_ID numeric NOT NULL,
+              BLOB_SEQ numeric(10) NOT NULL,
+              NAME varchar(40),
+              SHOW numeric,
+              LETTER_SCHED varchar(30),
+              ACTION_SCHED numeric,
+              LETTER_PATH varchar(200),
+              BLOBSIZE numeric,
+              REG_RPT_COVER numeric,
+              DELETED timestamp,
+              ACTION_TYPE_ID numeric,
+              RETURN_EMAIL_ADDRESS varchar(255),
+              AC_ID numeric,
+              NAME_J varchar(40),
+              PRIMARY KEY (ENTERPRISE_ID,TEMPLATE_ID,BLOB_SEQ)
+          ); " }
+
+    { "rm_cfg_users"
+          "CREATE TABLE rm_cfg_users (
+              ENTERPRISE_ID numeric NOT NULL,
+              USER_ID numeric NOT NULL,
+              USER_FULLNAME varchar(64),
+              USER_NAME varchar(64),
+              USER_PASSWORD varchar(1000),
+              USER_EMAIL varchar(100),
+              WORKFLOW_MGR numeric,
+              ACCOUNT_DISABLED numeric,
+              FORCE_EXPIRE numeric,
+              NUM_DAYS numeric,
+              PROTECT_FROM_UNBLIND numeric,
+              DISPLAY_WL_LOGIN numeric,
+              LANG_PREF numeric,
+              SITE_ID numeric,
+              PWD_SET_DATE timestamp,
+              CREATION_DATE timestamp,
+              ALLOW_UNBLINDING numeric(1),
+              ALLOW_LOCKING numeric(1),
+              ALLOW_CLOSING numeric(1),
+              SITE_SECURITY numeric(4),
+              AGSERVICE numeric(1),
+              FORCE_CHANGE numeric(2),
+              J_CONFIGURATION numeric(2),
+              SEE_NON_CURRENT numeric(2),
+              DELETED timestamp,
+              LOGIN_COUNT numeric NOT NULL,
+              SECURITY_DISABLED numeric NOT NULL,
+              SECURITY_DISABLED_TEXT varchar(400),
+              ROUTE_ON_CLOSE numeric,
+              LDAP_USER numeric,
+              ESM_USER numeric,
+              PERCEPTIVE_WORKFLOW_MGR numeric(1),
+              ENABLE_CHECKLIST_ON_ROUTE numeric NOT NULL,
+              AC_ADMIN numeric NOT NULL,
+              LDAP_SERVER_ID numeric,
+              COPY_CONFIG numeric,
+              GL_ENT_MGMT_ACCESS numeric NOT NULL,
+              GL_USR_MGMT_ACCESS numeric NOT NULL,
+              MENU_ACCESS varchar(2000),
+              SITE_NO_ACCESS varchar(2000),
+              WL_ACT_ITEM_ACCESS numeric NOT NULL,
+              WL_CONTACTS_ACCESS numeric NOT NULL,
+              WL_NEW_ACCESS numeric NOT NULL,
+              WL_OPEN_ACCESS numeric NOT NULL,
+              DEOPTIMIZER_COUNTER numeric,
+              GLOBAL_ADMIN numeric NOT NULL,
+              HASH_ALGO varchar(30),
+              SALT varchar(30),
+              PRIMARY KEY (ENTERPRISE_ID,USER_ID)
+          ); " }
+
+    { "rm_cfg_users_sites"
+          "CREATE TABLE rm_cfg_users_sites (
+              ENTERPRISE_ID numeric NOT NULL,
+              USER_ID numeric NOT NULL,
+              SITE_ID numeric NOT NULL,
+              ACCESS_LEVEL numeric(4) NOT NULL,
+              GROUP_ID numeric,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,USER_ID,SITE_ID)
+          ); " }
+
+    { "rm_cfg_user_access"
+          "CREATE TABLE rm_cfg_user_access (
+              ENTERPRISE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              USER_ID numeric NOT NULL,
+              APPLICATION_ID numeric NOT NULL,
+              DEFAULT_APPLICATIONID numeric NOT NULL,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,SEQ_NUM)
+          ); " }
+
+    { "rm_cfg_user_enterprise_apps"
+          "CREATE TABLE rm_cfg_user_enterprise_apps (
+              USER_NAME varchar(64) NOT NULL,
+              APP_NAME varchar(100) NOT NULL,
+              SECURITY_LEVEL numeric,
+              ENTERPRISE_ID numeric NOT NULL,
+              PRIMARY KEY (ENTERPRISE_ID,USER_NAME,APP_NAME)
+          ); " }
+
+    { "rm_cfg_user_groups"
+          "CREATE TABLE rm_cfg_user_groups (
+              ENTERPRISE_ID numeric NOT NULL,
+              USER_ID numeric NOT NULL,
+              GROUP_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              DELETED timestamp,
+              PRIMARY KEY (ENTERPRISE_ID,USER_ID,GROUP_ID,SEQ_NUM)
+          ); " }
+
+    { "rm_cfg_workflow_rules"
+          "CREATE TABLE rm_cfg_workflow_rules (
+              ENTERPRISE_ID numeric NOT NULL,
+              SEQ_NUM numeric NOT NULL,
+              TO_STATE_ID numeric NOT NULL,
+              FR_STATE_ID numeric NOT NULL,
+              GROUP_ID numeric NOT NULL,
+              AC_ID numeric,
+              EXCLUSIVE_FLAG numeric,
+              EMAIL_FLAG numeric,
+              DESCRIPTION varchar(80),
+              SORT_ID numeric,
+              NORMAL_TIME numeric(8,2),
+              MAX_TIME numeric(8,2),
+              DELETED timestamp,
+              LOCK_CASE numeric,
+              REQUIRE_PASSWORD numeric,
+              PRODUCT_GROUP_ID numeric,
+              UD_TEXT_1 varchar(100),
+              UD_TEXT_2 varchar(100),
+              RESTRICT_WORKFLOW_GROUP numeric,
+              UNIT numeric,
+              PRIMARY KEY (ENTERPRISE_ID,SEQ_NUM)
+          ); " }
+
+    { "rm_cfg_workflow_states"
+          "CREATE TABLE rm_cfg_workflow_states (
+              ENTERPRISE_ID numeric NOT NULL,
+              STATE_ID numeric NOT NULL,
+              STATE_NAME varchar(30),
+              STATE_DESC varchar(100),
+              SORT_ID numeric,
+              DELETED timestamp,
+              SITE_ID numeric,
+              ARCHIVING numeric(1),
+              PREF_STATE_ID numeric,
+              PRIMARY KEY (ENTERPRISE_ID,STATE_ID)
+          ); " }
+
+    { "rm_cl_autopsy_results"
+          "CREATE TABLE rm_cl_autopsy_results (
+              ID numeric NOT NULL,
+              RESULTS varchar(35),
+              DELETED timestamp,
+              PRIMARY KEY (ID)
+          ); " }
+
+    { "rm_cl_bfarm_causality"
+          "CREATE TABLE rm_cl_bfarm_causality (
+              ID numeric NOT NULL,
+              CAUSALITY varchar(35) NOT NULL,
+              DELETED timestamp,
+              PRIMARY KEY (ID)
+          ); " }
+
+    { "rm_cl_device_deliv_type"
+          "CREATE TABLE rm_cl_device_deliv_type (
+              ID numeric NOT NULL,
+              TYPE varchar(24),
+              DELETED timestamp,
+              PRIMARY KEY (ID)
+          ); " }
+
+    { "rm_cl_device_evaluation"
+          "CREATE TABLE rm_cl_device_evaluation (
+              ID numeric NOT NULL,
+              DEV_EVAL varchar(24),
+              DELETED timestamp,
+              PRIMARY KEY (ID)
+          ); " }
+
+    { "rm_cl_device_operator"
+          "CREATE TABLE rm_cl_device_operator (
+              ID numeric NOT NULL,
+              DEV_OPER varchar(19),
+              DELETED timestamp,
+              PRIMARY KEY (ID)
+          ); " }
+
+    { "rm_cl_device_usage"
+          "CREATE TABLE rm_cl_device_usage (
+              ID numeric NOT NULL,
+              DEV_USAGE varchar(7),
+              DELETED timestamp,
+              PRIMARY KEY (ID)
+          ); " }
+
   ] ))

 (def dummy


logging and comment cleanup in conv-man ns

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -344,10 +344,10 @@
       ;; If nil comes through as the first message, then the chan is closed, and we should be done, not continue looping forever
       (when-not (async/poll! kill-chan)
         (when-let [first-msg (<! message-chan)]
+          (log/debug "Message chan put in queue-message-batch! for zid:" zid)
           ;; If there are any retry messages from a failed recompute, we put them at the front of the message stack.
           ;; But retry messages only get processed in this way if there are new messages that have come in triggering the
           ;; first-msg take above, ensuring we don't just loop forever on a broken message/update.
-          (log/info "Message chan put in queue-message-batch! for zid:" zid)
           (let [retry-msgs (async/poll! retry-chan)
                 msgs (vec (concat retry-msgs [first-msg] (take-all! message-chan)))
                 ;; Regardless, now we split the messages by message type and process them as below
@@ -366,7 +366,7 @@
                        conv)
                 math-tick (postgres/inc-math-tick (:postgres conv-man) zid)]
             (log/info "Completed computing conversation zid:" zid)
-            (log/debug "Mod out for zid" zid "is:" (:mod-out conv))
+            ;; Write updated models
             (write-conv-updates! conv-man conv math-tick)
             ;; Run reports corr matrix stuff (etc)
             (doseq [report-task generate_report_data]
@@ -374,6 +374,7 @@
             ;; Here, we assoc into the parent conversations state as a convenience; the actual "current state" is
             ;; as closed over in this go-loop.
             (swap! conversations assoc-in [zid :conv] conv)
+            ;; Run any attached listener functions (this is experimental)
             (async/thread
               (doseq [[k f] @listeners] (try (f conv) (catch Exception e (log/error e "Listener error")))))
             (recur conv)))))


Delete unused function that I forgot to delete in my last commit

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10/data_contact.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10/data_contact.clj
@@ -49,11 +49,6 @@

 (def default-contact-person-role
   "Technical Contact")
-
-(defn- truncate-short-name?
-  "Return true if ShortName is more than 85 characters and should be truncated"
-  [short-name]
-  (> (count short-name) u/SHORTNAME_MAX))

 (defn- parse-contact-mechanisms
   "Parse ECHO10 contact mechanisms to UMM."


CMR-309: Added float attribute tests.

CMR-309: Added float attribute tests.

--- test/cmr/system_int_test/search/granule_psa_search_test.clj
+++ test/cmr/system_int_test/search/granule_psa_search_test.clj
@@ -21,6 +21,7 @@
        (= {:status 422 :errors [error]}
           (search/get-search-failure-data (search/find-refs :granule {"attribute[]" v})))
        ",alpha,a" (am/invalid-type-msg "")
+       "foo,alpha,a" (am/invalid-type-msg "foo")
        ",alpha,a,b" (am/invalid-type-msg "")
        "string,,a" (am/invalid-name-msg "")
        "string,,a,b" (am/invalid-name-msg "")
@@ -28,10 +29,12 @@
        "string,alpha" (am/invalid-num-parts-msg)
        "string,alpha,," (am/one-of-min-max-msg)
        "string,alpha,b,a" (am/max-must-be-greater-than-min-msg "b" "a")
-       "string,alpha,b,b" (am/max-must-be-greater-than-min-msg "b" "b"))
+       "string,alpha,b,b" (am/max-must-be-greater-than-min-msg "b" "b")
+       "float,alpha,a" (am/invalid-value-msg :float "a")
+       "float,alpha,a,0" (am/invalid-value-msg :float "a")
+       "float,alpha,0,b" (am/invalid-value-msg :float "b"))

-
-  (is (= {:status 422 :errors [(am/attributes-must-be-sequence-msg)]}
+    (is (= {:status 422 :errors [(am/attributes-must-be-sequence-msg)]}
          (search/get-search-failure-data
            (search/find-refs :granule {"attribute" "string,alpha,a"})))))

@@ -40,7 +43,6 @@
   (let [psa1 (dc/psa "alpha" :string)
         psa2 (dc/psa "bravo" :string)
         psa3 (dc/psa "charlie" :string)
-
         coll1 (d/ingest "PROV1" (dc/collection {:product-specific-attributes [psa1 psa2]}))
         gran1 (d/ingest "PROV1" (dg/granule coll1 {:product-specific-attributes [(dg/psa "alpha" ["ab" "bc"])
                                                                                (dg/psa "bravo" ["cd" "bf"])]}))
@@ -75,7 +77,46 @@
            ;; only max range provided
            "string,bravo,,bc" [gran2 gran3]))))

+(deftest float-psas-search-test
+  (let [psa1 (dc/psa "alpha" :float)
+        psa2 (dc/psa "bravo" :float)
+        psa3 (dc/psa "charlie" :float)
+        coll1 (d/ingest "PROV1" (dc/collection {:product-specific-attributes [psa1 psa2]}))
+        gran1 (d/ingest "PROV1" (dg/granule coll1 {:product-specific-attributes [(dg/psa "alpha" [10.5 123])
+                                                                                (dg/psa "bravo" [-12])]}))
+        gran2 (d/ingest "PROV1" (dg/granule coll1 {:product-specific-attributes [(dg/psa "bravo" [10.5 123])]}))
+
+        coll2 (d/ingest "PROV1" (dc/collection {:product-specific-attributes [psa1 psa2 psa3]}))
+        gran3 (d/ingest "PROV1" (dg/granule coll2 {:product-specific-attributes [(dg/psa "alpha" [14])
+                                                                                (dg/psa "bravo" [13.7 123])]}))
+        gran4 (d/ingest "PROV1" (dg/granule coll2 {:product-specific-attributes [(dg/psa "charlie" [14])]}))]
+    (index/flush-elastic-index)
+
+    (testing "search by value"
+      (are [v items]
+           (d/refs-match? items (search/find-refs :granule {"attribute[]" v}))
+           "float,bravo,123" [gran2, gran3]
+           "float,alpha,10" []
+           "float,bravo,-12" [gran1]))
+
+    (testing "search by range"
+      (are [v items]
+           (d/refs-match? items (search/find-refs :granule {"attribute[]" v}))
+
+           ;; inside range
+           "float,alpha,10.2,11" [gran1]
+           ;; beginning edge of range
+           "float,alpha,10.5,10.6" [gran1]
+           ;; ending edge of range
+           "float,alpha,10,10.5" [gran1]
+
+           ;; only min range provided
+           "float,bravo,120," [gran2 gran3]
+
+           ;; only max range provided
+           "float,bravo,,13.6" [gran2]))))

+


[l.d.aar] Only add classes.jar to classpath when they exist

--- src/leiningen/droid/aar.clj
+++ src/leiningen/droid/aar.clj
@@ -48,7 +48,7 @@
   [project]
   (let [classes-jars (get-aar-files project "classes.jar")
         libs-dirs (get-aar-files project "libs")]
-    (concat classes-jars
+    (concat (filter #(.exists ^File %) classes-jars)
             (mapcat #(.listFiles ^File %) libs-dirs))))

 (defn get-aar-native-paths


Avoid corrupting the save state if the application is killed when the file is being written

--- src/rpi_challenger/app.clj
+++ src/rpi_challenger/app.clj
@@ -32,8 +32,16 @@

 ; persistence

+(defn- with-file-ext [file ext]
+  (File. (.getParentFile file) (str (.getName file) "." ext)))
+
 (defn save-state [app file]
-  (io/object-to-file file (t/serialize (:tournament @app))))
+  (let [tmp-file (with-file-ext file "tmp")
+        bak-file (with-file-ext file "bak")]
+    (io/object-to-file tmp-file (t/serialize (:tournament @app)))
+    (.delete bak-file)
+    (.renameTo file bak-file)
+    (.renameTo tmp-file file)))

 (defn load-state [file]
   (let [app (make-app)


misprint

misprint

--- datomic-dsl/src/datomic_dsl/add_nested.clj
+++ datomic-dsl/src/datomic_dsl/add_nested.clj
@@ -10,33 +10,33 @@
   (take-while (complement nil)
               (iterate zip/up node)))

-(defn zip-nde-map-entries
+(defn zip-node-map-entries
   "If this is a map-entry - get the key out of the zipper."
   [me]
   (if (= (type (zip/node me)) clojure.lang.MapEntry)
-    (key (zip/node ma))))
+    (key (zip/node me))))

 (defn steps-up
   "Keys to the top for a given node."
   [node]
-  (filter (comp not all?)
+  (filter (comp not nil?)
           (map zip-node-map-entries
-               (up-zipper node))))
+               (up-stepper node))))

 (defn map-key-seqs
   "For a given dsl, get a sequence of steps to each of the nested nodes."
   [dsl]
   (filter
    (comp not empty?)
-   (map step-up
+   (map steps-up
         (zip-nodes
-         dsl-zipper dsl))))
+         (dsl-zipper dsl)))))

 (defn get-key-sequences
   "Get each of the nested nodes as a flat vector of nodes to map over."
   [nested-dsl]
   (let [nested-datom-dsl-zipper (map-zip nested-dsl)]
-    (map vec (map-keys-seqs nested-dsl))))
+    (map vec (map-key-seqs nested-dsl))))

 (defn append-in
   "Given a key sequence - append a value at the nested location."
@@ -61,13 +61,13 @@
         child-dbid (:db/id dbid)
         parent-keyword (case (count last-two)
                          2 (keyword (first last-two) (second last-two))
-                         1 (kayword (first last-two)))
-        parent-dbid (if (> (count curent-seq) 1) (parent-keyword dbid))
-        child-replace (append-in nest-datom-dsl-input current-seq-vec child-dbid)
-        parent-replace (marge child-replace parent-dbid)]
+                         1 (keyword (first last-two)))
+        parent-dbid (if (> (count current-seq) 1) (parent-keyword dbid))
+        child-replace (append-in nest-datom-dsl-input current-seq-rev child-dbid)
+        parent-replace (merge child-replace parent-dbid)]
     parent-replace))

-(defn key-sequence
+(defn key-sequences
   "Get the key sequence from the dsl and filter out the top-level ones and return a set of vectors."
   [dsl]
   (set
@@ -87,7 +87,7 @@
   [nested-dsl]
   (fn [key-sequence]
     (let [local-datom (get-in nested-dsl key-sequence)
-          db-if-ref (:db/id local-datom)
+          db-id-ref (:db/id local-datom)
           local-datom-minus-dbid (dissoc local-datom :db/id)
           local-datom-minus-children (into {} (map replace-children
                                                    local-datom-minus-dbid))


Basic operation reductions.

Basic operation reductions.

--- src/smallex/reductions.clj
+++ src/smallex/reductions.clj
@@ -1,6 +1,23 @@
 (ns smallex.reductions
   (:require [clojure.set :as set]
             [clojure.walk :as walk]))
+
+(def ^:private full-char-set
+  "A full char-set of all possible bytes"
+  (set (map char (range 0x100))))
+
+(defn- op-of
+  [op-type]
+  (fn [expr]
+    (and (= :op (:type expr))
+         (= op-type (:value expr)))))
+
+(def ^:private cat-op? (op-of :cat))
+(def ^:private or-op? (op-of :or))
+(def ^:private not-op? (op-of :not))
+(def ^:private star-op? (op-of :star))
+(def ^:private plus-op? (op-of :plus))
+(def ^:private opt-op? (op-of :opt))

 (defn- find-alias-deps
   "Returns a set of alias deps, given an expression."
@@ -157,3 +174,95 @@
               (:rules grammar)
               (keys (:rules grammar))))))

+(defn- setify-char-set
+  "Converts a char-set to an actual set."
+  [char-set]
+  (update-in char-set [:value] set))
+
+(defn- invert-not
+  "Inverses the not operation to a char-set."
+  [not-op]
+  {:type :char-set
+   :value (set/difference full-char-set
+                          (get-in not-op [:args 0 :value]))})
+
+(defn- flatten-cat
+  "Flattens a `cat`, whenever possible."
+  [cat-op]
+  (assoc cat-op
+    :args (->> (:args cat-op)
+               (mapcat (fn [arg] (if (cat-op? arg)
+                                  (:args arg)
+                                  [arg])))
+               vec)))
+
+(defn- reduce-cat
+  "Reduces a `cat`, whenever possible."
+  [cat-op]
+  (cond (every? #(= :string (:type %)) (:args cat-op))
+        {:type :string, :value (apply str (map :value (:args cat-op)))}
+        (= 1 (count (:args cat-op)))
+        (first (:args cat-op))
+        :else
+        cat-op))
+
+(defn- flatten-or
+  "Flattens an `or`, whenever possible."
+  [or-op]
+  (assoc or-op
+    :args (->> (:args or-op)
+               (mapcat (fn [arg] (if (or-op? arg)
+                                  (:args arg)
+                                  [arg])))
+               vec)))
+
+(defn- reduce-or
+  "Reduces an `or` whenever possible."
+  [or-op]
+  (cond (every? #(= :char-set (:type %)) (:args or-op))
+        {:type :char-set,
+         :value (apply set/union (map :value (:args or-op)))}
+        (= 1 (count (:args or-op)))
+        (first (:args or-op))
+        :else
+        or-op))
+
+(defn- expand-opt
+  "Expands (opt x) to (or \"\" x)."
+  [opt-op]
+  {:type :op, :value :or
+   :args [{:type :string, :value ""}
+          (get-in opt-op [:args 0])]})
+
+(defn- expand-plus
+  "Expands (plus x) to (cat x (star x))."
+  [plus-op]
+  {:type :op, :value :cat
+   :args [(get-in plus-op [:args 0])
+          {:type :op, :value :star,
+           :args (:args plus-op)}]})
+
+(defn- reduce-expression
+  "Reduces an expression."
+  [expr]
+  (case (:type expr)
+    :op (let [expr (assoc expr
+                     :args (mapv reduce-expression (:args expr)))]
+          (case (:value expr)
+            :cat (-> expr flatten-cat reduce-cat)
+            :or (-> expr flatten-or reduce-or)
+            :opt (expand-opt expr)
+            :plus (expand-plus expr)
+            :star expr))
+    :char-set (setify-char-set expr)
+    :string expr))
+
+(defn reduce-rules
+  "Reduces all rules within the grammar."
+  [grammar]
+  ;; TODO: memoize alias reductions perhaps?
+  (assoc grammar
+    :rules (into {}
+                 (for [[r-name r-expr] (:rules grammar)]
+                   [r-name (reduce-expression r-expr)]))))
+


added instruction for administrator

added instruction for administrator

--- src/tango/cljs/client.cljs
+++ src/tango/cljs/client.cljs
@@ -304,6 +304,15 @@
                 (dom/th nil "Plats")))
             (apply dom/tbody nil (map competition competitions)))

+          (dom/div nil
+            (dom/h4 nil "Instruktion:")
+            (dom/ol nil
+                    (dom/li nil "Refresha Browsern")
+                    (dom/li nil "Importera den nya filen")
+                    (dom/li nil "Klicka på namnet ovan för att ladda in tävlingen")
+                    (dom/li nil "Välj Time Schedule")
+                    (dom/li nil "Välj en runda per panel")
+                    (dom/li nil "Välj rundor för speaker")))
           (dom/div nil
             (dom/span #js {:className (str "btn btn-default btn-file"
                                            (when (= import-status :importing) " disabled"))}


wip on styling

wip on styling

--- src/tango/cljs/client.cljs
+++ src/tango/cljs/client.cljs
@@ -272,7 +272,7 @@
      (log adjudicators)
      (dom/div
       nil
-      (dom/h3 nil "Domare")
+      (dom/h2 {:className "sub-header"} "Domare")
       (dom/table
        #js {:className "table"}
        (dom/thead
@@ -313,7 +313,7 @@
      (log panels)
      (dom/div
       nil
-      (dom/h3 nil "Domarpaneler")
+      (dom/h2 {:className "sub-header"} "Domarpaneler")
       (dom/table
        #js {:className "table"}
        (dom/thead
@@ -402,7 +402,7 @@
    (let [classes (:competition/classes (om/props this))]
      (dom/div
       nil
-      (dom/h3 nil "Klasser")
+      (dom/h2 {:className "sub-header"} "Klasser")
       (dom/table
        #js {:className "table"}
        (dom/thead
@@ -466,7 +466,7 @@
      ;(log activites)
      (dom/div
       nil
-      (dom/h3 nil "Time Schedule")
+      (dom/h2 {:className "sub-header"} "Time Schedule")
       (dom/table
        #js {:className "table"}
        (dom/thead
@@ -487,12 +487,24 @@
 ;;;;;;;;;;;;;;;;;;;;
 ;; Menu

+;; (dom/li #js {:className "active"
+;;              :onClick  #(log "click")}
+;;         (dom/a {:href "#"} "Classer"))
+;; (dom/li nil (dom/a {:href "#"} "Time Schedule"))
+
 (defn make-menu-button
-  [component button-name page-key]
-  (dom/button
-   #js {:className "btn btn-default"
+  [component active-page-key button-name page-key ]
+  (dom/li
+   #js {:className (if (= active-page-key page-key) "active" "")
         :onClick #(om/transact! component `[(app/select-page {:page ~page-key})])}
-   button-name))
+   (dom/a nil button-name)))
+
+;; (defn make-menu-button
+;;   [component button-name page-key]
+;;   (dom/button
+;;    #js {:className "btn btn-default"
+;;         :onClick #(om/transact! component `[(app/select-page {:page ~page-key})])}
+;;    button-name))

 (defui MenuComponent
   static om/IQuery
@@ -511,7 +523,7 @@
    (let [competitions (:app/competitions (om/props this))
          spage (:app/selected-page (om/props this))
          selected-competition (:app/selected-competition (om/props this))
-         make-button (partial make-menu-button this)]
+         make-button (partial make-menu-button this spage)]
      (log "Render MenuComponent")
 ;     (dom/div #js {:className "container"})
      (dom/div
@@ -522,7 +534,14 @@
                                  (dom/a #js {:className "navbar-brand" :href  "#"} "Tango!"))
                         (dom/div #js {:id "navbar" :className "navbar-collapse collapse"}
                                  (dom/ul #js {:className "nav navbar-nav navbar-right"}
-                                         (dom/li nil (dom/a #js {:href "#"} "Tävlingar")))
+                                         (dom/li
+                                          #js {:onClick #(om/transact!
+                                                          this
+                                                          `[(app/select-page {:page :competitions})])}
+                                          (dom/a #js {:href "#"} "Tävlingar"))
+                                         (dom/li
+                                          #js {:onClick (fn [e] (test-query-click this))}
+                                          (dom/a #js {:href "#"} "Query")))
                                  (dom/form #js {:className "navbar-form navbar-right"}
                                            (dom/input #js {:type "text"
                                                            :className "form-control"
@@ -546,13 +565,6 @@
       (dom/div #js {:className "container-fluid"}
                (dom/div #js {:className "row"}
                         (dom/div #js {:className "col-sm-3 col-md-2 sidebar"}
-                                 (dom/ul #js {:className "nav nav-sidebar"}
-                                         (dom/li #js {:className "active"
-                                                      :onClick  #(log "click")}
-                                                 (dom/a {:href "#"} "Classer"))
-                                         (dom/li nil (dom/a {:href "#"} "Time Schedule"))
-                                         )
-
                                  (apply dom/ul #js {:className "nav nav-sidebar"}
                                         (map (fn [[name key]] (make-button name key))
                                              [["Properties" :properties]
@@ -568,7 +580,6 @@

                         (dom/div #js {:className "col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"}
                                  (dom/h1 #js {:className "page-header"} "Rikstävling yada yada")
-                                 (dom/h2 #js {:className "sub-header"} "Klasser")
                                  (condp = spage
                                    :properties ((om/factory PropertiesView) selected-competition)
                                    :classes ((om/factory ClassesView) selected-competition)


moving xml_tree_values cleanup after file is uploaded to s3 so 5.1 feeds can access values to generate file name

--- src/vip/data_processor.clj
+++ src/vip/data_processor.clj
@@ -65,8 +65,8 @@
            add-validations
            errors/close-errors-chan
            errors/await-statistics
+           s3/upload-to-s3
            psql/delete-from-xml-tree-values
-           s3/upload-to-s3
            cleanup/cleanup]))

 (defn-traced process-message [message]


Add more skeleton code for new API

Add more skeleton code for new API

--- src/monkey_music/rules.cljs
+++ src/monkey_music/rules.cljs
@@ -23,7 +23,25 @@
     (or (zero? (states/total-remaining-turns state))
         (zero? total-remaining-points))))

-(defn run-commands [state commands] nil)
+(defn shuffle-commands [state commands]
+  [state commands])
+
+(defn run-commands [state commands]
+  (let [[state commands] (shuffle-commands state commands)]
+    (reduce run-command state shuffled-commands)))
+
+(defn validate-command [state {command :command team :team}]
+  (if (states/has-team? team) command :noop))
+
+(defmulti run-command validate-command)
+
+(defmethod run-command :move [state {team :team direction :direction}]
+  state)
+
+(defmethod run-command :use [state command]
+  state)
+
+(defmethod run-command :default [state command] state)

 (defn move-player* [state player-id direction]
   (let [player-position (states/position state player-id)


remove redirectURI from template when creating user resource

--- cimi/src/com/sixsq/slipstream/ssclj/resources/user_self_registration.clj
+++ cimi/src/com/sixsq/slipstream/ssclj/resources/user_self_registration.clj
@@ -35,7 +35,7 @@
   [{:keys [password] :as resource} request]
   [nil (-> resource
            (merge user-defaults)
-           (dissoc :passwordRepeat :instance)
+           (dissoc :passwordRepeat :instance :redirectURI)
            (assoc :password (internal/hash-password password)))])


update docstrings

update docstrings

--- src/overtone/music/time.clj
+++ src/overtone/music/time.clj
@@ -16,32 +16,35 @@
   (System/currentTimeMillis))

 (defn after-delay
-  "Schedules fun to be executed after ms-delay milliseconds. Pool defaults to the player-pool."
+  "Schedules fun to be executed after ms-delay milliseconds. Pool defaults to
+  the player-pool."
   [ms-delay fun] (at-at/at (+ (now) ms-delay) fun player-pool*))

 (defn periodic
-  "Calls fun every ms-period, and takes an optional initial-delay for the first call in ms. Pool defaults to the player-pool."
+  "Calls fun every ms-period, and takes an optional initial-delay for the first
+  call in ms. Pool defaults to the player-pool."
   ([ms-period fun] (periodic ms-period fun 0))
   ([ms-period fun initial-delay]
      (at-at/every ms-period fun initial-delay player-pool*)))

-(on-sync-event :reset #(do (println "resetting player pool") (at-at/stop-and-reset-pool! player-pool* true)) ::player-reset)
+(on-sync-event :reset #(at-at/stop-and-reset-pool! player-pool* true) ::player-reset)

 (defn stop-player
   "Stop scheduled fn if it hasn't already executed."
   ([sched-fn] (at-at/cancel sched-fn))
   ([sched-fn cancel-immediately?] (at-at/cancel sched-fn cancel-immediately?)))

-; Recursion in Time
-;   By passing a function using #'foo syntax instead of just foo, when later
-; called by the scheduler it will lookup based on the symbol rather than using
-; the instance of the function defined earlier.
-; (apply-at (+ dur (now)) #'my-melody arg1 arg2 [])
-
 (def ^{:dynamic true} *apply-ahead* 300)

 (defn apply-at
-  "Calls (apply f args argseq) *apply-ahead* ms before ms-time."
+  "Recursion in Time. Calls (apply f args argseq) *apply-ahead* ms before
+  ms-time.
+
+  By passing a function using #'foo syntax instead of just foo, when later
+  called by the scheduler it will lookup based on the symbol rather than using
+  the instance of the function defined earlier.
+
+  (apply-at (+ dur (now)) #'my-melody arg1 arg2 [])"
   {:arglists '([ms-time f args* argseq])}
   [#^clojure.lang.IFn ms-time f & args]
   (let [delay-time (- ms-time *apply-ahead* (now))]


spacing fixes

spacing fixes

--- src/qu/query/validation.clj
+++ src/qu/query/validation.clj
@@ -133,16 +133,16 @@
 (defn- validate-integer
   [query clause]
   (let [val (clause query)]
-     (if (integer? val)
-       query
-        (try
-          (let [_ (cond   ;begin first statement in try
-                   (integer? val) val
-                    (nil? val) 0
-                    :default (Integer/parseInt val))]
-            query)
-          (catch NumberFormatException e;
-           (add-error query clause "Please use an integer."))))))
+    (if (integer? val)
+      query
+      (try
+        (let [_ (cond
+                 (integer? val) val
+                 (nil? val) 0
+                 :default (Integer/parseInt val))]
+          query)
+        (catch NumberFormatException e
+          (add-error query clause "Please use an integer."))))))

 (defn- validate-max-offset
   [query]


set en effort

set en effort

--- src/sandbox/multithread.clj
+++ src/sandbox/multithread.clj
@@ -57,3 +57,5 @@
 ;;=> else we pass result as is in the recursion
                (z/next loc))))))
 ;;=> and we recur with the next element.
+
+(def insts-effort {:heavy-op 10 :medium-op 5 :light-op 2 :lock 1 :unlock 1})


added link to own posts into navigation on the right side

--- src/statuses/views/main.clj
+++ src/statuses/views/main.clj
@@ -21,6 +21,8 @@
   (let [links ["Statuses" [{:url base :title "Everything"
                             :icon "icon-th-list"},
                            {:url (str base "?query=@" (user request)) :title "Mentions"
+                            :icon "icon-user"},
+                           {:url (str base "?author=" (user request)) :title "My posts"
                             :icon "icon-user"}],
                   "Feeds"    [{:url (str base "?format=atom") :title "Feed for everything"
                          :icon "icon-fire"},


add slurp guitar tab from web

add slurp guitar tab from web

--- ohack/src/ohack/core.clj
+++ ohack/src/ohack/core.clj
@@ -157,3 +157,7 @@

 ;; now we can play multiple notes at the same time
 (playguitar320 [[0 3, 3 0, 4 0, 5 3]])
+
+;; we're going to fetch the tab from
+;; http://tabs.ultimate-guitar.com/t/tracy_chapman/fast_car_ver8_tab.htm
+(def fast-car-html (slurp "http://tabs.ultimate-guitar.com/t/tracy_chapman/fast_car_ver8_tab.htm"))


Example

Example

--- example/src/example/core.clj
+++ example/src/example/core.clj
@@ -4,9 +4,15 @@
   (:require [clojure.contrib.logging :as log]))

 (defn- main-page [request]
-  (log/info "Hi there")
-  (json-str {:status "ok"
-	     :request (str request)}))
+  (let [session (.getSession (:servlet-request request))
+        old-val (.getAttribute session "testing")]
+    (.setAttribute session "testing" (str "blah " (:query-string request)))
+    (log/info "Hi there")
+    (json-str {:status "ok"
+               :old-val old-val
+               :new-val (.getAttribute session "testing")
+               :session (str (.getSession (:servlet-request request) true))
+               :request (str request)})))

 (defn- secure-page [request]
   (let [principal (.getUserPrincipal request)]
@@ -15,7 +21,7 @@
 		       "anonymous"
 		       (.getName principal))})))

-
+
 (defroutes example-routes
   (ANY "/example/user/*" request
        (secure-page (:servlet-request request)))


Less intermediate objects when converting results. - ByteBuffers already duplicate()’d by compose().

--- systems/cassandra-node/src/containium/systems/cassandra/embedded12.clj
+++ systems/cassandra-node/src/containium/systems/cassandra/embedded12.clj
@@ -40,19 +40,13 @@
     nil))

-(defn- postprocess-row
-  [keywordize? row]
-  (reduce (fn [m [k v]]
-            (assoc m
-              (if keywordize? (keyword k) k)
-              (condp instance? v
-                Map (into {} v)
-                Set (into #{} v)
-                List (seq v)
-                ByteBuffer (.slice v)
-                v)))
-          {}
-          row))
+(defn- clojurify
+  [v]
+  (condp instance? v
+    Map  (into  {} v)
+    Set  (into #{} v)
+    List (seq v)
+    v))

 (defn- decode-resultset
@@ -62,8 +56,8 @@
       (->> (for [[^ColumnSpecification meta ^ByteBuffer column] (zipmap metas row)
                  :let [^AbstractType type (.type meta)
                        ^String name (.. meta name toString)]]
-             [name (.compose type column)])
-           (postprocess-row keywordize?)))))
+             [(if keywordize? (keyword name) #_else name) (clojurify (.compose type column))])
+           (into {})))))

 (defprotocol Encode


Don't reinvent Reagent's excellent render batching

--- src/asciinema/player/core.cljs
+++ src/asciinema/player/core.cljs
@@ -248,25 +248,12 @@
   events. Updates Reagent atom with the result of event handler."
   [player-atom]
   (let [events-ch (:events-ch @player-atom)
-        time-ch (chan (sliding-buffer 1))
         mouse-moves-ch (chan (dropping-buffer 1))
-        user-activity-ch (activity-chan mouse-moves-ch 3000)
-        final-ch (chan 1000)
-        screen-event (atom nil)]
+        user-activity-ch (activity-chan mouse-moves-ch 3000)]
     (go-loop []
-      (let [[[event-name & _ :as event] c] (alts! [events-ch final-ch time-ch])]
-        (if (= c events-ch)
-          (condp = event-name
-            :screen (if @screen-event
-                      (reset! screen-event event)
-                      (do
-                        (reset! screen-event event)
-                        (raf/request-animation-frame (fn []
-                                                       (put! final-ch @screen-event)
-                                                       (reset! screen-event nil)))))
-            :time (>! time-ch event)
-            :mouse-move (>! mouse-moves-ch true)
-            (>! final-ch event))
+      (let [[event-name & _ :as event] (<! events-ch)]
+        (condp = event-name
+          :mouse-move (>! mouse-moves-ch true)
           (swap! player-atom process-event event)))
       (recur))
     (go-loop []


move {:slash true/false} down to :synsem

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -348,8 +348,8 @@
                 unmodified
                 root-is-head
                 {:rule "sentence-nonphrasal-head"
-                 :slash false
-                 :synsem {:cat :verb}
+                 :synsem {:cat :verb
+                          :slash false}
                  :head {:phrasal false
                         :slash false
                         :synsem {:participle false}}})
@@ -357,16 +357,16 @@
                 unmodified
                 root-is-head-root
                 {:head {:phrasal true
-                        :slash false}
-                 :slash false
+                        :synsem {:slash false}}
                  :rule "sentence-phrasal-head"
-                 :synsem {:cat :verb}})
+                 :synsem {:cat :verb
+                          :slash false}})

    (unify-check h21
                 root-is-head
                 {:rule "transitive-vp-nonphrasal-head"
-                 :slash false
                  :synsem {:aux false
+                          :slash false
                           :cat :verb}})
    (unify-check h21
                 root-is-head-root
@@ -385,8 +385,8 @@
                  :head {:phrasal false
                         :phrasal-verb true}
                  :synsem {:aux false
-                          :cat :verb}})
-
+                          :cat :verb
+                          :slash false}})
    (unify-check h10
                 {:head {:phrasal false
                         :synsem {:cat :sent-modifier}}
@@ -408,9 +408,10 @@
                              :sem head-sem})]
       {:phrasal true
        :synsem {:cat cat
-                :sem head-sem
                 :mod {:first comp-sem
                       :rest head-mod}
+                :sem head-sem
+                :slash false
                 :subcat '()}
        :head {:rule "noun-phrase2"
               :phrasal true
@@ -427,8 +428,8 @@
           cat (atom :verb)
           second-arg (atom {:reflexive false})]
       {:phrasal true
-       :slash true
        :synsem {:cat cat
+                :slash true
                 :subcat {:1 second-arg
                          :2 '()}}
        :comp {:synsem first-arg}


whitespace

whitespace

--- src/babel/italiano/lexicon.clj
+++ src/babel/italiano/lexicon.clj
@@ -35,7 +35,6 @@
              :sem {:pred :in}
              :subcat {:1 {:cat :noun
                           :sem {:city true}}}}}
-

        ;; e.g. "a ridere": tu hai fatto bene a ridere (you did well to laugh)"
        (let [complement-semantics (ref {:pred :a
@@ -289,7 +288,6 @@
                        :activity false
                        :discrete false
                        :subj {:human true}}}})
-

       ;; 3. "avere" that takes a transitive verb: e.g. "io l'ho vista (i saw her)"
       (let [agr-of-obj-of-main-verb (ref :top)]


Updates auth pages to use new patrec functions.

--- src/cadence/views/training.clj
+++ src/cadence/views/training.clj
@@ -99,31 +99,36 @@

 (defpage auth "/user/auth" {:keys [as-user]}
   (common/layout
-    (let [phrase (:phrase (model/get-phrase (:_id (model/get-auth)) true))]
+    (let [phrase-doc (model/get-phrase (:_id (model/get-auth)) true)
+          phrase (:phrase phrase-doc)]
+      (sess/put! :auth-phrase phrase-doc)
       (html
-        [:div.page-header [:h1 "Authencticate"]]
+        [:div.page-header [:h1 "Authenticate"]]
         [:p "If you don't know what this is for please checkout the "
          (link-to "/#authentication" "blurb on the front page") "."]
+        [:h3 "Authenticating as " (or as-user "yourself")]
         [:div#auth_well.well.container-fluid
-         [:h3 "Authenticating as " (or as-user "yourself")]
          (common/phrase-fields "authenticate" phrase)
          [:div#feedback.row-fluid]]))))

 (defpage auth-check [:post "/user/auth"] {:as unkeyed-cadence}
    (let [cadence (keywordize-keys unkeyed-cadence)]
      (if (is-valid/cadence? cadence true)
-       (if (patrec/cadence-matches? (model/get-classifier
-                                      (:_id (model/get-auth))
-                                      (:phrase cadence))
-                                    cadence)
+       (let [classifier (model/get-classifier (:_id (model/get-auth))
+                                              (:phrase cadence))
+             result (patrec/classify-cadence classifier cadence)
+             legit (= result 1.0)
+             evaluation (patrec/evaluate-classifier classifier)
+             error-rate (:error-rate evaluation)]
          (resp/json {:success true
-                     :conclusive true
-                     :legit true})
-         (resp/json {:sucess true
-                     :conclusive true
-                     :legit false}))
+                     :result result
+                     :legit legit
+                     :evaluation (select-keys evaluation [:error-rate :precision])
+                     :conclusive (< error-rate 0.11)
+                     }))
        (resp/json {:success false
                    :conclusive false
+                   :errors (vali/get-errors :cadence)
                    :legit false}))))

 (defpage auth-as [:get "/user/auth/as/:crypt-user-id"


Add missing logging to new implementation

--- src/clj_gatling/simulation.clj
+++ src/clj_gatling/simulation.clj
@@ -140,7 +140,9 @@
           (>! result-channel (conj results result))
           (recur (rest r) (conj results result)))))))

-(defn run-scenario-version2 [concurrency number-of-requests timeout scenario]
+(defn run-scenario-version2 [runner concurrency number-of-requests timeout scenario]
+  (println (str "Running scenario " (:name scenario) " with " concurrency " concurrency and
+            " (runner-info runner) "."))
   (let [cs       (repeatedly concurrency async/chan)
         ps       (map vector (iterate inc 0) cs)
         results  (async/chan)
@@ -160,11 +162,11 @@
           (recur (inc i)))))
     (repeatedly number-of-requests #(<!! results))))

-(defn run-scenarios-version2 [concurrency number-of-requests timeout scenarios]
+(defn run-scenarios-version2 [runner concurrency number-of-requests timeout scenarios]
   (let [results (async/chan)]
     (go-loop [s scenarios]
       (>! results
-          (run-scenario-version2 concurrency number-of-requests timeout (first scenarios)))
+          (run-scenario-version2 runner concurrency number-of-requests timeout (first scenarios)))
       (when-not (empty? (rest s))
         (recur (rest s))))
   (apply concat (repeatedly (count scenarios) #(<!! results)))))
@@ -172,11 +174,14 @@
 (defn run-simulation [scenarios users & [options]]
   (let [requests (or (:requests options) users)
         duration (:duration options)
-        step-timeout (or (:timeout-in-ms options) 5000)]
+        step-timeout (or (:timeout-in-ms options) 5000)
+        runner (if (nil? duration)
+                 (FixedRequestNumberRunner. requests)
+                 (DurationRunner. duration))]
         ; TODO The new implementation utilizes core.async better and it can generate
         ;      more load. However, it currently does not support running duration option
         (if (nil? duration)
-          (run-scenarios-version2 users requests step-timeout scenarios)
+          (run-scenarios-version2 runner users requests step-timeout scenarios)
           (let [scenario-runner (partial run-nth-scenario-with-multiple-users scenarios users step-timeout requests duration)
                 results (run-parallel-and-collect-results scenario-runner (count scenarios))]
                 (flatten results)))))


Revert "old core"

Revert "old core"

This reverts commit cb395a45e28f684fe8bfb39ad8031d8be28c696c.

--- src/clj_hypergraph_db/core.clj
+++ src/clj_hypergraph_db/core.clj
@@ -77,7 +77,28 @@
                   extent-config (evaluate extent-config-namespace extent-config-file)
                   extent-model (apply-resolved-function "create-model" extent-model-namespace extent-config input-model)]
               (apply-resolved-function "load-input-data" extent-persistance-namespace extent-model input-access)))))
-
+      ;(doseq [[assocaition-name association] (:associations @model)]
+      ;  (println "######" assocaition-name)
+      ;  (let [assoc-iterator (iterator-create :association assocaition-name)
+      ;        assoc-instance (atom (iterator-next assoc-iterator))]
+      ;    (while @assoc-instance
+      ;      (doseq [role-name (keys (:roles association))]
+      ;        (println "###" role-name)
+      ;        (doseq [role-instance (get-instance-extensions @assoc-instance role-name)]
+      ;          (println role-instance)))
+      ;      (reset! assoc-instance (iterator-next assoc-iterator)))))
+      ;(println)
+      ;(println)
+      ;(println)
+      ;(let [class-iterator (iterator-create :class :UserDomain)
+      ;      class-instance (atom (iterator-next class-iterator))]
+      ;  (while @class-instance
+      ;    (println "######")
+      ;    (doseq [attribute-name (keys (:attributes (:UserDomain (:classes @model))))]
+      ;      (println "###" attribute-name)
+      ;      (doseq [ext (get-instance-exten )])
+      ;        )
+      ;    (reset! class-instance (iterator-next class-iterator))))
       (doseq [output-token (find-all-items-by-type run-config :output)]
         (let [output-config-file (read-string (str "(" (slurp (:filename output-token)) ")"))
               output-type (second (first output-config-file))


RR: color for calculate field on map

RR: color for calculate field on map

--- src/cljs/hatti/map/viewby.cljs
+++ src/cljs/hatti/map/viewby.cljs
@@ -67,6 +67,7 @@
                            qualitative-palette
                            (repeat "#f30"))
    (f/numeric? field)    sequential-palette
+   (f/calculate? field)  sequential-palette
    (f/time-based? field) sequential-palette
    (f/select-all? field) (repeat "#f30")))


remove dead code

remove dead code

--- src/cljs/lambdacd/ui_core.cljs
+++ src/cljs/lambdacd/ui_core.cljs
@@ -63,11 +63,7 @@
 (defn wired-current-build-component [build-state-atom build-number step-id-to-display-atom]
   (current-build-component build-state-atom build-number step-id-to-display-atom pipeline/pipeline-component output/output-component current-build-header-component))

-(defn header []
-  [:div
-   [:h1 "LambdaCD"]])
-
-(defn root [build-number-atom step-id-to-display-atom history state connection-state history-component current-build-component header-component]
+(defn root [build-number-atom step-id-to-display-atom history state connection-state history-component current-build-component]
   (let [build-number @build-number-atom
         container-classes (if (= @connection-state :lost)
                             ["app" "l-horizontal" "app--connection-lost"]
@@ -89,6 +85,6 @@
     (poll-state build-number-atom)
     (route/hook-browser-navigation! state-atom)
     ; #' is necessary so that fighweel can update: https://github.com/reagent-project/reagent/issues/94
-    (reagent/render-component [#'root build-number-atom step-id-to-display-atom history-atom state-atom connection-state history/build-history-component wired-current-build-component header] (.getElementById js/document "app"))))
+    (reagent/render-component [#'root build-number-atom step-id-to-display-atom history-atom state-atom connection-state history/build-history-component wired-current-build-component] (.getElementById js/document "app"))))


More consistent retrieved data format.

More consistent retrieved data format.

--- src/cljs/town_client/data.cljs
+++ src/cljs/town_client/data.cljs
@@ -3,63 +3,51 @@
    [goog.net.XhrIo]
    [goog.net.XhrIoPool]
    [town-client.util :refer [log]]
+   [town-client.ajax :as ajax]
    [town-client.config :as config]
    [cemerick.url :refer [url url-encode map->query]]
    [cljs.core.async :as async
     :refer [<! >! chan close! sliding-buffer put! alts! timeout]])
   (:require-macros [cljs.core.async.macros :as m :refer [go alt!]]))

-(defn parse-response
-  []
-  nil)
-
-(def pool
-  (goog.net.XhrIoPool. #js{"Accept" "application/json"}))
-
-(defn get-xhrio [callback]
-  (.getObject pool))
+(defn to-clj [value]
+  (map #(js->clj % {:keywordize-keys true}) value))

 (defn feed-channel [channel type path]
   (fn [reply-value]
-    (let [response (.-target reply-value)
-          object   (.getResponseJson response)
-          message  {:resource-type (keyword type)}
-          results (cond
-                   (aget object "results") (.-results object)
-                   (array? object) object
-                   true nil)]
+    (let [res-type (keyword type)
+          object (.getResponseJson (.-target reply-value))
+          value (if (array? object)
+                  (js->clj object)
+                  [object])]
       (put! channel
-            (if results
-              (assoc message :results
-                     (map (fn [o] (js->clj o {:keywordize-keys true}))
-                          (js->clj results)))
-              (if (= type "answers")
-                object ; google maps excepts an object
-                (merge message
-                       (js->clj object {:keywordize-keys true}))))))))
+            (assoc {:resource-type res-type}
+              :results
+              (if (= res-type :answers)
+                object
+                (to-clj value)))))))

 (defn api-url [type params path-elements]
-  (let [defaults    {:page_size 100}
+  (let [defaults {:page_size 100}
         real-params (merge defaults params)
-        url-string  (str config/url-base type "/"
+        url-string (str config/url-base type "/"
                         (if (not-empty path-elements)
                           (clojure.string/join "/" path-elements))
-                        (if (not-empty real-params) "?"))
-        url         (str url-string (map->query real-params))]
-    (print (str "Fetching " url "\n"))
+                        (if (not-empty real-params)
+                          "?"))
+        url (str url-string (map->query real-params))]
     url))

 (defn get-data [type params path-elements callback]
   (.send goog.net.XhrIo
          (api-url type params path-elements)
-         callback "GET" nil
-         ))
+         callback "GET" nil))

 (defn fetch-data [channel type params & path-elements]
   (get-data type params path-elements
    (feed-channel channel type path-elements)))

-(comment
+#_(
   ; REPL interaction
   (def result (atom {:value nil :error nil :orig nil}))
   (defn jkeys [o] (.keys js/Object o))
@@ -69,4 +57,5 @@
     (swap! result assoc :orig response))
   (get-data "respondents" {:neighborhood 370} nil parse)
   (get-data "rrgoijespondents" {:neighborhood 370} nil parse)
+  (ajax/make-request (api-url "respondents" {:neighborhood 370} nil))
   )


Removed navigation side bar.

Removed navigation side bar.

--- src/cornwalltechjam/layout.clj
+++ src/cornwalltechjam/layout.clj
@@ -134,9 +134,7 @@
           [:span {} "Reason"]]]
         "<!-- navbar-header -->"
         "<!-- Collect the nav links, forms, and other content for toggling -->"
-        [:div {:class "pull-right"}
-         [:a {:href "javascript:void(0);", :class "sb-icon-navbar sb-toggle-right"}
-          [:i {:class "fa fa-bars"}]]]
+
         [:div {:class "collapse navbar-collapse", :id "bs-example-navbar-collapse-1"}
          [:ul {:class "nav navbar-nav"}

@@ -220,32 +218,7 @@

-     [:div {:class "sb-slidebar sb-right"}
-      [:div {:class "input-group"}
-       [:input {:type "text", :class "form-control", :placeholder "Search..."}]
-       [:span {:class "input-group-btn"}
-        [:button {:class "btn btn-default", :type "button"} [:i {:class "fa fa-search"}]]]]
-
-      [:h2 {:class "slidebar-header no-margin-bottom"} "Navigation"]
-      [:ul {:class "slidebar-menu"}
-       [:li {} [:a {:href "index.html"} "Home"]]
-       [:li {} [:a {:href "portfolio_topbar.html"} "Portfolio"]]
-       [:li {} [:a {:href "page_about3.html"} "About us"]]
-       [:li {} [:a {:href "blog.html"} "Blog"]]
-       [:li {} [:a {:href "page_contact.html"} "Contact"]] ]
-
-      [:h2 {:class "slidebar-header"} "Social Media"]
-      [:div {:class "slidebar-social-icons"}
-       [:a {:href "#", :class "social-icon-ar rss"} [:i {:class "fa fa-rss"}]]
-       [:a {:href "#", :class "social-icon-ar facebook"} [:i {:class "fa fa-facebook"}]]
-       [:a {:href "#", :class "social-icon-ar twitter"} [:i {:class "fa fa-twitter"}]]
-       [:a {:href "#", :class "social-icon-ar pinterest"} [:i {:class "fa fa-pinterest"}]]
-       [:a {:href "#", :class "social-icon-ar instagram"} [:i {:class "fa fa-instagram"}]]
-       [:a {:href "#", :class "social-icon-ar wordpress"} [:i {:class "fa fa-wordpress"}]]
-       [:a {:href "#", :class "social-icon-ar linkedin"} [:i {:class "fa fa-linkedin"}]]
-       [:a {:href "#", :class "social-icon-ar flickr"} [:i {:class "fa fa-flickr"}]]
-       [:a {:href "#", :class "social-icon-ar vine"} [:i {:class "fa fa-vine"}]]
-       [:a {:href "#", :class "social-icon-ar dribbble"} [:i {:class "fa fa-dribbble"}]]]]
+

      [:div {:id "back-top"}  [:a {:href "#header"} [:i {:class "fa fa-chevron-up"}]]]


Clean up.

Clean up.

--- test/lein_xjc/t_plugin.clj
+++ test/lein_xjc/t_plugin.clj
@@ -6,27 +6,16 @@
             [midje.sweet :refer :all])
   (:import [com.sun.tools.xjc Driver]))

-(def base-project {:name "base-project"
-                   :group "A (non-existent) sample project used for testing"
-                   :version "0.1.0-SNAPSHOT"
-                   :target-path "/path/to/missing/directory/target"
-                   :root "/path/to/missing/directory"
-                   :java-source-paths ["src/main/java"]})
-
-(defn merge-project-snippet
-  [snippet & snippets]
-  (merge base-project snippet snippets))
-
 (facts "about xjc-task"
-       (fact "Given no plugin config creates a 'generated-java' directory inside
-             the project's target directory."
-             (let [project (merge-project-snippet {})
-                   project-root (:root project)
-                   target-path (:target-path project)
-                   generated-java "generated-java"]
+       (fact "It creates a generated-java directory"
+             (let [project {:root ..project-root..
+                            :target-path ..target-path..
+                            :xjc-plugin {:generated-java ..generated-java..}}]
                (plugin/xjc-task project) => irrelevant
                (provided
-                 (td/mk-xjc-target-dir project-root target-path generated-java)
+                 (td/mk-xjc-target-dir ..project-root..
+                                       ..target-path..
+                                       ..generated-java..)
                  => ..xjc-target-dir..)))

        (fact "xjc-task calls xjc for each xsd file"


working on add for binary tree

working on add for binary tree

--- sample/src/sample/btree.clj
+++ sample/src/sample/btree.clj
@@ -4,18 +4,18 @@

 (defprotocol TreeModify
-  (add [this v]))
+  (add [this k v root]))

 (defprotocol TreeSearch
   (search [this k]))

-(defrecord BinaryTree [key-fn l r]
+(defrecord BinaryTree [k* v* l r]

   TreeModify

-  (add [this v]
+  (add [this k v root]
     )

   TreeSearch


Fix local notification permissions setting

--- src-cljs/frontend/components/account.cljs
+++ src-cljs/frontend/components/account.cljs
@@ -363,7 +363,7 @@
                      [:a {:href "javascript:void(0)"
                           :on-click #(notifications/request-permission
                                        (fn [response]
-                                         (when (= response "granted") (raise! owner [:set-web-notifications {:enabled? true :response response}]))))}
+                                         (when (= response "granted") (raise! owner [:set-web-notifications-permissions {:enabled? true :response response}]))))}
                       "click here to turn permissions on."]]
           nil)
         [:div.section
@@ -374,7 +374,7 @@
              {:name "web_notif_pref"
               :type "radio"
               :checked web-notifications-enabled?
-              :on-change #(raise! owner [:set-web-notifications {:enabled? true}])
+              :on-change #(raise! owner [:set-web-notifications-permissions {:enabled? true}])
               :disabled disabled?}]
             (when disabled? [:span [:i.material-icons.lock "lock" ] " "])
             [:span.label-contents " Show me notifications when a build finishes"]]]
@@ -384,7 +384,7 @@
              {:name "web_notif_pref"
               :type "radio"
               :checked (not web-notifications-enabled?)
-              :on-change #(raise! owner [:set-web-notifications {:enabled? false}])
+              :on-change #(raise! owner [:set-web-notifications-permissions {:enabled? false}])
               :disabled disabled?}]
             (when disabled? [:span [:i.material-icons.lock "lock" ] " "])
             [:span.label-contents " Don't show me notifications when a build finishes"]]]]]]


kosaraju:: fixed the iterative finishing-times func -- 3

--- src/clojure_learning/algorithms/strongly_connected_comps.clj
+++ src/clojure_learning/algorithms/strongly_connected_comps.clj
@@ -79,32 +79,34 @@
 (non-visited [1 2] #{1}) ;; (2)
 (non-visited [1 2] #{1 2}) ;; nil
 (non-visited [8] #{7 8}) ;; nil
-(non-visited (adjacents-of 8 a-graph) (clojure.set/union #{6 7} (set '(7 8))))
-(non-visited '(6 8) (set '(8)))
-(reduce (fn [rems rem] (cons rem rems)) '(8) [7])

 (defn dfs->adj-finishings-iterative
-  [[head-vertex & tail-vertices :as vertices] remainings finishings visited graph]
-  (if (and (nil? head-vertex) (empty? remainings))
-    finishings;; finishing-time-acc
-    (if (nil? head-vertex)
-      (recur [(first remainings)] (rest remainings) finishings visited graph)
-      (if (visited head-vertex)
-        (recur tail-vertices remainings finishings visited graph)
-        (if-let [not-visited (non-visited
-                               (adjacents-of head-vertex graph)
-                               (clojure.set/union visited (set remainings)))]
-          (recur not-visited
-             (reduce #(cons %2 %1) remainings (reverse vertices)) ;; cons -> 1st
-             finishings
-             visited
-             graph)
-          (recur tail-vertices
-                 remainings
-                 (conj finishings head-vertex)
-                 (conj visited head-vertex)
-                 graph))))))
-
+   [[head-vertex & tail-vertices :as vertices]
+    [head-rem & tail-rems :as remainings]
+    finishings
+    visited
+    graph]
+   (if (and (nil? head-vertex) (empty? remainings))
+     finishings;; finishing-time-acc
+     (if (nil? head-vertex)
+       (recur [head-rem] tail-rems finishings visited graph)
+       (if (visited head-vertex)
+         (recur tail-vertices remainings finishings visited graph)
+         (if-let [not-visited (non-visited
+                                (adjacents-of head-vertex graph)
+                                (clojure.set/union visited (set remainings)))]
+           (recur not-visited
+              (reduce #(cons %2 %1) remainings (reverse vertices)) ;; cons -> 1st
+              ;; (lazy-cat vertices remainings)
+              finishings
+              visited
+              graph)
+           (recur tail-vertices
+                  remainings
+                  (conj finishings head-vertex)
+                  (conj visited head-vertex)
+                  graph)
+   )))))

 (def a-graph
   (-> "src/clojure_learning/algorithms/sample-1.txt"
@@ -362,7 +364,4 @@
          (map count
              (find-strongly-connected
                "src/clojure_learning/algorithms/kosaraju-course-file.txt"))))))
-;; "Elapsed time: 51337.885541 msecs":: (152 126 114 108 97)
-
-(clojure.set/union #{1 2} [3])
-(remove (clojure.set/union #{1 2} (cons 3 nil)) [1 2])
+;; "Elapsed time: 51337.885541 msecs":: (152 126 114 108 97)


Define a constant for the channel sizes

Define a constant for the channel sizes

--- src/leiningen/new/onyx_app/src/onyx_app/tasks/core_async.clj
+++ src/leiningen/new/onyx_app/src/onyx_app/tasks/core_async.clj
@@ -7,22 +7,24 @@

 (def channels (atom {}))

+(def default-channel-size 1000)
+
 (defn get-channel
   ([id] (get-channel id nil))
   ([id size]
    (if-let [id (get @channels id)]
      id
-     (do (swap! channels assoc id (chan (or size 1000)))
+     (do (swap! channels assoc id (chan (or size default-channel-size)))
          (get-channel id)))))

 (defn inject-in-ch
   [_ lifecycle]
   {:core.async/chan (get-channel (:core.async/id lifecycle)
-                                 (or (:core.async/size lifecycle) 1000))})
+                                 (or (:core.async/size lifecycle) default-channel-size))})
 (defn inject-out-ch
   [_ lifecycle]
   {:core.async/chan (get-channel (:core.async/id lifecycle)
-                                 (or (:core.async/size lifecycle) 1000))})
+                                 (or (:core.async/size lifecycle) default-channel-size))})

 (def in-calls
   {:lifecycle/before-task-start inject-in-ch})
@@ -40,7 +42,7 @@

 (defn add-core-async-input
-  ([job task opts] (add-core-async-input job task opts 1000))
+  ([job task opts] (add-core-async-input job task opts default-channel-size))
   ([job task opts chan-size]
    (-> job
        (update :catalog conj (merge {:onyx/name task
@@ -59,7 +61,7 @@
                                   :lifecycle/calls :onyx.plugin.core-async/reader-calls}]))))

 (defn add-core-async-output
-  ([job task opts] (add-core-async-output job task opts 1000))
+  ([job task opts] (add-core-async-output job task opts default-channel-size))
   ([job task opts chan-size]
    (-> job
        (update :catalog conj (merge {:onyx/name task


CMR-3281 removes some commented code

CMR-3281 removes some commented code

--- access-control-app/src/cmr/access_control/data/access_control_index.clj
+++ access-control-app/src/cmr/access_control/data/access_control_index.clj
@@ -255,9 +255,6 @@
      :permitted-group.lowercase (str/lower-case gid)
      :permission permissions
      :permission.lowercase (map str/lower-case permissions)}))
-
-; (access-value-elastic-doc-map {:catalog-item-identity {:granule-identifier {:access-value {:min-value 1 :max-value 2}}}})
-; (access-value-elastic-doc-map {:catalog-item-identity {:collection-identifier {:access-value {:min-value 1 :max-value 2}}}})

 (defn- access-value-elastic-doc-map
   "Returns map for access value to be merged into full elasic doc"


Use context request for PUT source

Use context request for PUT source

--- src/lcmap/aardvark/landsat.clj
+++ src/lcmap/aardvark/landsat.clj
@@ -132,7 +132,7 @@
      (GET    "/" [] {:body nil})
      (ANY    "/" [] (allow "GET"))
      (GET    "/source/:source-id" [source-id] (get-source source-id))
-     (PUT    "/source/:source-id" [source-id :as req] (put-source source-id request))
+     (PUT    "/source/:source-id" [source-id] (put-source source-id request))
      (GET    "/tiles" [] (get-tiles request))
      (GET    "/tile-spec" [] (get-tile-specs))
      (POST   "/tile-spec" [] (post-tile-spec request))


DRY bare and non-bare project definition

--- src/leiningen/new/onyx_app.clj
+++ src/leiningen/new/onyx_app.clj
@@ -6,78 +6,49 @@

 (defn onyx-app
   "Creates a new Onyx application template"
-  ([name]
-     (let [path (name-to-path name)
-           data {:name name
-                 :app-name name
-                 :sanitized path}]
-       (main/info "Generating fresh Onyx app.")
-       (->files data
-                ["README.md" (render "README.md" data)]
-                [".gitignore" (render "gitignore" data)]
-                ["LICENSE" (render "LICENSE" data)]
-                ["project.clj" (render "project.clj" data)]
-                ["Dockerfile" (render "Dockerfile" data)]
-
-                [(str "script/run-" name ".sh") (render "run-app.sh" data)]
-                ["script/build.sh" (render "build.sh" data)]
-
-                ["env/dev/user.clj" (render "user.clj" data)]
-                [(str "env/dev/" path "/dev_inputs/sample_input.clj") (render "sample_input.clj" data)]
-
-                ["resources/env-config.edn" (render "env-config.edn" data)]
-                ["resources/dev-peer-config.edn" (render "dev-peer-config.edn" data)]
-                ["resources/prod-peer-config.edn" (render "prod-peer-config.edn" data)]
-
-                [(str "src/" path "/utils.clj") (render "utils.clj" data)]
-
-                [(str "src/" path "/launcher/dev_system.clj") (render "dev_system.clj" data)]
-                [(str "src/" path "/launcher/launch_prod_peers.clj") (render "launch_prod_peers.clj" data)]
-                [(str "src/" path "/launcher/submit_prod_sample_job.clj") (render "submit_prod_sample_job.clj" data)]
-                [(str "src/" path "/launcher/aeron_media_driver.clj") (render "aeron_media_driver.clj" data)]
-
-                [(str "src/" path "/workflows/sample_workflow.clj") (render "sample_workflow.clj" data)]
-                [(str "src/" path "/catalogs/sample_catalog.clj") (render "sample_catalog.clj" data)]
-                [(str "src/" path "/flow_conditions/sample_flow_conditions.clj") (render "sample_flow_conditions.clj" data)]
-                [(str "src/" path "/functions/sample_functions.clj") (render "sample_functions.clj" data)]
-                [(str "src/" path "/lifecycles/sample_lifecycle.clj") (render "sample_lifecycle.clj" data)]
-                [(str "src/" path "/plugins/http_reader.clj") (render "http_reader.clj" data)]
-                [(str "src/" path "/jobs/sample_submit_job.clj") (render "sample_submit_job.clj" data)]
-                [(str "test/" path "/jobs/sample_job_test.clj") (render "sample_job_test.clj" data)])))
-  ([name arg]
-     (if (= arg "bare")
-       (let [path (name-to-path name)
-             data {:name name
-                   :app-name name
-                   :sanitized path}]
-         (main/info "Generating a fresh Onyx app.")
-         (->files data
-                  ["README.md" (render "README-bare.md" data)]
-                  [".gitignore" (render "gitignore" data)]
-                  ["LICENSE" (render "LICENSE" data)]
-                  ["project.clj" (render "project.clj" data)]
-                  ["Dockerfile" (render "Dockerfile" data)]
-
-                  [(str "script/run-" name ".sh") (render "run-app.sh" data)]
-                  ["script/build.sh" (render "build.sh" data)]
-
-                  ["env/dev/user.clj" (render "user.clj" data)]
-                  [(str "env/dev/" path "/dev_inputs/.gitkeep") (render "gitkeep" data)]
-                  [(str "src/" path "/utils.clj") (render "utils.clj" data)]
-
-                  ["resources/env-config.edn" (render "env-config.edn" data)]
-                  ["resources/dev-peer-config.edn" (render "dev-peer-config.edn" data)]
-                  ["resources/prod-peer-config.edn" (render "prod-peer-config.edn" data)]
-
-                  [(str "src/" path "/launcher/dev_system.clj") (render "dev_system.clj" data)]
-                  [(str "src/" path "/launcher/launch_prod_peers.clj") (render "launch_prod_peers_bare.clj" data)]
-
-                  [(str "src/" path "/workflows/.gitkeep") (render "gitkeep" data)]
-                  [(str "src/" path "/catalogs/.gitkeep") (render "gitkeep" data)]
-                  [(str "src/" path "/flow_conditions/.gitkeep") (render "gitkeep" data)]
-                  [(str "src/" path "/functions/.gitkeep") (render "gitkeep" data)]
-                  [(str "src/" path "/lifecycles/.gitkeep") (render "gitkeep" data)]
-                  [(str "src/" path "/plugins/.gitkeep") (render "gitkeep" data)]
-
-                  [(str "test/" path "/jobs/.gitkeep") (render "gitkeep" data)]))
-       (println "Only argument allowed after app-name is 'bare'"))))
+  [name & [arg]]
+  (let [path (name-to-path name)
+        data {:name name
+              :app-name name
+              :sanitized path}
+        base-files [["README.md" (render "README.md" data)]
+                    [".gitignore" (render "gitignore" data)]
+                    ["LICENSE" (render "LICENSE" data)]
+                    ["project.clj" (render "project.clj" data)]
+                    ["Dockerfile" (render "Dockerfile" data)]
+                    [(str "script/run-container.sh") (render "run-container.sh" data)]
+                    [(str "script/run-peers.sh") (render "run-peers.sh" data)]
+                    ["script/build.sh" (render "build.sh" data)]
+                    ["env/dev/user.clj" (render "user.clj" data)]
+                    [(str "env/dev/" path "/dev_inputs/sample_input.clj") (render "sample_input.clj" data)]
+                    ["resources/env-config.edn" (render "env-config.edn" data)]
+                    ["resources/dev-peer-config.edn" (render "dev-peer-config.edn" data)]
+                    ["resources/prod-peer-config.edn" (render "prod-peer-config.edn" data)]
+                    [(str "src/" path "/utils.clj") (render "utils.clj" data)]
+                    [(str "src/" path "/launcher/dev_system.clj") (render "dev_system.clj" data)]
+                    [(str "src/" path "/launcher/aeron_media_driver.clj") (render "aeron_media_driver.clj" data)]]
+        sample-files [[(str "src/" path "/launcher/launch_prod_peers.clj") (render "launch_prod_peers.clj" data)]
+                      [(str "src/" path "/launcher/submit_prod_sample_job.clj") (render "submit_prod_sample_job.clj" data)]
+                      [(str "src/" path "/workflows/sample_workflow.clj") (render "sample_workflow.clj" data)]
+                      [(str "src/" path "/catalogs/sample_catalog.clj") (render "sample_catalog.clj" data)]
+                      [(str "src/" path "/flow_conditions/sample_flow_conditions.clj") (render "sample_flow_conditions.clj" data)]
+                      [(str "src/" path "/functions/sample_functions.clj") (render "sample_functions.clj" data)]
+                      [(str "src/" path "/lifecycles/sample_lifecycle.clj") (render "sample_lifecycle.clj" data)]
+                      [(str "src/" path "/plugins/http_reader.clj") (render "http_reader.clj" data)]
+                      [(str "src/" path "/jobs/sample_submit_job.clj") (render "sample_submit_job.clj" data)]
+                      [(str "test/" path "/jobs/sample_job_test.clj") (render "sample_job_test.clj" data)]]
+        bare-files [[(str "src/" path "/launcher/launch_prod_peers.clj") (render "launch_prod_peers_bare.clj" data)]
+                    [(str "env/dev/" path "/dev_inputs/.gitkeep") (render "gitkeep" data)]
+                    [(str "src/" path "/workflows/.gitkeep") (render "gitkeep" data)]
+                    [(str "src/" path "/catalogs/.gitkeep") (render "gitkeep" data)]
+                    [(str "src/" path "/flow_conditions/.gitkeep") (render "gitkeep" data)]
+                    [(str "src/" path "/functions/.gitkeep") (render "gitkeep" data)]
+                    [(str "src/" path "/lifecycles/.gitkeep") (render "gitkeep" data)]
+                    [(str "src/" path "/plugins/.gitkeep") (render "gitkeep" data)]
+                    [(str "test/" path "/jobs/.gitkeep") (render "gitkeep" data)]]]
+    (main/info "Generating fresh Onyx app.")
+    (apply ->files
+           data
+           (cond-> base-files
+             (nil? arg) (into sample-files)
+             (= arg "bare") (into bare-files)))))


Add badges to side-panel-tab

Add badges to side-panel-tab

--- src/cljs/gtfve/components/side_panel.cljs
+++ src/cljs/gtfve/components/side_panel.cljs
@@ -9,7 +9,7 @@
             [gtfve.utils :as utils])
   (:import [goog.events EventType]))

-(defn side-panel-tab [{:keys [key label tab]} owner]
+(defn side-panel-tab [{:keys [key label tab badge]} owner]
   (reify
     om/IDisplayName (display-name [_] "Side Panel Tab")
     om/IRender
@@ -18,7 +18,9 @@
              [:a {:href "#"
                   :onClick (fn [e]
                              (raise! owner [:side-panel-changed {:key key}])
-                             (.preventDefault e))} label]]))))
+                             (.preventDefault e))} label
+              (when (not (zero? badge))
+                [:span " " [:span.badge badge]])]]))))

 (defn ^:private tab-class [active? in?]
   (join " "


only show active-from when either set or in edit-mode

--- src/cljs/iwaswhere_web/ui/entry/task.cljs
+++ src/cljs/iwaswhere_web/ui/entry/task.cljs
@@ -20,11 +20,11 @@
                      (let [dt (js/moment (-> ev .-nativeEvent .-target .-value))
                            updated (assoc-in entry [:task k] (.valueOf dt))]
                        (put-fn [:entry/update-local updated]))))
-        active-from (fn [entry]
-                      (fn [ev]
-                        (let [dt (-> ev .-nativeEvent .-target .-value)
-                              updated (assoc-in entry [:task :active-from] dt)]
-                          (put-fn [:entry/update-local updated]))))
+        set-active-from (fn [entry]
+                          (fn [ev]
+                            (let [dt (-> ev .-nativeEvent .-target .-value)
+                                  updated (assoc-in entry [:task :active-from] dt)]
+                              (put-fn [:entry/update-local updated]))))
         follow-up-select
         (fn [entry]
           (fn [ev]
@@ -65,30 +65,33 @@
             [:option {:value :C} "C"]
             [:option {:value :D} "D"]
             [:option {:value :E} "E"]]]
-          [:div
-           [:label "Active from: "]
-           [:input {:type      :datetime-local
-                    :read-only (not edit-mode?)
-                    :on-input  (active-from entry)
-                    :value     (get-in entry [:task :active-from])}]]
+          (let [active-from (get-in entry [:task :active-from])]
+            (when (or edit-mode? active-from)
+              [:div
+               [:label "Active from: "]
+               [:input {:type      :datetime-local
+                        :read-only (not edit-mode?)
+                        :on-input  (set-active-from entry)
+                        :value     (or active-from "")}]]))
           (if-let [follow-up-scheduled (:follow-up-scheduled (:task entry))]
             [:div "Follow-up in " follow-up-scheduled]
-            [:div
-             [:span "Follow-up after "]
-             [:select {:value     (get-in entry [:task :follow-up-hrs] "")
-                       :on-change (follow-up-select entry)
-                       :disabled  (not edit-mode?)}
-              [:option ""]
-              [:option {:value 1} "1 hour"]
-              [:option {:value 3} "3 hours"]
-              [:option {:value 6} "6 hours"]
-              [:option {:value 12} "12 hours"]
-              [:option {:value 18} "18 hours"]
-              [:option {:value 24} "24 hours"]
-              [:option {:value 48} "48 hours"]
-              [:option {:value 72} "3 days"]
-              [:option {:value 96} "4 days"]
-              [:option {:value 168} "1 week"]]])]]))))
+            (when edit-mode?
+              [:div
+               [:span "Follow-up after "]
+               [:select {:value     (get-in entry [:task :follow-up-hrs] "")
+                         :on-change (follow-up-select entry)
+                         :disabled  (not edit-mode?)}
+                [:option ""]
+                [:option {:value 1} "1 hour"]
+                [:option {:value 3} "3 hours"]
+                [:option {:value 6} "6 hours"]
+                [:option {:value 12} "12 hours"]
+                [:option {:value 18} "18 hours"]
+                [:option {:value 24} "24 hours"]
+                [:option {:value 48} "48 hours"]
+                [:option {:value 72} "3 days"]
+                [:option {:value 96} "4 days"]
+                [:option {:value 168} "1 week"]]]))]]))))

 (defn next-habit-entry
   "Generate next habit entry, as appropriate at the time of calling.


fix markdown editor

fix markdown editor

--- src/cljs/salava/badge/ui/endorsement.cljs
+++ src/cljs/salava/badge/ui/endorsement.cljs
@@ -170,7 +170,7 @@

     (js/setTimeout (fn [] (.value editor @value)) 200) ;;delay for editor to load
     (set! (.-onclick js/document) (fn [] (js/setTimeout (fn [] (.value editor @value)) 1))) ;refresh editor value
-    (.codemirror.on editor "mousedown" (fn [] (.value editor @value)))
+    ;(.codemirror.on editor "mousedown" (fn [] (.value editor @value)))
     (.codemirror.on editor "change" (fn [] (reset! value (.value editor))))))

 (defn markdown-editor [value]
@@ -180,7 +180,7 @@
                                     [:textarea {:class "form-control"
                                                 :id (str "editor" (-> (session/get :user) :id))
                                                 :value @value
-                                                :on-change #(reset! value (.-target.value %))
+                                                ;:on-change #(reset! value (.-target.value %))
                                                 }]]) }))

 (defn process-text [s state]


CMR-511: Refactored code.

CMR-511: Refactored code.

--- src/cmr/bootstrap/data/bulk_migration.clj
+++ src/cmr/bootstrap/data/bulk_migration.clj
@@ -30,6 +30,16 @@
   [provider-id]
   (keyword (str (catalog-rest-tablespace) "." provider-id "-dataset-records")))

+(defn catalog-rest-granule-table
+  "Get the granule table name for a given provider."
+  [provider-id]
+  (keyword (str (catalog-rest-tablespace) "." provider-id "-granule-records")))
+
+(defn metadata-db-concept-table
+  "Get the collection/granule table name for a given provider."
+  [provider-id concept-type]
+  (keyword (str (metadata-db-tablespace) "." (tables/get-table-name provider-id concept-type))))
+
 (defn create-provider-url
   []
   (format "%s/providers" (metadata-db-url)))
@@ -109,15 +119,9 @@
   "Generate SQL to copy the dataset/collection data from the catalog rest database to the
   metadata db for the given provider for all the provider's collections or a single collection."
   ([provider-id] (copy-collection-data-sql provider-id nil))
-  ([provider-id  collection-id] (let [dataset-table (keyword (str (catalog-rest-tablespace)
-                                                                  "."
-                                                                  provider-id
-                                                                  "-dataset-records"))
-                                      collection-table (keyword (str (metadata-db-tablespace)
-                                                                     "."
-                                                                     provider-id
-                                                                     "-collections"))
-                                      collection-id (first collection-id)]
+  ([provider-id  collection-id] (let [dataset-table (catalog-rest-dataset-table provider-id)
+                                      collection-table (metadata-db-concept-table provider-id
+                                                                                :collection)]
                                   (su/build (insert collection-table [:concept-id
                                                                       :native-id
                                                                       :metadata
@@ -140,18 +144,17 @@
 (defn- copy-collection-data
   "Copy the dataset/collection data from the catalog rest database to the metadata db
   for the given provider."
-  [db provider-id & collection-id]
-  (info "Copying collection data for provider" provider-id)
-  (j/with-db-transaction
-    [conn db]
-    (j/execute! conn (copy-collection-data-sql provider-id collection-id))))
+  ([db provider-id] (copy-collection-data db provider-id nil))
+  ([db provider-id collection-id] (info "Copying collection data for provider" provider-id)
+   (j/with-db-transaction
+     [conn db]
+     (j/execute! conn (copy-collection-data-sql provider-id collection-id)))))

 (defn- copy-granule-data-for-collection-sql
   "Generate the SQL to copy the granule data from the catalog reset datbase to the metadata db."
   [provider-id collection-id dataset-record-id]
-  (let [granule-echo-table (keyword (str (catalog-rest-tablespace) "." provider-id "-granule-records"))
-        granule-mdb-table (keyword (str (metadata-db-tablespace) "." provider-id "-granules"))
-        sequence (keyword (str (metadata-db-tablespace) ".concept_id_seq.NEXTVAL"))]
+  (let [granule-echo-table (catalog-rest-granule-table provider-id)
+        granule-mdb-table (metadata-db-concept-table provider-id :granule)]
     (su/build (insert granule-mdb-table [:concept-id
                                          :native-id
                                          :parent-collection-id
@@ -159,7 +162,7 @@
                                          :format]
                       (select [:echo-granule-id
                                :granule-ur
-                               `(concat ~collection-id "") ; don't know how else to select constant
+                               collection-id
                                :compressed-xml
                                :xml-mime-type]
                               (from granule-echo-table)
@@ -230,7 +233,7 @@
   (copy-provider (oc/create-db (oc/db-spec)) "FIX_PROV1")
   (copy-single-collection (oc/create-db (oc/db-spec)) "FIX_PROV1" "C1000000073-FIX_PROV1")
   (get-provider-collection-list-sql  "FIX_PROV1")
-  (copy-collection-data-sql "FIX_PROV1")
   (copy-granule-data-for-provider (oc/create-db (oc/db-spec)) "FIX_PROV1")
   (delete-collection-granules-sql "FIX_PROV1" "C1000000073-FIX_PROV1")
+  (metadata-db-concept-table "FIX_PROV1" :collection)
   )


update qa url

update qa url

--- src/name_bazaar/ui/config.cljs
+++ src/name_bazaar/ui/config.cljs
@@ -26,7 +26,7 @@
    :fallback-web3-url "https://ropsten.infura.io/"
    :load-node-addresses? true
    :root-url "https://namebazaar.qa.district0x.io"
-   :server-url "qa_namebazaar-server:3000"})
+   :server-url "https://api.namebazaar.qa.district0x.io"})

 (def production-config
   {:logging {:level :warn