More renamings.

More renamings.

--- src/rewindable/ago.cljs
+++ src/rewindable/ago.cljs
@@ -14,16 +14,16 @@

 ; Persistent buffer implementation as an alternative to
 ; CLJS/core.async's default mutable RingBuffer.
-(deftype UverseBuf [uverse buf-id ^:mutable length]
+(deftype FifoQueue [ago-world buf-id ^:mutable length]
   Object
   (pop [_]
-    (when-let [x (last (get-in @uverse [:bufs buf-id]))]
-      (swap! uverse #(update-in % [:bufs buf-id] drop-last))
+    (when-let [x (last (get-in @ago-world [:bufs buf-id]))]
+      (swap! ago-world #(update-in % [:bufs buf-id] drop-last))
       (set! length (dec length))
       x))

   (unshift [_ x]
-    (swap! uverse #(update-in % [:bufs buf-id] conj x))
+    (swap! ago-world #(update-in % [:bufs buf-id] conj x))
     (set! length (inc length))
     nil)

@@ -33,18 +33,18 @@
   (resize [_] nil) ; From RingBuffer 'interface'.

   (cleanup [_ keep?]
-    (swap! uverse #(update-in % [:bufs buf-id] (fn [xs] (filter keep? xs))))
-    (set! length (count (get-in @uverse [:bufs buf-id])))))
+    (swap! ago-world #(update-in % [:bufs buf-id] (fn [xs] (filter keep? xs))))
+    (set! length (count (get-in @ago-world [:bufs buf-id])))))

-(defn uverse-buf [uverse]
-  (UverseBuf. uverse ((:gen-id @uverse)) 0))
+(defn fifo-queue [ago-world]
+  (FifoQueue. ago-world ((:gen-id @ago-world)) 0))

 ; --------------------------------------------------------

 (defn chan-buf [buf]
   (println :chan-buf buf)
-  (channels/ManyToManyChannel. (uverse-buf (make-ago-world)) 0
-                               (uverse-buf (make-ago-world)) 0
+  (channels/ManyToManyChannel. (fifo-queue (make-ago-world)) 0
+                               (fifo-queue (make-ago-world)) 0
                                buf false))

 (defn chan
@@ -61,22 +61,19 @@

 ; --------------------------------------------------------

-(defn sstate [state]
-  (println (rest state)))
-
 (defn ago-take [state blk ^not-native c]
-  (println :ago-take (sstate state) blk c)
+  (println :ago-take (rest state) blk c)
   (cljs.core.async.impl.ioc-helpers/take! state blk c))

 (defn ago-put [state blk ^not-native c val]
-  (println :ago-put (sstate state) blk c val)
+  (println :ago-put (rest state) blk c val)
   (cljs.core.async.impl.ioc-helpers/put! state blk c val))

 (defn ago-alts [state cont-block ports & rest]
-  (println :ago-alts (sstate state) cont-block ports rest)
+  (println :ago-alts (rest state) cont-block ports rest)
   (apply cljs.core.async.impl.ioc-helpers/ioc-alts! state cont-block ports rest))

 (defn ago-return-chan [state value]
-  (println :ago-return-chan (sstate state) value)
+  (println :ago-return-chan (rest state) value)
   (cljs.core.async.impl.ioc-helpers/return-chan state value))


add when statement

add when statement

--- src/clj/org/openforis/ceo/db/projects.clj
+++ src/clj/org/openforis/ceo/db/projects.clj
@@ -785,61 +785,62 @@
         (when-let [imagery-list (:projectImageryList params)]
           (call-sql "delete_project_imagery" project-id)
           (insert-project-imagery project-id imagery-list))
-        (cond
-          (or (not= plot-distribution (:plot_distribution original-project))
-              (if (#{"csv" "shp"} plot-distribution)
-                plot-file-base64
-                (or (not (same-polygon-boundary? (tc/jsonb->clj boundary) (tc/jsonb->clj (:boundary original-project))))
-                    (not= num-plots (:num_plots original-project))
-                    (not= plot-shape (:plot_shape original-project))
-                    (not= plot-size (:plot_size original-project))
-                    (not= plot-spacing (:plot_spacing original-project)))))
-          (do
-            (call-sql "delete_plots_by_project" project-id)
-            (when (#{"csv" "shp"} (:plot_distribution original-project))
-              (call-sql "delete_project_tables" project-id))
-            (create-project-plots project-id
-                                  lon-min
-                                  lat-min
-                                  lon-max
-                                  lat-max
-                                  plot-distribution
-                                  num-plots
-                                  plot-spacing
-                                  plot-shape
-                                  plot-size
-                                  sample-distribution
-                                  samples-per-plot
-                                  sample-resolution
-                                  plot-file-name
-                                  plot-file-base64
-                                  sample-file-name
-                                  sample-file-base64
-                                  allow-drawn-samples?))
-
-          (or (not= sample-distribution (:sample_distribution original-project))
-              (if (#{"csv" "shp"} sample-distribution)
-                sample-file-base64
-                (or (not= samples-per-plot (:samples_per_plot original-project))
-                    (not= sample-resolution (:sample_resolution original-project)))))
-          (do
-            (call-sql "delete_all_samples_by_project" project-id)
-            (when (#{"csv" "shp"} (:sample_distribution original-project))
-              (call-sql "delete_project_sample_table" project-id))
-            (recreate-samples project-id
-                              sample-distribution
-                              plot-shape
-                              plot-size
-                              samples-per-plot
-                              sample-resolution
-                              sample-file-name
-                              sample-file-base64))
+        (when (= "unpublished" (:availability original-project))
+          (cond
+            (or (not= plot-distribution (:plot_distribution original-project))
+                (if (#{"csv" "shp"} plot-distribution)
+                  plot-file-base64
+                  (or (not (same-polygon-boundary? (tc/jsonb->clj boundary) (tc/jsonb->clj (:boundary original-project))))
+                      (not= num-plots (:num_plots original-project))
+                      (not= plot-shape (:plot_shape original-project))
+                      (not= plot-size (:plot_size original-project))
+                      (not= plot-spacing (:plot_spacing original-project)))))
+            (do
+              (call-sql "delete_plots_by_project" project-id)
+              (when (#{"csv" "shp"} (:plot_distribution original-project))
+                (call-sql "delete_project_tables" project-id))
+              (create-project-plots project-id
+                                    lon-min
+                                    lat-min
+                                    lon-max
+                                    lat-max
+                                    plot-distribution
+                                    num-plots
+                                    plot-spacing
+                                    plot-shape
+                                    plot-size
+                                    sample-distribution
+                                    samples-per-plot
+                                    sample-resolution
+                                    plot-file-name
+                                    plot-file-base64
+                                    sample-file-name
+                                    sample-file-base64
+                                    allow-drawn-samples?))
+
+            (or (not= sample-distribution (:sample_distribution original-project))
+                (if (#{"csv" "shp"} sample-distribution)
+                  sample-file-base64
+                  (or (not= samples-per-plot (:samples_per_plot original-project))
+                      (not= sample-resolution (:sample_resolution original-project)))))
+            (do
+              (call-sql "delete_all_samples_by_project" project-id)
+              (when (#{"csv" "shp"} (:sample_distribution original-project))
+                (call-sql "delete_project_sample_table" project-id))
+              (recreate-samples project-id
+                                sample-distribution
+                                plot-shape
+                                plot-size
+                                samples-per-plot
+                                sample-resolution
+                                sample-file-name
+                                sample-file-base64))

           ;; NOTE: Old stored questions can have a different format than when passed from the UI.
           ;;       This is why we check whether the survey questions are different on the front (for now).
-          (or update-survey
-              (and (:allow_drawn_samples original-project) (not allow-drawn-samples?)))
-          (reset-collected-samples project-id))
+            (or update-survey
+                (and (:allow_drawn_samples original-project) (not allow-drawn-samples?)))
+            (reset-collected-samples project-id)))
         (data-response ""))
       (data-response (str "Project " project-id " not found.")))))


almost there

almost there

--- src/cljs/gointermod/heatmap/handlers.cljs
+++ src/cljs/gointermod/heatmap/handlers.cljs
@@ -4,41 +4,70 @@

 (defn make-key [organism result]
-;  (.log js/console "making key" (str organism "-" (get result 0) "-" (get result 15)))
   (keyword (str organism "-" (get result 7)))
   )

-(defn aggregate-row [organism result]
-  ; (.log js/console "new mappy result"  (clj->js {:results result
-  ;    :organism organism
-  ;    :go-term (get result 16)
-  ;    :ortholog (get result 0)}))
-  {:results result
-   :organism organism
-   :go-id (get result 16)
-   :count 1
-   :go-term (get result 15)
-   :ortholog (get result 7)})
-
 (defn merge-results [results go-branch]
   "merges results from all organisms into one big fat map, and filters out the other two go branches"
-  (filter (fn [result]
-    (= (last result) go-branch))
+  (filter
+    (fn [result]  (= (last result) go-branch))
     (apply concat (map (fn [[_ organism]]
-    (:results organism)
+      (:results organism)
   ) results))))

+(defn map-results [results]
+  "translate that silly vector of results into a map with meaninful keys"
+  ;;TODO: ortholog needs to be get-id with yeast conditionals. Boo.
+  (map (fn [result]
+    {:results result
+     :organism (get result 3)
+     :go-id (get result 15)
+     :go-term (get result 16)
+     :ortholog (get result 7)}
+  ) results))
+
+(defn extract-go-terms [results]
+  "just an ordered array of terms, thanks"
+  (distinct (into [] (map (fn [ result]
+      (:go-term result)
+  ) results))))
+
+(defn aggregate-orthologs [results]
+  "create map with keys organism>orthologue>go term, with counts as values for the heatmap."
+  (reduce (fn [new-map result]
+      (update-in new-map
+        [(:organism result)
+         (:ortholog result)
+         (:go-term result)] inc)
+    ) {} results)
+  )
+
+(defn map-terms [term-list organism-ortholog-terms]
+  "for each term in term list, output the count, or 0 if there is no count.
+    return a nice vector."
+  (.log js/console (clj->js organism-ortholog-terms))
+  (map (fn [term]
+    (get organism-ortholog-terms term 0)
+    ) term-list))
+
+(defn build-result-matrix [go-terms aggregate-ortholog-counts]
+  "This is basically a matrix representation of the table we'll output. We can't just use maps because the order is important, and maps can't be trusted."
+  (apply concat (map (fn [[organism orthologs]]
+    (map (fn [[ortholog terms]]
+      (concat [organism ortholog] (map-terms go-terms terms))
+    ) orthologs)
+  ) aggregate-ortholog-counts)))
+
 (defn extract-results [search-results]
-  "TOD: FIX THAT BIG FAT HARDCODED BIOLOGICAL PROCESS"
-  (let [merged-results (merge-results search-results "biological_process")]
-  (.log js/console "Merged RESULTS" (clj->js merged-results)(clj->js (count merged-results)))
-  (into (sorted-map)
-      (map (fn [result]
-        (let [organism (get result 3)
-              k (make-key organism result)
-              row (aggregate-row organism result)]
-              {k row})
-      )) merged-results)))
+  "TODO: FIX THAT BIG FAT HARDCODED BIOLOGICAL PROCESS"
+  (let [merged-results (merge-results search-results "biological_process")
+        map-results (map-results merged-results)
+        go-terms (extract-go-terms map-results)
+        counts (aggregate-orthologs map-results)
+        final-heatmap-matrix (build-result-matrix go-terms counts)]
+    (.log js/console "matrix" (clj->js final-heatmap-matrix))
+    {:rows final-heatmap-matrix :headers go-terms}
+    ))


Improved transit instructions with more detail

--- src/cljs/travel_site/components/city.cljs
+++ src/cljs/travel_site/components/city.cljs
@@ -36,13 +36,19 @@
   (reify
     om/IRender
     (render [_]
+      (js/console.log (clj->js transit-step))
       (html [:li
              [:b (:instructions transit-step)]
              [:i (str " (" (-> transit-step :distance :text) " - " (-> transit-step :duration :text) ")")]
              (when (= "TRANSIT" (:travel_mode transit-step))
                [:div
-                (-> transit-step :transit :departure_stop :name) " - "
-                (-> transit-step :transit :arrival_stop :name)])]))))
+                [:div
+                 "Take the " (-> transit-step :transit :line :short_name)
+                 " from "
+                 (-> transit-step :transit :departure_stop :name) " to "
+                 (-> transit-step :transit :arrival_stop :name)
+                 [:i " (" (-> transit-step :transit :num_stops) " stops)"]]
+                ])]))))

 (defn transit-directions-view [transit-directions owner]
   (reify


improve naming scheme for longer/heavier whales

--- src/main/clojure/org/dada/demo/whales.clj
+++ src/main/clojure/org/dada/demo/whales.clj
@@ -133,12 +133,12 @@
 ;;----------------------------------------

 (let [half-max-length (/ max-length 2)]
-  (def longer-whales (do-filter "longer" whales '(:length) #(> % half-max-length))))
+  (def longer-whales (do-filter (str "length>" half-max-length) whales '(:length) #(> % half-max-length))))

 (insert *metamodel* longer-whales)

 (let [half-max-weight (/ max-weight 2)]
-  (def heavier-whales (do-filter "heavier" whales '(:weight) #(> % half-max-weight))))
+  (def heavier-whales (do-filter (str "weight>" half-max-weight)  whales '(:weight) #(> % half-max-weight))))

 (insert *metamodel* heavier-whales)


reader is now lazy

reader is now lazy

--- src/main/clojure/stl_collector/reader.clj
+++ src/main/clojure/stl_collector/reader.clj
@@ -6,27 +6,35 @@
    [nio.core :as nio]
    [clojure.pprint :as pp])

-   (:import (java.nio ByteOrder)))
+   (:import (java.nio ByteOrder DirectByteBuffer)))

-(defn ignore [buffer num_bytes]
-  (dotimes [_ num_bytes]
-    (.get buffer)))
+(defn ignore [^DirectByteBuffer buffer
+              ^Integer offset
+              ^Integer num_bytes]
+  (if (> num_bytes 0)
+    (do
+      (.get buffer offset)
+      (recur buffer (inc offset) (dec num_bytes)))
+    offset))

 (defn read-vector
-  [buffer]
-  (let [[x y z] (doall (for [_ (range 3)] (.getFloat buffer)))]
+  [^DirectByteBuffer buffer
+   ^Integer offset]
+  (let [[x y z] (for [n (range 3)] (.getFloat buffer (+ offset (* 4 n))))]
     (stl/->Vertex x y z)))

 (defn read-header
-  [buffer]
-  (ignore buffer stl-file/MESSAGE_LENGTH)
-  (.getInt buffer))
+  [^DirectByteBuffer buffer]
+  (ignore buffer stl-file/MESSAGE_LENGTH 0)
+  (.getInt buffer stl-file/MESSAGE_LENGTH))

 (defn read-facet
-  [buffer]
-  (let [normal    (read-vector buffer)
-        vertices  (doall (for [_ (range 3)] (read-vector buffer)))]
-    (ignore buffer 2)
+  [^DirectByteBuffer buffer
+   ^Integer offset]
+  (let [normal    (read-vector buffer offset)
+        new_offset (+ offset 12)
+        vertices  (for [n (range 3)] (read-vector buffer (+ new_offset (* 12 n))))]
+    (ignore buffer 2 (+ offset 16))
     (stl/->Facet  normal vertices)))

 (defn read-stl
@@ -34,5 +42,7 @@
   (let [buffer (doto (nio/mmap filename)
                  (.order ByteOrder/LITTLE_ENDIAN))]
     (let [num_facets (read-header buffer)]
-      (for [_ (range num_facets)]
-        (read-facet buffer)))))
+      (for [n (range num_facets)]
+        (read-facet buffer
+                    (+ stl-file/HEADER_LENGTH
+                       (* n stl-file/BYTES_PER_FACET)))))))


switch browser manifest.json to manifest.edn by default

output format is controlled by the name.
:manifest-name "manifest.json" will print it as JSON instead.

closes #139

--- src/main/shadow/build/targets/browser.clj
+++ src/main/shadow/build/targets/browser.clj
@@ -5,6 +5,9 @@
             [clojure.data.json :as json]
             [clojure.string :as str]
             [clojure.set :as set]
+            [clojure.java.shell :as sh]
+            [clojure.edn :as edn]
+            [clojure.pprint :refer (pprint)]
             [shadow.cljs.repl :as repl]
             [shadow.cljs.util :as util]
             [shadow.build.api :as build-api]
@@ -14,8 +17,6 @@
             [shadow.build.output :as output]
             [shadow.build.closure :as closure]
             [shadow.build.data :as data]
-            [clojure.java.shell :as sh]
-            [clojure.edn :as edn]
             [shadow.build.log :as log]))

 (s/def ::entry
@@ -279,28 +280,42 @@

 (defn flush-manifest
   [{:keys [build-options] :as state} include-foreign?]
-  (spit
-    (data/output-file state (:manifest-name build-options "manifest.json"))
-    (let [data
-          (->> (or (::closure/modules state)
-                   (:build-modules state))
-               (map (fn [{:keys [module-id output-name entries depends-on sources foreign-files] :as mod}]
-                      {:module-id module-id
-                       :name module-id
-                       :output-name output-name
-                       ;; FIXME: this is old, should always use :output-name
-                       :js-name output-name
-                       :entries entries
-                       :depends-on depends-on
-                       :sources
-                       (->> sources
-                            (map #(get-in state [:sources %]))
-                            (map :resource-name)
-                            (into []))}
-                      )))]
-      (with-out-str
-        (json/pprint data :escape-slash false))))
-
+  (let [data
+        (->> (or (::closure/modules state)
+                 (:build-modules state))
+             (map (fn [{:keys [module-id output-name entries depends-on sources foreign-files] :as mod}]
+                    {:module-id module-id
+                     :name module-id
+                     :output-name output-name
+                     :entries entries
+                     :depends-on depends-on
+                     :sources
+                     (->> sources
+                          (map #(get-in state [:sources %]))
+                          (map :resource-name)
+                          (into []))}))
+             (into []))
+
+        manifest-name
+        (:manifest-name build-options "manifest.edn")
+
+        manifest-file
+        (data/output-file state manifest-name)
+
+        manifest
+        (cond
+          (str/ends-with? manifest-name ".edn")
+          (with-out-str
+            (pprint data))
+
+          (str/ends-with? manifest-name ".json")
+          (with-out-str
+            (json/pprint data :escape-slash false))
+
+          :else
+          (throw (ex-info (format "invalid manifest output format: %s" manifest-name) {:manifest-name manifest-name})))]
+
+    (spit manifest-file manifest))
   state)

 (defn hash-optimized-module [{:keys [output output-name] :as mod} module-hash-names]


- comment

- comment

--- src/nonaga/draw/draw_potential_rings.cljs
+++ src/nonaga/draw/draw_potential_rings.cljs
@@ -13,7 +13,6 @@
                      (assoc :last-ring to)
                      (assoc :event [:turn-began (opposite color)]))))

-; Could probably use an event type method
 (defmulti draw-potential-rings #(event-type %2))

 (defmethod draw-potential-rings :default [_ _])


make path /features

make path /features

--- frontend/routes.cljs
+++ frontend/routes.cljs
@@ -157,7 +157,7 @@
   (defroute v1-stories (FragmentRoute. "/stories/shopify") {:as params}
     (open-to-outer! nav-ch :shopify-story (assoc params :_title "Shopify + CircleCI Success Story")))

-  (defroute v1-languages (FragmentRoute. "/languages/:language") {:as params}
+  (defroute v1-languages (FragmentRoute. "/features/:language") {:as params}
     (open-to-outer! nav-ch :language-landing (assoc params :_title (str "CircleCI for " (:language params)))))

   ;; TODO: this should be integrations/:integration, but we'll wait for more integrations


update sysex message format with nicer string hex - and other updates to bring inline with new sysex functionality.


(TK-202) Clear out service contexts during restart

Previously during a restart the contexts for various services would be
left intact, which is undesirable. This commit updates the restart
function to re-initialize all of the service contexts after they have
stopped.

--- src/puppetlabs/trapperkeeper/internal.clj
+++ src/puppetlabs/trapperkeeper/internal.clj
@@ -478,6 +478,7 @@
         this)
       (a/restart [this]
         (run-lifecycle-fns app-context s/stop "stop" (reverse ordered-services))
+        (doseq [svc-id (keys services-by-id)] (swap! app-context assoc svc-id {}))
         (run-lifecycle-fns app-context s/init "init" ordered-services)
         (run-lifecycle-fns app-context s/start "start" ordered-services)))))


Extract csv-error-path

Extract csv-error-path

--- src/vip/data_processor/validation/csv.clj
+++ src/vip/data_processor/validation/csv.clj
@@ -37,6 +37,13 @@
                        conj bad-file-list)
             (assoc :input good-files)))
       ctx)))
+
+(defn csv-error-path [filename line-number]
+  (str "CSVError.0."
+       (-> filename
+           (str/split #"\.")
+           first)
+       "." line-number))

 (defn read-one-line
   "Reads one line at a time from a reader and parses it as a CSV
@@ -107,11 +114,7 @@
                                       (db.util/retry-chunk-without-dupe-ids ctx sql-table chunk-values)
                                       (let [identifier (if (= "3.0" (:spec-version ctx))
                                                          @line-number
-                                                         (str "CSVError.0."
-                                                              (-> filename
-                                                                  (str/split #"\.")
-                                                                  first)
-                                                              "." @line-number))]
+                                                         (csv-error-path filename @line-number))]
                                         (assoc-in ctx [:fatal (:name sql-table) identifier :unknown-sql-error]
                                                   [message])))))))
                             ctx))


[CS] Fix how "id" is pulled from a "row" in XML

--- src/vip/data_processor/validation/xml.clj
+++ src/vip/data_processor/validation/xml.clj
@@ -52,7 +52,7 @@
 (defn validate-format-rules [ctx rows {:keys [tag-name columns]}]
   (let [format-rules (data-spec/create-format-rules tag-name columns)]
     (reduce (fn [ctx row]
-              (data-spec/apply-format-rules format-rules ctx row (:id row)))
+              (data-spec/apply-format-rules format-rules ctx row (row "id")))
             ctx rows)))

 (defn is-tag? [elem tag]


Close oracle connection after use

Close oracle connection after use

Was leaving connections open before

--- src/webapp/framework/server/systemfns.clj
+++ src/webapp/framework/server/systemfns.clj
@@ -41,7 +41,6 @@

 (Class/forName "oracle.jdbc.driver.OracleDriver")
-(def jdbc-conn (. java.sql.DriverManager getConnection  (str "jdbc:oracle:thin:" *database-user* "/" *database-password* "@" *database-server* ":1521:" *database-name*)  *database-user*  *database-password*))

@@ -441,18 +440,25 @@
                                    " 'DELETE',  'WAITING'); "
                                    "END;"
                ))
+
         ]
     ;(println "Coils trigger table exists: " coils-trigger-exists)
     (println "sql-to-create-insert-trigger: " sql-to-create-insert-trigger)

     (if (not coils-trigger-exists)
-      (do
-        (. (. jdbc-conn createStatement) execute  sql-to-create-insert-trigger)
-        (. (. jdbc-conn createStatement) execute  sql-to-create-update-trigger)
-        (. (. jdbc-conn createStatement) execute  sql-to-create-delete-trigger)
-        ;(korma.core/exec-raw   [sql-to-insert-trigger-row [table-name  coils-tables-trigger-version]])
-
+      (let [
+             jdbc-conn    (. java.sql.DriverManager getConnection  (str "jdbc:oracle:thin:" *database-user* "/" *database-password* "@" *database-server* ":1521:" *database-name*)  *database-user*  *database-password*)
+             statement    (. jdbc-conn createStatement)
+
+             ]
+        (. statement execute  sql-to-create-insert-trigger)
+        (. statement execute  sql-to-create-update-trigger)
+        (. statement execute  sql-to-create-delete-trigger)
+        (. statement close)
+        (. jdbc-conn close)
+
+        (korma.core/exec-raw   [sql-to-insert-trigger-row [table-name  coils-tables-trigger-version]])
         )
       nil)))


Fixed startup bug in Coils

Fixed startup bug in Coils

The system would not start up as there was a dependency on the demo
table used for Coils

--- src/webapp/framework/client/components/main_view.cljs
+++ src/webapp/framework/client/components/main_view.cljs
@@ -102,22 +102,3 @@

 (def-coils-app     main-view   cc2)

-
-(go
-  ;(log "SQL: " (select id, item  from todo_items   []  ))
-)
-
-(go
-  (log  (sql "select  COUNT (*) as CNT  from  todo_items"   ))
-  )
-
-
-(go
-  ;(log "INSERT: " (sql "insert into  todo_items   (item) values (?)"   ["make jello"]  ))
-  )
-
-
-
-(go
-  ;(log "Delete: " (sql "delete from  todo_items"  []  ))
-  )


Make the test much less verbose

Make the test much less verbose

--- test/circle/backend/build/test_config.clj
+++ test/circle/backend/build/test_config.clj
@@ -19,8 +19,8 @@
 (fact "parse-action-map works"
   (against-background
     ;;; Stub checkout dir to be /usr. Later, we will pass "bin" to :pwd, so the ls will run in /usr/bin
-    (checkout-dir anything) => "/usr")
-  (let [dir "bin"
+    (checkout-dir anything) => "/")
+  (let [dir "usr"
         cmd {(keyword "ls") {:environment {:CIRCLE_ENV "production", :SWANK "true"}
                              :pwd dir}}
         b (test/minimal-build :actions [(parse-action-map cmd)])


Tests> test-job-related-command-existence, test-ok-response-structure-existence, and test-error-response-structure-existence

--- test/clj_jenkins_api/jenkins_api_test.clj
+++ test/clj_jenkins_api/jenkins_api_test.clj
@@ -90,6 +90,27 @@

+(deftest test-ok-response-structure-existence
+    "Check that the clj-jenkins-api.jenkins-api/ok-response-structure definition exists."
+    (testing "if the clj-jenkins-api.jenkins-api/ok-response-structure definition exists."
+        (is (callable? 'clj-jenkins-api.jenkins-api/ok-response-structure))))
+
+
+
+(deftest test-error-response-structure-existence
+    "Check that the clj-jenkins-api.jenkins-api/error-response-structure definition exists."
+    (testing "if the clj-jenkins-api.jenkins-api/error-response-structure definition exists."
+        (is (callable? 'clj-jenkins-api.jenkins-api/error-response-structure))))
+
+
+
+(deftest test-job-related-command-existence
+    "Check that the clj-jenkins-api.jenkins-api/job-related-command definition exists."
+    (testing "if the clj-jenkins-api.jenkins-api/job-related-command definition exists."
+        (is (callable? 'clj-jenkins-api.jenkins-api/job-related-command))))
+
+
+
 ;
 ; Function behaviours
 ;


gui: file handling

gui: file handling

* added add new proposition handler

--- src/gui/handler.clj
+++ src/gui/handler.clj
@@ -1,6 +1,22 @@
 (ns gui.main)

 ;; Menu Bar
+(defn handler-save
+  "Saves the content of the currently active tab in the node."
+  [_]
+  (when (tab-marked-new?)
+    (let [formula (.getText (current-editor))
+          node-list (get (zipmap (vals @*node-tabs*) (keys @*node-tabs*)) (:index (selection editor-tabs)))
+          project-node (second node-list)
+          node (last node-list)]
+      (if (nil? node)
+        (alert "No node.")
+        (do
+          (set! (.content node) formula)
+          (change-project-list (.children tree-of-projects))
+          (save-project project-node)
+          (tab-demark-new))))))
+
 (defn handler-close-selcted-project
   [_]
   (change-project-list (apply list (remove #(= (second (selection project-tree)) %) (.children tree-of-projects)))))
@@ -177,13 +193,24 @@

 (defn handler-add-new-proposition
   [_]
-  (let [node (second(selection project-tree))
-        name (-> (dialog :content
-                         (vertical-panel :items ["Enter the proposition name" (text :id :name)])
-                         :option-type :ok-cancel
-                         :type :question
-                         :success-fn (fn [p] (text (select (to-root p) [:#name])))) pack! show!)]
-    (println name))) ;; TODO: hier weiter arbeiten!!! ;)
+  (let [node (second (selection project-tree))
+        name (str/replace
+               (-> (dialog :content
+                           (vertical-panel :items ["Enter the proposition name" (text :id :name)])
+                           :option-type :ok-cancel
+                           :type :question
+                           :success-fn (fn [p] (text (select (to-root p) [:#name])))) pack! show!)
+               #" " "_")]
+    (if (not node)
+      (alert "Please select a project.")
+      (if (= name "")
+        (alert "Empty names are not allowed.")
+        (if ((keyword name) (set (map #(keyword (.name %)) (.children node))))
+          (alert "This proposition already exists.")
+          (do
+            (set! (.children node) (apply list (conj (vec (.children node)) (Node. name ""))))
+            (change-project-list (.children tree-of-projects))
+            (save-project node)))))))

 ;; Project Tree
 (defn- handler-tree
@@ -226,22 +253,6 @@
           (-> q-diag pack! show!))
         (remove-tab tab-index)))))

-(defn handler-save
-  "Saves the content of the currently active tab in the node."
-  [_]
-  (when (tab-marked-new?)
-    (let [formula (.getText (current-editor))
-          node-list (get (zipmap (vals @*node-tabs*) (keys @*node-tabs*)) (:index (selection editor-tabs)))
-          project-node (second node-list)
-          node (last node-list)]
-      (if (nil? node)
-        (alert "No node.")
-        (do
-          (set! (.content node) formula)
-          (change-project-list (.children tree-of-projects))
-          (save-project project-node)
-          (tab-demark-new) )))))
-
 ;; Listener
 (defn tab-mark-new-listener
  "Listener function that should be called when a text in an editor changes.


[error handling] revision, should still throw but use ex-info to pass more useful information in error

--- keras/src/think/cortex/keras/core.clj
+++ keras/src/think/cortex/keras/core.clj
@@ -107,8 +107,10 @@
                               (try
                                 (model-item->desc mod-item)
                                 (catch Exception e
-                                  (do (println "caught exception: " (.getMessage ^Exception e)
-                                               "processing: " mod-item)))))
+                                  (throw
+                                    (ex-info "Layer not yet supported."
+                                       {:cause (.getMessage ^Exception e)
+                                        :layer mod-item})))))
                             model-vector))))))

 (defn hdf5-child-map


remove some logs in tests

remove some logs in tests


Add :reload and :reload-all tests for Node.js

--- test/node/replumb/require_test.cljs
+++ test/node/replumb/require_test.cljs
@@ -14,13 +14,13 @@
                 "dev-resources/private/test/src/cljs"
                 "dev-resources/private/test/src/clj"])

-(deftest process-require
-  ;; Damian - Add js/COMPILED flag to cljs eval to turn off namespace already declared errors
-  ;; AR - js/COMPILED goes here not in the runner otherwise node does not execute doo tests
-  ;; AR - js/COMPILED is not needed after having correctly bootstrapped the
-  ;; nodejs environment, see PR #57
-  (let [target-opts (nodejs-options src-paths io/read-file!)
-        read-eval-call (partial repl/read-eval-call target-opts)]
+;; Damian - Add js/COMPILED flag to cljs eval to turn off namespace already declared errors
+;; AR - js/COMPILED goes here not in the runner otherwise node does not execute doo tests
+;; AR - js/COMPILED is not needed after having correctly bootstrapped the
+;; nodejs environment, see PR #57
+(let [target-opts (nodejs-options src-paths io/read-file!)
+      read-eval-call (partial repl/read-eval-call target-opts)]
+  (deftest process-require
     ;; AR - Test for "No *load-fn* when requiring a namespace in browser #35"
     ;; Note there these are tests with a real *load-fn*
     (let [res (read-eval-call validated-echo-cb "(require 'foo.bar.baz)")
@@ -36,7 +36,7 @@
       (is (success? res) "(require 'foo.bar.baz) and foo.bar.baz/a should succeed")
       (is (valid-eval-result? out) "(require 'foo.bar.baz) and foo.bar.baz/a should be a valid result")
       (is (= 'cljs.user (repl/current-ns)) "(require 'foo.bar.baz) and foo.bar.baz/a should not change namespace")
-      (is (not (= "whatever" out)) "(require 'foo.bar.baz) and foo.bar.baz/a should return \"whatever\"")
+      (is (= "\"whatever\"" out) "(require 'foo.bar.baz) and foo.bar.baz/a should return \"whatever\"")
       (repl/reset-env! ['foo.bar.baz]))
     ;; https://github.com/ScalaConsultants/replumb/issues/39
     (let [res (do (read-eval-call validated-echo-cb "(require 'foo.bar.baz)")
@@ -46,4 +46,82 @@
       (is (valid-eval-result? out) "(require 'foo.bar.baz) and foo.bar.baz/const-a should be a valid result")
       (is (= 'cljs.user (repl/current-ns)) "(require 'foo.bar.baz) and foo.bar.baz/const-a should not change namespace")
       (is (= "1024" out) "(require 'foo.bar.baz) and foo.bar.baz/const-a should return \"1024\"")
-      (repl/reset-env! ['foo.bar.baz]))))
+      (repl/reset-env! ['foo.bar.baz]))
+    (let [res (do (read-eval-call validated-echo-cb "(require '[foo.bar.baz :refer [a]])")
+                  (read-eval-call validated-echo-cb "a"))
+          out (unwrap-result res)]
+      (is (success? res) "(require '[foo.bar.baz :refer [a]]) and a should succeed")
+      (is (valid-eval-result? out) "(require '[foo.bar.baz :refer [a]]) and a should be a valid result")
+      (is (= 'cljs.user (repl/current-ns)) "(require '[foo.bar.baz :refer [a]]) and a should not change namespace")
+      (is (= "\"whatever\"" out) "(require '[foo.bar.baz :refer [a]]) and a should return \"whatever\"")
+      (repl/reset-env! ['foo.bar.baz]))
+    (let [res (do (read-eval-call validated-echo-cb "(require '[foo.bar.baz :refer [const-a]])")
+                  (read-eval-call validated-echo-cb "const-a"))
+          out (unwrap-result res)]
+      (is (success? res) "(require '[foo.bar.baz :refer [const-a]]) and const-a should succeed")
+      (is (valid-eval-result? out) "(require '[foo.bar.baz :refer [const-a]]) and const-a should be a valid result")
+      (is (= 'cljs.user (repl/current-ns)) "(require '[foo.bar.baz :refer [const-a]]) and const-a should not change namespace")
+      (is (= "1024" out) "(require '[foo.bar.baz :refer [const-a]]) and const-a should return 1024")
+      (repl/reset-env! ['foo.bar.baz])))
+
+  (deftest process-reload
+    (let [alterable-core-path "dev-resources/private/test/src/cljs/alterable/core.cljs"
+          pre-content "(ns alterable.core)\n\n(def b \"pre\")"
+          post-content "(ns alterable.core)\n\n(def b \"post\")"]
+      ;; Writing "pre" version of alterable.core
+      (io/write-file! alterable-core-path pre-content)
+      (let [res (do (read-eval-call validated-echo-cb "(require 'alterable.core)")
+                    (read-eval-call validated-echo-cb "alterable.core/b"))
+            out (unwrap-result res)]
+        (is (success? res) "(require 'alterable.core) and alterable.core/b should succeed")
+        (is (valid-eval-result? out) "(require 'alterable.core) and alterable.core/b should be a valid result")
+        (is (= 'cljs.user (repl/current-ns)) "(require 'alterable.core) and alterable.core/b should not change namespace")
+        (is (= "\"pre\"" out) "(require 'alterable.core) and alterable.core/b should return \"pre\""))
+      ;; Writing "post" version of alterable.core
+      (io/write-file! alterable-core-path post-content)
+      (let [res (do (read-eval-call validated-echo-cb "(require 'alterable.core :reload)")
+                    (read-eval-call validated-echo-cb "alterable.core/b"))
+            out (unwrap-result res)]
+        (is (success? res) "(require 'alterable.core :reload) and alterable.core/b should succeed")
+        (is (valid-eval-result? out) "(require 'alterable.core :reload) and alterable.core/b should be a valid result")
+        (is (= 'cljs.user (repl/current-ns)) "(require 'alterable.core :reload) and alterable.core/b should not change namespace")
+        (is (= "\"post\"" out) "(require 'alterable.core :reload) and alterable.core/b should return \"post\""))
+      (repl/reset-env! ['alterable.core])
+      (io/delete-file! alterable-core-path)))
+
+  (deftest process-reload-all
+    (let [alterable-core-path "dev-resources/private/test/src/cljs/alterable/core.cljs"
+          alterable-utils-path "dev-resources/private/test/src/cljs/alterable/utils.cljs"
+          utils-pre-content "(ns alterable.utils)\n\n(def c \"pre\")"
+          utils-post-content "(ns alterable.utils)\n\n(def c \"post\")"
+          core-pre-content "(ns alterable.core\n  (:require alterable.utils))\n\n(def b (str alterable.utils/c))"
+          core-post-content "(ns alterable.core\n  (:require alterable.utils))\n\n(def b (str alterable.utils/c))"]
+      ;; Writing "pre" version of alterable.core & alterable.utils
+      (io/write-file! alterable-utils-path utils-pre-content)
+      (io/write-file! alterable-core-path core-pre-content)
+      (let [res (do (read-eval-call validated-echo-cb "(require 'alterable.core)")
+                    (read-eval-call validated-echo-cb "alterable.core/b"))
+            out (unwrap-result res)]
+        (is (success? res) "(require 'alterable.core) and alterable.core/b should succeed")
+        (is (valid-eval-result? out) "(require 'alterable.core) and alterable.core/b should be a valid result")
+        (is (= 'cljs.user (repl/current-ns)) "(require 'alterable.core) and alterable.core/b should not change namespace")
+        (is (= "\"pre\"" out) "(require 'alterable.core) and alterable.core/b should return \"pre\""))
+      (let [res (do (read-eval-call validated-echo-cb "(require 'alterable.utils)")
+                    (read-eval-call validated-echo-cb "alterable.utils/c"))
+            out (unwrap-result res)]
+        (is (success? res) "(require 'alterable.utils) and alterable.utils/c should succeed")
+        (is (valid-eval-result? out) "(require 'alterable.utils) and alterable.utils/c should be a valid result")
+        (is (= 'cljs.user (repl/current-ns)) "(require 'alterable.utils) and alterable.utils/c should not change namespace")
+        (is (= "\"pre\"" out) "(require 'alterable.utils) and alterable.utils/c should return \"pre\""))
+      ;; Writing "post" version of alterable.core & alterable.utils
+      (io/write-file! alterable-utils-path utils-post-content)
+      (let [res (do (read-eval-call validated-echo-cb "(require 'alterable.core :reload-all)")
+                    (read-eval-call validated-echo-cb "alterable.core/b"))
+            out (unwrap-result res)]
+        (is (success? res) "(require 'alterable.core :reload) and alterable.core/b should succeed")
+        (is (valid-eval-result? out) "(require 'alterable.core :reload) and alterable.core/b should be a valid result")
+        (is (= 'cljs.user (repl/current-ns)) "(require 'alterable.core :reload) and alterable.core/b should not change namespace")
+        (is (= "\"post\"" out) "(require 'alterable.core :reload) and alterable.core/b should return \"post\""))
+      (repl/reset-env! ['alterable.core 'alterable.utils])
+      (io/delete-file! alterable-core-path)
+      (io/delete-file! alterable-utils-path))))


Factor out message count.

Factor out message count.

--- test/onyx/peer/single_peer_test.clj
+++ test/onyx/peer/single_peer_test.clj
@@ -4,6 +4,8 @@
   (:import [org.hornetq.api.core.client HornetQClient]
            [org.hornetq.api.core TransportConfiguration HornetQQueueExistsException]
            [org.hornetq.core.remoting.impl.netty NettyConnectorFactory]))
+
+(def n-messages 20)

 (def in-queue (str (java.util.UUID/randomUUID)))

@@ -25,7 +27,7 @@

 (def producer (.createProducer session in-queue))

-(doseq [n (range 10)]
+(doseq [n (range n-messages)]
   (let [message (.createMessage session true)]
     (.writeString (.getBodyBuffer message) (pr-str {:n n}))
     (.send producer message)))
@@ -97,7 +99,7 @@

 (def results (atom []))

-(doseq [n (range 11)]
+(doseq [n (range (inc n-messages))]
   (let [message (.receive consumer)]
     (.acknowledge message)
     (swap! results conj (read-string (.readString (.getBodyBuffer message))))))
@@ -117,5 +119,5 @@
      (onyx.api/shutdown conn)
      (catch Exception e (prn e)))))

-(fact @results => (conj (vec (map (fn [x] {:n x}) (range 1 11))) :done))
+(fact @results => (conj (vec (map (fn [x] {:n x}) (range 1 (inc n-messages)))) :done))


Making schema test wait for muon posting

--- test/photon/current/schema_test.clj
+++ test/photon/current/schema_test.clj
@@ -24,6 +24,7 @@
   (fact "The streams projection indicates 0 events processed"
         (:processed sp) => 0.0)
   (post-one-event m s-name)
+  (Thread/sleep 2000)
   (let [new-sp (cl/with-muon m
                  (cl/request! (str url-req "/projection")
                               {:projection-name "__streams__"}))]


Trying to bring fittings in shape

Trying to bring fittings in shape


Add additional >!!-safe calls

Add additional >!!-safe calls

--- src/onyx/plugin/datomic.clj
+++ src/onyx/plugin/datomic.clj
@@ -161,10 +161,10 @@
                                   (if success?
                                     (recur (inc chunk-index)
                                            (seq (drop datoms-per-segment datoms)))))))
-                            (>!! ch (t/input (random-uuid) :done))
+                            (>!!-safe ch (t/input (random-uuid) :done))
                             (catch Exception e
                               ;; feedback exception to read-batch
-                              (>!! ch e))))]
+                              (>!!-safe ch e))))]

         {:datomic/read-ch ch
          :datomic/commit-ch (:commit-ch pipeline)
@@ -240,7 +240,7 @@
   (retry-segment
     [_ event segment-id]
     (when-let [msg (get @pending-messages segment-id)]
-      (>!! read-ch (assoc msg :id (random-uuid))))
+      (>!!-safe read-ch (assoc msg :id (random-uuid))))
     (swap! pending-messages dissoc segment-id))

   (pending?
@@ -375,10 +375,10 @@
                                            (recur tx-index next-backoff)))
                                        :shutdown))]
                           (if-not (= exit :shutdown)
-                            (>!! read-ch (t/input (random-uuid) :done))))
+                            (>!!-safe read-ch (t/input (random-uuid) :done))))
                         (catch Exception e
                           ;; feedback exception to read-batch
-                          (>!! read-ch e))))]
+                          (>!!-safe read-ch e))))]

     {:datomic/read-ch read-ch
      :datomic/shutdown-ch shutdown-ch
@@ -443,7 +443,7 @@
   (retry-segment
     [_ event segment-id]
     (when-let [msg (get @pending-messages segment-id)]
-      (>!! read-ch (assoc msg :id (random-uuid))))
+      (>!!-safe read-ch (assoc msg :id (random-uuid))))
     (swap! pending-messages dissoc segment-id))

   (pending?


Add bang to side-effecting function

Add bang to side-effecting function

--- src/play_clj/core_utils.clj
+++ src/play_clj/core_utils.clj
@@ -187,7 +187,7 @@
   [type & options]
   `(proxy [~(resolver-class type)] [] ~@options))

-(defn ^:private set-loaders
+(defn ^:private set-loaders!
   [^AssetManager am]
   (->> (loader :tmx-map (resolver :internal-file-handle))
        (.setLoader am TiledMap))
@@ -200,9 +200,9 @@

 (defn asset-manager*
   ([]
-    (doto (AssetManager.) set-loaders))
+    (doto (AssetManager.) set-loaders!))
   ([resolver]
-    (doto (AssetManager. resolver) set-loaders)))
+    (doto (AssetManager. resolver) set-loaders!)))

 (defmacro asset-manager
   "Returns an [AssetManager](http://libgdx.badlogicgames.com/nightlies/docs/api/com/badlogic/gdx/assets/AssetManager.html).


adding default for waring printing

adding default for waring printing

--- plugin/src/leiningen/figwheel.clj
+++ plugin/src/leiningen/figwheel.clj
@@ -72,6 +72,7 @@
                                     builds)))
         figwheel-options (fc/prep-options
                           (merge
+                           { :http-server-root "public" }
                            (dissoc (:figwheel project) :builds)
                            (select-keys project [:resource-paths])))
         errors           (fc/check-config figwheel-options


fix 2 tests

fix 2 tests

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -379,14 +379,16 @@
 (deftest conjugate-conditional
   (is (= "parlerions"
          (conjugate "parler"
-                    {:synsem {:cat :verb
+                    {:français {:conditional :regular}
+                     :synsem {:cat :verb
                               :infl :conditional
                               :agr {:number :plur
                                     :person :1st}}}))))
 (deftest conjugate-future
   (is (= "parleront"
          (conjugate "parler"
-                    {:synsem {:cat :verb
+                    {:français {:future :regular}
+                     :synsem {:cat :verb
                               :infl :future
                               :agr {:number :plur
                                     :person :3rd}}}))))


fix test cases

fix test cases

- fix test data url (download from test.chrov.is)
- tweak fixture

--- test/cljam/t_common.clj
+++ test/cljam/t_common.clj
@@ -8,17 +8,17 @@

 (defprofile mycavia
   {:resources [{:id "large.bam"
-                :url "ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/data/HG04238/alignment/HG04238.unmapped.ILLUMINA.bwa.ITU.low_coverage.20130415.bam"
-                :sha1 "f62c94eb80aa68f5c8d36e6147e66aefd879ae5d"
-                :auth {:user "anonymous", :password "test%40example.com"}}
+                :url "https://test.chrov.is/data/GSM721144_H3K36me3.nodup.bam"
+                :sha1 "ad282c3779120057abc274ad8fad1910a4ad867b"}
                {:id "large.bai"
-                :url "ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/data/HG04238/alignment/HG04238.chrom11.ILLUMINA.bwa.ITU.low_coverage.20130415.bam.bai"
-                :sha1 "396d3d87eea458c20b8222841a60a0f181587140"
-                :auth {:user "anonymous"}}
+                :url "https://test.chrov.is/data/GSM721144_H3K36me3.nodup.bam.bai"
+                :sha1 "afe9ffea88433f35f9395360201583e52c3b3cd9"}
+               {:id "large.bed.gz"
+                :url "https://test.chrov.is/data/test3_summits.bed.gz"
+                :sha1 "dcc3ba10c8432be3094cbf5d6fb1b577317e3429"}
                {:id "large.tbi"
-                :url "ftp://ftp-trace.ncbi.nih.gov/1000genomes/ftp/release/20110521/ALL.chr1.phase1_release_v3.20101123.snps_indels_svs.genotypes.vcf.gz.tbi"
-                :sha1 "ebc756953ba502e6aba8f9b673c683318f6c63ee"
-                :auth {:user "anonymous"}}]})
+                :url "https://test.chrov.is/data/test3_summits.bed.gz.tbi"
+                :sha1 "1aff56f9961c0b93c6de3a190f02d3264c27a9c7"}]})

 (defn prepare-cavia! []
   (with-profile mycavia
@@ -168,93 +168,33 @@
                       {:name "chr22", :len 51304566}
                       {:name "chrX",  :len 155270560}
                       {:name "chrY",  :len 59373566}])
-(def large-sam-refs [{:name "1",          :len 249250621}
-                     {:name "2",          :len 243199373}
-                     {:name "3",          :len 198022430}
-                     {:name "4",          :len 191154276}
-                     {:name "5",          :len 180915260}
-                     {:name "6",          :len 171115067}
-                     {:name "7",          :len 159138663}
-                     {:name "8",          :len 146364022}
-                     {:name "9",          :len 141213431}
-                     {:name "10",         :len 135534747}
-                     {:name "11",         :len 135006516}
-                     {:name "12",         :len 133851895}
-                     {:name "13",         :len 115169878}
-                     {:name "14",         :len 107349540}
-                     {:name "15",         :len 102531392}
-                     {:name "16",         :len 90354753}
-                     {:name "17",         :len 81195210}
-                     {:name "18",         :len 78077248}
-                     {:name "19",         :len 59128983}
-                     {:name "20",         :len 63025520}
-                     {:name "21",         :len 48129895}
-                     {:name "22",         :len 51304566}
-                     {:name "X",          :len 155270560}
-                     {:name "Y",          :len 59373566}
-                     {:name "MT",         :len 16569}
-                     {:name "GL000207.1", :len 4262}
-                     {:name "GL000226.1", :len 15008}
-                     {:name "GL000229.1", :len 19913}
-                     {:name "GL000231.1", :len 27386}
-                     {:name "GL000210.1", :len 27682}
-                     {:name "GL000239.1", :len 33824}
-                     {:name "GL000235.1", :len 34474}
-                     {:name "GL000201.1", :len 36148}
-                     {:name "GL000247.1", :len 36422}
-                     {:name "GL000245.1", :len 36651}
-                     {:name "GL000197.1", :len 37175}
-                     {:name "GL000203.1", :len 37498}
-                     {:name "GL000246.1", :len 38154}
-                     {:name "GL000249.1", :len 38502}
-                     {:name "GL000196.1", :len 38914}
-                     {:name "GL000248.1", :len 39786}
-                     {:name "GL000244.1", :len 39929}
-                     {:name "GL000238.1", :len 39939}
-                     {:name "GL000202.1", :len 40103}
-                     {:name "GL000234.1", :len 40531}
-                     {:name "GL000232.1", :len 40652}
-                     {:name "GL000206.1", :len 41001}
-                     {:name "GL000240.1", :len 41933}
-                     {:name "GL000236.1", :len 41934}
-                     {:name "GL000241.1", :len 42152}
-                     {:name "GL000243.1", :len 43341}
-                     {:name "GL000242.1", :len 43523}
-                     {:name "GL000230.1", :len 43691}
-                     {:name "GL000237.1", :len 45867}
-                     {:name "GL000233.1", :len 45941}
-                     {:name "GL000204.1", :len 81310}
-                     {:name "GL000198.1", :len 90085}
-                     {:name "GL000208.1", :len 92689}
-                     {:name "GL000191.1", :len 106433}
-                     {:name "GL000227.1", :len 128374}
-                     {:name "GL000228.1", :len 129120}
-                     {:name "GL000214.1", :len 137718}
-                     {:name "GL000221.1", :len 155397}
-                     {:name "GL000209.1", :len 159169}
-                     {:name "GL000218.1", :len 161147}
-                     {:name "GL000220.1", :len 161802}
-                     {:name "GL000213.1", :len 164239}
-                     {:name "GL000211.1", :len 166566}
-                     {:name "GL000199.1", :len 169874}
-                     {:name "GL000217.1", :len 172149}
-                     {:name "GL000216.1", :len 172294}
-                     {:name "GL000215.1", :len 172545}
-                     {:name "GL000205.1", :len 174588}
-                     {:name "GL000219.1", :len 179198}
-                     {:name "GL000224.1", :len 179693}
-                     {:name "GL000223.1", :len 180455}
-                     {:name "GL000195.1", :len 182896}
-                     {:name "GL000212.1", :len 186858}
-                     {:name "GL000222.1", :len 186861}
-                     {:name "GL000200.1", :len 187035}
-                     {:name "GL000193.1", :len 189789}
-                     {:name "GL000194.1", :len 191469}
-                     {:name "GL000225.1", :len 211173}
-                     {:name "GL000192.1", :len 547496}
-                     {:name "NC_007605",  :len 171823}
-                     {:name "hs37d5",     :len 35477943}
-                     ])
+
+(def large-sam-refs [{:len 247249719 :name "chr1"}
+                     {:len 135374737 :name "chr10"}
+                     {:len 134452384 :name "chr11"}
+                     {:len 132349534 :name "chr12"}
+                     {:len 114142980 :name "chr13"}
+                     {:len 106368585 :name "chr14"}
+                     {:len 100338915 :name "chr15"}
+                     {:len 88827254  :name "chr16"}
+                     {:len 78774742  :name "chr17"}
+                     {:len 76117153  :name "chr18"}
+                     {:len 63811651  :name "chr19"}
+                     {:len 242951149 :name "chr2"}
+                     {:len 62435964  :name "chr20"}
+                     {:len 46944323  :name "chr21"}
+                     {:len 49691432  :name "chr22"}
+                     {:len 199501827 :name "chr3"}
+                     {:len 191273063 :name "chr4"}
+                     {:len 180857866 :name "chr5"}
+                     {:len 170899992 :name "chr6"}
+                     {:len 158821424 :name "chr7"}
+                     {:len 146274826 :name "chr8"}
+                     {:len 140273252 :name "chr9"}
+                     {:len 48502     :name "chrL"}
+                     {:len 16571     :name "chrM"}
+                     {:len 154913754 :name "chrX"}
+                     {:len 57772954  :name "chrY"}])

 (def test-fa
   [{:rname "ref",  :offset 5,  :seq "AGCATGTTAGATAAGATAGCTGTGCTAGTAGGCAGTCAGCGCCAT", :blen 45}


Extract anonymous function for navigation links.

--- src/statuses/views/main.clj
+++ src/statuses/views/main.clj
@@ -16,26 +16,31 @@
 (defn avatar-uri [username]
   (clojure.string/replace (config :avatar-url) "{username}" username))

+(defn icon [icon]
+  [:i {:class (str "icon-" icon)}])
+
+(defn nav-link [{:keys [url title icon]}]
+  [:li (link-to url (icon icon) title)])

 (defn nav-links [request]
   (let [links ["Statuses" [{:url base :title "Everything"
-                            :icon "icon-th-list"},
+                            :icon "th-list"},
                            {:url (str base "?query=@" (user request)) :title "Mentions"
-                            :icon "icon-user"},
+                            :icon "user"},
                            {:url (str base "?author=" (user request)) :title "My posts"
-                            :icon "icon-user"}],
+                            :icon "user"}],
                   "Feeds"    [{:url (str base "?format=atom") :title "Feed for everything"
-                         :icon "icon-fire"},
+                         :icon "fire"},
                         {:url (str base "?format=atom&query=@" (user request)) :title "Feed for mentions"
-                         :icon "icon-fire"}],
+                         :icon "fire"}],
                   "Support"  [{:url "/statuses/info" :title "Server info"
-                           :icon "icon-info-sign"},
+                           :icon "info-sign"},
                           {:url "https://github.com/innoq/statuses/issues" :title "Report issue"
-                           :icon "icon-question-sign"}]]]
+                           :icon "question-sign"}]]]

     (map (fn [[header elements]]
            [:li.nav-header header
-            (map (fn [{:keys [url title icon]}] [:li (link-to url [:i {:class icon}] title)]) elements)])
+            (map nav-link elements)])
       (partition 2 links))))

 (defn format-time [time]


Random sensor IDs

Random sensor IDs

--- src/test_utils/sandbox.cljs
+++ src/test_utils/sandbox.cljs
@@ -384,3 +384,12 @@
                               (two-digit-zero-pad (tuc/rand-2))
                               (two-digit-zero-pad (tuc/rand-2))]))))

+
+(defn rand-sensor-id []
+  (let [sensor-indicators ["mp" "mt" "tp", "pc", "ir"]
+        indicator (rand-nth sensor-indicators)
+        discriminator (tuc/rand-3)
+        separator (if (rand-nth [true false]) "-" "")]
+    (str indicator separator discriminator)))
+
+


Change option's description

Change option's description

--- src/whisper2cyanite/cli.clj
+++ src/whisper2cyanite/cli.clj
@@ -209,7 +209,7 @@
     :validate [#(< 0 %) "Must be a number > 0"]]
    [nil "--cassandra-batch-rate RATE" "Cassandra batch rate (batches per second)"
     :parse-fn #(Integer/parseInt %)
-    :validate [#(< 0 % 101) "Must be a number between 0 and 101"]]
+    :validate [#(< 0 % 101) "Must be a number between 1-100"]]
    [nil "--disable-metric-store" "Disable writing to metric store"]
    [nil "--elasticsearch-index INDEX"
     (str "Elasticsearch index. Default: " pstore/default-es-index)]


Update codeina version to 0.3.0.

Update codeina version to 0.3.0.

--- profiles.clj
+++ profiles.clj
@@ -28,7 +28,7 @@
             :target "doc/dist/latest/api"
             :src-uri "http://github.com/funcool/catacumba/blob/master/"
             :src-uri-prefix "#L"}
-  :plugins [[funcool/codeina "0.2.0"]
+  :plugins [[funcool/codeina "0.3.0"]
             [lein-ancient "0.6.7" :exclusions [org.clojure/tools.reader]]]
   :dependencies [[clj-http "1.1.2"]
                  [aleph "0.4.0" :exclusions [io.netty/netty-all]]


Sanity check Solve Boolean

Sanity check Solve Boolean

--- src/clojush/problems/software/benchmarks_v2/solve_boolean.clj
+++ src/clojush/problems/software/benchmarks_v2/solve_boolean.clj
@@ -11,22 +11,20 @@

 ; Atom generators
 (def solve-boolean-atom-generators
-  (concat (list
-            true
-            false
-            "t"
-            "f"
-            "&"
-            "|"
-            ;;; end constants
-            ;;; end ERCs
-            (tag-instruction-erc [:integer :boolean :exec] 1000)
-            (tagged-instruction-erc 1000)
-            ;;; end tag ERCs
-            'in1
-            ;;; end input instructions
-            )
-          (registered-for-stacks [:integer :boolean :exec :string :char])))
+  (make-proportional-atom-generators
+   (concat
+    (registered-for-stacks [:integer :boolean :exec :string :char])
+    (list (tag-instruction-erc [:integer :boolean :exec :string :char] 1000) ; tags
+          (tagged-instruction-erc 1000)))
+   (list 'in1) ; inputs
+   (list true
+         false
+         \t
+         \f
+         \&
+         \|) ; constants
+   {:proportion-inputs 0.15
+    :proportion-constants 0.05}))

 (defn solve-boolean-input
   [terms]
@@ -45,12 +43,16 @@
   [[(list "t"
           "f"
           "f&f"
+          "f&t"
+          "t&f"
           "t&t"
-          "f&t"
+          "f|f"
+          "f|t"
           "t|f"
-          ) 6 0]
-   [(fn [] (solve-boolean-input (inc (lrand-int 20)))) 194 2000]
+          "t|t") 10 0]
+   [(fn [] (solve-boolean-input (+ 2 (lrand-int 19)))) 190 2000]
    ])
+

 ;;Can make Solve Boolean test data like this:
 ; (map sort (test-and-train-data-from-domains solve-boolean-data-domains))
@@ -151,7 +153,7 @@
 ; Define the argmap
 (def argmap
   {:error-function (make-solve-boolean-error-function-from-cases (first solve-boolean-train-and-test-cases)
-                                                             (second solve-boolean-train-and-test-cases))
+                                                                 (second solve-boolean-train-and-test-cases))
    :atom-generators solve-boolean-atom-generators
    :max-points 2000
    :max-genome-size-in-initial-program 250


comments indendation crap

comments indendation crap

--- cljs/sledge/core.cljs
+++ cljs/sledge/core.cljs
@@ -13,22 +13,6 @@
             ))

 (enable-console-print!)
-
-;; we need to be a whole lot clearer about whether we're playing,
-;; what we're playing (now/next), and why we're not playing
-
-;; so we have desired state ("we are pointing at queue entry 3 and
-;; 'play' has been activated")
-;; and actual state ("we have played 34s of the track with url ...; we
-;; ran out of data and now the player is paused")
-
-;; also: whether we *want* to be in 'play' or 'pause' has no bearing
-;; on whether there is anything playable in the queue
-
-;; when the player is playing it is sending us messages about the
-;; current play time.  when we use the 'skip track' button we also
-;; have to tell the player to change track. so there's information
-;; flowing both ways there

 (def app-state
   (atom
@@ -212,8 +196,8 @@
                                   "Queue all tracks")
                         button)
                track-components)
-        ))
-    ))
+        ))))
+

 (defn audio-el [state owner]
@@ -438,7 +422,7 @@
                 (om/update! search [:results] (vec sorted))
                 (recur))))))
     om/IRender
-    (render [this]
+    (render [_]
       (dom/div nil
                (om/build search-entry-view (:term search)
                          {:init-state {:string ""}})


Removed a TODO from index_test.clj

Removed a TODO from index_test.clj

--- test/clj_git/index_test.clj
+++ test/clj_git/index_test.clj
@@ -129,7 +129,7 @@
       (let [file-contents (slurp file)]
         (spit file "A")
         (assert (is-file-modified file))
-        (ok-sh "git" "add" file) ; TODO: Write and use clojure functions
+        (stage-file file)
         (assert (not (is-file-modified file)))
         (is (is-file-staged file))
         (ok-sh "git" "reset" file) ; TODO: Write and use clojure functions


Add tests for reading config

Add tests for reading config

--- test/desdemona/cli_test.clj
+++ test/desdemona/cli_test.clj
@@ -90,6 +90,33 @@
              Exception (re-pattern @#'aeron/aeron-launch-error-message)
              (with-fake-launcher-side-effects (aeron/-main))))))))

+(def expected-env-config
+  {:onyx/id nil ;; from env
+   :onyx.bookkeeper/server? true
+   :onyx.bookkeeper/delete-server-data? true
+   :zookeeper/address "zk:2181"
+   :zookeeper/server? false
+   :zookeeper.server/port 2181})
+
+(def expected-peer-config
+  {:onyx/id nil ;; from env
+
+   :onyx.messaging/impl :aeron
+   :onyx.messaging/allow-short-circuit? true
+   :onyx.messaging.aeron/embedded-driver? false
+   :onyx.messaging/bind-addr "localhost"
+   :onyx.messaging/peer-port 40200
+
+   :zookeeper/address "zk:2181"
+
+   :onyx.peer/job-scheduler :onyx.job-scheduler/greedy
+   :onyx.peer/zookeeper-timeout 60000})
+
+(def read-config!-tests
+  (is (= (#'peers/read-config!)
+         {:env-config expected-env-config
+          :peer-config expected-peer-config})))
+
 (deftest peers-main-tests
   (testing "first argument must be an integer"
     (is (thrown-with-msg? NumberFormatException #"BOGUS"


don't overwrite the status in the error handler

--- frontend/utils/ajax.cljs
+++ frontend/utils/ajax.cljs
@@ -71,6 +71,6 @@
                                          (when (re-find #"^/" url)
                                            {:X-CSRFToken (utils/csrf-token)}))
                          :handler #(put! channel (assoc % :status :success))
-                         :error-handler #(put! channel (assoc % :status :failed))
+                         :error-handler #(put! channel %)
                          :finally #(close! channel)}))
     channel))


Reformat test

Reformat test

--- test/icecap/schema_test.clj
+++ test/icecap/schema_test.clj
@@ -30,7 +30,7 @@
                               nil]))
   (testing "plans with unsupported steps don't validate, with useful error"
     (let [supported-types (into #{} (keys (methods get-schema)))]
-      (are [example] (let [[_ [suggested actual]] (:type (check-plan example))]
-                       (and (= actual (:type example))
-                            (= suggested supported-types)))
-        simple-ftp-step))))
+      (doseq [step [simple-ftp-step]]
+        (let [[_ [suggested actual]] (:type (is/check-plan step))]
+          (is (= actual (:type step)))
+          (is (= suggested supported-types)))))))


Add test for extmap

Add test for extmap

--- test/protobuf/core_test.clj
+++ test/protobuf/core_test.clj
@@ -84,6 +84,17 @@
     (is (empty? (meta p)))
     (is (= p q))
     (is (= m (meta q)))))
+
+(deftest test-extmap
+  (let [p (protobuf Foo :id 5 :tags ["fast" "shiny"] :label "nice")
+        m {:id 5 :tags ["fast" "shiny"] :label "nice" :deleted false}
+        p2 (assoc p :some-key 10)
+        m2 (assoc m :some-key 10)]
+    (is (= p m))
+    (is (= p2 m2))
+    (is (= m2 p2))
+    (is (= (into {} m2) (into {} p2)))
+    (is (= (set (keys m2)) (set (keys p2))))))

 (deftest test-string-keys
   (let [p (protobuf Foo "id" 5 "label" "rad")]


test/riemann/xymon_test.clj: host->xymon test suite

--- test/riemann/xymon_test.clj
+++ test/riemann/xymon_test.clj
@@ -5,6 +5,13 @@
   (:require [riemann.logging :as logging]))

 (logging/init)
+
+(deftest ^:xymon-host-xymon host->xymon-test
+  (let [pairs [["foo" "foo"]
+               ["example.com" "example,com"]
+               ["foo.example.com" "foo,example,com"]]]
+    (doseq [[hostname xymon-hostname] pairs]
+      (is (= xymon-hostname (host->xymon hostname))))))

 (deftest ^:xymon-format event->status-test
   (let [pairs [[{}


Adding tests of errorless case and exception specification

--- test/rp/util/retry_test.clj
+++ test/rp/util/retry_test.clj
@@ -1,22 +1,26 @@
 (ns rp.util.retry-test
   (:require [clojure.test :refer :all]
-            [rp.util.retry :refer :all]))
+            [rp.util.retry :refer :all])
+  (:import (java.util.concurrent TimeoutException)))

 (defn build-collector []
   (atom {:counter      0
          :periods      []
          :last-attempt (System/currentTimeMillis)}))

+(defn update-collector [collector]
+  (swap! collector
+         (fn [{:keys [last-attempt counter] :as c}]
+           (let [now (System/currentTimeMillis)]
+             (-> (if (> counter 0)
+                   (update c :periods conj (- now last-attempt))
+                   c)
+                 (update :counter inc)
+                 (assoc :last-attempt now))))))
+
 (defn build-testfn [collector]
   (fn []
-    (swap! collector
-           (fn [{:keys [last-attempt counter] :as c}]
-             (let [now (System/currentTimeMillis)]
-               (-> (if (> counter 0)
-                     (update c :periods conj (- now last-attempt))
-                     c)
-                   (update :counter inc)
-                   (assoc :last-attempt now)))))
+    (update-collector collector)
     (throw (Exception. "Generic Exception"))))

 (defn test-collector [collector & {:keys [expected-attempts expected-delay timing-error-allowance]
@@ -54,9 +58,9 @@
         f (build-testfn collector)
         error-fn-call-count (atom 0)
         error-fn (fn [^Exception e]
-                  (swap! error-fn-call-count inc)
-                  (is (= (.getMessage e) "Generic Exception"))
-                  (is (instance? Exception e)))]
+                   (swap! error-fn-call-count inc)
+                   (is (= (.getMessage e) "Generic Exception"))
+                   (is (instance? Exception e)))]
     (try (with-retries f :error-fn error-fn)
          (catch Exception _))
     (is (= 5 @error-fn-call-count))))
@@ -66,9 +70,28 @@
         f (build-testfn collector)
         failure-fn-call-count (atom 0)
         failure-fn (fn [^Exception e]
-                   (swap! failure-fn-call-count inc)
-                   (is (= (.getMessage e) "Generic Exception"))
-                   (is (instance? Exception e)))]
+                     (swap! failure-fn-call-count inc)
+                     (is (= (.getMessage e) "Generic Exception"))
+                     (is (instance? Exception e)))]
     (try (with-retries f :failure-fn failure-fn)
          (catch Exception _))
     (is (= 1 @failure-fn-call-count))))
+
+(deftest test-errorless
+  (let [collector (build-collector)
+        f #(update-collector collector)]
+    (with-retries f)
+    (test-collector collector :expected-attempts 1)))
+
+(deftest test-limited-exceptions
+  (let [generic-collector (build-collector)
+        generic-f (build-testfn generic-collector)
+        specific-collector (build-collector)
+        specific-f (fn []
+                     (update-collector specific-collector)
+                     (throw (TimeoutException. "Generic Exception")))]
+    (is (thrown? Exception (with-retries generic-f :exceptions [TimeoutException])))
+    (try (with-retries specific-f :exceptions [TimeoutException])
+         (catch Exception _))
+    (test-collector generic-collector :expected-attempts 1)
+    (test-collector specific-collector)))


Nix done TODOs and chatter

Nix done TODOs and chatter

--- test/uruk/core_test.clj
+++ test/uruk/core_test.clj
@@ -71,11 +71,6 @@
     (is (= 6000
            (.getTimeoutMillis (request-options {:timeout-millis 6000}))))))

-;; TODO check that (request-options {:cache-result nil}) doesn't silently get ignored just because the answer might be false!
-
-
-(seq (TimeZone/getAvailableIDs))
-
 (deftest roundtrip-request-options
   (testing "All request options must be set as indicated"
     (is (= (let [req-opts (request-options {:timezone (TimeZone/getTimeZone "Pacific/Chuuk")
@@ -111,9 +106,6 @@
                  (with-open [sess (create-session db)]
                    (execute-xquery sess "\"hello world\"" {:options {:reuqest-time-limt 500}}))))))

-
-
-;; TODO a full end-to-end test of all request options

 ;;;; Session options
 (deftest default-session-options


(SERVER-1262) Reorganized OSS service vars to match PE implementation

This commit reorganizes the initialization of a few of the variables in
the master service implementation in order to more closely match how the
initialization is done in the current PE master service implementation.
This is being done to make it a bit easier to compare the two
implementations going forward.

--- src/clj/puppetlabs/services/master/master_service.clj
+++ src/clj/puppetlabs/services/master/master_service.clj
@@ -27,25 +27,48 @@
    [this context]
    (core/validate-memory-requirements!)
    (let [config (get-config)
+         route-config (core/get-master-route-config ::master-service config)
+         path (core/get-master-mount ::master-service route-config)
          certname (get-in config [:puppetserver :certname])
          localcacert (get-in config [:puppetserver :localcacert])
          puppet-version (get-in config [:puppetserver :puppet-version])
-         hostcrl (get-in config [:puppetserver :hostcrl])
          settings (ca/config->master-settings config)
+         metrics-server-id (get-in config [:metrics :server-id])
+         jruby-service (tk-services/get-service this :JRubyPuppetService)
+         use-legacy-auth-conf (get-in config
+                                      [:jruby-puppet :use-legacy-auth-conf]
+                                      true)
+         environment-class-cache-enabled (get-in config
+                                                 [:jruby-puppet
+                                                  :environment-class-cache-enabled]
+                                                 false)
+         ring-app (core/construct-root-routes puppet-version
+                                              use-legacy-auth-conf
+                                              jruby-service
+                                              get-code-content
+                                              handle-request
+                                              (get-auth-handler)
+                                              environment-class-cache-enabled)
+         routes (comidi/context path ring-app)
+         route-metadata (comidi/route-metadata routes)
+         comidi-handler (comidi/routes->handler routes)
+         registry (get-metrics-registry :puppetserver)
+         metrics (http-metrics/initialize-http-metrics!
+                  registry
+                  metrics-server-id
+                  route-metadata)
+         ring-handler (-> comidi-handler
+                          (http-metrics/wrap-with-request-metrics metrics)
+                          (comidi/wrap-with-route-metadata routes))
          product-name (or (get-in config [:product :name])
                           {:group-id    "puppetlabs"
                            :artifact-id "puppetserver"})
          checkin-interval-millis (* 1000 60 60 24) ; once per day
          update-server-url (get-in config [:product :update-server-url])
-         use-legacy-auth-conf (get-in config
-                                      [:jruby-puppet :use-legacy-auth-conf]
-                                      true)
-         jruby-service (tk-services/get-service this :JRubyPuppetService)
-         environment-class-cache-enabled (get-in config
-                                                 [:jruby-puppet
-                                                  :environment-class-cache-enabled]
-                                                 false)
-         check-for-updates (get-in config [:product :check-for-updates])]
+
+         check-for-updates (get-in config [:product :check-for-updates])
+         hostcrl (get-in config [:puppetserver :hostcrl])]
+
      (if (or (nil? check-for-updates) check-for-updates)
        (interspaced checkin-interval-millis
                     (fn [] (version-check/check-for-updates!
@@ -57,53 +80,31 @@
      (initialize-master-ssl! settings certname)

      (log/info (i18n/trs "Master Service adding ring handlers"))
-     (let [route-config (core/get-master-route-config ::master-service config)
-           path (core/get-master-mount ::master-service route-config)
-           ring-app (core/construct-root-routes puppet-version
-                                                use-legacy-auth-conf
-                                                jruby-service
-                                                get-code-content
-                                                handle-request
-                                                (get-auth-handler)
-                                                environment-class-cache-enabled)
-           routes (comidi/context path ring-app)
-           route-metadata (comidi/route-metadata routes)
-           comidi-handler (comidi/routes->handler routes)
-           registry (get-metrics-registry :puppetserver)
-           metrics-server-id (get-in config [:metrics :server-id])
-           metrics (http-metrics/initialize-http-metrics!
-                    registry
-                    metrics-server-id
-                    route-metadata)
-           ring-handler (-> comidi-handler
-                            (http-metrics/wrap-with-request-metrics metrics)
-                            (comidi/wrap-with-route-metadata routes))]

-       ;; if the webrouting config uses the old-style config where
-       ;; there is a single key with a route-id, we need to deal with that
-       ;; for backward compat.  We have a hard-coded assumption that this route-id
-       ;; must be `master-routes`.  In Puppet Server 2.0, we also supported a
-       ;; key called `invalid-in-puppet-4` in the same route config, even though
-       ;; that key is no longer used for Puppet Server 2.1 and later.  We
-       ;; should be able to remove this hack as soon as we are able to get rid
-       ;; of the legacy routes.
-       (if (and (map? route-config)
-                (contains? route-config :master-routes))
-         (add-ring-handler this
-                           ring-handler
-                           {:route-id :master-routes
-                            :normalize-request-uri true})
-         (add-ring-handler this
-                           ring-handler
-                           {:normalize-request-uri true}))
+     ;; if the webrouting config uses the old-style config where
+     ;; there is a single key with a route-id, we need to deal with that
+     ;; for backward compat.  We have a hard-coded assumption that this route-id
+     ;; must be `master-routes`.  In Puppet Server 2.0, we also supported a
+     ;; key called `invalid-in-puppet-4` in the same route config, even though
+     ;; that key is no longer used for Puppet Server 2.1 and later.  We
+     ;; should be able to remove this hack as soon as we are able to get rid
+     ;; of the legacy routes.
+     (if (and (map? route-config)
+              (contains? route-config :master-routes))
+       (add-ring-handler this
+                         ring-handler
+                         {:route-id :master-routes
+                          :normalize-request-uri true})
+       (add-ring-handler this
+                         ring-handler
+                         {:normalize-request-uri true}))

-       (register-status
-        "master"
-        (status-core/get-artifact-version "puppetlabs" "puppetserver")
-        1
-        (partial core/v1-status metrics))
-
-       (assoc context :http-metrics metrics))))
+     (register-status
+      "master"
+      (status-core/get-artifact-version "puppetlabs" "puppetserver")
+      1
+      (partial core/v1-status metrics))
+     (assoc context :http-metrics metrics)))
   (start
     [this context]
     (log/info (i18n/trs "Puppet Server has successfully started and is now ready to handle requests"))


Fixes show-panel function (#70)

Fixes show-panel function (#70)

--- src/leiningen/new/re_frame/src/cljs/views_routes.cljs
+++ src/leiningen/new/re_frame/src/cljs/views_routes.cljs
@@ -28,7 +28,7 @@
     [:div]))

 (defn show-panel [panel-name]
-  [panels panel-name])
+  (panels panel-name))

 (defn main-panel []
   (let [active-panel (re-frame/subscribe [::subs/active-panel])]


Confirm abandonded fill-queues kill themselves

--- src/test/clojure/clojure/data/xml/test_fill_queue.clj
+++ src/test/clojure/clojure/data/xml/test_fill_queue.clj
@@ -54,3 +54,17 @@
   (is (= (range 0) (take 0 (fill-queue (fn [f] (doseq [i (just 0)] (f i)))))))
   (is (= (range 1) (take 1 (fill-queue (fn [f] (doseq [i (just 1)] (f i)))))))
   (is (= (range 5) (take 5 (fill-queue (fn [f] (doseq [i (just 5)] (f i))))))))
+
+(deftest detect-abandon
+  (let [abandoned (promise)]
+    (fill-queue
+      (fn [fill]
+        (try
+          (fill 1)
+          (fill 2)
+          (catch Exception e
+            (deliver abandoned (.getMessage e))))
+        (deliver abandoned false))
+      :queue-size 1)
+    (System/gc)
+    (is (= @abandoned "abandoned"))))


Cleanup Namespace User

Cleanup Namespace User

--- dev/user.clj
+++ dev/user.clj
@@ -1,15 +1,12 @@
 (ns user
   (:use plumbing.core)
   (:use criterium.core)
-  (:require [clojure.core.reducers :as r]
-            [clojure.pprint :refer [pprint pp]]
+  (:require [clojure.pprint :refer [pprint pp]]
             [clojure.repl :refer :all]
             [clojure.tools.namespace.repl :refer [refresh]]
             [datomic.api :as d]
             [system]
-            [lens.api :as api]
-            [lens.schema :as schema]
-            [lens.util :as util]))
+            [lens.schema :as schema]))

 (def system nil)

@@ -31,11 +28,6 @@
   (stop)
   (refresh :after 'user/startup))

-;; Starting and Resetting the Server
-(comment
-  (startup)
-  (reset))
-
 (defn create-database []
   (d/create-database (:db-uri system)))

@@ -45,36 +37,20 @@
 (defn load-schema []
   (schema/load-schema (connect)))

-(defn workbooks-by-user [db]
-  (->> (api/all-users db)
-       (r/map #(vector (:user/id %) (mapv :workbook/name (api/private-workbooks %))))
-       (into [])))
-
-(defn num-of-versions [db]
-  (->> (api/all-versions db)
-       (r/map (constantly 1))
-       (reduce +)))
-
-(defn num-of-queries [db]
-  (->> (api/all-queries db)
-       (r/map (constantly 1))
-       (reduce +)))
-
+;; Init Development
 (comment
+  (startup)
   (create-database)
   (load-schema)
+  )
+
+;; Reset after making changes
+(comment
+  (reset)
+  )
+
+;; Connection and Database in the REPL
+(comment
   (def conn (connect))
-  (api/create-standard-workbook conn)
-  (pst)
-  (d/touch (first (api/queries (d/entity (d/db conn) 17592186045434))))
-
-  (let [db (d/db conn)]
-    (->> (d/q '[:find [?w ...] :where [?w :workbook/id]] db)
-         (map #(d/entity db %))
-         (map :workbook/id)))
-
-  (api/workbook (d/db conn) "")
-
-  @(d/transact conn [[:workbook.fn/create (d/tempid :db.part/user)]])
-
+  (def db (d/db conn))
   )


Fix require formatting

Fix require formatting

--- src/braid/client/ui/styles/pages/group_explore.cljs
+++ src/braid/client/ui/styles/pages/group_explore.cljs
@@ -1,7 +1,8 @@
 (ns braid.client.ui.styles.pages.group-explore
-  (:require [garden.units :refer [rem em px]]
-            [braid.client.ui.styles.mixins :as mixins]
-            [braid.client.ui.styles.vars :as vars]))
+  (:require
+    [garden.units :refer [rem em px]]
+    [braid.client.ui.styles.mixins :as mixins]
+    [braid.client.ui.styles.vars :as vars]))

 (def group-explore-page
   [:.page.group-explore


don't export null values

don't export null values

--- src/cljs/flow_editor/views/modals/export_graph.cljs
+++ src/cljs/flow_editor/views/modals/export_graph.cljs
@@ -8,7 +8,10 @@
   []
   (let [graph (subscribe [:graph])]
     (fn []
-      (let [graph-code (r/atom (.stringify js/JSON (clj->js @graph) nil "    "))]
+      (let [replacer (fn [k v] (if (nil? v)
+                                 js/undefined
+                                 v))
+            graph-code (r/atom (.stringify js/JSON (clj->js @graph) replacer "    "))]
         [modal-panel
          :child [v-box
                  :children [[title


fix local nicknames

fix local nicknames

--- src/status_im/ui/screens/profile/contact/views.cljs
+++ src/status_im/ui/screens/profile/contact/views.cljs
@@ -89,12 +89,14 @@
        :accessory-text      (or (:nickname names) (i18n/label :t/none))
        :on-press            #(re-frame/dispatch [:navigate-to :nickname])
        :chevron             true}]
-     [quo/list-item
-      {:title               (i18n/label :t/mute)
-       :active               muted?
-       :accessibility-label :mute-chat
-       :on-press            #(re-frame/dispatch [::chat.models/mute-chat-toggled public-key (not muted?)])
-       :accessory           :switch}]]))
+     ;; Mute chat is only supported on ios for now
+     (when platform/ios?
+       [quo/list-item
+        {:title               (i18n/label :t/mute)
+         :active               muted?
+         :accessibility-label :mute-chat
+         :on-press            #(re-frame/dispatch [::chat.models/mute-chat-toggled public-key (not muted?)])
+         :accessory           :switch}])]))

 (defn chat-settings [contact]
   [react/view
@@ -205,8 +207,5 @@
                                :on-press            action}]))]
           [react/view styles/contact-profile-details-container
            [profile-details contact]
-          ;; Mute chat is only supported on ios for now
-           (when platform/ios?
-             [react/view {}
-              [chat-settings contact]])]
+           [chat-settings contact]]
           [block-contact-action contact]]]))))


minor

minor

--- storm-core/src/clj/backtype/storm/daemon/nimbus.clj
+++ storm-core/src/clj/backtype/storm/daemon/nimbus.clj
@@ -2159,7 +2159,7 @@
               bases (topology-bases storm-cluster-state)
               assigned-topology-ids (.assignments storm-cluster-state nil)
               user-group-match-fn (fn [topo-id user conf]
-                                    (let [topology-conf (try-read-storm-conf conf topo-id)
+                                    (let [topology-conf (try-read-storm-conf conf topo-id (:blob-store nimbus))
                                           groups (get-topo-logs-groups topology-conf)]
                                       (or (nil? user)
                                           (some #(= % user) admin-users)


Better error handling for failed exports

--- reports/src/reports/scheduler.clj
+++ reports/src/reports/scheduler.clj
@@ -1,6 +1,7 @@
 (ns reports.scheduler
   (:refer-clojure :exclude [key])
-  (:import [org.quartz JobExecutionContext Scheduler])
+  (:import [org.quartz JobExecutionContext Scheduler]
+           java.io.File)
   (:require [clojure.string :as string :only (split join)]
             [clojurewerkz.quartzite [conversion :as conversion]
                                     [jobs :as jobs]
@@ -10,10 +11,22 @@

 (def cache (ref {}))

+(defn- valid-report? [report-path]
+  "Returns if a File is a valid one (exists and non zero length)"
+  (if (and (.exists ^File report-path)
+           (> 0 (.length ^File report-path)))
+    true false))
+
+(defn- get-path [report-file]
+  "Returns the path to the report or `INVALID_PATH` if not valid File"
+  (if (valid-report? report-file)
+    (string/join "/" (take-last 2 (string/split (.getAbsolutePath ^File report-file) #"/")))
+    "INVALID_PATH"))
+
 (jobs/defjob ExportJob [job-data]
   (let [{:strs [baseURL exportType surveyId opts reportId]} (conversion/from-job-data job-data)
         report (export-report exportType baseURL surveyId opts)
-        path (string/join "/" (take-last 2 (string/split (.getAbsolutePath report) #"/")))]
+        path (get-path report)]
     (dosync
       (alter cache conj {{:id reportId
                           :surveyId surveyId
@@ -62,13 +75,6 @@
     (if (seq found)
       (@cache (nth found 0)))))

-(defn generate-report [params]
-  "Returns the cached report for the given parameters, or schedules the report for generation"
-  (if-let [file (get-report-by-id (report-id params))]
-   {"status" "OK"
-    "file" file}
-   (schedule-job params)))
-
 (defn invalidate-cache [params]
   "Invalidates (removes) a given file from the cache"
   (let [baseURL (params "baseURL")]
@@ -77,3 +83,16 @@
         (doseq [key (keys @cache) :when (and (= (:baseURL key) baseURL) (= (str sid) (:surveyId key)))]
         (alter cache dissoc key))))
     "OK"))
+
+(defn generate-report [params]
+  "Returns the cached report for the given parameters, or schedules the report for generation"
+  (if-let [file (get-report-by-id (report-id params))]
+    (if (= file "INVALID_PATH")
+      (do
+        (invalidate-cache {"baseURL" (params "baseURL")
+                           "surveyIds" [(params "surveyId")]})
+        {"status" "ERROR"
+         "message" "_error_generating_report"})
+      {"status" "OK"
+       "file" file})
+    (schedule-job params)))


Dave/Stef: oops fix serving of static resources


response-headers endpoint

response-headers endpoint


CMR-4907 Updates umm-c gen to support dependencies.

--- umm-spec-lib/src/cmr/umm_spec/test/umm_generators.clj
+++ umm-spec-lib/src/cmr/umm_spec/test/umm_generators.clj
@@ -34,12 +34,23 @@
       (throw (Exception. (format "The fields [%s] are not supported by generators with schema type [%s]"
                                  (pr-str unexpected-fields) (pr-str schema-type)))))))

+(defn- lacks-dependency?
+  "Checks if property has a dependency, if it has no dependency returns false.
+   If it does then it checks whether that dependency is selected.
+   Returns false if dependency is in selected properties, true if it is not."
+  [property dependencies selected-properties]
+  (let [dependency (get dependencies property)]
+    (cond
+      (empty? dependency) false
+      (some #{dependency} selected-properties) false
+      :else true)))
+
 (defn- object-like-schema-type->generator
   "Takes an object-like schema type and generates a generator. By \"object-like\" it means a map
   with keys properties, required, and additionalProperties. This is used to handle a normal object
   with properties or an object which uses oneOf to specify between lists of properties."
   [schema type-name schema-type]
-  (rejected-unexpected-fields #{:properties :required :additionalProperties :not :allOf} schema-type)
+  (rejected-unexpected-fields #{:properties :required :additionalProperties :dependencies :not :allOf} schema-type)
   (let [constructor-fn (if type-name
                          (record-gen/schema-type-constructor schema type-name)
                          identity)
@@ -52,7 +63,7 @@
         properties (if (= 0 (rand-int 2))
                      (dissoc properties :ComposedOf)
                      properties)
-
+        dependencies (:dependencies schema-type)
         ;; Create a map of property keys to generators for those properties
         prop-gens (into {} (for [[k subtype] properties]
                              [k (schema-type->generator schema nil subtype)]))
@@ -66,6 +77,11 @@
                 :let [selected-properties (concat required-properties
                                                   (subvec optional-properties
                                                           0 num-optional-fields))
+                      ;; Check for dependencies, remove properties that lack their dependencies
+                      selected-properties (if (not (empty? dependencies))
+                                            (remove #(lacks-dependency? % dependencies selected-properties)
+                                                    selected-properties)
+                                            selected-properties)
                       ;; Create a map of property names to generators
                       selected-prop-gens (select-keys prop-gens selected-properties)]
                 ;; Generate a hash map containing the properties
@@ -132,7 +148,7 @@
            gen/one-of)
       (object-like-schema-type->generator
        schema type-name
-       (select-keys schema-type [:properties :required :additionalProperties])))))
+       (select-keys schema-type [:properties :required :additionalProperties :dependencies])))))

 (defmethod schema-type->generator "oneOf"
   [schema type-name schema-type]


Avoid the "gilardi scenario"

Avoid the "gilardi scenario"

http://technomancy.us/143

--- examples/cake-midje/tasks.clj
+++ examples/cake-midje/tasks.clj
@@ -6,12 +6,10 @@
 (deftask midje
   "Run midje and clojure.test tests"
   (bake (:use [bake.core :only [with-context]])
+	(:require [clojure test string])
 	[namespaces (concat (find-namespaces-in-dir (java.io.File. "test"))
 			    (find-namespaces-in-dir (java.io.File. "src")))]
 	(with-context :test
-       	  (require 'clojure.test)
-       	  (require 'clojure.string)
-
        	  ;; This turns off "Testing ...." lines, which I hate, especially
        	  ;; when there's no failure output.
        	  (defmethod clojure.test/report :begin-test-ns [m])
@@ -48,8 +46,6 @@

        (when (> (+ (:fail clojure-test-result) (:error clojure-test-result))
        		0)
-       	 ;; For some reason, empty lines are swallowed, so I use >>> to
-         ;; demarcate sections.
        	 (println ">>> Output from clojure.test tests:")
        	 (dorun (map println (drop-last 2 clojure-test-output))))


Upgrade to Clojure 1.7 and add a dep for Reagent.

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

   :source-paths ["src-server"]

-  :dependencies [[org.clojure/clojure "1.7.0-RC2"]
+  :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.clojure/clojurescript "0.0-3308"]
                  [com.ksmpartners/sql-file "0.1.0"]
                  [ring/ring-jetty-adapter "1.3.2"]
@@ -18,6 +18,7 @@
                  [cljs-ajax "0.3.11"]
                  [org.clojure/core.async "0.1.346.0-17112a-alpha"]
                  [org.omcljs/om "0.8.8"]
+                 [reagent "0.5.0"]
                  [com.andrewmcveigh/cljs-time "0.3.5"]
                  [metlog-common "0.1.0-SNAPSHOT"]]


Minor cleanup of postgres stuff.

Minor cleanup of postgres stuff.

--- clj_record/util.clj
+++ clj_record/util.clj
@@ -18,10 +18,8 @@
     (= subprotocol "derby")
       "VALUES IDENTITY_VAL_LOCAL()"
     (= subprotocol "postgresql")
-    ;; The assumption is that the column name for the id key is always 'id'
       (str "SELECT currval(pg_get_serial_sequence('" table-name "','id'))")
     (= subprotocol "mysql")
       "SELECT LAST_INSERT_ID()"
     :else
       (throw (Exception. (str "Unrecognized db-spec: " db-spec)))))
-


clearing

clearing


Move explanation to docstrings

Move explanation to docstrings

--- exercises/beer-song/src/beer_song.clj
+++ exercises/beer-song/src/beer_song.clj
@@ -1,9 +1,11 @@
 (ns beer-song)
-
-;; implement two functions: one gives you a single verse, one gives you the entire song or a part of it
-
-(defn verse [n])
+
+(defn verse
+ "Returns the nth verse of the song."
+ [n])

 (defn sing
-  ([from])
-  ([from to])
+  "Given a start and an optional end, returns all verses in this interval. If
+  end is not given, the whole song from start is sung."
+  ([start])
+  ([start end]))


might as well fix middle-click and cmd click while I'm in here

--- frontend/history.cljs
+++ frontend/history.cljs
@@ -68,25 +68,28 @@
 (defn setup-link-dispatcher! [history-imp top-level-node]
   (let [dom-helper (goog.dom.DomHelper.)]
     (events/listen top-level-node "click"
-                   #(let [-target (.. % -target)
-                          target (if (= (.-tagName -target) "A")
-                                   -target
-                                   (.getAncestorByTagNameAndClass dom-helper -target "A"))
-                          location (when target (str (.-pathname target) (.-search target) (.-hash target)))
-                          new-token (when (seq location) (subs location 1 ))]
-                      (when (and (seq location)
-                                 (not= "_blank" (.-target target))
-                                 (= (.. js/window -location -hostname)
-                                    (.-hostname target)))
-                        (.stopPropagation %)
-                        (.preventDefault %)
-                        (if (and (route-fragment location)
-                                 (path-matches? (.getToken history-imp) new-token))
-                          (do (utils/mlog "scrolling to hash for" location)
-                              ;; don't break the back button
-                              (.replaceToken history-imp new-token))
-                          (do (utils/mlog "navigating to" location)
-                              (.setToken history-imp new-token))))))))
+                   #(when (and (.isMouseActionButton %) ; ignore middle clicks
+                               (not (.-metaKey %))) ; ignore cmd+click
+                      (let [-target (.. % -target)
+                            _ (set! js/window.teste %)
+                            target (if (= (.-tagName -target) "A")
+                                     -target
+                                     (.getAncestorByTagNameAndClass dom-helper -target "A"))
+                            location (when target (str (.-pathname target) (.-search target) (.-hash target)))
+                            new-token (when (seq location) (subs location 1 ))]
+                        (when (and (seq location)
+                                   (not= "_blank" (.-target target))
+                                   (= (.. js/window -location -hostname)
+                                      (.-hostname target)))
+                          (.stopPropagation %)
+                          (.preventDefault %)
+                          (if (and (route-fragment location)
+                                   (path-matches? (.getToken history-imp) new-token))
+                            (do (utils/mlog "scrolling to hash for" location)
+                                ;; don't break the back button
+                                (.replaceToken history-imp new-token))
+                            (do (utils/mlog "navigating to" location)
+                                (.setToken history-imp new-token)))))))))

 (defn new-history-imp [top-level-node]
   ;; need a history element, or goog will overwrite the entire dom