Added utf-8 to content type so web can display arabic, japanese, etc.

--- web/src/twitter_hashtags_visualizer/handler.clj
+++ web/src/twitter_hashtags_visualizer/handler.clj
@@ -54,22 +54,22 @@

 (defn json-response [data & [status]]
   {:status (or status 200)
-   :headers {"Content-Type" "application/json"
+   :headers {"Content-Type" "application/json; charset=UTF-8"
              "Cache-Control" "public, max-age=0, nocache"}
    :body (json/generate-string data)})

 (defn page []
   (let [title "Popular Twitter Tags"]
     (html5
-      [:head
-        [:title title]
-        (include-css "main.css")
-        (include-js "http://code.jquery.com/jquery-2.0.3.min.js"
-                    "http://underscorejs.org/underscore.js"
-                    "tags.js")]
-      [:body
-        [:h1 title]
-        [:div {:class "tags-container"}]])))
+     [:head
+      [:title title]
+      (include-css "main.css")
+      (include-js "http://code.jquery.com/jquery-2.0.3.min.js"
+                  "http://underscorejs.org/underscore.js"
+                  "tags.js")]
+     [:body
+      [:h1 title]
+      [:div {:class "tags-container"}]])))

 (defroutes app-routes
   (GET "/" [] (page))


correct negative values for inverse gamma

--- src/distributions/inverse-gamma.clj
+++ src/distributions/inverse-gamma.clj
@@ -10,18 +10,18 @@
   (P [d x] (.probability (new GammaDistribution shape (/ 1 scale)) x))
   (P [d] (fn [x] (P d x)))
   distribution-function
-  (cdf [d x] (- 1 (.cumulativeProbability (new GammaDistribution shape (/ 1 scale)) (/ 1 x))))
+  (cdf [d x] (if (<= x 0) 0.0  (- 1 (.cumulativeProbability (new GammaDistribution shape (/ 1 scale)) (/ 1 x)))))
   (cdf [d] (fn [x] (cdf d x)))
   inverse-distribution-function
-  (icdf [d x] (/ 1 (.inverseCumulativeProbability (new GammaDistribution shape (/ 1 scale)) (- 1 x))))
+  (icdf [d x] (if (= x 0) 0.0 (/ 1 (.inverseCumulativeProbability (new GammaDistribution shape (/ 1 scale)) (- 1 x)))))
   (icdf [d] (fn [x] (icdf d x)))
   density-function
-  (pdf [d x] (* (/ 1 (* x x)) (.density (new GammaDistribution shape (/ 1 scale)) (/ 1 x))))
+  (pdf [d x] (if (<= x 0) 0.0 (* (/ 1 (* x x)) (.density (new GammaDistribution shape (/ 1 scale)) (/ 1 x)))))
   (pdf [d] (fn [x] (pdf d x)))
-  (log-pdf [d x] (+ (* -2 (Math/log x)) (.logDensity (new GammaDistribution shape (/ 1 scale)) (/ 1 x))))
+  (log-pdf [d x] (if (<= x 0) Double/NEGATIVE_INFINITY (+ (* -2 (Math/log x)) (.logDensity (new GammaDistribution shape (/ 1 scale)) (/ 1 x)))))
   (log-pdf [d] (fn [x] (log-pdf d x)))
   support
-  (support-lower [d] 0)
+  (support-lower [d] 0.0)
   (support-upper [d] Double/POSITIVE_INFINITY)
   first-moment
   (mean [d] (/ scale (dec shape)))


Factor *eval-fn* to one binding

Factor *eval-fn* to one binding

Former-commit-id: 3151b539bea9e8554a525f72b1ea65cfbbd6494c

--- planck-cljs/src/planck/core.cljs
+++ planck-cljs/src/planck/core.cljs
@@ -189,7 +189,8 @@
   [source expression? print-nil-expression?]
   (binding [ana/*cljs-ns* @current-ns
             *ns* (create-ns @current-ns)
-            r/*data-readers* tags/*cljs-data-readers*]
+            r/*data-readers* tags/*cljs-data-readers*
+            cljs.js/*eval-fn* cljs/js-eval]
     (let [expression-form (and expression? (repl-read-string source))]
       (if (repl-special? expression-form)
         (let [env (assoc (ana/empty-env) :context :expr
@@ -207,8 +208,7 @@
                   (try (cljs/eval st
                                   expr
                                   {:ns   @current-ns
-                                   :context :expr
-                                   :eval cljs/js-eval}
+                                   :context :expr}
                                   print-error)
                        (catch js/Error e (prn :caught e)))))
           (prn nil))
@@ -220,7 +220,6 @@
             (merge
               {:ns         @current-ns
                :load       load
-               :eval       cljs/js-eval
                :source-map false
                :verbose    (:verbose @app-env)}
               (when expression?


Whitespace formatting

Whitespace formatting

Former-commit-id: 8358fa7c0d06a68cad2a3a6d68bb377046a8b62f

--- planck-cljs/src/planck/repl.cljs
+++ planck-cljs/src/planck/repl.cljs
@@ -219,7 +219,7 @@
   constructor named by closure-namespace to the current namespace. Use :import in the ns
   macro in preference to calling this directly."}
     load-file      {:arglists ([name])
-                    :doc     "Sequentially read and evaluate the set of forms contained in the file."}
+                    :doc      "Sequentially read and evaluate the set of forms contained in the file."}
     doc            {:arglists ([name])
                     :doc      "Prints documentation for a var or special form given its name"}
     source         {:arglists ([name])


Fix compile?

Fix compile?

--- src/exp/sas_hierarchy_induction.clj
+++ src/exp/sas_hierarchy_induction.clj
@@ -87,7 +87,7 @@
     (hla-type        [] orig-type)
     (extend-hla!     [init-sets par-effect-sets] (throw (UnsupportedOperationException.)))
   env/Action
-    (action-name [] name)
+    (action-name [] [:!C  name])
     (primitive?  [] false)
   env/ContextualAction
     (precondition-context [s] precond-vars)
@@ -122,20 +122,22 @@

 (defn default-compile-hla-noflatten [hla retain-type-set]
-  (if (contains? retain-type-set (hla-type hla)) hla
-    (or (get *compile-cache* hla)
-        (let [chla (make-compiled-hla (env/action-name hla) (type hla) (precond-var-set hla) (effect-sets hla))]
-          (.put *compile-cache* hla chla)
-          (set-compiled-hla-refinements chla
-            (doall (for [[p r] (pre-ref-pairs hla)] [p (compile-refinement r retain-type-set)])))
-          chla))))
+  (println "compiling-noflatten" (env/action-name hla))
+  (or (get *compile-cache* hla)
+      (let [chla (make-compiled-hla (env/action-name hla) (type hla) (precond-var-set hla) (effect-sets hla))]
+        (.put *compile-cache* hla chla)
+        (set-compiled-hla-refinements chla
+                                      (doall (for [[p r] (pre-ref-pairs hla)] [p (compile-refinement r retain-type-set)])))
+        chla)))

 (defn default-compile-hla [hla retain-type-set]
- (if (contains? retain-type-set (hla-type hla)) hla
+  (println "compiling" (env/action-name hla))
   (let [pr (pre-ref-pairs hla)]
-    (if (and (util/singleton? pr) (empty? (ffirst pr)))
-      (compile-refinement (second (first pr)) retain-type-set)
-      (default-compile-hla-noflatten hla retain-type-set)))))
+     (if (and (util/singleton? pr)
+              (empty? (ffirst pr))
+              (not (contains? retain-type-set (hla-type hla))))
+         (compile-refinement (second (first pr)) retain-type-set)
+         (default-compile-hla-noflatten hla retain-type-set))))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; VV HLAs ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -440,7 +442,8 @@
     (effect-sets     [] (throw (UnsupportedOperationException.)))
     (pre-ref-pairs   [] (throw (UnsupportedOperationException.)))
     (compile-hla     [retain-type-set]
-                     (SAS-Interleaving-HLA. (vec (map #(compile-refinement % (conj retain-type-set ::SAS-Precond-Set-HLA)) refinements)) shared-var-set))
+      (println "interleaved compile" (map #(map env/action-name %) refinements))
+      (SAS-Interleaving-HLA. (vec (map #(compile-refinement % (conj retain-type-set ::SAS-Precond-Set-HLA)) refinements)) shared-var-set))
     (hla-type        [] (type this))
     (extend-hla!     [init-sets par-effect-sets] (throw (UnsupportedOperationException.)))
   env/Action
@@ -450,7 +453,7 @@
     (precondition-context [s] (precond-var-set this))
   hierarchy/HighLevelAction
     (immediate-refinements- [s]
-      (let [[stalled-refs rest-refs] (split-with #(= (type (first %)) ::SAS-Precond-Set-HLA) refinements)]
+      (let [[stalled-refs rest-refs] (split-with #(= (hla-type (first %)) ::SAS-Precond-Set-HLA) refinements)]
 ;        (println (map count [stalled-refs rest-refs]))
 ;        (println (map #(map type %) rest-refs))
         (if-let [[target-ref & more-refs] (seq rest-refs)]
@@ -561,7 +564,7 @@
 (defn pretty-print-hla [h #^HashSet done-set]
   (when-not (.contains done-set h)
     (.add done-set h)
-    (println (str "\nRefs for HLA" (env/action-name h)) (precond-var-set h)  (effect-sets h))
+    (println (str "\nRefs for HLA" (env/action-name h)) );(precond-var-set h)  (effect-sets h))
     (doseq [ref (map second (pre-ref-pairs   h))]
       (println " " (util/str-join ", " (map env/action-name ref))))
     (doseq [ref (map second (pre-ref-pairs   h)), a ref]


Update words.clj

Update words.clj

--- src/iyye/subcon/knowledge/words.clj
+++ src/iyye/subcon/knowledge/words.clj
@@ -85,10 +85,10 @@
 (defn set-iyye-type! [type]
   (let [uname (:Uname (:atom type))
         builtin (:Builtin (:atom type))]
-    (when builtin
       (do
-        (dosync (alter noun-words assoc @noun-words {uname type}))
-        (save-iyye-type-to-db type)))))
+        (dosync (alter noun-words #(assoc % uname type)))
+        (when (not builtin)
+          (save-iyye-type-to-db type)))))

 (defn check-params [action params]
   (let [act-params (:Types action)]


conditional compiler string logic & foreign libs handling

--- src/main/clojure/cljs/compiler.cljc
+++ src/main/clojure/cljs/compiler.cljc
@@ -18,13 +18,15 @@
                     [cljs.source-map :as sm]
                     [clojure.data.json :as json]
                     [cljs.js-deps :as deps])
-     :cljs (:require [clojure.string :as string]
+     :cljs (:require [goog.string :as gstring]
+                     [clojure.string :as string]
                      [cljs.tools.reader :as reader]
                      [cljs.env :as env]
                      [cljs.analyzer :as ana]
                      [cljs.source-map :as sm]))
   #?(:clj (:import java.lang.StringBuilder
-                   java.io.File)))
+                   java.io.File)
+     :cljs (:import [goog.string StringBuffer])))

 (set! *warn-on-reflection* true)

@@ -94,7 +96,8 @@
   (interpose "," xs))

 (defn- escape-char [^Character c]
-  (let [cp (.hashCode c)]
+  (let [cp #?(:clj (.hashCode c)
+              :cljs (gstring/hashCode c))]
     (case cp
       ; Handle printable escapes before ASCII
       34 "\\\""
@@ -110,7 +113,8 @@
         (format "\\u%04X" cp))))) ; Any other character is Unicode

 (defn- escape-string [^CharSequence s]
-  (let [sb (StringBuilder. (count s))]
+  (let [sb #?(:clj (StringBuilder. (count s))
+              :cljs (StringBuffer.))]
     (doseq [c s]
       (.append sb (escape-char c)))
     (.toString sb)))
@@ -466,7 +470,9 @@

 (defn get-define [mname jsdoc]
   (let [opts (get @env/*compiler* :options)]
-    (and (some #(.startsWith ^String % "@define") jsdoc)
+    (and (some #?(:clj #(.startsWith ^String % "@define")
+                  :cljs #(gstring/startsWith % "@define"))
+           jsdoc)
          opts
          (= (:optimizations opts) :none)
          (let [define (get-in opts [:closure-defines (str mname)])]
@@ -893,18 +899,19 @@
       (emitln "if(!COMPILED) " loaded-libs " = cljs.core.set();"))
     (doseq [lib (remove (set (vals seen)) (distinct (vals libs)))]
       (cond
-        (ana/foreign-dep? lib)
-        (let [{:keys [target optimizations]} (get @env/*compiler* :options)]
-          ;; we only load foreign libraries under optimizations :none
-          (when (= :none optimizations)
-            (if (= :nodejs target)
-              ;; under node.js we load foreign libs globally
-              (let [{:keys [js-dependency-index options]} @env/*compiler*
-                    ijs-url (get-in js-dependency-index [(name lib) :url])]
-                (emitln "cljs.core.load_file(\""
-                  (str (io/file (util/output-directory options) (util/get-name ijs-url)))
-                  "\");"))
-              (emitln "goog.require('" (munge lib) "');"))))
+        #?@(:clj
+            [(ana/foreign-dep? lib)
+             (let [{:keys [target optimizations]} (get @env/*compiler* :options)]
+               ;; we only load foreign libraries under optimizations :none
+               (when (= :none optimizations)
+                 (if (= :nodejs target)
+                   ;; under node.js we load foreign libs globally
+                   (let [{:keys [js-dependency-index options]} @env/*compiler*
+                         ijs-url (get-in js-dependency-index [(name lib) :url])]
+                     (emitln "cljs.core.load_file(\""
+                       (str (io/file (util/output-directory options) (util/get-name ijs-url)))
+                       "\");"))
+                   (emitln "goog.require('" (munge lib) "');"))))])

         (or (-> libs meta :reload)
             (= (get reloads lib) :reload))
@@ -1016,13 +1023,14 @@
 (defn- build-affecting-options [opts]
   (select-keys opts [:static-fns :optimize-constants :elide-asserts :target]))

-(defn compiled-by-string
-  ([] (compiled-by-string nil))
-  ([opts]
-    (str "// Compiled by ClojureScript "
-      (util/clojurescript-version)
-      (when opts
-        (str " " (pr-str (build-affecting-options opts)))))))
+#?(:clj
+   (defn compiled-by-string
+     ([] (compiled-by-string nil))
+     ([opts]
+      (str "// Compiled by ClojureScript "
+        (util/clojurescript-version)
+        (when opts
+          (str " " (pr-str (build-affecting-options opts))))))))

 #?(:clj
    (defn compile-file*


Don't use range directly, because it's awkwardly non-inclusive and doens't handle runs downward.

--- src/overtunes/songs/variatio-12.clj
+++ src/overtunes/songs/variatio-12.clj
@@ -16,8 +16,12 @@
 (defn bpm [per-minute] #(-> % (/ per-minute) (* 60) (* 1000)))
 (defn translate [f x y] #(-> % (+ x) f (+ y)))
 (defn syncopate [timing durations] #(->> % (sum-n durations) timing))
+(defn run [a b]
+  (if (<= a b)
+    (range a (inc b))
+    (reverse (run b a))))

-(def pitches (flatten [-7 0 (range -1 4) (range 2 -1 -1) 4 (range 1 9) (range 7 -2 -1) 0]))
+(def pitches (flatten [-7 0 (run -1 3) (run 2 0) 4 (run 1 8) (run 7 -1) 0]))
 (def durations (flatten [1/2 (repeat 2 1/4) 1/2 (repeat 6 1/4) (repeat 8 1/4) 3/2 (repeat 10 1/4)]))

 (defn melody# [timing notes]


remove heroku-starter.clj, no dashes allowed in filenames

--- src/ruuvi_server/heroku-starter.clj
+++ src/ruuvi_server/heroku-starter.clj
@@ -1,8 +0,0 @@
-(ns ruuvi-server.heroku-starter
-  (:use ruuvi-server.core)
-  )
-
-;; heroku starter
-(defn -main []
-  (let [port (Integer/parseInt (System/getenv "PORT"))]
-    (start port)))


[#12907] Fix error on 'Accept and join' in referral chat

--- src/status_im/acquisition/chat.cljs
+++ src/status_im/acquisition/chat.cljs
@@ -37,7 +37,7 @@

 (fx/defn join-public-chat
   [cofx chat-name]
-  (chat/start-public-chat cofx chat-name))
+  (chat/start-public-chat cofx chat-name nil))

 (fx/defn accept-pack
   {:events [::accept-pack]}


Small refactor of keyword-params

Small refactor of keyword-params

--- ring-core/src/ring/middleware/keyword_params.clj
+++ ring-core/src/ring/middleware/keyword_params.clj
@@ -4,11 +4,9 @@
 (defn- keyify-params [target]
   (cond
     (map? target)
-      (reduce
-        (fn [m [k v]]
-          (assoc m (keyword k) (keyify-params v)))
-        {}
-        target)
+      (into {}
+        (for [[k v] target]
+          [(keyword k) (keyify-params v)]))
     (vector? target)
       (vec (map keyify-params target))
     :else


Add Spec

Add Spec

--- src/twentyfortyeight/view/view.cljs
+++ src/twentyfortyeight/view/view.cljs
@@ -53,6 +53,10 @@
         padding (repeat amount-to-pad pad)]
     (clojure.string/join (concat s padding))))

+(s/def ::hex-length #(= 6 (.-length %)))
+
+(s/def ::hex-color (s/and string? ::hex-length))
+
 (defn value->color
   [value]
   (str "#" (pad-right-with (int->hex (* 10001 value)) 6 \0)))


modify log statements

modify log statements

--- src/vip/data_processor/pipeline.clj
+++ src/vip/data_processor/pipeline.clj
@@ -20,9 +20,10 @@

 (defn check-stop-flag
   [ctx]
-  (log/info "Checking stop request flag")
-  (if (psql/get-run-field ctx :stop_requested)
-    (assoc ctx :stop "Stop requested")
+  (log/debug "Checking stop request flag")
+  (if-let [stop-requested (psql/get-run-field ctx :stop_requested)]
+    (do (log/info "db stop requested by" stop-requested)
+        (assoc ctx :stop "Stop requested"))
     ctx))

 (defn run-pipeline


Update Jetty version to 9.4.28.v20200408

--- ring-jetty-adapter/project.clj
+++ ring-jetty-adapter/project.clj
@@ -7,7 +7,7 @@
   :dependencies [[org.clojure/clojure "1.7.0"]
                  [ring/ring-core "1.8.0"]
                  [ring/ring-servlet "1.8.0"]
-                 [org.eclipse.jetty/jetty-server "9.4.24.v20191120"]]
+                 [org.eclipse.jetty/jetty-server "9.4.28.v20200408"]]
   :aliases {"test-all" ["with-profile" "default:+1.8:+1.9:+1.10" "test"]}
   :profiles
   {:dev  {:dependencies [[clj-http "3.10.0"]]


don't have connection-filter in an atom

don't have connection-filter in an atom

--- figwheel-repl/src/figwheel/repl.cljc
+++ figwheel-repl/src/figwheel/repl.cljc
@@ -813,7 +813,7 @@
 (defn connections-available [repl-env]
   (sort-by
    :created-at >
-   (filter (or (some-> repl-env :connection-filter deref)
+   (filter (or (some-> repl-env :connection-filter)
                identity)
            (open-connections))))

@@ -1087,7 +1087,7 @@
           :out-print-fn nil
           :err-print-fn nil
           :print-to-output-streams true
-          :connection-filter (atom connection-filter)
+          :connection-filter connection-filter
           :focus-session-name (atom nil)
           :broadcast false
           :port port}


Wrap docstrings

Wrap docstrings

--- src-cljs/frontend/components/pieces/button.cljs
+++ src-cljs/frontend/components/pieces/button.cljs
@@ -173,7 +173,9 @@

     ## Widths
-    Button widths vary based on button text length and can have a **Fixed** attribute which if set to **true** will make the button fixed width for cases where we want buttons to be consistent."
+    Button widths vary based on button text length and can have a **Fixed**
+    attribute which if set to **true** will make the button fixed width for
+    cases where we want buttons to be consistent."

     (button-display
      [;; Primary buttons
@@ -334,7 +336,8 @@
                   (icon/settings))]]))

   (defcard bordered-buttons
-    "Buttons with borders are used in the header. This is design debt and will be addressed when we revisit the build/run page header."
+    "Buttons with borders are used in the header. This is design debt and will
+    be addressed when we revisit the build/run page header."
     (button-display
      [
       [(managed-button {:bordered? true


Wrap header-item text in span (for easier styling)

--- src/braid/core/client/ui/views/header_item.cljs
+++ src/braid/core/client/ui/views/header_item.cljs
@@ -25,6 +25,6 @@
                          (on-click context)
                          on-click)
              :title title}
-         body
+         [:span body]
          (when icon
            [:div.icon icon])]))))


fix: names disappeared!

fix: names disappeared!

--- src/amindblowingworld/civs.clj
+++ src/amindblowingworld/civs.clj
@@ -127,7 +127,7 @@
              biome (.get b (:x pos) (:y pos))]
         (not (= (.name biome) "OCEAN"))))))

-(def fastness 10000)
+(def fastness 100)

 (defn settlements-around [pos radius]
   (let [cx (:x pos)
@@ -211,7 +211,7 @@
         tribe           (get-tribe tribe-id)
         _               (assert (not (nil? tribe)) (str "No tribe found with id " tribe-id " in " @game))
         language        (:language tribe)
-        new-village-name (:name language)
+        new-village-name (.name language)
         new-pos (free-random-land-near (:pos old-village) 10)
         _               (assert (not (nil? new-pos)))
         pop-new-village (rand-between (/ (:pop old-village) 5) (/ (:pop old-village) 3))
@@ -272,8 +272,8 @@
     (let [id-tribe        (get-next-id)
           id-settlement   (get-next-id)
           language        (generate-language)
-          name-tribe      (:name language)
-          name-settlement (:name language)
+          name-tribe      (.name language)
+          name-settlement (.name language)
           pos             (free-random-land)
           settlement      (Settlement. id-settlement name-settlement 100 id-tribe pos)
           tribe           (Tribe. id-tribe name-tribe language [id-settlement])


clojure: streamlined code for row/column elimination in matrices

--- clojure/org/gavrog/clojure/common/arithmetic.clj
+++ clojure/org/gavrog/clojure/common/arithmetic.clj
@@ -54,14 +54,7 @@
   (let [i0 (first rows), j0 (first cols)]
     (reduce (fn [M i]
               (let [a (M [i0 j0]), b (M [i j0])]
-                (cond (divides? a b)
-                      (combine-rows M cols i0 i 1 0 (- (quot b a)) 1)
-
-                      (not (zero? b))
-                      (apply combine-rows M cols i0 i (gcdex a b))
-
-                      :else
-                      M)))
+                (if (zero? b) M (apply combine-rows M cols i0 i (gcdex a b)))))
             M
             (rest rows))))

@@ -70,14 +63,9 @@
     (loop [M M, js (rest cols)]
       (if-let [j (first js)]
         (let [a (M [i0 j0]), b (M [i0 j])]
-          (cond (divides? a b)
-                (recur (assoc M [i0 j] 0) (rest js))
-
-                (not (zero? b))
-                [(apply combine-cols M rows j0 j (gcdex a b)) true]
-
-                :else
-                (recur M (rest js))))
+          (if (divides? a b)
+            (recur (assoc M [i0 j] 0) (rest js))
+            [(apply combine-cols M rows j0 j (gcdex a b)) true]))
         [M false]))))

 (defn- eliminate [M rows cols]


PDOK-1582: fixed test

PDOK-1582: fixed test

--- src/test/clojure/pdok/featured/feature_test.clj
+++ src/test/clojure/pdok/featured/feature_test.clj
@@ -36,7 +36,7 @@

 (def gml-object-with-hole {"type" "gml" "gml" gml-with-hole})

-(def gml-without-curves "<gml:Polygon xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:imgeo-s=\"http://www.geostandaarden.nl/imgeo/2.1/simple/gml31\" xmlns:gml=\"http://www.opengis.net/gml\"><gml:exterior><gml:LinearRing><gml:posList> 45000.0 65000.0 40000.0 65000.0 40000.0 60000.0 45000.0 60000.0 45000.0 65000.0 </gml:posList></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:posList> 43000.0 63000.0 42000.0 63000.0 42000.0 62000.0 43000.0 62000.0 43000.0 63000.0 </gml:posList></gml:LinearRing></gml:interior></gml:Polygon>")
+(def gml-without-curves "<gml:Polygon xmlns:xlink=\"http://www.w3.org/1999/xlink\" xmlns:imgeo-s=\"http://www.geostandaarden.nl/imgeo/2.1/simple/gml31\" xmlns:gml=\"http://www.opengis.net/gml\"><gml:exterior><gml:LinearRing><gml:posList> 45000.0 65000.0 40000.0 65000.0 40000.0 60000.0 45000.0 60000.0 45000.0 65000.0 </gml:posList></gml:LinearRing></gml:exterior><gml:interior><gml:LinearRing><gml:posList> 43000.0 63000.0 42000.0 63000.0 42000.0 62000.0 43000.0 62000.0 43000.0 63000.0 </gml:posList></gml:LinearRing></gml:interior><gml:interior><gml:LinearRing><gml:posList> 44000.0 63000.0 42000.0 63000.0 42000.0 62000.0 43000.0 62000.0 44000.0 63000.0 </gml:posList></gml:LinearRing></gml:interior></gml:Polygon>")
 (def gml-object-without-curves {"type" "gml" "gml" gml-without-curves})

 (defn test-transform [xsl] (transform xsl  gml-with-arc))


+"there" (existential nominative pronoun) (e.g. "there will be ..")

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -2167,6 +2167,13 @@
               :subcat '()}}
     ]

+   "there" {:synsem {:cat :noun
+                     :pronoun true
+                     :case :nom
+                     :sem {:null true
+                           :pred :existential}
+                     :agr {:person :3rd
+                           :number :sing}}}
    "they"
    [;; human
     {:english {:note "♂"}
@@ -2475,7 +2482,8 @@
                       :past-participle "worried"}
             :synsem {:cat :verb
                      :sem {:reflexive true
-                           :pred :worry}}}
+                           :pred :worry}
+                     :subcat {:2 '()}}}

    "write"  {:english {:past "wrote"
                        :past-participle "written"}


added changer marcher effacer

added changer marcher effacer

--- src/babel/francais/lexicon.clj
+++ src/babel/francais/lexicon.clj
@@ -37,13 +37,6 @@

     "augmenter" {:synsem {:cat :verb
                          :sem {:pred :increase}}}
-
-     "boire" {:synsem {:boot-stem1 "boiv"
-                        :boot-stem2 "buv"}
-    :français {:passato "bu"}
-             :synsem {:cat :verb
-                      :sem {:pred :drink}}}
-

    "avoir"
    {:synsem {:essere false
@@ -59,13 +52,26 @@
                          :2plur "avez"
                          :3plur "ont"}}}

+    "boire" {:synsem {:boot-stem1 "boiv"
+                        :boot-stem2 "buv"}
+    :français {:passato "bu"}
+             :synsem {:cat :verb
+                      :sem {:pred :drink}}}
+
+   "changer" {:synsem {:cat :verb
+                         :sem {:pred :change}}}
+
    "commencer" {:synsem {:cat :verb
                          :sem {:pred :begin}}}

      "ecouter" {:synsem {:cat :verb
                          :sem {:pred :listen}}}
+
+     "marchcer" {:synsem {:cat :verb
+                         :sem {:pred :walk}}}

-
+     "effacer" {:synsem {:cat :verb
+                         :sem {:pred :erase}}}
    "elle"
    [{:synsem {:cat :noun
              :pronoun true


documentation

documentation

--- src/babel/latin/morphology.clj
+++ src/babel/latin/morphology.clj
@@ -373,11 +373,9 @@
                               ire-future-indicative))

 (defn analyze [surface-form lexicon]
+  "find the lexical structure for a surface form given a lexicon"
   (morph/analyze surface-form lexicon replace-patterns))

-(defn conjugate [surface-form lexicon]
-  (morph/conjugate surface-form lexicon replace-patterns))
-
-
-
-
+(defn conjugate [structure lexicon]
+  "reverse of analyze: find the surface form given a lexical structure and a lexicon"
+  (morph/conjugate structure lexicon replace-patterns))


Add fn unit/convert

Add fn unit/convert

--- src/bakyeono/litedocx/unit.clj
+++ src/bakyeono/litedocx/unit.clj
@@ -1,5 +1,6 @@
 (ns bakyeono.litedocx.unit
   "Thinchgs for unit conversion."
+  (:require [clojure.string :as str])
   (:use [bakyeono.litedocx.util])
   (:gen-class))

@@ -18,7 +19,7 @@
 (defconst inch-per-px (/ 1 px-per-inch))
 (defconst pt-per-twip (/ 1 twip-per-pt))

-;;; Combinchation
+;;; Combination
 (defconst pt-per-inch (* pt-per-px px-per-inch))
 (defconst pt-per-cm (* pt-per-inch inch-per-cm))
 (defconst pt-per-mm (* pt-per-cm cm-per-mm))
@@ -41,4 +42,31 @@
 (defconst mm-per-twip (* mm-per-pt pt-per-twip))

 ;;; Functions
-;;; TODO
+(defn parse-unit
+  "Takes a string expression of a number and returns it as a [number unit]
+  vector."
+  [s]
+  (let [s (str/trim s)
+        n (Double/parseDouble (re-find #"^-?\d+\.?\d*" s))
+        unit (re-find #"[a-z]+$" s)]
+    [n unit]))
+
+(defn conversion-rate
+  [from to]
+  (let [sym (symbol (str from "-per-" to))]
+    (cond (resolve sym) (eval sym)
+          (= from to) 1
+          true (throw (Exception. (str "Unsupported unit conversion: "
+                                       from " -> " to))))))
+
+(defn convert
+  "Takes a string expression of a value and its unit and then converts it into
+  given to-unit.
+
+  Parameters:
+  - value: <string or number>
+  - to: <string>"
+  [value to]
+  (let [[n unit] (parse-unit value)
+        rate (conversion-rate unit (name to))]
+    (* n rate)))


Add the recommendations to the front for :hörbuch

By adding the recommendations under the key `:recommendation` instead
of `:recommendations` the sort order is changed and the
recommendations show up before the items

--- src/clj/catalog/layout/fop.clj
+++ src/clj/catalog/layout/fop.clj
@@ -859,7 +859,7 @@
                          (#(apply dissoc % (remove #{fmt} (keys %))))
                          (cond->
                              (not (string/blank? editorial)) (assoc :editorial editorial)
-                             (not (string/blank? recommendations)) (assoc :recommendations recommendations)))
+                             (not (string/blank? recommendations)) (assoc :recommendation recommendations)))
             path-to-numbers (layout/path-to-number subitems)]
         [:fo:flow {:flow-name "xsl-region-body"}
          ;; Cover page


remove unnecesary print wrapper

remove unnecesary print wrapper

--- src/clj/weba/print_wrapper.clj
+++ src/clj/weba/print_wrapper.clj
@@ -1,42 +0,0 @@
-(ns weba.print-wrapper
-  "Logitus HTTP pyynnöille Ringiin. Vastaavia yleiskäyttöisiäkin on, mutta niissä on toivomisen varaa ainakin tällä hetkellä."
-  (:require [clojure.tools.logging :as log]
-            [clojure.string :as str]))
-
-(def ^:private requestid (atom 1))
-(def ^:dynamic *requestid*)
-
-(defn debug-request
-  "Ring wrapper joka logittaa kaiken informaation requestista"
-  [ring-handler]
-  (fn [request]
-    (log/info request)
-    (ring-handler request)))
-
-(defn http-method->str [keyword-or-str]
-  (str/upper-case (name keyword-or-str)))
-
-(defn log-request-wrapper [ring-handler & custom-paths-vseq]
-  "Logitus requestille. Perustiedot + kestoaika ja uniikki id per request"
-  (fn [req]
-    (binding [*requestid* (swap! requestid inc)]
-      (let [start (System/currentTimeMillis)
-            host (or (get-in req [:headers "x-forwarded-host"])
-                     (get-in req [:headers "host"]))]
-        (log/info (str "Request " *requestid* " start. "
-                       " host: " host
-                       " ,remote-addr: " (:remote-addr req)
-                       " ,method: " (http-method->str (:request-method req))
-                       " ,uri: " (:uri req)
-                       " ,query-string: " (:query-string req)
-                       " ,user-agent: " (get (:headers req) "user-agent")
-                       " ,referer: " (get (:headers req) "referer")
-                       " ,oid: " (get (:headers req) "oid")))
-        (let [response (ring-handler req)
-              finish (System/currentTimeMillis)
-              total  (- finish start)]
-          (if (or (= response nil)
-                  (= (:status response) 404))
-            (log/warn (str "Response nil or status 404, uri: " (:uri req) ", query-string: " (:query-string req))))
-          (log/info (str "Request " *requestid* " end. Status: " (:status response) " Duration: " total " ms. uri: " (:uri req)))
-          response)))))


flesh out commodity list in account show

--- src/clj_money/web/accounts.clj
+++ src/clj_money/web/accounts.clj
@@ -14,7 +14,9 @@
             [clj-money.validation :as validation]
             [clj-money.models.accounts :as accounts]
             [clj-money.models.transactions :as transactions]
+            [clj-money.models.commodities :as commodities]
             [clj-money.models.lots :as lots]
+            [clj-money.models.prices :as prices]
             [clj-money.web.money-shared :refer [grouped-options-for-accounts
                                                 budget-monitors]])
   (:use [clj-money.web.shared :refer :all]))
@@ -194,26 +196,37 @@
    "Back"])

 (defn- commodity-row
-  [lot]
-  [:tr
-   [:td (:commodity-id lot)]])
+  [{:keys [commodity shares] :as input}]
+  (let [price (prices/most-recent (env :db) (:id commodity))]
+    [:tr
+     [:td (:symbol commodity)]
+     [:td.text-right shares]
+     [:td.text-right (:price price)]
+     [:td (format-number (* (:price price) shares))]]))

 (defmethod show-account :commodities
   [account params]
   (html
-    (let [lots (lots/search (env :db) {:account-id (:id account)})]
+    (let [commodities (->> {:account-id (:id account)}
+                           (lots/search (env :db))
+                           (group-by :commodity-id)
+                           (map (fn [[commodity-id lots]]
+                                  {:commodity (commodities/find-by-id (env :db) commodity-id)
+                                   :shares (->> lots
+                                                (map :shares-owned)
+                                                (reduce +))})))]
       [:table.table.table-striped.table-hover
        [:tr
         [:th "Symbol"]
         [:th "Shares"]
         [:th "Price"]
         [:th "Value"]]
-       (if (empty? lots)
+       (if (empty? commodities)
          [:tr
           [:td.empty-table {:colspan 4}
            "This account does not have any positions"]]
          (map commodity-row
-              lots))])
+              commodities))])
     [:a.btn.btn-primary
      {:href (format "/accounts/%s/purchases/new" (:id account))
       :title "Click here to purchase a commodity with this account."}


Test deployment.

Test deployment.

--- src/cljs/beatha/automaton.cljs
+++ src/cljs/beatha/automaton.cljs
@@ -203,7 +203,8 @@
                         :corp-3 :worker-3 :corp-4 :worker-4}
         worker? #((into #{:worker} (vals company-worker)) %)
         company-of-worker (fn [s] (or ((set/map-invert company-worker) s) s))
-        worker-of-company (fn [s] (or (company-worker s) s))]
+        worker-of-company (fn [s] (or (company-worker s) s))
+        test 1]
     (reify
       AutomatonSpecification
       (default-cell [_] {:state :worker})


update uris

update uris

--- src/cljs/traveler/ng/core.cljs
+++ src/cljs/traveler/ng/core.cljs
@@ -50,7 +50,7 @@
                          (! $scope.isSearch true)
                          (! $scope.showPaging false)
                          (-> $http
-                             (.get (str "../api/user/search/" $scope.query))
+                             (.get (str "api/user/search/" $scope.query))
                              (.success (fn [data]
                                          (if (empty? (aget data "results"))
                                            (! $scope.usersLoaded "no")
@@ -118,7 +118,7 @@
                         (! $scope.isSearch false)
                         (! $scope.usersLoaded "loading")
                         (-> $http
-                            (.get (str "../api/users/" $scope.usersPerPage "/" $scope.currentPage))
+                            (.get (str "api/users/" $scope.usersPerPage "/" $scope.currentPage))
                             (.success (fn [data]
                                         (if (empty? (aget data "users"))
                                           (! $scope.usersLoaded "no")
@@ -151,7 +151,7 @@

   (! $scope.getUser (fn []
                       (-> $http
-                          (.get (str "../api/user/" $scope.userId))
+                          (.get (str "api/user/" $scope.userId))
                           (.success (fn [data]
                                       (! $scope.user (aget data "user"))
                                       (if (aget data "user" "username")


Typo and cosmetic fixes on jws namespace.

--- src/clojure/buddy/sign/jws.clj
+++ src/clojure/buddy/sign/jws.clj
@@ -59,7 +59,7 @@
   (into {} (remove (comp nil? second) data)))

 (defn- make-headers
-  "Make jws header as json string"
+  "Encode jws header"
   [alg extra-headers]
   (-> (or extra-headers {})
       (merge {:alg (.toUpperCase (name alg)) :typ "JWS"})
@@ -68,7 +68,7 @@
       (codecs/bytes->safebase64)))

 (defn- make-claims
-  "Make jws claims as json string"
+  "Encode jws claims."
   [input exp nbf iat]
   (-> (normalize-nil-claims {:exp exp :nbf nbf :iat iat})
       (normalize-date-claims)
@@ -78,44 +78,53 @@
       (codecs/bytes->safebase64)))

 (defn- parse-header
-  [headerdata]
+  "Parse jws header."
+  [^String headerdata]
   (-> headerdata
       (codecs/safebase64->bytes)
       (codecs/bytes->str)
       (json/parse-string true)))

 (defn- parse-claims
-  [claimsdata]
+  "Parse jws claims"
+  [^String claimsdata]
   (-> claimsdata
       (codecs/safebase64->bytes)
       (codecs/bytes->str)
       (json/parse-string true)))

 (defn- parse-algorithm
+  "Parse algorithm name and return a
+internal keyword representation of it."
   [header]
   (let [algname (:alg header)]
     (keyword (.toLowerCase algname))))

 (defn- get-verifier-for-algorithm
+  "Get verifier function for algorithm name."
   [^Keyword alg]
   (when (contains? gsign/*signers-map* alg)
     (get-in gsign/*signers-map* [alg :verifier])))

-(defn- get-signer-for-algorith
+(defn- get-signer-for-algorithm
+  "Get signer function for algorithm name."
   [^Keyword alg]
   (when (contains? gsign/*signers-map* alg)
     (get-in gsign/*signers-map* [alg :signer])))

 (defn- safe-encode
-  [input]
+  "Properly encode string into
+safe url base64 encoding."
+  [^String input]
   (-> input
       (codecs/str->bytes)
       (codecs/bytes->safebase64)))

 (defn- make-signature
+  "Make a jws signature."
   [pkey alg header claims]
   (let [candidate (str/join "." [header claims])
-        signer    (get-signer-for-algorith alg)]
+        signer    (get-signer-for-algorithm alg)]
     (-> (signer candidate pkey)
         (codecs/bytes->safebase64))))

@@ -151,9 +160,3 @@
                         (or (< (- now (:iat claims)) maxage) nil)
                         true)]
           claims)))))
-
-
-
-
-
-


Created set-attrs! - the basis of animate! and started work on replace-attrs! - the basis of DOM diffing.

--- src/clojure/freactive/dom.cljs
+++ src/clojure/freactive/dom.cljs
@@ -323,6 +323,42 @@
       :default
       (bind-prop-attr! set-attr! element attr-name attr-value node-state))))

+(defn- unbind-attr!* [node-state prefix attr-name]
+  (let [attr-key (str "-" prefix attr-name)]
+    (when-let [child-states (.-child-states node-state)]
+      (when-let [state (aget child-states attr-key)]
+        (set! (.-disposed state) true)
+        (js-delete child-states attr-key)))))
+
+(defn set-attrs! [node attrs]
+  (let [node-state (get-element-state node)]
+    (doseq [[k v] attrs]
+      (let [k (name k)]
+        (if (= k "style")
+          (doseq [[p v] v]
+            (do
+              (when node-state
+                (unbind-attr!* node-state "style" p))
+              (bind-style-prop! node p v node-state)))
+          (do
+            (when node-state
+              (unbind-attr!* node-state "attr" k))
+            (bind-attr! node k v node-state)))))))
+
+(defn- replace-attr!* [node node-state attr-name old-val new-val prefix
+                       binder remover]
+  (if old-val
+    (if new-val
+      (if (not (identical? old-val new-val))
+        (unbind-attr!* node-state prefix attr-name)
+        (binder node attr-name new-val node-state))
+      (remover node attr-name))
+    (binder node attr-name new-val node-state)))
+
+(defn- replace-attrs! [node old-attrs new-attrs]
+  (let [node-state (get-element-state node)]
+    ))
+
 ;; From hiccup.compiler:
 (def ^{:doc "Regular expression that parses a CSS-style id and class from an element name."
        :private true}


Added support for HTTP HEAD on root.

Added support for HTTP HEAD on root.

--- src/cmr/opendap/rest/route.clj
+++ src/cmr/opendap/rest/route.clj
@@ -17,7 +17,9 @@

 (defn ous
   [httpd-component]
-  [["/" {:get core-handler/ok}]
+  [["/" {
+    :get core-handler/ok
+    :head core-handler/ok}]
    ["/ous/collections" {
     :post {
       :handler collection-handler/batch-generate


(PDB-3302) Refactor pdb test helpers a little

--- test/puppetlabs/puppetdb/testutils/services.clj
+++ test/puppetlabs/puppetdb/testutils/services.clj
@@ -10,7 +10,7 @@
             [puppetlabs.puppetdb.scf.storage-utils :as sutils]
             [metrics.counters :refer [clear!]]
             [clojure.walk :as walk]
-            [puppetlabs.trapperkeeper.app :refer [get-service]]
+            [puppetlabs.trapperkeeper.app :as tk-app :refer [get-service]]
             [puppetlabs.trapperkeeper.testutils.bootstrap :as tkbs]
             [puppetlabs.trapperkeeper.services.webserver.jetty9-service :refer [jetty9-service]]
             [puppetlabs.trapperkeeper.services.webrouting.webrouting-service :refer [webrouting-service]]
@@ -88,7 +88,6 @@
 (defn strip-retired-config [config]
   (update config :database dissoc :classname :subprotocol))

-;; TODO: rework call-with-puppetdb-instance to use this
 (defn run-test-puppetdb [config services bind-attempts]
   (when (zero? bind-attempts)
     (throw (RuntimeException. "Repeated attempts to bind port failed, giving up")))
@@ -132,33 +131,13 @@
   ([config services f]
    (call-with-puppetdb-instance config services 10 f))
   ([config services bind-attempts f]
-   (when (zero? bind-attempts)
-     (throw (RuntimeException. "Repeated attempts to bind port failed, giving up")))
-   (let [config (-> config
-                    strip-retired-config
-                    conf/adjust-and-validate-tk-config
-                    assoc-open-port)
-         port (or (get-in config [:jetty :port])
-                  (get-in config [:jetty :ssl-port]))
-         is-ssl (boolean (get-in config [:jetty :ssl-port]))
-         base-url {:protocol (if is-ssl "https" "http")
-                   :host "localhost"
-                   :port port
-                   :prefix "/pdb/query"
-                   :version :v4}]
+   (let [{:keys [app base-url]} (run-test-puppetdb config services bind-attempts)]
      (try
-       (swap! dispatch/metrics clear-counters!)
-       (tkbs/with-app-with-config server
-         (map var-get services)
-         config
-         (binding [*server* server
-                   *base-url* base-url]
-           (f)))
-       (catch java.net.BindException e
-         (log/errorf e "Error occured when Jetty tried to bind to port %s, attempt #%s"
-                     port bind-attempts)
-         (call-with-puppetdb-instance config services (dec bind-attempts)
-                                      f))))))
+      (binding [*server* app
+                *base-url* base-url]
+        (f))
+      (finally
+        (tk-app/stop app))))))

 (defn create-url-str [base-url url-suffix]
   (str (utils/base-url->str base-url)


(PDB-2255) Make notable-pdb-event? configurable

Originally notable-pdb-event? wasn't set up to be customized, but now we
want that (i.e. PDB-2215), so make it configurable by
adding *notable-pdb-event?* to testutils.services.

--- test/puppetlabs/puppetdb/testutils/services.clj
+++ test/puppetlabs/puppetdb/testutils/services.clj
@@ -143,13 +143,15 @@
       (fn []
         ~@body))))

+(def ^:dynamic *notable-log-event?* notable-pdb-event?)
+
 (defn call-with-single-quiet-pdb-instance
   "Calls the call-with-puppetdb-instance with args after suppressing
   all log events.  If there's an error or worse, prints the log to
   *err*.  Should not be nested, nor nested with calls to
   with-log-suppressed-unless-notable."
   [& args]
-  (with-log-suppressed-unless-notable notable-pdb-event?
+  (with-log-suppressed-unless-notable *notable-log-event?*
     (apply call-with-puppetdb-instance args)))

 (defmacro with-single-quiet-pdb-instance


Simplify item menu rendering

Simplify item menu rendering

--- src/dungeon_crusade/render.clj
+++ src/dungeon_crusade/render.clj
@@ -12,58 +12,48 @@

 (set! *warn-on-reflection* true)

+(defn render-multi-select [screen title selected-hotkeys items]
+  (let [contents (take 22
+                       (concat (map #(format "%c%c%-38s"
+                                             (% :hotkey)
+                                             (if (contains? selected-hotkeys (% :hotkey))
+                                               \+
+                                               \-)
+                                             (% :name))
+                                    items)
+                              (repeat (apply str (repeat 40 " ")))))]
+    (println "contents" contents)
+    (doall (map-indexed (fn [y line]
+      (do
+        (s/put-string screen 40 (inc y) line {:fg :black :bg :white :styles #{:bold}}))) contents))
+    (println "header")
+    (s/put-string screen 40 0 (format "  %s                               " title) {:fg :black :bg :white :styles #{:underline :bold}})))
+
 (defn render-pick-up [state]
   ;; maybe draw pick up menu
   (when (-> state :world :show-pick-up?)
-    (println "render-pick-up")
-    (let [player-x   (-> state :world :player :pos :x)
-          player-y   (-> state :world :player :pos :y)
-          cell       (first (get-xy player-x player-y (current-place state)))
-          cell-items (or (cell :items) [])
-          hotkeys    (-> state :world :remaining-hotkeys)
-          contents   (take 22
-                       (concat (map #(format "%c%c%-38s" (% :hotkey)
-                                                         (if (contains? (-> state :world :selected-hotkeys) (% :hotkey))
-                                                           \+
-                                                           \-)
-                                                         (% :name))
-                                    (fill-missing #(not (contains? % :hotkey))
-                                                  #(assoc %1 :hotkey %2)
-                                                  hotkeys
-                                                  cell-items))
-                               (repeat (apply str (repeat 40 " ")))))]
+    (let [player-x         (-> state :world :player :pos :x)
+          player-y         (-> state :world :player :pos :y)
+          cell             (first (get-xy player-x player-y (current-place state)))
+          cell-items       (or (cell :items) [])
+          hotkeys          (-> state :world :remaining-hotkeys)
+          selected-hotkeys (-> state :world :selected-hotkeys)
+          items            (fill-missing #(not (contains? % :hotkey))
+                                              #(assoc %1 :hotkey %2)
+                                              hotkeys
+                                              cell-items)]
     (println "player-x" player-x "player-y" player-y)
     (println "cell" cell)
     (println "cell-items" cell-items)
-    (println "type-contents" (type contents))
-    (println "contents" contents)
-    (doall (map-indexed (fn [y line]
-      (do
-        (s/put-string (state :screen) 40 (inc y) line {:fg :black :bg :white :styles #{:bold}}))) contents))
-    (println "header")
-    (s/put-string (state :screen) 40 0 "  Pick up                               " {:fg :black :bg :white :styles #{:underline :bold}}))))
+    (render-multi-select (state :screen) "Pick up" selected-hotkeys items))))

 (defn render-inventory [state]
   (when (-> state :world :show-inventory?)
-    (let [contents (take 22
-                     (concat (map #(format "%-40s"  (% :name)) (-> state :world :player :inventory))
-                             (repeat (apply str (repeat 40 " ")))))]
-      (println "render-inventory")
-      (println "contents" contents)
-      (dorun (map-indexed (fn [y line] (s/put-string (state :screen) 40 (inc y) line {:fg :black :bg :white :styles #{:bold}})) contents))
-      (s/put-string (state :screen) 40 0 "  Inventory                             " {:fg :black :bg :white :styles #{:underline}}))))
+    (render-multi-select (state :screen) "Inventory" [] (-> state :world :player :inventory))))

 (defn render-drop [state]
   (when (-> state :world :show-drop?)
-    (let [contents (take 22
-                     (concat (map #(format "%c %-40s"  (% :hotkey) (% :name))
-                                  (-> state :world :player :inventory))
-                             (repeat (apply str (repeat 40 " ")))))]
-      (println "render-inventory")
-      (println "contents" contents)
-      (dorun (map-indexed (fn [y line] (s/put-string (state :screen) 40 (inc y) line {:fg :black :bg :white :styles #{:bold}})) contents))
-      (s/put-string (state :screen) 40 0 "  Drop Inventory                        " {:fg :black :bg :white :styles #{:underline}}))))
-
+    (render-multi-select (state :screen) "Drop Inventory" [] (-> state :world :player :inventory))))

 (defn render-map [state]
   (do
@@ -138,7 +128,6 @@
         (apply str (interpose " " (-> state :world :player :status))))
         {:fg :black :bg :white})
     (s/redraw (state :screen))
-    (s/redraw (state :screen))
     (println "end-render")))

 (defn render-game-over [state]


Made minion sheets have smaller font to not run over pages

--- src/hphelper/scengen/print.clj
+++ src/hphelper/scengen/print.clj
@@ -125,7 +125,7 @@
   "Prints a single minion table cell"
   [minion]
   (assert minion "Minion does not exist?")
-  [:td {:style "border: 1px solid black"}
+  [:td {:style "border: 1px solid black; font-size: small"}
    (:minion_name minion) " -- "
    (:minion_clearance minion) " -- "
    (:minion_cost minion) " -- "


Don't stringify device's metadata on GET.

--- src/kixi/hecuba/api/device.clj
+++ src/kixi/hecuba/api/device.clj
@@ -67,7 +67,11 @@
   (fn [{items ::items {mime :media-type} :representation {routes :modular.bidi/routes route-params :route-params} :request :as req}]
     (util/render-items req (->> items
                                 (map #(dissoc % :user-id))
-                                (map #(update-in % [:location] json/decode)))))
+                                (map #(update-in % [:location] json/decode))
+                                (map #(update-in % [:metadata] json/decode))
+                                (map util/downcast-to-json)
+                                (map util/camelify)
+                                json/encode)))

   :handle-created
   (fn [{{routes :modular.bidi/routes {entity-id :entity-id} :route-params} :request device-id :device-id}]
@@ -144,5 +148,8 @@
                    ;; Specifially, we are keeping the following line commented :-
                    ;; (assoc :measurements (hecuba/items querier :measurement {:device-id (:id item)}))
                    (update-in [:location] json/decode)
+                   (update-in [:metadata] json/decode)
                    (dissoc :user-id)
-                   util/downcast-to-json util/camelify json/encode)))
+                   util/downcast-to-json
+                   util/camelify
+                   json/encode)))


Corrected some mistakes in chords and added piano.

--- src/overtunes/pitch/chords.clj
+++ src/overtunes/pitch/chords.clj
@@ -1,4 +1,9 @@
-(ns overtunes.pitch.chords)
+(ns overtunes.pitch.chords
+  (:use [overtone.inst.sampled-piano :only [sampled-piano]]
+        [overtone.live :only []]))
+
+(def note! sampled-piano)
+(def chord! #(map note! %))

 (defmacro defall
   "Define multiple values at once."
@@ -8,27 +13,30 @@
            names
            (eval values))))

-(def tone 2)
-(def semitone (/ tone 2))
-(def octave (* 12 semitone))
-(def sharp #(+ semitone %))
-(def flat #(- semitone %))
+(def semitone 1)
+(def tone (* semitone 2))
+(def octave1 (* 12 semitone))

-(defn scale
+(def sharp1 #(+ % semitone))
+(def flat1 #(- % semitone))
+(def raise #(+ % octave1))
+
+(defn scale1
   ([] '(0))
   ([interval & intervals]
-   (cons 0 (map #(+ interval %) (apply scale intervals)))))
+   (cons 0 (map #(+ interval %) (apply scale1 intervals)))))

 (def major-scale (zipmap
                    [:i :ii :iii :iv :v :vi :vii :viii]
-                   (scale tone tone semitone tone tone tone semitone)))
+                   (scale1 tone tone semitone tone tone tone semitone)))

 (defn grounding [offset]
+  "Takes an offset from root and produces a function for rendering chords."
   (fn
     ([octave-number]
-     (+ offset (* octave-number octave)))
+     (+ offset (* octave-number octave1)))
     ([octave-number chord]
-     (map #(+ offset % (* octave-number octave)) (vals chord)))))
+     (map #(+ offset % (* octave-number octave1)) (vals chord)))))

 ; Name notes
 (defall [C D E F G A B]
@@ -38,17 +46,17 @@

 ; Qualities
 (def major (select-keys major-scale [:i :iii :v]))
-(def minor (update-in major [:iii] flat))
+(def minor (update-in major [:iii] flat1))
 (def power (select-keys major-scale [:i :v :viii]))

 ; Modifications
-(def augmented #(update-in % [:v] sharp))
-(def diminished #(update-in % [:v] flat))
-(def suspended-second #(update-in % [:iii] 2))
-(def suspended-fourth #(update-in % [:iii] 5))
-(def sixth #(assoc % :vi 9))
+(def augmented #(update-in % [:v] sharp1))
+(def diminished #(update-in % [:v] flat1))
+(def suspended-second #(assoc % :iii (:ii major-scale)))
+(def suspended-fourth #(assoc % :iii (:iv major-scale)))
+(def sixth1 #(assoc % :vi (:vi major-scale)))
 (def seventh #(assoc % :vii (+ (:v %) (:iii %))))
-(def dominant-seventh #(assoc % :vii 10))
-(def ninth #(assoc (seventh %) :ix 14))
-(def eleventh #(assoc (ninth %) :xi 17))
-(def thirteenth #(assoc (eleventh %) :xi 21))
+(def dominant-seventh #(assoc % :vii (flat1 (:vii major-scale))))
+(def ninth #(assoc (seventh %) :ix (raise (:ii major-scale))))
+(def eleventh #(assoc (ninth %) :xi (raise (:iv major-scale))))
+(def thirteenth #(assoc (eleventh %) :xi (raise (:vi major-scale))))


Extract some metronome-related logic for clarity.

--- src/overtunes/songs/before.clj
+++ src/overtunes/songs/before.clj
@@ -58,12 +58,14 @@
 ))

 (def metro (metronome 90))
+(def bar 4)
 (defn beat-length [metro] (- (metro 1) (metro 0)))
+(defn bar-length [metro] (* (beat-length metro) bar))

 (defn play-progression [progression metro start] ( do
   (if (not (empty? progression)) (do
-    (at (metro (+ start 0)) (play-chord (nth progression 0) (* 4 (beat-length metro))))
-    (play-progression (rest progression) metro (+ start 4))
+    (at (metro (+ start 0)) (play-chord (nth progression 0) (bar-length metro)))
+    (play-progression (rest progression) metro (+ start bar))
   ))
 ))


Added a new chord in the end and fixed formatting.

--- src/overtunes/songs/before.clj
+++ src/overtunes/songs/before.clj
@@ -8,7 +8,7 @@
   "A crude five-note melody that will constantly fall out of time when played
   over chords at a rate of two notes per chord."
   [[(C 4) (Bb 4) (Eb 4) (G 4) (Eb 4)]
-   [1/1 1/1  1/1  1/1 1/1]])
+   [ 1/1   1/1    1/1    1/1   1/1]])

 (def start
   "In which we establish the key and give the syncopated relationship between
@@ -56,6 +56,7 @@
 (def finish
   "In which we return to root for resolution at the end of the piece."
   [(Eb 6 major)
+   (Eb 6 minor seventh)
    (Eb 6 major)])

 (defn cycle-n


Simplify code with Reagent 0.6 with-let

Simplify code with Reagent 0.6 with-let

--- src/sinusoides/components.cljs
+++ src/sinusoides/components.cljs
@@ -146,30 +146,24 @@
            37 (nav-arrow! -1)
            39 (nav-arrow! +1)
            27 (routes/nav! (routes/do))
-           nil))]
+           nil))

-    (r/create-class
-      {:component-will-mount
-       (fn []
+       (fetch-data []
          (go (let [entries   (map #(assoc % :slug (util/to-slug (:name %)))
-                               (:body  (<! (http/get "/data/do.json"))))
+                                         (:body  (<! (http/get "/data/do.json"))))
                    languages (apply sorted-set (map :lang entries))]
                (swap! do assoc-in [:entries] entries)
-               (swap! do assoc-in [:languages] languages))))
+               (swap! do assoc-in [:languages] languages))))]

-       :component-did-mount
-       #(events/listen js/document "keydown" key-listener)
-
-       :component-will-unmount
-       #(events/unlisten js/document "keydown" key-listener)
-
-       :reagent-render
-       (fn [do]
-         (let [entries (filter-entries)]
-           (if-let [id (:detail @do)]
-             (when-let [p (find-entry entries id)]
-               [do-detail-view @do p entries])
-             [do-view- do entries])))})))
+    (r/with-let [_ (fetch-data)
+                 _ (events/listen js/document "keydown" key-listener)]
+      (let [entries (filter-entries)]
+        (if-let [id (:detail @do)]
+          (when-let [p (find-entry entries id)]
+            [do-detail-view @do p entries])
+          [do-view- do entries]))
+      (finally
+        (events/unlisten js/document "keydown" key-listener)))))

 (defn root-view [app]
   [:div.sinusoides


partial fix for newline terminators

partial fix for newline terminators

Because the largest delimiter is two bytes, aleph waits for a
second byte before terminating the frame.  If the last line in
a sequence of metrics ends in a newline it is ignored.

input       |expected|actual
------------|--------|------
in1\n       |in1     |
in1\nin2\n  |in1, in2|in1
in1\nin2\r\n|in1, in2|in1, in2

--- src/so/grep/cyanite/carbon.clj
+++ src/so/grep/cyanite/carbon.clj
@@ -35,4 +35,4 @@
     (info "starting carbon handler")
     (tcp/start-tcp-server
      handler
-     (merge carbon {:frame (string :utf-8 :delimiters ["\r\n"])}))))
+     (merge carbon {:frame (string :utf-8 :delimiters ["\r\n" "\n"])}))))


stop being stupid

stop being stupid

--- src/so/grep/cyanite/config.clj
+++ src/so/grep/cyanite/config.clj
@@ -26,8 +26,8 @@

 (defn assoc-rollup-to
   [rollups]
-  (map (fn [{:keys [period] :as rollup}]
-         (assoc rollup :rollup-to #(-> % (quot period) (* period))))
+  (map (fn [{:keys [rollup] :as rollup-def}]
+         (assoc rollup-def :rollup-to #(-> % (quot rollup) (* rollup))))
        rollups))

 (defn find-ns-var


Pass connected rooms when printing out first intro to story.

--- src/tryclojure/models/eval.clj
+++ src/tryclojure/models/eval.clj
@@ -53,7 +53,9 @@
     (let [file-path (str/lower-case (str "stories/" story-name ".is"))
           story-str (slurp file-path)]
       (dosync (ref-set story (story/init-story story-str)))
-      (t/room-intro (:room (:player (deref story)))))
+      (let [player (:player (deref story))
+            conn-rooms (story/connected-rooms (:room player) (deref story))]
+        (t/room-intro (:room player) conn-rooms)))
     (throw (Exception. "You must specify the name of the story you want to load."))))

 (defmethod run-story-command :default [command expr] ;; normal command


Add generative test to expose problem with `record-read-handler` and hyphenated namespace segments

--- test/transit/check_transit.clj
+++ test/transit/check_transit.clj
@@ -17,7 +17,8 @@
             [clojure.test.check :as tc]
             [clojure.test.check.properties :as prop]
             [clojure.test.check.generators :as gen]
-            [transit.verify :as verify])
+            [transit.verify :as verify]
+            [clojure.string :as str])
   (:import [java.io ByteArrayOutputStream ByteArrayInputStream]))

 (defn roundtrip [encoding]
@@ -29,7 +30,29 @@
                       reader (transit/reader in encoding)]
                   (= value (transit/read reader)))))

-(defn run-test [n property]
+(def record-name (gen/elements ["Foo" "Bar" "Baz"]))
+(def ns-segments (gen/elements ["foo" "bar" "baz" "x" "y" "z" "a-b"]))
+
+(def record-sym (gen/fmap (fn [[segs name]]
+                            (symbol (if (empty? segs)
+                                      name
+                                      (str (str/join "." segs) "/" name))))
+                          (gen/tuple (gen/vector ns-segments) record-name)))
+
+(defn record-read-handler-returns-read-handler []
+  (prop/for-all [sym transit.check-transit/record-sym]
+    (let [ns-name (namespace sym)
+          ns-sym (if ns-name (symbol ns-name) 'user)
+          record-sym (symbol (name sym))]
+      (binding [*ns* *ns*]
+        (eval `(do (ns ~ns-sym)
+                   (defrecord ~record-sym [a#])
+                   (let [handler# (transit/record-read-handler
+                                   (resolve (symbol (Compiler/munge (str '~ns-sym "." '~record-sym)))))]
+                     (.fromRep handler# {:a 1}))))))))
+
+(defn run-test [n property test-desc]
+  (println "check:" test-desc)
   (let [result (tc/quick-check n property :max-size 50)
         color (if (:result result) :green :red)]
     (println (verify/with-style color (pr-str result)))))
@@ -37,6 +60,8 @@
 (defn -main [& args]
   (binding [verify/*style* true]
     (let [n (Long/parseLong (first args))]
+      (run-test 100 (record-read-handler-returns-read-handler)
+                "record-read-handler returns ReadHandler")
       (doseq [t [:json :json-verbose :msgpack]]
-        (println (format "check %s encoding..." (name t)))
-        (run-test n (roundtrip t))))))
+        (run-test n (roundtrip t)
+                  (format "%s encoding..." (name t)))))))


Test for function render-search-field

Test for function render-search-field

--- test/zg/html_renderer_test.clj
+++ test/zg/html_renderer_test.clj
@@ -147,3 +147,16 @@
             "test/expected/search-href7.html" (search-href "http://10.20.30.40/zg/" :whitelist)
             "test/expected/search-href8.html" (search-href "http://10.20.30.40/zg/" :blacklist))))

+(deftest test-render-search-field
+    "Checking the function zg.html-renderer/render-search-field."
+    (testing "the function zg.html-renderer/render-search-field."
+        (are [x y] (= (slurp x) y)
+            "test/expected/search-field1.html" (page/xhtml (render-search-field "word" "" :whitelist))
+            "test/expected/search-field2.html" (page/xhtml (render-search-field "word" "" :blacklist))
+            "test/expected/search-field3.html" (page/xhtml (render-search-field "word" "/" :whitelist))
+            "test/expected/search-field4.html" (page/xhtml (render-search-field "word" "/" :blacklist))
+            "test/expected/search-field5.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/" :whitelist))
+            "test/expected/search-field6.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/" :blacklist))
+            "test/expected/search-field7.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/zg/" :whitelist))
+            "test/expected/search-field8.html" (page/xhtml (render-search-field "word" "http://10.20.30.40/zg/" :blacklist)))))
+


Align "Create game" button

Align "Create game" button

--- src/clj/ji/service/templates.clj
+++ src/clj/ji/service/templates.clj
@@ -78,7 +78,7 @@
      {:method "POST"
       :action (game-url)}
      [:input {:type "hidden" :name "game-id" :value game-id}]
-     [:div.row
+     [:div.row.collapse
       [:div.large-6.small-12.columns.large-centered
        [:h2 "Game does not exist ..yet!"]
        [:input.button


minot

minot

--- src/clj/r0_rich/invoice/crud.clj
+++ src/clj/r0_rich/invoice/crud.clj
@@ -133,7 +133,7 @@
           [:div.row-fluid "check in date:" [:input#client_checkin {:type "date" :name "client_checkin"}]]
           [:div.row-fluid "checkout date:" [:input#client_checkout {:type "date" :name "client_checkout"}]]]]
         [:div#printable
-          [:table {:style "margin-left: 20px; width: 100%; border-collapse:collapse; text-align:left;font-size: 18px;"}
+          [:table {:style "width: 100%; border-collapse:collapse; text-align:left;font-size: 18px;"}
             [:tr {:style "font-size:20px;color:#000;"}
               [:th {:style "padding:15px; border: 1px solid black; font-size:20px;color:#000;"} "Description"]
               [:th {:style "padding:15px; border: 1px solid black; font-size:20px;color:#000;"} "price"]


Fix require Tuple in spec.event

Fix require Tuple in spec.event

--- src/cljc/precept/spec/event.cljc
+++ src/cljc/precept/spec/event.cljc
@@ -1,7 +1,9 @@
 (ns precept.spec.event
   (:require [clojure.spec.alpha :as s]
-            [precept.util :as util]
-            [precept.spec.lang :as lang]))
+            [precept.spec.lang :as lang]
+            [precept.util]
+   #?(:cljs [precept.util :refer [Tuple]]))
+  #?(:clj (:import [precept.util Tuple])))

 (s/def ::type #{:add-facts :add-facts-logical :retract-facts :retract-facts-logical})

@@ -11,7 +13,7 @@

 (s/def ::event-number integer?)

-(s/def ::facts (s/every (s/or :Tuple-record #(= util/Tuple (type %))
+(s/def ::facts (s/every (s/or :Tuple-record #(= Tuple (type %))
                               :fact-map (s/every (comp #{:e :a :v :t} first)))))

 (s/def ::matches (s/and vector? (s/every vector?)))


[n.compilation] Don't use locking macro

[n.compilation] Don't use locking macro

Until http://dev.clojure.org/jira/browse/CLJ-1472 is resolved, `locking`
won't work on ART. For now, we just hope that noone will call
`clear-cache` explicitly, all the more so call it from multiple threads.

--- src/clojure/neko/compilation.clj
+++ src/clojure/neko/compilation.clj
@@ -44,15 +44,13 @@
 (defn clear-cache
   "Clears all DEX and JAR files from the cache directory."
   []
-  (locking cache-dir
-    (let [^File dir @cache-dir
-          delete-file (fn [^String name] (.delete (File. dir name)))]
-      (when dir
-        (->>
-          (.list dir)
-          (filter cache-file?)
-          (map delete-file)
-          (dorun))))))
+  (let [^File dir @cache-dir
+        delete-file (fn [^String name] (.delete (File. dir name)))]
+    (when dir
+      (->> (.list dir)
+           (filter cache-file?)
+           (map delete-file)
+           (dorun)))))

 (defn get-data-readers [^Context context]
   (when-let [readers-file (try (.open (.getAssets context) "data_readers.clj")
@@ -67,7 +65,6 @@
   "Initializes the compilation path, creating or cleaning cache directory as
   necessary."
   ([^Context context dir-name]
-   (locking cache-dir
      (when-not @cache-dir
        (let [dir  (.getDir context dir-name Context/MODE_PRIVATE)
              path (.getAbsolutePath dir)]
@@ -75,6 +72,6 @@
          (System/setProperty "clojure.compile.path" path)
          (alter-var-root #'clojure.core/*data-readers*
                          (constantly (get-data-readers context)))
-         (alter-var-root #'clojure.core/*compile-path* (constantly path))))))
+         (alter-var-root #'clojure.core/*compile-path* (constantly path)))))
   ([context]
-   (init context default-cache-dir)))
+     (init context default-cache-dir)))


Refactoring get-jobs-in-queue

Refactoring get-jobs-in-queue

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -478,18 +478,22 @@
             (log/error (.getMessage e))
             nil)))

+(defn create-jobs-in-queue-response
+    [items]
+    (let [job-names       (map get-job-name-from-queue-info items) ; items are sorted properly!
+          queue-positions (range 1 (count items))]                 ; we need to have index assigned to each item in queue
+          (for [[queue-position job-name] (zipmap queue-positions job-names)]
+             {"queuePos" queue-position
+              "jobName"  job-name})))
+
 (defn get-jobs-in-queue
+    "Get (and return) all jobs that are in Jenkins queue."
     [request]
     (let [url   (jobs-in-queue-url request)
           items (read-queue-info url)]
           (if items
-              (let [job-names (map get-job-name-from-queue-info items)
-                    queue-pos (range 1 (count items))
-                    output
-                    (for [[q-pos job-name] (zipmap queue-pos job-names)]
-                       {"queuePos" q-pos
-                        "jobName"  job-name})]
-                        (send-response output request))
+              (-> (create-jobs-in-queue-response items)
+                  (send-response request))
               (-> (create-bad-request-response "jobs_in_queue" "Can not read Jenkins queue")
                   (send-error-response request :internal-server-error)))))


Send-response function now supports pretty-printed JSON (if configured)

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -45,10 +45,12 @@
         get-job-name))

 (defn send-response
-    [response]
-    (-> (http-response/response (json/write-str response))
-        (http-response/content-type "application/json")))
-   ;(-> (http-response/response (with-out-str (json/pprint response)))
+    [response request]
+    (if (config/pretty-print? request)
+        (-> (http-response/response (with-out-str (json/pprint response)))
+            (http-response/content-type "application/json"))
+        (-> (http-response/response (json/write-str response))
+            (http-response/content-type "application/json"))))

 (defn send-plain-response
     [response]
@@ -61,19 +63,19 @@
                     :version    (config/get-version request)
                     :api_prefix (config/get-api-prefix request)
                     :hostname   hostname :test "/api"}]
-        (send-response response)))
+        (send-response response request)))

 (defn configuration-handler
     [request]
     (let [response (-> request :configuration)]
-        (send-response response)))
+        (send-response response request)))

 (defn system-banners
     [request uri]
     (if (= uri "/api/system/banners")
         (let [response {:message "Alpha version"
                         :type    "Warning"}]
-        (send-response response))))
+        (send-response response request))))

 (defn reload-job-list
     [previous-response request]
@@ -84,7 +86,7 @@
     [request]
     (results/reload-all-results (:configuration request))
     (let [response @results/results]
-        (send-response response)))
+        (send-response response request)))

 (defn error-response
     [job-name command message]
@@ -108,9 +110,9 @@
             (-> (jenkins-api/start-job (config/get-jenkins-url request)
                                        (config/get-jenkins-auth request)
                                        job-name)
-                send-response)
+                (send-response request))
             (-> (job-does-not-exist-response job-name "start")
-                send-response))))
+                (send-response request)))))

 (defn enable-job
     [request]
@@ -119,9 +121,9 @@
             (-> (jenkins-api/enable-job (config/get-jenkins-url request)
                                         (config/get-jenkins-auth request)
                                         job-name)
-                send-response)
+                (send-response request))
             (-> (job-does-not-exist-response job-name "enable")
-                send-response))))
+                (send-response request)))))

 (defn disable-job
     [request]
@@ -130,9 +132,9 @@
             (-> (jenkins-api/disable-job (config/get-jenkins-url request)
                                          (config/get-jenkins-auth request)
                                          job-name)
-                send-response)
+                (send-response request))
             (-> (job-does-not-exist-response job-name "enable")
-                send-response))))
+                (send-response request)))))

 (defn delete-job
     [request]
@@ -142,9 +144,9 @@
                                         (config/get-jenkins-auth request)
                                         job-name)
                 (reload-job-list request)
-                send-response)
+                (send-response request))
             (-> (job-does-not-exist-response job-name "delete")
-                send-response))))
+                (send-response request)))))

 (defn create-job
     [request]
@@ -155,15 +157,15 @@
           branch     (get input-data :branch)]
         (if (results/job-exists? job-name)
             (-> (job-already-exist-response job-name "create")
-                send-response)
+                (send-response request))
             (if (and job-name git-repo branch)
                 (-> (jenkins-api/create-job (config/get-jenkins-url request)
                                             (config/get-jenkins-auth request)
                                             job-name git-repo branch)
                     (reload-job-list request)
-                    send-response)
+                    (send-response request))
                 (-> (error-response (or job-name "not set!") "create" "invalid input")
-                    send-response)))))
+                    (send-response request))))))

 (defn uri->job-name
     [uri prefix]
@@ -182,7 +184,7 @@
     (let [job-name (uri->job-name uri "/api/get_job/")]
         (if job-name
             (let [job-metadata (results/find-job-with-name job-name)]
-                 (send-response job-metadata)))))
+                 (send-response job-metadata request)))))

 (defn update-job
     [request]
@@ -197,11 +199,11 @@
                                             (config/get-jenkins-auth request)
                                             job-name git-repo branch)
                     ;(reload-job-list request)
-                    send-response)
+                    (send-response request))
                 (-> (error-response (or job-name "not set!") "update" "invalid input")
-                    send-response))
+                    (send-response request)))
             (-> (job-does-not-exist-response job-name "update")
-                send-response))))
+                (send-response request)))))

 (defn get-jobs
     [request]
@@ -209,7 +211,7 @@
           product (get params "product")
           version (get params "version")
           results (results/get-job-results product version)]
-        (send-response results)))
+        (send-response results request)))

 (defn get-job-results
     [request uri]
@@ -219,30 +221,30 @@
                  (if job-results
                      (send-plain-response job-results)
                      (-> (error-response job-name "get_job_results" "can not read test results")
-                         send-response)))
+                         (send-response request))))
             (-> (job-does-not-exist-response job-name "get_job_results")
-                send-response))))
+                (send-response request)))))

 (defn job-started-handler
     [request]
     (println "job-started")
-    (send-response {:status "ok"}))
+    (send-response {:status "ok"} request))

 (defn job-finished-handler
     [request]
     (println "job-finished")
-    (send-response {:status "ok"}))
+    (send-response {:status "ok"} request))

 (defn job-results
     [request]
     (println "job-results")
-    (send-response {:status "ok"}))
+    (send-response {:status "ok"} request))

 (defn unknown-call-handler
-    [uri method]
+    [request uri method]
     (let [response {:status :error
                     :error "Unknown API call"
                     :uri uri
                     :method method}]
-        (send-response response)))
-
+        (send-response response request)))
+


Proper response sent when job does not exist

--- src/emender_jenkins/rest_api.clj
+++ src/emender_jenkins/rest_api.clj
@@ -90,35 +90,45 @@
          (println job-name)
     ))

+(defn job-does-not-exist-response
+    [job-name command]
+    {:status "error"
+     :job-name job-name
+     :command "start"
+     :message "Job does not exist"})
+
 (defn start-job
     [request]
     (let [job-name (get-job-name-from-body request)]
-        (when (results/job-exists? job-name)
-           (println "Starting " job-name)
-           (let [response (jenkins-api/start-job (config/get-jenkins-url request)
-                                                 (config/get-jenkins-auth request)
-                                                 job-name)]
-               (send-response response)))))
+        (if (results/job-exists? job-name)
+            (-> (jenkins-api/start-job (config/get-jenkins-url request)
+                                       (config/get-jenkins-auth request)
+                                       job-name)
+                send-response)
+            (-> (job-does-not-exist-response job-name "start")
+                send-response))))

 (defn enable-job
     [request]
     (let [job-name (get-job-name-from-body request)]
-        (when (results/job-exists? job-name)
-           (println "Enabling: " job-name)
-           (let [response (jenkins-api/enable-job (config/get-jenkins-url request)
-                                                  (config/get-jenkins-auth request)
-                                                  job-name)]
-               (send-response response)))))
+        (if (results/job-exists? job-name)
+            (-> (jenkins-api/enable-job (config/get-jenkins-url request)
+                                        (config/get-jenkins-auth request)
+                                        job-name)
+                send-response)
+            (-> (job-does-not-exist-response job-name "enable")
+                send-response))))

 (defn disable-job
     [request]
     (let [job-name (get-job-name-from-body request)]
-        (when (results/job-exists? job-name)
-           (println "Disabling " job-name)
-           (let [response (jenkins-api/disable-job (config/get-jenkins-url request)
-                                                   (config/get-jenkins-auth request)
-                                                   job-name)]
-               (send-response response)))))
+        (if (results/job-exists? job-name)
+            (-> (jenkins-api/disable-job (config/get-jenkins-url request)
+                                         (config/get-jenkins-auth request)
+                                         job-name)
+                send-response)
+            (-> (job-does-not-exist-response job-name "enable")
+                send-response))))

 (defn uri->job-name
     [uri prefix]


Add charset meta tag to base layout impl.

--- src/incise/layouts/impl/base.clj
+++ src/incise/layouts/impl/base.clj
@@ -45,8 +45,8 @@
   [{:keys [site-title]} {:keys [title]}]
   [:head
    [:title (str site-title (when title (str " - " title)))]
-   [:meta {:name "viewport"
-           :content "width=device-width, initial-scale=1.0"}]
+   [:meta {:charset "UTF-8"}]
+   [:meta {:name "viewport" :content "width=device-width, initial-scale=1.0"}]
    (apply include-css (remove nil? (stylesheets)))]
   [:body#page
    [:div.container


Move docstring to correct location

Move docstring to correct location

--- src/main/cljs/lean_map/util.cljs
+++ src/main/cljs/lean_map/util.cljs
@@ -61,28 +61,33 @@
       (recur (nnext in) (assoc! out (first in) (second in)))
       (persistent! out))))

-(defn set-maps-to-lean-map! []
+(defn set-maps-to-lean-map!
   "Makes Persistent and Transient ArrayMaps convert to Lean Maps at the HashMap threshold
   (current 8 key value pairs)"
+  []
   (set! (.-cljs$core$IAssociative$_assoc$arity$3 (.-prototype PersistentArrayMap)) lean-persistent-assoc)
   (set! (.-cljs$core$ITransientAssociative$_assoc_BANG_$arity$3 (.-prototype TransientArrayMap)) lean-transient-assoc)
   (reset! use-lean-map true))

-(defn set-maps-to-cljs-map! []
+(defn set-maps-to-cljs-map!
   "Makes Persistent and Transient ArrayMaps convert to CLJS Maps at the HashMap threshold
   (current 8 key value pairs)"
+  []
   (set! (.-cljs$core$IAssociative$_assoc$arity$3 (.-prototype PersistentArrayMap)) cljs-persistent-assoc)
   (set! (.-cljs$core$ITransientAssociative$_assoc_BANG_$arity$3 (.-prototype TransientArrayMap)) cljs-transient-assoc)
   (reset! use-lean-map false))

-(defn using-lean-maps? []
+(defn using-lean-maps?
   "Is ClojureScript currently using Lean Maps or the default CLJS Map implementation"
+  []
   @use-lean-map)

-(defn lean-map? [m]
+(defn lean-map?
   "Check if a map is an instance of lean-map"
+  [m]
   (or (instance? c/PersistentHashMap m) (instance? c/TransientHashMap m)))

-(defn lean-map-seq? [s]
-  "Checks if a map is an instance of the lean-map seq"
+(defn lean-map-seq?
+  "Checks if a sequence is an instance of the lean-map seq"
+  [s]
   (instance? c/NodeSeq s))


Added to look around the situations.

Added to look around the situations.

--- web/src/sound_effector/web.clj
+++ web/src/sound_effector/web.clj
@@ -22,7 +22,8 @@
            user-controller/routes
            sound-effect-controller/routes
            (GET "/" request (index-view/index request))
-           (GET "/test" request (friend/authorize #{::role/user} (str "Hello,
" request "
" (get-in request [:session ::friend/identity :current]))))
+           (GET "/status" request (str "Status,
" request "
" (get-in request [:session ::friend/identity :current])))
+           (GET "/authorized-status" request (friend/authorize #{::role/user} (str "Authorized status,
" request "
" (get-in request [:session ::friend/identity :current]))))
            (friend/logout (GET "/logout" [] (redirect "/")))
            (resources "/")
            (not-found (layout/response-404)))


formatting.

formatting.

--- src/metabase/driver/redshift.clj
+++ src/metabase/driver/redshift.clj
@@ -30,17 +30,17 @@
 (defn- describe-table-fks [_ table]
   (set (for [fk (jdbc/query (sql/db->jdbc-connection-spec @(:db table))
                             ["SELECT source_column.attname AS \"fk-column-name\",
-                                     dest_table.relname  AS \"dest-table-name\",
+                                     dest_table.relname    AS \"dest-table-name\",
                                      dest_table_ns.nspname AS \"dest-table-schema\",
-                                     dest_column.attname AS \"dest-column-name\"
+                                     dest_column.attname   AS \"dest-column-name\"
                               FROM pg_constraint c
-                                     JOIN pg_namespace n             ON c.connamespace = n.oid
-                                     JOIN pg_class source_table      ON c.conrelid     = source_table.oid
-                                     JOIN pg_attribute source_column ON c.conrelid     = source_column.attrelid
-                                     JOIN pg_class dest_table        ON c.confrelid    = dest_table.oid
+                                     JOIN pg_namespace n             ON c.connamespace          = n.oid
+                                     JOIN pg_class source_table      ON c.conrelid              = source_table.oid
+                                     JOIN pg_attribute source_column ON c.conrelid              = source_column.attrelid
+                                     JOIN pg_class dest_table        ON c.confrelid             = dest_table.oid
                                      JOIN pg_namespace dest_table_ns ON dest_table.relnamespace = dest_table_ns.oid
-                                     JOIN pg_attribute dest_column   ON c.confrelid    = dest_column.attrelid
-                              WHERE c.contype            = 'f'::char
+                                     JOIN pg_attribute dest_column   ON c.confrelid             = dest_column.attrelid
+                              WHERE c.contype                 = 'f'::char
                                      AND source_table.relname = ?
                                      AND n.nspname            = ?
                                      AND source_column.attnum = ANY(c.conkey)


DM + CW | 226 | refactor, remove un-needed function

--- src/mooncake/controller/feed.clj
+++ src/mooncake/controller/feed.clj
@@ -4,9 +4,6 @@
             [mooncake.helper :as mh]
             [mooncake.controller.customise-feed :as cfc]
             [mooncake.view.feed :as f]))
-
-(defn retrieve-activities-from-user-sources [db active-activity-source-keys]
-  (a/retrieve-activities db active-activity-source-keys))

 (defn activity-src-preferences->feed-query [preferences-for-an-activity-src]
   (let [selected-types (map :id (filter :selected (:activity-types preferences-for-an-activity-src)))]
@@ -24,6 +21,6 @@
         user-feed-settings (:feed-settings user)
         activity-sources (:activity-sources context)
         feed-query (generate-feed-query user-feed-settings activity-sources)
-        activities (retrieve-activities-from-user-sources db feed-query)
+        activities (a/retrieve-activities db feed-query)
         updated-context (assoc context :activities activities)]
     (mh/enlive-response (f/feed (assoc request :context updated-context)) (:context request))))


Test for function body->job-info

Test for function body->job-info

--- test/emender_jenkins/rest_api_test.clj
+++ test/emender_jenkins/rest_api_test.clj
@@ -376,3 +376,12 @@
             [1 2 3 4]     "[1,2,3,4]"
             {"a" 1 "b" 2} "{\"a\":1, \"b\":2}")))

+(deftest test-body->job-info
+    "Check the function emender-jenkins.rest-api/body->job-info."
+    (testing "the function emender-jenkins.rest-api/body->job-info."
+        (are [x y] (= x (body->job-info y))
+            {}          "{}"
+            []          "[]"
+            [1 2 3 4]   "[1,2,3,4]"
+            {:a 1 :b 2} "{\"a\":1, \"b\":2}")))
+


New tests: get-calendar-8 and get-calendar-9

--- test/clj_calendar/calendar_test.clj
+++ test/clj_calendar/calendar_test.clj
@@ -199,6 +199,25 @@
             (is (<=  (.get calendar (java.util.Calendar/MILLISECOND)) 1000)))
 ))

+(deftest test-get-calendar-8
+    "Check the function clj-calendar.calendar/get-calendar."
+    (testing "the function clj-calendar.calendar/get-calendar."
+        (let [calendar (get-calendar)]
+            (.set calendar 10000 01 01 10 20 30)
+            (is (=  (.get calendar (java.util.Calendar/HOUR)) 10))
+            (is (=  (.get calendar (java.util.Calendar/MINUTE)) 20))
+            (is (=  (.get calendar (java.util.Calendar/SECOND)) 30)))
+))
+
+(deftest test-get-calendar-9
+    "Check the function clj-calendar.calendar/get-calendar."
+    (testing "the function clj-calendar.calendar/get-calendar."
+        (let [calendar (get-calendar)]
+            (.set calendar 10000 01 01 10 20 30)
+            (is (>=  (.get calendar (java.util.Calendar/MILLISECOND)) 0))
+            (is (<=  (.get calendar (java.util.Calendar/MILLISECOND)) 1000)))
+))
+
 (deftest test-format-date-using-desired-format
     "Check the function clj-calendar.calendar/format-date-using-desired-format"
     (testing "the function clj-calendar.calendar/format-date-using-desired-format."


Fixed docstrings for test in the utils module

--- test/emender_jenkins/utils_test.clj
+++ test/emender_jenkins/utils_test.clj
@@ -356,7 +356,7 @@
         (is (thrown? NullPointerException (replaceAll nil nil "b")))))

 (deftest test-parse-boolean
-    "Check the behaviour of function emender-jenkins.config/parse-boolean."
+    "Check the behaviour of function emender-jenkins.utils/parse-boolean."
     (are [x y] (= x y)
         true (parse-boolean "true")
         true (parse-boolean "True")
@@ -367,7 +367,7 @@
         false (parse-boolean nil)))

 (deftest test-parse-int-zero
-    "Check the behaviour of function emender-jenkins.config/parse-int."
+    "Check the behaviour of function emender-jenkins.utils/parse-int."
     (are [x y] (== x y)
         0 (parse-int "0")
         0 (parse-int "00")
@@ -377,7 +377,7 @@
         0 (parse-int "-000")))

 (deftest test-parse-int-positive-int
-    "Check the behaviour of function emender-jenkins.config/parse-int."
+    "Check the behaviour of function emender-jenkins.utils/parse-int."
     (are [x y] (== x y)
         1          (parse-int "1")
         2          (parse-int "2")
@@ -387,7 +387,7 @@
         2147483646 (parse-int "2147483646")))

 (deftest test-parse-int-negative-int
-    "Check the behaviour of function emender-jenkins.config/parse-int."
+    "Check the behaviour of function emender-jenkins.utils/parse-int."
     (are [x y] (== x y)
         -1          (parse-int "-1")
         -2          (parse-int "-2")
@@ -397,21 +397,21 @@
         -2147483647 (parse-int "-2147483647")))

 (deftest test-parse-int-min-int
-    "Check the behaviour of function emender-jenkins.config/parse-int."
+    "Check the behaviour of function emender-jenkins.utils/parse-int."
     (is (== Integer/MIN_VALUE (parse-int "-2147483648"))))

 (deftest test-parse-int-max-int
-    "Check the behaviour of function emender-jenkins.config/parse-int."
+    "Check the behaviour of function emender-jenkins.utils/parse-int."
     (is (== Integer/MAX_VALUE (parse-int "2147483647"))))

 (deftest test-parse-int-overflow
-    "Check the behaviour of function emender-jenkins.config/parse-int."
+    "Check the behaviour of function emender-jenkins.utils/parse-int."
     (are [x] (thrown? NumberFormatException x)
         (parse-int "2147483648")
         (parse-int "-2147483649")))

 (deftest test-parse-int-bad-input
-    "Check the behaviour of function emender-jenkins.config/parse-int."
+    "Check the behaviour of function emender-jenkins.utils/parse-int."
     (are [x] (thrown? NumberFormatException x)
         (parse-int "")
         (parse-int " ")
@@ -419,7 +419,7 @@
        ; (parse-int "+1"))) ; removed, not compatible with all supported JDKs

 (deftest test-parse-float-zero
-    "Check the behaviour of function emender-jenkins.config/parse-float."
+    "Check the behaviour of function emender-jenkins.utils/parse-float."
     (are [x y] (== x y)
         0.0 (parse-float "0")
         0.0 (parse-float "00")
@@ -429,7 +429,7 @@
         0.0 (parse-float "-000")))

 (deftest test-parse-float-positive-values
-    "Check the behaviour of function emender-jenkins.config/parse-float."
+    "Check the behaviour of function emender-jenkins.utils/parse-float."
     (are [x y] (== x y)
         0.5 (parse-float "0.5")
         1.0 (parse-float "1.0")
@@ -441,7 +441,7 @@
         1e10 (parse-float "1e10")))

 (deftest test-parse-float-negative-values
-    "Check the behaviour of function emender-jenkins.config/parse-float."
+    "Check the behaviour of function emender-jenkins.utils/parse-float."
     (are [x y] (== x y)
         -0.5 (parse-float "-0.5")
         -1.0 (parse-float "-1.0")
@@ -453,15 +453,15 @@
         -1e10 (parse-float "-1e10")))

 (deftest test-parse-float-min-value
-    "Check the behaviour of function emender-jenkins.config/parse-int."
+    "Check the behaviour of function emender-jenkins.utils/parse-int."
     (is (== Float/MIN_VALUE (parse-float "0x0.000002P-126f"))))

 (deftest test-parse-float-max-value
-    "Check the behaviour of function emender-jenkins.config/parse-int."
+    "Check the behaviour of function emender-jenkins.utils/parse-int."
     (is (== Float/MAX_VALUE (parse-float "0x1.fffffeP+127f"))))

 (deftest test-parse-float-bad-input
-    "Check the behaviour of function emender-jenkins.config/parse-float."
+    "Check the behaviour of function emender-jenkins.utils/parse-float."
     (are [x] (thrown? NumberFormatException x)
         (parse-float "")
         (parse-float "xyzzy")


uses select-keys instead of filterm (#250)

--- waiter/src/waiter/state.clj
+++ waiter/src/waiter/state.clj
@@ -1117,15 +1117,14 @@
                                (case message-type
                                  :update-available-apps
                                  (let [{:keys [available-apps scheduler-sync-time]} message-data
-                                       available-apps-set (into #{} available-apps)
-                                       filter-fn (fn [[service-id _]] (contains? available-apps-set service-id))
-                                       service-id->healthy-instances' (utils/filterm filter-fn service-id->healthy-instances)
-                                       service-id->unhealthy-instances' (utils/filterm filter-fn service-id->unhealthy-instances)
-                                       services-without-instances (apply disj available-apps-set (keys service-id->my-instance->slots))
-                                       service-id->expired-instances' (utils/filterm filter-fn service-id->expired-instances)
-                                       service-id->starting-instances' (utils/filterm filter-fn service-id->starting-instances)
-                                       service-id->failed-instances' (utils/filterm filter-fn service-id->failed-instances)
-                                       service-id->deployment-error' (utils/filterm filter-fn service-id->deployment-error)]
+                                       available-service-ids (into #{} available-apps)
+                                       services-without-instances (remove #(contains? service-id->my-instance->slots %) available-service-ids )
+                                       service-id->healthy-instances' (select-keys service-id->healthy-instances available-service-ids)
+                                       service-id->unhealthy-instances' (select-keys service-id->unhealthy-instances available-service-ids)
+                                       service-id->expired-instances' (select-keys service-id->expired-instances available-service-ids)
+                                       service-id->starting-instances' (select-keys service-id->starting-instances available-service-ids)
+                                       service-id->failed-instances' (select-keys service-id->failed-instances available-service-ids)
+                                       service-id->deployment-error' (select-keys service-id->deployment-error available-service-ids)]
                                    (when (or (not= service-id->healthy-instances service-id->healthy-instances')
                                              (not= service-id->unhealthy-instances service-id->unhealthy-instances')
                                              (seq services-without-instances))


Two changes in waiter.state for readability (#281)

--- waiter/src/waiter/state.clj
+++ waiter/src/waiter/state.clj
@@ -401,7 +401,7 @@
       (let [current-state'
             (if (not= status :success-async)
               (cond-> (-> current-state
-                          (update-in [:instance-id->request-id->use-reason-map] #(utils/dissoc-in % [instance-id request-id]))
+                          (update-in [:instance-id->request-id->use-reason-map] utils/dissoc-in [instance-id request-id])
                           (update-in [:instance-id->state instance-id] sanitize-instance-state))
                       ; instance received from work-stealing, do not change slot state
                       (nil? work-stealing-data) (update-slot-state-fn instance-id #(cond-> %2 (not= :kill-instance reason) (-> (dec) (max 0))))
@@ -609,8 +609,9 @@
                          ; to be handled before release calls. This allows instances from work-stealing offers
                          ; to be used preferentially. `exit-chan` and `query-state-chan` must be lowest priority
                          ; to facilitate unit testing.
-                         chans (concat (cond-> [update-state-chan]
-                                               (or slots-available? (seq work-stealing-queue) deployment-error) (conj reserve-instance-chan))
+                         chans (concat [update-state-chan]
+                                       (when (or slots-available? (seq work-stealing-queue) deployment-error)
+                                         [reserve-instance-chan])
                                        [release-instance-chan blacklist-instance-chan unblacklist-instance-chan kill-instance-chan
                                         work-stealing-chan query-state-chan exit-chan])
                          [data chan-selected] (async/alts! chans :priority true)]


[#5616] Persistent error "Intrinsic gas too low" popup when buying cryptokitty

Signed-off-by: Igor Mandrigin <042dc4512fa3d391c5170cf3aa61e6a638f84342@mandrigin.ru>

--- src/status_im/models/wallet.cljs
+++ src/status_im/models/wallet.cljs
@@ -75,7 +75,7 @@
              :gas              (cond
                                  gas
                                  (money/bignumber gas)
-                                 value
+                                 (and value (empty? data))
                                  (money/bignumber 21000))
              :gas-price        (when gasPrice
                                  (money/bignumber gasPrice))


updating year on copyright

updating year on copyright

--- src/anyviz/views.clj
+++ src/anyviz/views.clj
@@ -31,7 +31,7 @@

 (defn common-footer []
   [:div#footer.footer
-    [:div.text-muted "Copyright © 2013 " @g/brand-name ". All Rights Reserved"]])
+    [:div.text-muted "Copyright © 2014 " @g/brand-name ". All Rights Reserved"]])

 (def match-operators ["=","!=","<","<=",">",">="])
 (def group-times ["year","month","day","hour","minute"])


Clean up old comments

Clean up old comments

--- src-cljs/frontend/components/pages/projects.cljs
+++ src-cljs/frontend/components/pages/projects.cljs
@@ -166,8 +166,6 @@
         (element :main-content
           (let [current-user (:app/current-user (om-next/props this))
                 orgs (get-in (om-next/props this) [:app/current-user :user/organizations])
-                ;; selected-org-ident (:selected-org (om-next/get-params this))
-                ;; selected-org (get (om-next/props this) selected-org-ident)
                 selected-org (get-in (om-next/props this) [:app/route-data :route-data/organization])]
             (html
              [:div