Update content.cljs

Update content.cljs

CP changes:
1. Updated first sentence of background Q1 to be more accurate with numbers & UK & Ireland.
2. Updated last sentence of 2nd background FAQ to include Ireland
3. tidied up Q3 of background to be less repetitive.
4. tidied up Q4 of background, inlcuding making clear difference between E&W and Scotland & Ireland.
5. massively tidied up answer to first Q in limitations. tried to insert a new para break, hopefully successfully.
6. tidied up answer to Q2 , Q3, Q4 in limitations
7. tided up q5 in limitations to be clear we are talking about 30 day survival after surgery (not first month of life) and some typos.

--- src/prais2/content.cljs
+++ src/prais2/content.cljs
@@ -326,7 +326,7 @@
                     :faqs    [{:title    "Why do some children need heart surgery?"
                                :glossary []
                                :body     [:div
-                                          [:p "Each year in the UK, about 5000-6000 babies are born with a heart defect (called congenital heart disease). Congenital heart disease covers a wide range of problems from the relatively minor (such as a small hole in the heart) to more severe conditions where a child needs specialist hospital care. About half of all children born with a heart defect will need heart surgery at some stage in their childhood. Children can also develop problems with their heart as they grow up which require hospital care (called acquired heart disease). "]
+                                          [:p "About 6500 to 7500 babies are born with a heart defect (called congenital heart disease) in the UK and Ireland every year. Congenital heart disease covers a wide range of problems from the relatively minor (such as a small hole in the heart) to more severe conditions where a child needs specialist hospital care. About half of all children born with a heart defect will need heart surgery at some stage in their childhood. Children can also develop problems with their heart as they grow up which require hospital care (called acquired heart disease). "]
                                           [:p "Read more about "
                                            [:a {:href "http://www.chfed.org.uk/how-we-help/information-service/heart-conditions/"} "different heart conditions"]
                                            " and caring for children with heart conditions on the "
@@ -345,7 +345,7 @@
                                                                                :margin-right "20px"}
                                                                                :src   "assets/bristol.png"}] "In the 1990s, problems were found with the standard of care for children having heart surgery at the Bristol Royal Infirmary. The proportion of children who died after surgery at Bristol was much higher than other UK hospitals. There was a formal inquiry into what happened (" [:a {:href "http://webarchive.nationalarchives.gov.uk/20090811143745/http:/www.bristol-inquiry.org.uk/final_report/the_report.pdf"} "The Bristol Inquiry 2001"] "), which led to a number of changes, including a new compulsory national reporting system so that the proportion of children surviving to 30 days after surgery for all hospitals have been published every year since 2001. Results where there is some evidence that survival rates are lower than expected are checked further by the hospital and the national audit body (NICOR)."]

-                                              [:p "The UK now has one of the strongest monitoring programmes in the world. Since reporting started, " [:a {:href "http://www.bbc.co.uk/news/health-32162803"} "survival rates have been improving"] " and now " [:strong "over 97% of children survive to at least one month after surgery."]]]
+                                              [:p "The UK and Ireland now have one of the strongest monitoring programmes in the world. Since reporting started, " [:a {:href "http://www.bbc.co.uk/news/health-32162803"} "survival rates have been improving"] " and now " [:strong "over 97% of children survive to at least one month after surgery."]]]
                                }

                               {:title        "How are survival rates monitored?"
@@ -357,21 +357,21 @@
                                                     {:style {:width        "100px"
                                                              :margin-right "20px"}
                                                      :src   "assets/nicor.png"}]]
-                                               "Until 2013, the national audit body " [:a {:href "http://www.ucl.ac.uk/nicor/patients"} "NICOR"] " only published survival rates for certain types of procedure because there was no clear way to put overall survival rates for each hospital into context (see " [:a {:href "?#/intro"} "What, Why and How?"] "). But " [:a {:href "https://www.ucl.ac.uk/operational-research/AnalysisTools/PRAiS"} "researchers"] " have now made this possible by creating a statistical formula. Using this, NICOR has published overall survival rates along with the predicted range (dark blue bar) and extended predicted range (light blue bar) for survival for each hospital since 2013 (see " [:a {:href "?#/intro"} "What, Why and How?"] ").  The predicted range is the range in which we expect to see each hospital’s survival rate the majority of the time (19 times out of 20 for the dark blue bar, 998 times out of 1000 for the light blue bar). "
+                                               "Until 2013, the national audit body " [:a {:href "http://www.ucl.ac.uk/nicor/patients"} "NICOR"] " only published survival rates for certain types of procedure because there was no clear way to put overall survival rates for each hospital into context (see " [:a {:href "?#/intro"} "What, Why and How?"] "). But " [:a {:href "https://www.ucl.ac.uk/operational-research/AnalysisTools/PRAiS"} "researchers"] " have now made this possible by creating a statistical formula. Using this formula, NICOR has published overall survival rates along with the predicted range and extended predicted range for survival over the previous 3 years for each hospital since 2013 (see " [:a {:href "?#/intro"} "What, Why and How?"] ").  The predicted range is the range in which we expect to see each hospital’s survival rate the majority of the time (19 times out of 20 for the dark blue bar, 998 times out of 1000 for the light blue bar). "

                                                ]
                                               [:p "The predicted range is calculated using the " [:strong "same"] " statistical formula for all hospitals and this prediction is " [:strong "not"] " influenced by what the survival rate at a hospital actually was."]
-                                              [:p "Each year, NICOR publishes a report of survival over the previous 3 years for each hospital in the UK and Ireland. It reports the percentage of children surviving for about 40 common surgical procedures and, since 2013, has been able to also include overall survival rate for all heart operations at each hospital along with that hospital’s predicted range for survival. Note that operations that occur within 30 days of each other are treated as a single operation when reporting overall survival."]]
+                                              [:p "Operations that occur within 30 days of each other are treated as a single operation when reporting overall survival."]]

                                }

                               {:title        "Where is this data from?"
-                               :short-answer "The data on what was wrong with each child’s heart and their operation comes from the hospital’s records, and the data on whether a child survived to 30 days comes from both the hospital and the Office of National Statistics."
+                               :short-answer "The data on each child’s operation and what was wrong with their heart comes from the hospital’s records. The data on whether a child survived to 30 days after their operation comes from both the hospital and the Office of National Statistics."
                                :glossary     []
                                :body         [:div
-                                              [:p "Each hospital must collect data on every surgery or intervention carried out on a child for heart problems. Every three months, hospitals must submit this data to the national audit body, " [:a {:href "http://www.ucl.ac.uk/nicorum/patients"} "NICOR "] "(The National Institute for Cardiovascular Outcomes Research). NICOR sets out exactly what data is collected and each hospital undergoes independent checks of the quality of their submitted data. NICOR also reports to the UK Department of Health, the Care Quality Commission (CQC) and other NHS regulatory bodies."]
-
-                                              [:p "NICOR tracks the survival of these children by linking to the national register of deaths using patients’ NHS number and also from hospital records. NICOR statisticians then analyse the data every year to enable hospitals and healthcare improvement bodies to monitor and improve the quality of care and outcomes of children who need heart surgery."]
+                                              [:p "Each hospital in the UK and Ireland must collect data on every surgery or intervention carried out on a child for heart problems. Every three months, hospitals must submit this data to the national audit body, " [:a {:href "http://www.ucl.ac.uk/nicorum/patients"} "NICOR "] "(The National Institute for Cardiovascular Outcomes Research). NICOR sets out exactly what data is collected and each hospital undergoes independent checks of the quality of their submitted data. NICOR also reports to the UK Department of Health, the Care Quality Commission (CQC) and other NHS regulatory bodies."]
+
+                                              [:p "NICOR tracks the survival of these children by linking to the national register of deaths using patients’ NHS number (in England and Wales) and also from hospital records."]

                                               #_[:p "If a hospital’s survival outcomes are below a certain threshold, NICOR and the hospital together examine the data and the individual cases to understand whether any further action needs to be taken. In extreme cases, a hospital might stop doing surgery while action is taken to improve the service. You can read more this process on " [:a {:href "https://nicor4.nicor.org.uk/CHD/an_paeds.nsf/vwContent/Information%20for%20Patients?Opendocument"} "NICOR’s patient information pages"] " and in our FAQ section. In this website, we explain how survival statistics are used to support this decision making."]]
                                }
@@ -511,42 +511,44 @@
                                :short-answer "Yes – a child’s chances of survival can never be completely captured in a single formula. "
                                :glossary     [:risk-adjustment]
                                :body         [:div
-                                              [:p "Yes there are. Taking the different risks for each child into account in a formula (called 'risk adjustment') allows for fairer assessment of a hospital’s survival rate by putting into context (see also the " [:a {:href "?#/intro"} "What, why, how?"] " section),  but it still cannot make it completely fair. It is always ‘partial’ as there will always be information about important risk factors that are not routinely collected and so cannot be captured by risk adjustment methods (see also 2.3). Any statistical formula has to be developed on existing data and so the data will be typically at least a year out of date. So risk adjustment cannot adjust or account for future changes to the way data is collected (for instance more complete data) or new methods of surgical or medical management. Often, these statistical formulas are updated every few years with more up to date (in 2016, we updated PRAiS for the third time). "]]}
+                                              [:p "Yes there are. While taking into account the complexity of each child’s medical problems in a formula allows for fairer assessment of a hospital’s survival rate, it still cannot make it completely fair. There will always be information about important factors that affect a child’s chances of survival that are not routinely collected for national bodies and so cannot be captured by a formula that was developed using national data. "]
+                                              [:p "Any statistical formula has to be developed on existing data and so the data will be typically at least a year out of date. So risk adjustment cannot adjust or account for future changes to the way data is collected (for instance more complete data) or new methods of surgical or medical management. Often, these statistical formulas are updated every few years with more up to date (in 2016, we updated PRAiS for the third time). "]]}
+

                               {:title        "How reliable are the data?"
                                :short-answer "The data are of very high quality and some of the best in the world."
                                :glossary     []
                                :body         [:div
-                                              [:p "The data come from the National Institute for Cardiovascular Outcomes Research (UCL NICOR) which collects national data for the National Heart Disease Audits. All hospitals performing heart surgery in children have to submit their data in a standard format to NICOR. All hospitals are independently audited each year as part of a data validation process (to check the quality of the data submitted)."]
-
-                                              [:p "So, the data are of high quality. While no large dataset is perfect (e.g., it is inevitable that a few records will not be 100% accurate), this dataset is among the most detailed and complete in the world for children’s heart surgery."]]
+                                              [:p "The data come from the National Institute for Cardiovascular Outcomes Research (NICOR) which collects national data for the UK National Heart Disease Audits. All hospitals in the UK and Ireland performing heart surgery in children have to submit their data in a standard format to NICOR. All hospitals are independently audited each year as part of a data validation process (to check the quality of the data submitted) to ensure that the data are of high quality."]
+
+                                              [:p "While no large dataset is perfect (it is inevitable that a few records will not be 100% accurate), this dataset is among the most detailed and complete in the world for children’s heart surgery."]]
                                }

                               {:title        "What are the limitations of the data?"
                                :short-answer "These data do not capture all the potential medical problems a child has and only represent a snapshot of survival outcomes. They cannot capture the full picture of the quality of care provided by a hospital."
                                :glossary     [:unforeseen-factors]
                                :body         [:div
-                                              [:p "Apart from occasional inaccuracies in the data, there are other limits to what the data can tell us about surgery outcomes. There are risk factors not routinely collected (for instance the size of a hole in the heart), which means these cannot be accounted for in our statistical formula. "]
-
-                                              [:p "These data are also snapshots in time of what happened at each specialist hospital. A number of particularly challenging patients one year (in ways not accounted for in our prediction) or a run of unforeseen factors could cause a very good hospital to have worse outcomes than predicted. So we need to be careful about reading too much into any single time period."]]
+
+
+                                              [:p "Apart from occasional inaccuracies in the data, there are other limits to what the data can tell us about surgery outcomes. There are factors that affect a child’s chances of survival that are not routinely collected for national bodies and so cannot be captured by a formula that was developed using national data. These data are also snapshots in time of what happened at each hospital. A run of unforeseen factors could cause a very good hospital to have worse outcomes than predicted, so we need to be careful about reading too much into results from any single time period."]]
                                }

                               {:title        "What about longer term survival and quality of life?"
-                               :short-answer "At the moment these are not reported. There is active research underway to work how to report long term survival and quality of life for children after heart surgery but it will be some years before this becomes part of routine national audit."
+                               :short-answer "At the moment these are not reported. There is active research underway to work out how to report long term survival and quality of life for children after heart surgery but it will be some years before this becomes part of routine national audit."
                                :glossary     []
                                :body         [:div
-                                              [:p "National audit data at the moment (as of 2016) only looks at what happens shortly after surgery. These data cannot tell us about longer term (e.g. 90 day, 1 year or 5 year) survival, or other outcomes such as post-surgery complication rates or the impact of surgery on the child or their family. There is a lot of " [:a {:href "http://www.gosh.nhs.uk/medical-information/clinical-specialties/cardiothoracic-surgery-information-parents-and-visitors/research/complications-after-heart-surgery-children"} "active research"] " going right now (due to finish around 2018) investigating how to capture, interpret and publish longer term survival and complication rates so hopefully this information will be available in the next 5 years."]
+                                              [:p "Currently (as of 2016), National audit only monitors what happens shortly after surgery. These data cannot tell us about longer term (e.g. 5 year) survival, or other outcomes such as post-surgery complication rates or the impact of surgery on the child or their family. There is a lot of " [:a {:href "http://www.gosh.nhs.uk/medical-information/clinical-specialties/cardiothoracic-surgery-information-parents-and-visitors/research/complications-after-heart-surgery-children"} "active research"] " going right now (due to finish around 2018) investigating how to capture, interpret and publish longer term survival and complication rates so hopefully this information will be available in the next 5 years."]

                                               [:p "The data also can’t tell us about how or why a hospital achieved the recorded results, so it cannot, by itself, tell us whether one hospital offers better or worse quality care than any other. These data cannot tell you what the results are likely to be next year. It also cannot tell us anything about what happens to children who never get operated on for whatever reason, since data on these children is not currently submitted to national audit. "]]
                                }

-                              {:title        "Why is survival to 30 days used as the main survival measure?"
-                               :short-answer "Survival to 30 days is a more objective measure than survival to hospital discharge, since different types of hospital have different treatment pathways for very sick patients (for instance some will transfer patients to another hospital or some to local palliative care). "
+                              {:title        "Why is survival to 30 days after surgery used as the main survival measure?"
+                               :short-answer "Survival to 30 days after surgery is a more objective measure than survival to hospital discharge, since different types of hospital have different treatment pathways for very sick patients (for instance some will transfer patients to another hospital or some to local palliative care). "
                                :glossary     []
                                :body         [:div
-                                              [:p "Two very common measures used for looking at a hospital’s outcomes are “survival at discharge from hospital” and “30 day survival”. Survival at discharge is often used in other contexts as it’s the easiest to obtain – it is included within standard hospital records. However, survival to discharge does depend on the treatment and discharge pathways at that hospital. For instance, some hospitals will transfer very sick patients to other, more specialised hospitalised, meaning that more patients will be alive at discharge from that hospital than the specialised hospital. Some hospitals might have close links with local palliative care services and so might discharge patients to these services if further treatment is considered unavailing. Again, such hospitals with have more patients alive at discharge compared to a hospital that look after the sickest patients until they die. "]
-                                              [:p "Therefore, if it is available, “30 day survival” is considered a more objective and preferable statistic than “survival to hospital discharge”, since it does not depend on the hospital’s discharge pathways."]
-                                              [:p "While longer term survival is extremely important (see [link to longer term survival FAQ]), 30-day survival was initially chosen as it more straightforward to link this outcome to a child’s surgery and post-operative care than a longer range survival  period which might, for instance, incorporate further treatment at different hospitals. The other important aspect of monitoring 30-day survival, particularly within hospitals, is that any worrying outcomes can be investigated very quickly since the survival outcomes are available (locally) within 30 days of a child’s operation."]]}
+                                              [:p "Two very common measures used for looking at a hospital’s outcomes are “survival at discharge from hospital” and “30 day survival” after an operation. Survival at discharge is often used in other contexts as it’s the easiest to obtain – it is included within standard hospital records. However, survival to discharge does depend on the discharge procedures at that hospital. For instance, some hospitals will transfer very sick patients to other, more specialised hospitals, meaning that more patients will be alive at discharge from that hospital than the specialised hospital. Some hospitals might have close links with local palliative care services and so might discharge patients to these services if further treatment is considered unavailing. Again, such hospitals with have more patients alive at discharge compared to a hospital that look after the sickest patients until they die. "]
+                                              [:p "Therefore, if it is available, “30 day survival” after surgery is considered a more objective and preferable statistic than “survival to hospital discharge”, since it does not depend on the hospital’s discharge procedures."]
+                                              [:p "While longer term survival is extremely important (see [link to longer term survival FAQ]), 30-day survival post surgery was initially chosen as it is more straightforward to link this outcome to a child’s surgery and post-operative care than a longer range survival  period which might, for instance, incorporate further treatment at different hospitals. The other important aspect of monitoring 30-day survival, particularly within hospitals, is that any worrying outcomes can be investigated very quickly since the survival outcomes are available (locally) within 30 days of a child’s operation."]]}
                               ]
                     }


record status and statusClass metrics

record status and statusClass metrics

--- src/prometheus/core.clj
+++ src/prometheus/core.clj
@@ -1,4 +1,6 @@
 (ns prometheus.core
+  (:require
+    [clojure.string :as string])
   (:import
     (clojure.lang IObj)
     (java.io StringWriter)
@@ -12,7 +14,7 @@
   (-> (Counter/build)
       (.namespace app-name)
       (.name "http_requests_total")
-      (.labelNames (into-array String ["method" "status" "path"]))
+      (.labelNames (into-array String ["method" "status" "statusClass" "path"]))
       (.help "A counter of the total number of HTTP requests processed.")
       (.register registry)))

@@ -21,7 +23,7 @@
       (.buckets (double-array @histogram-buckets))
       (.namespace app-name)
       (.name "http_request_latency_seconds")
-      (.labelNames (into-array String ["method" "status" "path"]))
+      (.labelNames (into-array String ["method" "status" "statusClass" "path"]))
       (.help "A histogram of the response latency for HTTP requests in seconds.")
       (.register registry)))

@@ -30,9 +32,9 @@
 (defn- ^Histogram$Child histogram-with-labels [^Histogram histogram label-array] (.labels histogram label-array))

 (defn- record-request-metric [counter histogram request-method response-status request-time response-path]
-  (let [method-label (.toUpperCase (name request-method))
-        status-label (str (int (/ response-status 100)) "XX")
-        labels (into-array String [method-label status-label response-path])]
+  (let [status-class (str (int (/ response-status 100)) "XX")
+        method-label (string/upper-case (name request-method))
+        labels (into-array String [method-label (str response-status) status-class response-path])]
     (-> (histogram-with-labels histogram labels) (.observe request-time))
     (-> (counter-with-labels counter labels) (.inc))))


CMR-2081: Reduced the number of sample source granule urs in virtual product config to 2 per source collection instead of 3 per source collection


document default encoding for write-tag

document default encoding for write-tag

--- src/id3.clj
+++ src/id3.clj
@@ -147,7 +147,7 @@
 "Writes an ID3v2 tag to `ostream`.
 Options:
   :version   ID3v2.x tag version to write (3 or 4, default 4)
-  :encoding  character encoding to use for text frames, etc.
+  :encoding  character encoding to use for text frames, etc. (default UTF-16 for v2.3, UTF-8 for v2.4)
   :padding   bytes of padding to write (default 1024)"
 	[ostream tag & {:keys [version encoding padding]}]
 	(b/encode id3 ostream


Minor changes

Minor changes

--- src/specintro/core.cljs
+++ src/specintro/core.cljs
@@ -22,12 +22,11 @@

 ## Including clojure.spec in your project

-As usual, clojure.spec is just a library. So, you start by adding a dependency for
-`[org.clojure/clojure \"1.9.0-alpha5\"]` to your project.
+Add a dependency for `[org.clojure/clojure \"1.9.0-alpha5\"]` to your project.

 You can, optionally, also add a dependency for `[org.clojure/test.check \"0.9.0\"]`
 if you want to use clojure.spec to generate test-data.
-I think that, at this point in time, test.check only works for Clojure, not Clojurescript.
+AFAIK test.check only works for Clojure, not Clojurescript.

 Within your namespace you require clojure.spec with

@@ -84,6 +83,10 @@
 (parse (s/cat :cat1 integer? :cat2 keyword?) [42 :foo])
 ```"
   (parse (s/cat :cat1 integer? :cat2 keyword?) [42 :foo]))
+
+(defcard
+  "In Clojure you can use `s/unform` to convert a *conformed value*
+back to a *data value*. AFAIK this doesn't work in Clojurescript.")

 (defcard
   "
@@ -131,12 +134,14 @@
 ```"
   (parse ::int :foo))

-(s/def ::ints (s/or :or1 integer? :or2 (s/* ::ints)))
-
-(defcard
-  "
-```
-(s/def ::ints (s/or :or1 integer? :or2 (s/* ::ints)))
+(s/def ::ints (s/or :or1 integer?
+                    :or2 (s/* ::ints)))
+
+(defcard
+  "
+```
+(s/def ::ints (s/or :or1 integer?
+                    :or2 (s/* ::ints)))
 (parse ::ints [42 [43 44] 45])
 ```"
   (parse ::ints [42 [43 44] 45]))
@@ -270,7 +275,11 @@
          [:foo 42 43 :baz]))

 (defcard
-  "`s/&` version 2: check the two integers
+  "`s/&` version 2: check the two integers with
+an additional predicate
+
+The *conformed value* produced by `(s/cat :cat1 integer? :cat2 integer?)`
+is the input of predicate `#(> (:cat1 %) (:cat2 %))`.
 ```
 (parse (s/cat :cat1 keyword?
               :cat2 (s/& (s/cat :cat1 integer?


Move text to the right by 10 pixels

Move text to the right by 10 pixels

--- src/sporktrum/core.cljs
+++ src/sporktrum/core.cljs
@@ -100,9 +100,9 @@
     (set! (.-fillStyle ctx) "#8A8A8A")
     (set! (.-textAlign ctx) "right")
     (set! (.-font ctx) "14px Helvetica, Arial")
-    (.fillText ctx (str (js/parseInt max-freq 10) "Hz") (- width 20) 20)
-    (.fillText ctx (str note octave) (- width 20) 40)
-    (.fillText ctx (str signed-cents " cents") (- width 20) 60)
+    (.fillText ctx (str (js/parseInt max-freq 10) "Hz") (- width 10) 20)
+    (.fillText ctx (str note octave) (- width 10) 40)
+    (.fillText ctx (str signed-cents " cents") (- width 10) 60)
     ))

 (defn print-scale


clean up requires

clean up requires

--- src/midje/emission/plugins/default.clj
+++ src/midje/emission/plugins/default.clj
@@ -1,7 +1,6 @@
 (ns ^{:doc "The default for Midje output"}
   midje.emission.plugins.default
-  (:require [midje.ideas.reporting.report :as report]
-            [midje.clojure-test-facade :as ctf]
+  (:require
             [midje.ideas.reporting.levels :as levelly]
             [midje.emission.state :as state]
             [midje.emission.plugins.silence :as silence]))


use coords->tile over manual nth call

use coords->tile over manual nth call

--- src/tile_game/grid.cljs
+++ src/tile_game/grid.cljs
@@ -50,7 +50,7 @@
 (defn render-board [board dim command]
   [:svg {:view-box (str "0 0 " dim " " dim) :width 800 :height 800}
    (for [x (range dim) y (range dim)]
-     (let [tile (nth board (+ (* y dim) x))]
+     (let [tile (b/coords->tile board [x y])]
        (render-tile [x y] tile command)))])

 (defn help-screen []


Changed some key names

Changed some key names

--- src/onyx/lifecycle/metrics/riemann.clj
+++ src/onyx/lifecycle/metrics/riemann.clj
@@ -13,8 +13,8 @@
        (loop []
          (Thread/sleep (:riemann/interval-ms lifecycle))
          (let [state @(:onyx.metrics/state event)
-               client (r/tcp-client {:host (:riemann/client lifecycle)})
-               name   (:riemann/name lifecycle)
+               client (r/tcp-client {:host (:riemann/address lifecycle)})
+               name   (:riemann/workflow-name lifecycle)
                task-name (str (:onyx.core/task event))]
            (when-let [throughput (:throughput state)]
              (r/send-event client {:service (format "[%s] 1s_throughput" task-name)


added waveform visualizer

added waveform visualizer

--- src/vijualizer/core.clj
+++ src/vijualizer/core.clj
@@ -1,56 +1,44 @@
 (ns vijualizer.core
-  (:require [incanter.charts :as p]
-            [clojure.core.async :as a]
+  (:require [clojure.core.async :as a]
             [quil.core :as q]
             [quil.middleware :as qm])
   (:import [ddf.minim Minim]
            [ddf.minim.analysis BeatDetect FFT]))

+
 ;;; Minim

+;; Emulation of Processing-Environment functions
+
+;; Defining an interface so it is possible to add types,
+;; which is necessary for the class
 (definterface MinimInput
   (^String sketchPath [^String filename])
   (^java.io.InputStream createInput [^String filename]))

-(def MinimDummyService
+(def MinimDummyInput
   (proxy [MinimInput] []
     (sketchPath [filename] "")
-    (createInput [filename]
-      nil)))
+    (createInput [filename] nil)))

-
-(defn plot1 [fft]
-  (let [x (->> (range (.avgSize fft))
-               (map #(.getAverageCenterFrequency fft %)))
-        y (->> (range (.avgSize fft))
-               (map #(.getAvg fft %)))
-        chart (p/xy-plot x y)]
-    (println (count x))
-    (print x)
-    (print y)
-    (p/set-axis chart :x (p/log-axis :base 2))
-    (incanter.core/view chart)))
-
-
-(defn init-stuff []
+(defn init-line []
+  "Initializes Minim and an InputLine"
   (let [frame-size 1024
-        minim (Minim. MinimDummyService)
+        minim (Minim. MinimDummyInput)
         input (.getLineIn minim Minim/MONO, frame-size)]
     {:frame-size frame-size
      :minim minim
      :input input}))

-(defn stop-stuff [stuff]
-  (.close (:input stuff))
-  (.stop (:minim stuff)))
+(defn stop-line [line]
+  (.close (:input line))
+  (.stop (:minim line)))

-#_(def state (atom {:stop false
-                  :xs [] :ys []}))
-
+;;; FFT stuff

 (defn make-init-state []
   (atom {:stop false
@@ -65,66 +53,29 @@
                       (map #(.getAvg fft %))))))

-
-(def A 45)
-(def B 15)
-
 (defn stop-update [state]
   (swap! state assoc :stop true))

+
 (defn update-state [state args]
-  (stop-update state)
-  (Thread/sleep 400)
-  (swap! state assoc :stop false)
   (let [fft (FFT. (:frame-size args) 44100.0)]
-    (.logAverages fft A B)
+    (.logAverages fft 45 15)
     (a/go (while (not (:stop @state))
             (.forward fft (.-mix (:input args)))
             (swap! state update-state-once fft)
             (Thread/sleep 10)))))

+(defn restart-update
+  "for interactive use"
+  [state args]
+  (stop-update state)
+  (Thread/sleep 400)
+  (swap! state assoc :stop false)
+  (update-state state args))

-#_(defn test []
-  (def a (init-stuff))
-  (update-state state a)
-  (Thread/sleep 1000)
-  (swap! state assoc :stop true)
-  (stop-stuff a)
-  (swap! state assoc :stop false)
-  nil)
-
-
-(defn minim-test [args]
-  (let [fft (FFT. (:frame-size args) 44100.0)
-        get-bands (fn [] (->> (range (.specSize fft))
-                              (map #(.getBand fft %))))
-        get-avgs (fn [] (->> (range (.avgSize fft))
-                             (map #(.getAverageBandWidth fft %))))
-        get-bnds get-bands]
-    (.logAverages fft A B)
-    (.forward fft (.-mix (:input args)))
-    (Thread/sleep 50)
-    (.forward fft (.-mix (:input args)))
-    (def bands (get-bnds))
-    (println (count bands))
-                                        ;(plot bands)
-    (plot1 fft)
-    nil
-    #_(while true
-      (.forward fft (.-mix input))
-      (->> (get-bands) plot)
-      (Thread/sleep 2000)
-      #_(.detect beat-detect (.-mix input))
-      #_(cond (.isHat beat-detect) (println "HAT")
-              (.isSnare beat-detect) (println "SNARE")
-              (.isKick beat-detect) (println "KICK")))))
-
-
-
-;;; quil
-
+;;; quil frequency spectrum

 (def CONF
   {:w 600
@@ -136,36 +87,55 @@
   (q/color-mode :rgb 1.0))

-(defn draw-state [state]
+(defn draw-freq-spectrum [state]
   "state is an atom"
   (q/background 0.2)
   (let [s @state]
-;    (q/text (str (:ys s)) 100 100 300 300)
     (doseq [i (range (count (:xs s)))
             :let [x (* i 4)
                   h (+ 2 (nth (:ys s) i))]]
-      #_(q/rect x 0 4 (* 10 (/ (Math/log (* 1 h))
+      #_(q/rect x 0 4 (* 10 (/ (Math/log (* 1 h)) ;; linearly scaled scaling
                              (Math/log (+ 1.1 (- 1 (/ i 135)))))))
-      (q/rect x 0 4 h)
-      #_(q/rect x 0 4 (Math/pow h (nth (:xs s) i)))
-      #_(q/rect x 0 4 (* (+ 1 (/ (+ 1 i) 136)) h)))))
+      #_(q/rect x 0 4 h) ;; linear scaling
+      (q/rect x 0 4 (* (+ 1 (* 2 (/ (+ 1 i) 136))) h)))))

-(defn quil-plot [state]
+(defn quil-freq-spectrum [state]
   (q/sketch
    :title "plot"
    :size [(:w CONF) (:h CONF)]
    :setup quil-setup
    :update identity
-   :draw (fn [_] (draw-state state))
+   :draw (fn [_] (draw-freq-spectrum state))
    :middleware [qm/fun-mode]))

+;;; waveform
+
+(defn draw-waveform [a]
+  (q/background 1.0)
+  (defn scale [y] (-> y (* 200) (+ 200)))
+  (defn get-y [i] (-> (:input a) .-mix (.get i)))
+  (doseq [i (-> (:frame-size a) dec range)]
+    (q/line i (scale (get-y i))
+            (inc i) (scale (get-y (inc i))))))
+
+
+(defn plot-waveform [a]
+  (q/sketch
+   :size [1024 400]
+   :setup quil-setup
+   :update identity
+   :draw (fn [_] (draw-waveform a))
+   :middleware [qm/fun-mode]))
+
+
+;;; docs

 ;; in repl:
-;; (def a (init-stuff)) ;; a dict
+;; (def a (init-line)) ;; a dict
 ;; (def state (make-init-state)) ;; an atom
 ;; (update-state state a)
 ;; ... (quil-plot state)
-;; (swap! state assoc :stop true)
-;; (stop-stuff a)
+;; (stop-update state)
+;; (stop-line a)


(maint) Catch perm error in replication set update

Changes exception behavior of update-pglogical-replication-set. If the
db user don't have rights to update pglogical, catches the exception and
returns false. Other exceptions are passed through.

This fixes db migration crashes in users of this function when pglogical
is installed but the database is read-only.

--- src/puppetlabs/jdbc_util/pglogical.clj
+++ src/puppetlabs/jdbc_util/pglogical.clj
@@ -1,4 +1,5 @@
 (ns puppetlabs.jdbc-util.pglogical
+  (:import [org.postgresql.util PSQLException PSQLState])
   (:require [clojure.java.jdbc :as jdbc]
             [puppetlabs.jdbc-util.core :refer [has-extension?]]))

@@ -25,12 +26,22 @@
        " end;';"))

 (defn update-pglogical-replication-set
-  "Update the default pglogical replication set to replicate all tables in the
-  given schema."
+  "Tries to update the default pglogical replication set to replicate all tables
+  in the given schema. If the db user don't have rights to update pglogical,
+  catches the exception and returns false. Other exceptions are passed through.
+  Returns true if the replication set was successfully updated."
   [db schema]
-  (jdbc/query db
-              (str "select pglogical.replication_set_add_all_tables("
-                   "'default',"
-                   "'{\"" schema "\"}',"
-                   "true"
-                   ");")))
+  (try
+    (jdbc/query db
+                (str "select pglogical.replication_set_add_all_tables("
+                     "'default',"
+                     "'{\"" schema "\"}',"
+                     "true"
+                     ");"))
+    true
+    (catch PSQLException e
+      (if (= "42501" (.getSQLState e))
+        false
+        (throw e)))))
+
+


(maint) Update messaging_test regex

(maint) Update messaging_test regex

This commit updates the TLS Handshake regex to account for a possible
race condition. It seems possible for the "Sleeping for up to 200 ms"
message can occur without being logged at warn level (from a regular
connection failure), so the first message in the logs has the 400 ms
timeout instead. This commit should help avoid that issue.

--- test/puppetlabs/pcp/messaging_test.clj
+++ test/puppetlabs/pcp/messaging_test.clj
@@ -162,7 +162,7 @@
                {:ssl-key "./test-resources/ssl/private_keys/client01.example.com.pem"
                 :ssl-cert "./test-resources/ssl/certs/client01.example.com.pem"})
     (eventually-logged? "puppetlabs.pcp.client" :warn
-                        (partial re-find #"TLS Handshake failed\. Sleeping for up to 200 ms to retry")
+                        (partial re-find #"TLS Handshake failed\. Sleeping for up to .* to retry")
                         (with-open [client (connect-client "client01" (constantly true))]
                           (client/wait-for-connection client (* 4 1000))
                           (is (not (client/connected? client)))))))
@@ -196,7 +196,7 @@
                   (str "./test-resources/" broker-ca "/ca/ca_crt.pem"))
           (eventually-logged?
             "puppetlabs.pcp.client" :warn
-            (partial re-find #"TLS Handshake failed\. Sleeping for up to 200 ms to retry")
+            (partial re-find #"TLS Handshake failed\. Sleeping for up to .* to retry")
             (with-open [client (connect-client-config
                                  (assoc-in (client-config "client01")
                                         [:ssl-context :cacert] (str "test-resources/" client-ca "/certs/ca.pem"))


change test-runner/run-html-tests to use cljs-test/run-all-tests with regex so you don't have to provide list of ns. (need to do same for karma variant but needs macro)

- actual test ns still need to be required, but at least this avoids needing to specify again to run tests.

--- test/re_frame_http_fx/test_runner.cljs
+++ test/re_frame_http_fx/test_runner.cljs
@@ -16,8 +16,7 @@

 (defn ^:export run-html-tests []
-  (cljs-test/run-tests
-    're-frame-http-fx.core-test))
+  (cljs-test/run-all-tests #"re-frame-http-fx.*-test"))

 ;; ---- KARMA  -----------------------------------------------------------------


more strict testing of parse results: test that semantics are as expected

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -23,6 +23,9 @@
   {:en (morph expr)
    :subj (get-in expr [:synsem :sem :subj :pred])
    :pred (get-in expr [:synsem :sem :pred])
+   :tense (get-in expr [:synsem :sem :tense])
+   :infl (get-in expr [:synsem :infl])
+   :aspect (get-in expr [:synsem :sem :aspect])
    :obj (get-in expr [:synsem :sem :obj :pred])})

 (deftest generate-irregular-present-1
@@ -124,19 +127,40 @@
               (= surface-form
                  "you all used to go downstairs"))))))

-(deftest simple-parse
-  (is (not (empty? (parse "she sleeps")))))
-
-(deftest future-parse
-  (is (not (empty? (parse "he will speak")))))
+(deftest present-tense-parse
+  (let [parses (parse "she sleeps")]
+    (is (not (empty? parses)))
+    (is (= (get-in (first parses) [:synsem :sem :tense])
+           :present))))
+
+(deftest future-tense-parse
+  (let [parses (parse "he will speak")]
+    (is (not (empty? parses)))
+    (is (= (get-in (first parses) [:synsem :sem :tense])
+           :future))))

 (deftest conditional-parse
   (is (not (empty? (parse "she would speak")))))

 (deftest imperfect-parse
-  (is (not (empty? (parse "she used to speak"))))
-  (is (not (empty? (parse "she was loving"))))
-  (is (not (empty? (parse "she was speaking")))))
+  (let [parses (parse "she used to speak")]
+    (is (not (empty? parses)))
+    (is (= (get-in (first parses) [:synsem :sem :tense])
+           :past))
+    (is (= (get-in (first parses) [:synsem :sem :aspect])
+           :progressive)))
+  (let [parses (parse "she was loving")]
+    (is (not (empty? parses)))
+    (is (= (get-in (first parses) [:synsem :sem :tense])
+           :past))
+    (is (= (get-in (first parses) [:synsem :sem :aspect])
+           :progressive)))
+  (let [parses (parse "she was speaking")]
+    (is (not (empty? parses)))
+    (is (= (get-in (first parses) [:synsem :sem :tense])
+           :past))
+    (is (= (get-in (first parses) [:synsem :sem :aspect])
+           :progressive))))

 (deftest parse-with-gender-symbols
   (is (not (empty? (parse "I (♀) speak"))))
@@ -171,9 +195,10 @@
   (let [result (generate {:modified false
                           :synsem {:cat :noun
                                    :sem {:pred :name
-                                         :mod '()}}})]
+                                         :mod '()
+                                         }}})]
     (is (= (get-in result [:synsem :sem :mod]
-                   :undefined-should-not-return-this)
+                   ::undefined-should-not-return-this)
            '()))))

 (deftest her-name-is-luisa
@@ -247,21 +272,19 @@

 (deftest furniture-sentence
   (let [expr (generate {:modified false
-                        :comp {:synsem {:agr {:person :3rd}}}
                         :synsem {:cat :verb
-                                 :sem {:aspect :progressive
-                                       :obj {:pred :table
+                                 :sem {:obj {:pred :table
                                              :mod '()
                                              :number :sing
                                              :spec {:def :def
                                                     :pred :definite}}
                                        :pred :in-front-of
+                                       :tense :present
                                        :subj {:pred :chair
                                               :mod '()
                                               :number :sing
                                               :spec {:def :def
-                                                     :pred :definite}}
-                                       :tense :present}}})]
+                                                     :pred :definite}}}}})]
     (log/info (str "furniture-sentence: "
                    (display-expression expr)))


remove commas

remove commas

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -868,12 +868,13 @@
 (deftest io-lo-vedo
   (is (= "io lo vedo"
          (let [spec
-               {:modified false,
-                :synsem {:cat :verb,
-                         :subcat [],
-                         :sem {:pred :see,
-                               :tense :present,
-                               :subj {:pred :I},
+               {:modified false
+                :synsem {:cat :verb
+                         :subcat []
+                         :sem {:pred :see
+                               :tense :present
+                               :aspect :simple
+                               :subj {:pred :I}
                                :obj {:pred :lui}}}}]
            (-> spec
                generate
@@ -882,12 +883,13 @@
 (deftest tu-mi-vedi
   (is (= "tu mi vedi"
          (let [spec
-               {:modified false,
-                :synsem {:cat :verb,
-                         :subcat [],
-                         :sem {:pred :see,
-                               :tense :present,
-                               :subj {:pred :tu},
+               {:modified false
+                :synsem {:cat :verb
+                         :subcat []
+                         :sem {:pred :see
+                               :tense :present
+                               :aspect :simple
+                               :subj {:pred :tu}
                                :obj {:pred :I}}}}]
            (-> spec
                generate


clojure: cider 0.9.1 version bump

clojure: cider 0.9.1 version bump

--- .lein/profiles.clj
+++ .lein/profiles.clj
@@ -1 +1 @@
-{:user {:plugins [[cider/cider-nrepl "0.8.2"]]}}
+{:user {:plugins [[cider/cider-nrepl "0.9.1"]]}}


Version 0.6.6

Version 0.6.6

--- metlog-vault/project.clj
+++ metlog-vault/project.clj
@@ -1,4 +1,4 @@
-(defproject metlog-vault "0.6.6-SNAPSHOT"
+(defproject metlog-vault "0.6.6"
   :description "Repository for storing and displaying time series data reported by metlog-agent.."

   :license {:name "Eclipse Public License"


HEAD doesn't require Content-Length calculation

--- test/yada/head_test.clj
+++ test/yada/head_test.clj
@@ -14,4 +14,5 @@
     (given response
       :status 200
       [:headers "content-type"] "text/plain"
+      [:headers "content-length"] nil ; see rfc7231.html#section-3.3
       :body nil)))


supporting fan out

supporting fan out

--- src/celestial/provider.clj
+++ src/celestial/provider.clj
@@ -17,18 +17,20 @@
       [clojure.core.strint :only (<<)]
       [slingshot.slingshot :only  [throw+ try+]]))

-(def str? [string? :msg "not a string"])
-
-(def vec? [vector? :msg "not a vector"])
-
 (defn- key-select [v] (fn [m] (select-keys m (keys v))))

-(defn mappings [res ms]
-  "Maps raw model keys to specific model"
-  (let [vs ((key-select ms) res) ]
+(defn repeates [k v]
+  (if (set? k) (interleave k (repeat (count k) v)) [k v]))
+
+(defn mappings
+  {:test #(assert (= {:template :ubuntu, :flavor :ubuntu, :search "local"}
+                     (mappings {:os :ubuntu :domain "local"} {:os #{:template :flavor} :domain :search})))
+   :doc "Maps raw model keys to specific model keys, single key can fan out to multiple keys using a set"}
+  [res ms]
+  (let [mapped ((key-select ms) res)]
      (merge
        (reduce (fn [r [k v]] (dissoc r k)) res ms)
-       (reduce (fn [r [k v]] (assoc r (ms k) v)) {} vs))
+       (reduce (fn [r [k v]] (apply assoc r (repeates (ms k) v))) {} mapped))
      ))

 (defn os->template
@@ -59,3 +61,5 @@
           true
           (do (Thread/sleep (parse-time-unit sleep)) (recur)))
         (throw+ (merge err timings))))))
+
+(test #'mappings)


refactor

refactor

--- src/cljs/skyport/core.cljs
+++ src/cljs/skyport/core.cljs
@@ -89,25 +89,28 @@
     (js/setTimeout (fn [] (close! c)) ms)
     c))

-(go
-  (loop [{:keys [ws-channel error]}
-         (<! (ws-ch "ws://localhost:54331"
-                   {:format :json}))]
-    (if error
-      (do
-        (println error)
-        (<! (timeout 1000))
-        {:keys [ws-channel error]}
-        (recur (<! (ws-ch "ws://localhost:54331"
-                          {:format :json}))))
-      (loop [{:keys [message error]} (<! ws-channel)]
-        (if error
-          (println (str "-- " error))
-          (let [m (keywordize-keys message)]
-            (println (type (get m :message)))
-            (handle-message! m)
-            (println m)
-            (recur (<! ws-channel))))))))
+
+(go-loop [{:keys [ws-channel error]}
+          (<! (ws-ch "ws://localhost:54331"
+                     {:format :json}))]
+  ;; If there is an error we print the error and try again in a
+  ;; second. If there isn't an error we loop forever in the message
+  ;; channel. If the message channel provides an error we try to
+  ;; connect again in a second.
+  (if error
+    (println error)
+    (loop [{:keys [message error]} (keywordize-keys
+                                    (<! ws-channel))]
+      (if error
+        (println "-- " error)
+        (do
+          (println message)
+          (handle-message! message)
+          (recur (<! ws-channel))))))
+  ;; wait 1 second before continuing.
+  (<! (timeout 1000))
+  (recur (<! (ws-ch "ws://localhost:54331"
+                    {:format :json}))))

 (def tile-type {"G" "grass"
                 "V" "void"


remove unused :refer

remove unused :refer

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -4,7 +4,6 @@
   (:require [babel.directory :refer [models]]
             [babel.francais :as fr :refer [generate parse medium]]
             [babel.francais.grammar :as grammar :refer [fo-ps]]
-            [babel.francais.lexicon :refer [lexicon]]
             [babel.francais.morphology :refer [analyze conjugate fo get-string]]
             [babel.generate :as generate]
             [babel.over :as over]


reduce do-this-many back to 10 from 100 after fixing conditional 2nd person bug

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -381,7 +381,7 @@
                         expressions))))))

 (deftest roundtrip-conditional
-  (let [do-this-many 100
+  (let [do-this-many 10
         expressions (take do-this-many
                           (repeatedly
                            #(generate {:synsem {:cat :verb


show-notes=false for latin

show-notes=false for latin

--- test/babel/test/la.cljc
+++ test/babel/test/la.cljc
@@ -113,13 +113,13 @@
 (deftest reader2
   (let [spec (choose-spec curriculum target/model)
         target-expression (target/generate spec)]
-
     (is (string? (target/morph target-expression)))
     (let [;; this is to show the user question in their native (i.e. 'source') language.
           semantics (get-in target-expression [:synsem :sem])
           pose-question-to-user
           (source/morph (source/generate {:synsem {:sem semantics}}
-                                         :model source-model))
+                                         :model source-model)
+                        :show-notes false)
           result
           (-> spec
               target/generate)]


add superficial test of navigator/update-competency

--- test/navigator_test.clj
+++ test/navigator_test.clj
@@ -7,7 +7,7 @@

 (use-fixtures :once nt-config/testing-fixture)

-(deftest assert-comp
+(deftest create-comps
   (testing "raw assertion"
     (is (n-tl/ensure-tx (schematode/tx
                          (:db-conn nt-config/system)
@@ -29,6 +29,20 @@
                              "v1"
                              :comp.status/active
                              :comp/id-sk "jeep")))))
+
+(deftest update-comps
+  (is (n-tl/ensure-tx (navigator/create-competency
+                       (:db-conn nt-config/system)
+                       "can I update?"
+                       "v1"
+                       :comp.status/active
+                       :comp/id-sk "yeep")))
+  (is (n-tl/ensure-tx (navigator/update-competency
+                       (:db-conn nt-config/system)
+                       {:comp/name "can I update?"
+                        :comp/version "v1"
+                        :comp/status :comp.status/active
+                        :db/id [:comp/id-sk "yeep"]}))))

 (comment
   (map #(keys (deref %))


Fix race condition for pool creation (thanks cespare!)

--- src/taoensso/carmine/connections.clj
+++ src/taoensso/carmine/connections.clj
@@ -96,18 +96,22 @@
     opts ; Pass through pre-made pools
     (if-let [dp (and cached? (@pool-cache opts))]
       @dp
-      (let [dp (delay
-                (if (= opts :none) (->NonPooledConnectionPool)
-                    (let [defaults {:test-while-idle?              true
-                                    :num-tests-per-eviction-run    -1
-                                    :min-evictable-idle-time-ms    60000
-                                    :time-between-eviction-runs-ms 30000}]
-                      (->ConnectionPool
-                       (reduce set-pool-option
-                               (GenericKeyedObjectPool. (make-connection-factory))
-                               (merge defaults opts))))))]
-        (swap! pool-cache assoc opts dp)
-        @dp))))
+      (locking pool-cache ; Pool creation can be racey even with `delay`
+        ;; Retry after lock acquisition:
+        (if-let [dp (and cached? (@pool-cache opts))]
+          @dp
+          (let [dp (delay
+                    (if (= opts :none) (->NonPooledConnectionPool)
+                        (let [defaults {:test-while-idle?              true
+                                        :num-tests-per-eviction-run    -1
+                                        :min-evictable-idle-time-ms    60000
+                                        :time-between-eviction-runs-ms 30000}]
+                          (->ConnectionPool
+                           (reduce set-pool-option
+                                   (GenericKeyedObjectPool. (make-connection-factory))
+                                   (merge defaults opts))))))]
+            (swap! pool-cache assoc opts dp)
+            @dp))))))

 (comment (conn-pool :none) (conn-pool {}))

@@ -134,7 +138,7 @@
 (defn pooled-conn "Returns [<open-pool> <pooled-connection>]."
   [pool-opts spec-opts]
   (let [spec (conn-spec spec-opts)
-        pool (conn-pool pool-opts true)]
+        pool (conn-pool pool-opts :cached)]
     (try (try [pool (get-conn pool spec)]
               (catch IllegalStateException e
                 (let [pool (conn-pool pool-opts)]


Run importation in a transaction.

Run importation in a transaction.

Among other cosmetic fixes.

--- backend/src/uxbox/cli/collimp.clj
+++ backend/src/uxbox/cli/collimp.clj
@@ -52,11 +52,10 @@

 ;; --- Colors Collections Importer

-(def storage media/images-storage)
-
 (defn- create-image-collection
   "Create or replace image collection by its name."
   [conn {:keys [name] :as entry}]
+  (println "Creating image collection:" name)
   (let [id (uuid/namespaced +imates-uuid-ns+ name)
         sqlv (sql/create-image-collection {:id id :name name})]
     (sc/execute conn sqlv)
@@ -78,7 +77,8 @@
   [conn {:keys [id path] :as image}]
   {:pre [(uuid? id)
          (fs/path? path)]}
-  (let [sqlv (sql/delete-image {:id id})]
+  (let [sqlv (sql/delete-image {:id id})
+        storage media/images-storage]
     @(st/delete storage path)
     (sc/execute conn sqlv)))

@@ -88,7 +88,8 @@
          (uuid? collid)
          (uuid? imageid)]}
   (let [filename (fs/base-name localpath)
-        [width height] (retrieve-image-size localpath)
+        storage media/images-storage
+        [width height] (time (retrieve-image-size localpath))
         extension (second (fs/split-ext filename))
         path @(st/save storage filename localpath)
         params {:name filename
@@ -106,7 +107,9 @@
 (defn- import-image
   [conn id fpath]
   {:pre [(uuid? id) (fs/path? fpath)]}
-  #_(let [imageid (uuid/namespaced +imates-uuid-ns+ (str id fpath))]
+  (println "Importing image:" (str fpath))
+  (let [filename (fs/base-name fpath)
+        imageid (uuid/namespaced +imates-uuid-ns+ (str id filename))]
     (if-let [image (retrieve-image conn imageid)]
       (do
         (delete-image conn image)
@@ -114,9 +117,10 @@
       (create-image conn id imageid fpath))))

 (defn- process-images-entry
-  [conn {:keys [path regex] :as entry}]
-  {:pre [(s/valid? ::import-entry entry)]}
-  (let [id (uuid/random) #_(create-image-collection conn entry)]
+  [conn basedir {:keys [path regex] :as entry}]
+  {:pre [(us/valid? ::import-entry entry)]}
+  (let [id (create-image-collection conn entry)
+        path (fs/resolve basedir path)]
     (doseq [fpath (fs/list-files path)]
       (when (re-matches regex (str fpath))
         (import-image conn id fpath)))))
@@ -145,25 +149,24 @@

 (defn- start-system
   []
-  (-> (mount/only #{#'uxbox.config/config
-                    #'uxbox.db/datasource
-                    #'uxbox.migrations/migrations})
-      (mount/start)))
+  (mount/start))

 (defn- stop-system
   []
   (mount/stop))

 (defn- run-importer
-  [directory data]
-  (println "Running importer on:")
-  (pprint data))
+  [conn basedir data]
+  (let [images (:images data)
+        icons (:icons data)]
+    (run! #(process-images-entry conn basedir %) images)))

 (defn -main
   [& [path]]
-  (let [[directory data] (read-import-file path)]
+  (let [[basedir data] (read-import-file path)]
     (start-system)
     (try
-      (run-importer directory data)
+      (with-open [conn (db/connection)]
+        (sc/apply-atomic conn run-importer basedir data))
       (finally
         (stop-system)))))


modified random program maker in acceptance.new-stress-test.clj

--- test/acceptance/new_stress_tests.clj
+++ test/acceptance/new_stress_tests.clj
@@ -47,23 +47,6 @@
         :bindings bindings}
         )))

-         ; (try
-         ;   (catch StackOverflowError e
-         ;     (println
-         ;       (str "\n\nSTACK OVERFLOW >>>>>>> "
-         ;            "\n:exec stack: " (push/get-stack interpreter :exec)
-         ;            "\n:log stack:  " (push/get-stack interpreter :log)
-         ;            "\n:counter:    " (:steps interpreter)))
-         ;     (spit-prisoner-file program bindings (.getMessage e))
-         ;     ;(throw (Exception. (.getMessage e)))
-         ;     )
-         ;   (catch Exception e
-         ;     (println (str e))
-         ;     :other-exception
-         ;     )
-         ;   ; (finally
-         ;   ;   (println (str "\n\n running: " program)))
-         ;     ))

 (with-handler! #'run-program-in-standardized-interpreter
   "If an interpreter raises an exception, dump a new prisoner file."
@@ -114,17 +97,14 @@

 ;; setup for stress test

-(def sample-programs
-  (map-indexed
-    (fn [idx p] [idx p])
-    (take
-      cohort-size
-      (repeatedly
-        #(util/some-program
-          program-size
-          erc-scale
-          erc-prob
-          my-interpreter)))))
+(defn sample-program
+  [i]
+  [i (util/some-program
+      program-size
+      erc-scale
+      erc-prob
+      my-interpreter)])
+

 (def sample-bindings
@@ -134,19 +114,20 @@

 (defn launch-some-workers
-  [interpreter bindings numbered-programs]
-  (doall
-    (cp/upmap 2
-      #(.write *out*
-        (str "\n\n"
-          (first %) ": "
-          (interpreter-details
-            (run-program-in-standardized-interpreter
-              interpreter
-              (second %)
-              bindings))))
-      numbered-programs)
-      ))
+  [interpreter bindings how-many]
+  (cp/with-shutdown! [net-pool (cp/threadpool 100)]
+    (doall
+      (lazy/upmap net-pool
+        #(.write *out*
+          (str "\n\n"
+            (first %) ": "
+            (interpreter-details
+              (run-program-in-standardized-interpreter
+                interpreter
+                (second %)
+                bindings))))
+        (map sample-program (range how-many))
+        ))))

 (fact "run some workers in parallel"
@@ -154,4 +135,4 @@
   (launch-some-workers
     my-interpreter
     sample-bindings
-    sample-programs) =not=> (throws))
+    100) =not=> (throws))


New test test-api-call-handler-2

New test test-api-call-handler-2

--- test/emender_jenkins/server_test.clj
+++ test/emender_jenkins/server_test.clj
@@ -215,3 +215,23 @@
                     :headers {"Content-Type" "application/json"}
                     :body "{\"name\":\"Emender Jenkins Service\",\"version\":\"1.0\",\"api_prefix\":\"\\/api\",\"hostname\":\"\",\"test\":\"\\/api\"}"}))))))

+(deftest test-api-call-handler-2
+    "Check the function emender-jenkins.server/api-call-handler."
+    (testing "the function emender-jenkins.server/api-call-handler."
+        (let [request {:configuration {
+                          :api  {:prefix "/api"}
+                          :info {:version "1.0"}}}]
+            (are [uri result] (= (api-call-handler request uri :get) result)
+                "/api/"
+                {:status 200
+                 :headers {"Content-Type" "application/json"}
+                 :body "{\"name\":\"Emender Jenkins Service\",\"version\":\"1.0\",\"api_prefix\":\"\\/api\",\"hostname\":\"dhcp-lab-190.englab.brq.redhat.com\",\"test\":\"\\/api\"}"}
+                "/api/configuration"
+                {:status 200
+                 :headers {"Content-Type" "application/json"}
+                 :body "{\"api\":{\"prefix\":\"\\/api\"},\"info\":{\"version\":\"1.0\"},\"jenkins\":{\"jenkins-auth\":\"********\"}}"}
+                "/api/system/banners"
+                {:status 200
+                 :headers {"Content-Type" "application/json"}
+                 :body "{\"message\":\"Alpha version\",\"type\":\"Warning\"}"}))))
+


added schema validation to the event tracking

--- src-cljs/frontend/analytics.cljs
+++ src-cljs/frontend/analytics.cljs
@@ -121,24 +121,24 @@
     (mwarn "Cannot log an unsupported event type, please add it to the list of supported events")
     (mwarn "Analytics are currently not enabled")))

-(defmethod track :track-event [event-data]
+(s/defmethod ^:always-validate track :track-event [event-data :- AnalyticsEvent]
   (let [{:keys [event-type properties owner]} event-data]
     (segment/track-event (name event-type) (add-current-state-to-props properties owner))))

-(defmethod track :new-plan-created [event-data]
+(s/defmethod ^:always-validate track :new-plan-created [event-data :- AnalyticsEvent]
   (let [{:keys [event-type properties owner]} event-data]
     (segment/track-event "new-plan-created" properties)
     (intercom/track :paid-for-plan)))

-(defmethod track :external-click [event-data]
+(s/defmethod ^:always-validate track :external-click [event-data :- ExternalClickEvent]
   (let [{:keys [event properties owner]} event-data]
     (segment/track-external-click event (add-current-state-to-props properties owner))))

-(defmethod track :pageview [event-data]
+(s/defmethod ^:always-validate track :pageview [event-data :- PageviewEvent]
   (let [{:keys [navigation-point owner]} event-data]
     (segment/track-pageview (name navigation-point) (get-current-state-properties owner))))

-(defmethod track :build-triggered [event-data]
+(s/defmethod ^:always-validate track :build-triggered [event-data :- BuildEvent]
   (let [{:keys [build properties owner]} event-data
         props (merge {:project (vcs-url/project-name (:vcs_url build))
                       :build-num (:build_num build)
@@ -146,7 +146,7 @@
                      properties)]
     (segment/track-event "build-triggered" (add-current-state-to-props props owner))))

-(defmethod track :view-build [event-data]
+(s/defmethod ^:always-validate track :view-build [event-data :- ViewBuildEvent]
   (let [{:keys [build user properties owner]} event-data
         props (merge (build-properties build) properties)]
     (segment/track-event "view-build" (add-current-state-to-props props owner))


Fix the local-mode filesystem dispatch fn. Initialize the reader with partitions, not the location.

--- pigpen-core/src/main/clojure/pigpen/local.clj
+++ pigpen-core/src/main/clojure/pigpen/local.clj
@@ -228,12 +228,12 @@
 (defmethod graph->local :return [{:keys [^Iterable data]} _]
   (Observable/from data))

-(defmulti load-list (fn [location] (re-find #"^([a-z0-9]+)://" location)))
+(defmulti load-list (fn [location] (second (re-find #"^([a-z0-9]+)://" location))))

 (defmethod load-list :default [location]
   (list-files location))

-(defmulti load-reader (fn [location] (re-find #"^([a-z0-9]+)://" location)))
+(defmulti load-reader (fn [location] (second (re-find #"^([a-z0-9]+)://" location))))

 (defmethod load-reader :default [location]
   (io/reader location))
@@ -246,7 +246,7 @@
       (locations [_]
         (load-list location))
       (init-reader [_ file]
-        (load-reader location))
+        (load-reader file))
       (read [_ reader]
         (for [line (line-seq reader)]
           (->>


rearrange validation logic a bit

rearrange validation logic a bit

--- src/alibi/domain/entry/entry.clj
+++ src/alibi/domain/entry/entry.clj
@@ -79,6 +79,11 @@
                                        :as-identity integer?}))
          (task? old-task)
          (or (not task-id) (task? new-task))]}
+  (assert (= as-identity (:user-id entry))
+          "can only updates entries for yourself")
+  (assert (not (:billed? entry))
+          "can not change an entry when it's already billed")
+  (assert (not (find cmd :user-id)) "you can't update the user-id for an hour entry")
   (let [update-field (fn [entry k]
                        (if (find cmd k)
                          (assoc entry k (k cmd))
@@ -86,13 +91,8 @@
         entry' (reduce update-field entry
                        #{:start-time :end-time :for-date :task-id :comment
                          :billable?})]
-    (assert (= as-identity (:user-id entry))
-            "can only updates entries for yourself")
-    (assert (not (find cmd :user-id)) "you can't update the user-id for an hour entry")
     (assert (not (before? (:end-time entry') (:start-time entry')))
             "start time can't come after end time")
-    (assert (not (:billed? entry))
-            "can not change an entry when it's already billed")
     (assert (valid-billable? (:billable? entry') (or new-task old-task)))
     entry'))


Really fixes #183

Really fixes #183

--- boot/core/project.clj
+++ boot/core/project.clj
@@ -6,6 +6,7 @@

 (defproject boot/core version
   :aot          [#"^(?!boot\.repl-server).*$"]
+  :jar-exclusions [#"^clojure/"]
   :description  "Core boot module–boot scripts run in this pod."
   :url          "http://github.com/boot-clj/boot"
   :scm          {:url "https://github.com/boot-clj/boot.git" :dir "../../"}


turn on pfs and then compute how long to sleep

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -181,14 +181,14 @@
   (while (and (:pause @state) (not (:stop @state))) (Thread/sleep 5)))

 (defn interruptible-sleep [time-ms]
+  (let [sleepy (CountDownLatch. 1)]
+    (state-assoc! :sleepy sleepy :next-wake-time (+ (clock-ms) time-ms))
+    (.await sleepy time-ms TimeUnit/MILLISECONDS)))
+
+(defn acq-sleep [interval-ms]
   (when (and (@state :init-continuous-focus)
              (not (core isContinuousFocusEnabled)))
     (core enableContinuousFocus true))
-  (let [sleepy (CountDownLatch. 1)]
-    (state-assoc! :sleepy sleepy :next-wake-time (+ (clock-ms) time-ms))
-    (.await sleepy time-ms TimeUnit/MILLISECONDS)))
-
-(defn acq-sleep [interval-ms]
   (let [target-time (+ (@state :last-wake-time) interval-ms)
         delta (- target-time (clock-ms))]
     (when (pos? delta)


make timer thread run at highest priority

--- src/clj/backtype/storm/timer.clj
+++ src/clj/backtype/storm/timer.clj
@@ -42,6 +42,7 @@
                               )))
                         (.release notifier)))]
     (.setDaemon timer-thread true)
+    (.setPriority timer-thread Thread/MAX_PRIORITY)
     (.start timer-thread)
     {:timer-thread timer-thread
      :queue queue


1. added log 2. modified main-page 3. renamed my-value-writer -> cauca-writer 4. applied handler/api

--- src/clj/cauca/component/rest.clj
+++ src/clj/cauca/component/rest.clj
@@ -4,6 +4,7 @@
  (:use [hiccup core page-helpers])
  (:use [ring.adapter.jetty :only [run-jetty]])
  (:require [cauca.factory :as f]
+           [cauca.log :as log]
            [compojure.route :as route]
            [compojure.handler :as handler]
            [clojure.data.json :as json]
@@ -11,10 +12,10 @@
            )
  (:gen-class))

- (defn ui-template [body]
-   (html4
+ (defn main-page []
+   (html5
     [:head
-     [:title "Cauca UI"]
+     [:title "CAUCA"]
      (include-css "/css/bootstrap-1.1.0.css")
      (include-css "/css/style.css")
      (include-js "/js/jquery-1.6.2.min.js")
@@ -23,30 +24,48 @@
      (include-js "/js/script.js")
      ]
     [:body
-     [:h1 (link-to "/" "Cauca UI")]
-     (seq body)
-     ]))
+     [:h1 "CAUCA API"]
+     [:ul
+      [:li "/courtauction"
+       [:ul
+        [:li "법원 경매 정보 리스트 조회"]
+        [:li "method:get"]
+       ]
+       ]
+      [:li "/courtauction/:id"
+       [:ul
+        [:li "법원 경매 정보 조회"]
+        [:li "method:get"]
+       ]
+       ]
+      ]
+     ]
+    ))

- (defn main-page []
-   (concat [[:h1 "Cauca Main"]])
-   )
-
- (defn my-value-writer [key value]
+ (defn cauca-writer [key value]
   (if (or (= key :auctionDate) (= key :regDate) (= key :updDate))
     (str (java.sql.Date. (.getTime value)))
     value))

  (defroutes main-routes
-   (GET "/" [:as {cookies :cookies}]
-        (-> (main-page)
-            ui-template))
-   (GET "/courtauction/:id" [id]
+   (GET "/" [] (main-page))
+   (GET "/api/courtauction/:id" [id]
         (let [dao-impl# (f/get-obj :courtauction-dao)
-              ret-courtauction (first (.get-courtauction dao-impl# id))]
-          (json/write-str ret-courtauction
-                          :value-fn my-value-writer
-                          )))
+              ret-courtauction (first (.get-courtauction dao-impl# id))
+              json (json/write-str ret-courtauction :value-fn cauca-writer :escape-unicode false)]
+          (log/log-message json)
+          (-> (resp/response json)
+            (resp/content-type "application/json; charset=utf-8"))))
+   (GET "/api/courtauction" {params :query-params}
+        (str "itemType:" (params "itemType") "
"
+             "addr0:" (params "addr0") "
"
+             "addr1:" (params "addr1") "
"
+             "value:" (params "value") "
"
+             "valueMin:" (params "valueMin") "
"
+             "auctionDate:" (params "auctionDate")))
    (route/not-found "Page not found"))
+
+ (def main-handler (-> main-routes handler/api))

  (defn exception->html [e]
    (concat
@@ -60,17 +79,16 @@
      (try
        (handler request)
        (catch Exception e
-         (-> (resp/response (ui-template (exception->html e)))
+         (-> (resp/response (ui-template "Cauca UI" (exception->html e)))
            (resp/status 500)
            (resp/content-type "text/html"))
          ))))

  (def app
-   (-> #'main-routes
+   (-> #'main-handler
        (wrap-reload '[cauca.component.rest])
        catch-errors))

  (defn start-server! [] (run-jetty app {:port 8080
                                         :join? false}))
-
  (defn -main [] (start-server!))


add missing Muertos Gang Member effects

add missing Muertos Gang Member effects

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -231,8 +231,22 @@
                                 (move state side (first (:deck runner)) :deck)))}]}

    "Muertos Gang Member"
-   {:abilities [{:msg "draw 1 card"
-                 :effect (effect (trash card {:cause :ability-cost}) (draw))}] }
+   {:effect (req (resolve-ability
+                   state :corp
+                   {:prompt "Choose a card to derez"
+                    :choices {:req #(and (= (:side %) "Corp") (:rezzed %))}
+                    :effect (req (derez state side target))}
+                  card nil))
+    :leave-play (req (resolve-ability
+                       state :corp
+                       {:prompt "Choose a card to rez, ignoring the rez cost"
+                        :choices {:req #(not (:rezzed %))}
+                        :effect (req (gain state :corp :credit (rez-cost state side target))
+                                     (rez state side target)
+                                     (system-msg state side (str "rezzes " (:title target) " at no cast")))}
+                      card nil))
+    :abilities [{:msg "draw 1 card"
+                 :effect (effect (trash card {:cause :ability-cost}) (draw))}]}

    "New Angeles City Hall"
    {:events {:agenda-stolen {:msg "trash itself" :effect (effect (trash card))}}


Improve doc string

Improve doc string

--- src/clj/mdr2/routes/services.clj
+++ src/clj/mdr2/routes/services.clj
@@ -130,7 +130,7 @@
                               (not-found))))}}]

     ["/:id/xml"
-     {:get {:summary "Get DTBook XML for production"
+     {:get {:summary "Get the DTBook XML structure for a production"
             :parameters {:path {:id int?}}
             :handler (fn [{{{:keys [id]} :path} :parameters}]
                        (if-let [doc (db/get-production {:id id})]


don't pass long-time to add-pends

don't pass long-time to add-pends

--- src/clj/tictag/server_chimer.clj
+++ src/clj/tictag/server_chimer.clj
@@ -21,7 +21,7 @@
           (let [long-time (tc/to-long time)
                 id        (next!)]
             (timbre/debug "CHIME!")
-            (db/add-pending! db long-time id)
+            (db/add-pending! db time id)
             (doseq [slack-user (map :slack (db/get-all-users db))]
               (slack/send-message! slack-user (format "PING! id: %s, long-time: %d" id long-time)))))))))
   (stop [component]


Preserve meta of sequence

Preserve meta of sequence

--- src/com/wsscode/pathom/core.cljc
+++ src/com/wsscode/pathom/core.cljc
@@ -288,7 +288,7 @@
          env' (if processing-sequence
                 (if (::stop-sequence? (meta processing-sequence))
                   (dissoc env ::processing-sequence)
-                  (update env ::processing-sequence with-meta {::stop-sequence? true}))
+                  (update env ::processing-sequence vary-meta assoc ::stop-sequence? true))
                 env')]
      (cond
        (identical? query ::blank-union)


Add link to IETF tracker

Add link to IETF tracker


Added init fn alias for FRMX symmetry.

Added init fn alias for FRMX symmetry.

--- src/dragon/components/system.clj
+++ src/dragon/components/system.clj
@@ -81,10 +81,12 @@
              evt
              http))))

-(def init
+(def init-lookup
   {:default initialize-default
    :basic initialize-bare-bones
    :web initialize-with-web})
+
+(def init #'initialize-default)

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;   Managment Functions   ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


fixes

fixes

--- src/dynamodb_expression/core.clj
+++ src/dynamodb_expression/core.clj
@@ -28,9 +28,11 @@
                    {:type :add}
                    parts)))

-(defmulti render-update-expression first)
+(defmulti render-update-expression (fn [args] (first args)))

-(defmethod render-update-expression :add [_ pairs]
+(defmethod render-update-expression :default [[t _]] (throw (ex-info "Can't handle type" {:type t})))
+
+(defmethod render-update-expression :add [[_ pairs]]
   (->> pairs
        (map #(clojure.string/join " " %))
        (clojure.string/join ", ")))
@@ -38,16 +40,16 @@
 (defn type-kwd->type-expr [kwd] (-> kwd name clojure.string/upper-case))

 (defn reduce-partial-exprs [partial-type partials]
-  (-> (reduce (fn [{:keys [update-expression expression-attribute-names expression-attribute-values]
-                    :as acc}
-                   {:keys [type expression attr-names attr-values]}]
-                (prn update-expression)
-                {:update-expression (vec (conj update-expression (render-add-expr partial-type expression)))
-                 :expression-attribute-names (merge expression-attribute-names attr-names)
-                 :expression-attribute-values (merge expression-attribute-values attr-values)})
-              {}
-              partials)
-      (update :update-expression #(str (type-kwd->type-expr partial-type) " " (first %)))))
+  (->
+   (reduce (fn [{:keys [update-expression expression-attribute-names expression-attribute-values]
+                 :as acc}
+                {:keys [type expression attr-names attr-values]}]
+             {:update-expression (vec (conj update-expression (render-update-expression [partial-type expression])))
+              :expression-attribute-names (merge expression-attribute-names attr-names)
+              :expression-attribute-values (merge expression-attribute-values attr-values)})
+           {}
+           partials)
+   (update :update-expression #(str (type-kwd->type-expr partial-type) " " (first %)))))

 (defn expr [& forms]
   (->>


Adding sample key handlers for Q/W.

Adding sample key handlers for Q/W.

--- ClojureScript/hello.cljs
+++ ClojureScript/hello.cljs
@@ -1,12 +1,16 @@
 ; :mode=clojure:

 (ns hello
-    (:use
-        [goog.dom :only [appendChild createDom createTextNode removeChildren]]
-        [goog.events :only [listen]]
-        [goog.events.EventType :only [CLICK]]
-        [goog.graphics :only [createGraphics Stroke SolidFill Path]]
-        [goog :only [Timer]]
+    (:require
+        [goog.Timer :as Timer]
+        [goog.dom :as dom]
+        [goog.events :as events]
+        [goog.events.EventType :as EventType]
+        [goog.events.KeyCodes :as KeyCodes]
+        [goog.graphics :as graphics]
+        [goog.graphics.Stroke :as Stroke]
+        [goog.graphics.SolidFill :as SolidFill]
+        [goog.graphics.Path :as Path]
         ))

 (def my-code-url "https://github.com/pauldoo/scratch/blob/master/ClojureScript/hello.cljs")
@@ -114,38 +118,48 @@
         (fn [{keys :keys}]
             {:keys
                 (cond
-                    (= (.type event) goog.events.EventType/KEYUP)
+                    (= (.type event) EventType/KEYUP)
                         (disj keys (.keyCode event))
-                    (= (.type event) goog.events.EventType/KEYDOWN)
+                    (= (.type event) EventType/KEYDOWN)
                         (conj keys (.keyCode event))
                     :else keys)})))

-(defn tick-imp [state tick-step]
-    (assoc state :nodes
-        (update-node-positions
-            (update-node-velocities
-                (:nodes state)
-                (calculate-all-node-forces (:nodes state) (:springs state))
-                tick-step)
-            tick-step)))
+(defn tick-imp [state tick-step input-state]
+    (assoc state
+        :springs
+            (let [modifier (cond
+                    ((:keys input-state) KeyCodes/Q) 0.99
+                    ((:keys input-state) KeyCodes/W) 1.01
+                    :else 1.0)]
+                (map (fn [s]
+                    (assoc s :rest-length
+                        (* modifier (:rest-length s))))
+                        (:springs state)))
+        :nodes
+            (update-node-positions
+                (update-node-velocities
+                    (:nodes state)
+                    (calculate-all-node-forces (:nodes state) (:springs state))
+                    tick-step)
+                tick-step)))

 (defn tick [game-state-ref input-state] (do
-    (swap! game-state-ref #(tick-imp % tick-step))))
+    (swap! game-state-ref #(tick-imp % tick-step input-state))))

 (defn world-to-screen [[x y]]
     [x (- 275 y)])

 (defn draw-line [g x1 y1 x2 y2]
     (.drawPath g
-        (let [p (Path.)] (do
+        (let [p (goog.graphics.Path.)] (do
             (.moveTo p x1 y1)
             (.lineTo p x2 y2)
             p))
-        (Stroke. 1 "green") nil))
+        (goog.graphics.Stroke. 1 "green") nil))

 (defn rerender [canvas-element game-state]
     (let [
-        graphics (goog.graphics/createGraphics 400 300)
+        graphics (graphics/createGraphics 400 300)
         {nodes :nodes springs :springs} game-state]
         (do
             (apply draw-line graphics (apply concat (map world-to-screen [[0 0] [400 0]])))
@@ -157,9 +171,9 @@
                         (draw-line graphics x1 y1 x2 y2))) springs))
             (dorun (map
                 (fn [{p :pos}] (let [[x y] (world-to-screen p)]
-                    (.drawCircle graphics x y 3 (Stroke. 2 "green") (SolidFill. "yellow"))))
+                    (.drawCircle graphics x y 3 (goog.graphics.Stroke. 2 "green") (goog.graphics.SolidFill. "yellow"))))
                 (vals nodes)))
-            (goog.dom/removeChildren canvas-element)
+            (dom/removeChildren canvas-element)
             (.render graphics canvas-element)
             )))

@@ -167,26 +181,26 @@
     (let [
         game-state-ref (atom initial-game-state)
         input-state-ref (atom {:keys (set)})
-        canvas (goog.dom/createDom "div" {} "")
-        button (goog.dom/createDom "button" {} "Click!")
-        tick-timer (Timer. (Math/round (* 1000 tick-step)))
-        render-timer (Timer. (Math/round (* 1000 render-step)))
+        canvas (dom/createDom "div" {} "")
+        button (dom/createDom "button" {} "Click!")
+        tick-timer (goog.Timer. (Math/round (* 1000 tick-step)))
+        render-timer (goog.Timer. (Math/round (* 1000 render-step)))
         ]
         (do
             (. tick-timer (start))
             (. render-timer (start))
-            (dorun (map (partial apply goog.events/listen) [
-                [button goog.events.EventType/CLICK (partial input-event input-state-ref)]
-                [document.body goog.events.EventType/KEYDOWN (partial input-event input-state-ref) true]
-                [document.body goog.events.EventType/KEYUP (partial input-event input-state-ref) true]
-                [tick-timer goog.Timer/TICK #(tick game-state-ref (deref input-state-ref))]
-                [render-timer goog.Timer/TICK #(rerender canvas (deref game-state-ref))]]))
-            (goog.dom/appendChild document.body (goog.dom/createDom "div" {}
-                (goog.dom/createDom "h1" {} "Work in progress..")
-                (goog.dom/createDom "div" {} "Try clicking the button, or pressing keys.")
-                (goog.dom/createDom "div" {}
-                    (goog.dom/createTextNode "My code lives here: ")
-                    (goog.dom/createDom "a" (.strobj {"href" my-code-url}) my-code-url))
+            (dorun (map (partial apply events/listen) [
+                [button EventType/CLICK (partial input-event input-state-ref)]
+                [document.body EventType/KEYDOWN (partial input-event input-state-ref) true]
+                [document.body EventType/KEYUP (partial input-event input-state-ref) true]
+                [tick-timer Timer/TICK #(tick game-state-ref (deref input-state-ref))]
+                [render-timer Timer/TICK #(rerender canvas (deref game-state-ref))]]))
+            (dom/appendChild document.body (dom/createDom "div" {}
+                (dom/createDom "h1" {} "Work in progress..")
+                (dom/createDom "div" {} "Try clicking the button, or pressing keys.")
+                (dom/createDom "div" {}
+                    (dom/createTextNode "My code lives here: ")
+                    (dom/createDom "a" (.strobj {"href" my-code-url}) my-code-url))
                 button
                 canvas)))))


Tweak compile-dispatch-table's docstring

--- src/io/aviso/rook/dispatcher.clj
+++ src/io/aviso/rook/dispatcher.clj
@@ -118,7 +118,10 @@
     arglist))

 (defn compile-dispatch-table
-  "Compiles the dispatch table into a Ring handler."
+  "Compiles the dispatch table into a Ring handler.
+
+  See the docstring of unnest-dispatch-table for a description of
+  dispatch table format."
   ([dispatch-table]
      (compile-dispatch-table {} dispatch-table))
   ([options dispatch-table]


Additional doc/comments for async test mechanism


Change test code style

Change test code style


serve om-dev.js

serve om-dev.js

--- src/frontend/core.clj
+++ src/frontend/core.clj
@@ -15,6 +15,8 @@
    :mode :development})

 (defroutes routes
+  (GET "/js/om-dev.js" []
+       (response/redirect (stefon/link-to-asset "js/om-dev.js.stefon" stefon-options)))
   (compojure.route/resources "/" {:root "public"
                                   :mime-types {:svg "image/svg"}})
   (GET "/docs/manifest-dev.json" []


Fix stack overflow with large input corpus.

--- Spraff/src/spraff/core.clj
+++ Spraff/src/spraff/core.clj
@@ -80,10 +80,9 @@
             :table
                 (update-table (:table state) words)
             :starters
-                (concat (:starters state)
-                    (if (>= (count words) prefix-length)
-                        [(take prefix-length words)]
-                        [])))))
+                (if (>= (count words) prefix-length)
+                    (conj (:starters state) (take prefix-length words))
+                    (:starters state)))))
 (defn log-sentence! [message]
     (with-open [out (writer corpus-file :append true)]
         (.write out (str message "\n"))))


fix bug in wrongfully overwriting lexemes in grammar's index: copy before calling (over/overh)

--- src/babel/forest.cljc
+++ src/babel/forest.cljc
@@ -159,14 +159,18 @@
                                 (if (= true head-is-phrasal)
                                   (log/debug (str "no head lexemes possible because spec requires a phrasal head."))
                                   (log/warn (str "no head lexemes found for parent: " (:rule parent) " and spec: "
-                                                 (strip-refs spec))))
-                                (over/overh parent (lazy-shuffle candidate-lexemes) morph))]
-                          (if (not (empty? result))
-                            (log/debug (str "successful results of attaching head lexemes to: " (get-in parent [:rule]) ":"
-                                            (string/join ","
-                                                         (map #(morph %1)
-                                                              result)))))
-                          result)))
+                                                 (strip-refs spec)))
+                                  (over/overh parent
+                                              (map copy (lazy-shuffle candidate-lexemes))
+                                              morph))]
+                            (if (not (empty? result))
+                              (log/debug (str "successful results of attaching head lexemes to: " (get-in parent [:rule]) ":"
+                                              (string/join ","
+                                                           (map #(morph %1)
+                                                                result))))
+                              (if (not (empty? candidate-lexemes))
+                                (log/warn (str "all candidate lexemes failed!"))))
+                            result))))
                     candidate-heads)

             ;; TODO: throw exception if (get-in parent [:head]) is null.


Ignore values like s.n., s.l. and s.a.

Ignore values like s.n., s.l. and s.a.

which are basically empty values (sine nominem, sine loco and sine
annum)

--- src/catalog/vubis.clj
+++ src/catalog/vubis.clj
@@ -347,17 +347,25 @@
               :else [format genre])]
         (update-in m update-keys (fnil conj []) item))) {})))

+(defn ignore-sine-nomine [s]
+  "Return input string `s` unless it contains \"s.n.\" (Sine nomine),
+  \"s.l.\" (Sine loco) or \"s.a.\" (Sine anno)"
+  (when-not (re-matches #"\[?s.[nla]+.\]?" s)
+    s))
+
 (defn get-subfield
   "Get the subfield text for the given `path` in the given `record`.
   Returns nil if there is no such subfield"
   [record path]
-  (some-> (apply xml1-> record path) text string/trim))
+  (some->
+   (apply xml1-> record path) text string/trim ignore-sine-nomine))

 (defn get-multi-subfields
   "Get a list of subfield texts for the given `path` in the given
   `record`. Returns an empty list if there is no such subfield"
   [record path]
-  (some->> (apply xml-> record path) (map text) (map string/trim)))
+  (some->>
+   (apply xml-> record path) (map text) (map string/trim) (map ignore-sine-nomine)))

 (defn get-personel-role
   "Return `:director` if `personel` is a director, `actor` if


fixing default args

fixing default args

--- src/celestial/ssh.clj
+++ src/celestial/ssh.clj
@@ -11,14 +11,12 @@

 (defn ssh-opts
   "SSH session options"
-  ([port]
-   {:username "root" :strict-host-key-checking :no :port port})
   ([port user]
    {:username user :strict-host-key-checking :no :port port}))

 (defn with-session
   "Executes f on host with an ssh session"
-  [host port user f]
+  [{:keys [host port user] :or {user "root" port 22}} f]
   (let [agent (ssh-agent  {:use-system-ssh-agent false})]
     (add-identity agent (config :ssh))
     (let [session (session agent host (ssh-opts port user))]
@@ -31,7 +29,7 @@
 (defn put
   "Copies a file into host under dest"
   [host file dest]
-  (with-session host 22
+  (with-session {:host host :port 22}
     (fn [session]
       (let [channel (ssh-sftp session)]
         (with-channel-connection channel
@@ -43,11 +41,11 @@
   (doseq [line (line-seq (clojure.java.io/reader out))] (debug line))
   )

-(defn execute [{:keys [host port user] :or {port 22}} & batches]
+(defn execute [opts & batches]
   {:pre [(every? sequential? batches)]}
   "Executes remotly using ssh for example: (execute {:host \"192.168.20.171\"} [\"ls\"])"
   (doseq [b batches]
-    (with-session host port user
+    (with-session opts
       (fn [session]
         (let [{:keys [channel out-stream] :as res} (ssh session {:in  (join "\n" b)  :out :stream :agent-forwarding false})]
           (log-output out-stream)
@@ -55,7 +53,6 @@
             (when-not (= exit 0)
               (throw+ (merge res {:type ::execute-failed :exit exit} (meta b))))))
         ))))
-

 (defn fname [uri] (-> uri (split '#"/") last))


Quiet down log

Quiet down log

--- src/cfpb/qu/query.clj
+++ src/cfpb/qu/query.clj
@@ -82,12 +82,12 @@
 (defn execute
   "Execute the query against the provided collection."
   [dataset collection query]
-  (let [_ (log/info (str "Raw query: " (into {} query)))
+  (let [_ (log/info (str "Raw query: " (into {} (dissoc query :metadata :slicedef))))
         query (-> query
                   validation/validate
                   resolve-limit-and-offset
                   mongo/process)
-        _ (log/info (str "Post-process query: " (into {} query)))]
+        _ (log/info (str "Post-process query: " (into {} (dissoc query :metadata :slicedef))))]
     (assoc query :result
            (cond
             (seq (:errors query)) []


adding group creds to hz client

adding group creds to hz client

--- src/chazel/chazel.clj
+++ src/chazel/chazel.clj
@@ -7,6 +7,7 @@
            [com.hazelcast.client HazelcastClient]
            [com.hazelcast.client.impl HazelcastClientProxy]
            [com.hazelcast.client.config ClientConfig]
+           [com.hazelcast.config GroupConfig]
            [com.hazelcast.instance HazelcastInstanceProxy]))

 (defn new-instance
@@ -24,13 +25,15 @@
   ([conf]
     (Hazelcast/getOrCreateHazelcastInstance conf)))

-(defn client-config [{:keys [hosts retry-ms retry-max]}]
-  (let [config (ClientConfig.)]
+(defn client-config [{:keys [hosts retry-ms retry-max group-name group-password]}]
+  (let [config (ClientConfig.)
+        groupConfig (GroupConfig. group-name group-password)]
     (doto config
       (.getNetworkConfig)
       (.addAddress (into-array hosts))
       (.setConnectionAttemptPeriod retry-ms)
       (.setConnectionAttemptLimit retry-max))
+      (.setGroupConfig config groupConfig)
     config))

 (defn instance-active? [instance]
@@ -43,7 +46,9 @@
   default-client-config
   {:hosts ["127.0.0.1"]
    :retry-ms 5000
-   :retry-max 720000})                        ;; 720000 * 5000 = one hour
+   :retry-max 720000
+   :group-name "dev"
+   :group-password "dev-pass"})                        ;; 720000 * 5000 = one hour

 (defonce c-instance (atom nil))


Fix misplaced docstring (found with clj-kondo). (#153)

Fix misplaced docstring (found with clj-kondo).

--- src/cheshire/core.clj
+++ src/cheshire/core.clj
@@ -121,11 +121,12 @@
 (def ^:dynamic ^JsonGenerator *generator*)
 (def ^:dynamic *opt-map*)

-(defmacro with-writer [[writer opt-map] & body]
+(defmacro with-writer
   "Start writing for series objects using the same json generator.
    Takes writer and options map as arguments.
    Expects its body as sequence of write calls.
    Returns a given writer."
+  [[writer opt-map] & body]
   `(let [c-wr# ~writer]
      (binding [*generator* (create-generator c-wr#)
                *opt-map* ~opt-map]


change `satisfies?` so it takes a third parametr. passing false will disable JS native hash table lookup. this way if a protocol test fails, we don't pay when we're going to handle the natives cases directly anyway.

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -825,21 +825,29 @@

 (defmacro satisfies?
   "Returns true if x satisfies the protocol"
-  [psym x]
-  (let [p (:name (cljs.analyzer/resolve-var (dissoc &env :locals) psym))
-        prefix (protocol-prefix p)
-        xsym (bool-expr (gensym))
-        [part bit] (fast-path-protocols p)
-        msym (symbol (core/str "-cljs$lang$protocol_mask$partition" part "$"))]
-    `(let [~xsym ~x]
-       (if ~xsym
-         (if (or ~(if bit `(unsafe-bit-and (. ~xsym ~msym) ~bit))
+  ([psym x] `(satisfies? ~psym ~x true))
+  ([psym x check-native]
+    (let [p          (:name
+                       (cljs.analyzer/resolve-var
+                         (dissoc &env :locals) psym))
+          prefix     (protocol-prefix p)
+          xsym       (bool-expr (gensym))
+          [part bit] (fast-path-protocols p)
+          msym       (symbol
+                       (core/str "-cljs$lang$protocol_mask$partition" part "$"))]
+      `(let [~xsym ~x]
+         (if ~xsym
+           (if (or ~(if bit `(unsafe-bit-and (. ~xsym ~msym) ~bit))
                  ~(bool-expr `(. ~xsym ~(symbol (core/str "-" prefix)))))
-           true
-           (if (coercive-not (. ~xsym ~msym))
-             (cljs.core/type_satisfies_ ~psym ~xsym)
-             false))
-         (cljs.core/type_satisfies_ ~psym ~xsym)))))
+             true
+             ~(if check-native
+                `(if (coercive-not (. ~xsym ~msym))
+                   (cljs.core/type_satisfies_ ~psym ~xsym)
+                   false)
+                false))
+           ~(if check-native
+              `(cljs.core/type_satisfies_ ~psym ~xsym)
+              false))))))

 (defmacro lazy-seq [& body]
   `(new cljs.core/LazySeq nil false (fn [] ~@body) nil))


Neatens the can-be-advanced function definition

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -52,14 +52,14 @@
 (declare prompt! forfeit trigger-event handle-end-run trash update-advancement-cost update-all-advancement-costs
          update! get-card update-all-ice update-ice-strength update-breaker-strength all-installed resolve-steal-events)

+(declare rezzed?)
+
 (defn can-be-advanced? [card]
   "Returns true if the card can be advanced"
-  (or (= (:advanceable card) "always")
-      (= (:advanceable card) :always) ; needed for testing
-      (and (or (= (:advanceable card) "while-rezzed")
-               (= (:advanceable card) :while-rezzed)) ; needed for testing
-           (:rezzed card))
-      (and (= (:type card) "Agenda")
+  (or (card-is? card :advanceable :always)
+      (and (card-is? card :advanceable :while-rezzed)
+           (rezzed? card))
+      (and (card-is? card :type "Agenda")
            (= (first (:zone card)) :servers))))

 (defn can-pay? [state side & args]


changed search engine to duckduckgo

changed search engine to duckduckgo

--- src/complico/core.clj
+++ src/complico/core.clj
@@ -12,7 +12,7 @@
             [hiccup.core :as hiccup]))

 ; url of the external search engine to use
-(def external-search-url "http://uk.search.yahoo.com/search?p=")
+(def external-search-url "https://duckduckgo.com/?q=")

 (def home-page
   (selmer/render-file "templates/index.html" {}))


Cleaner check for medusa

Cleaner check for medusa

--- src/demogorgon/nh.clj
+++ src/demogorgon/nh.clj
@@ -314,8 +314,7 @@
                                  "")
                                (:genocided_monster data))

-    :killed_uniq (if (= (:killed_uniq data) "Medusa")
-                   nil
+    :killed_uniq (if (not (= (:killed_uniq data) "Medusa"))
                    (str (:player data) " killed " (:killed_uniq data) " after " (:turns data) " turns."))

     :killed_shopkeeper (str (:player data) " killed the shopkeeper "


Add support for lein's `:managed-dependencies` (#506)

Prior to this commit, figwheel would error out on any projects
that were using lein's `:managed-dependencies` feature to
inject version numbers into the project.  This commit makes sure
that `:managed-dependencies` is one of the included keys selected
from the original project map, and allows projects that use this
key to run properly.

--- plugin/src/leiningen/figwheel.clj
+++ plugin/src/leiningen/figwheel.clj
@@ -19,6 +19,7 @@
                             :eval-in
                             :jvm-opts
                             :local-repo
+                            :managed-dependencies
                             :dependencies
                             :repositories
                             :mirrors