add compander ugen metadata

add compander ugen metadata

--- src/overtone/sc/ugen/compander.clj
+++ src/overtone/sc/ugen/compander.clj
@@ -12,11 +12,12 @@
       ;;                   }

       {:name "Amplitude",
-       :args [{:name "in", :default 0.0}
-              {:name "attackTime", :default 0.01}
-              {:name "releaseTime", :default 0.01}]
+       :args [{:name "in", :default 0.0 :doc "input signal"}
+              {:name "attackTime", :default 0.01 :doc "60dB convergence time for following attacks"}
+              {:name "releaseTime", :default 0.01 :doc "60dB convergence time for following decays"}]
        :muladd true
-       :doc "amplitude follower"}
+       :doc "amplitude follower. Tracks the peak amplitude of a signal."
+       :auto-rate true}

       ;; Compander : UGen {
       ;;   *ar { arg in = 0.0, control = 0.0, thresh = 0.5, slopeBelow = 1.0, slopeAbove = 1.0,
@@ -27,16 +28,17 @@
       ;; }

       {:name "Compander",
-       :args [{:name "in", :default 0.0}
-              {:name "control", :default 0.0}
-              {:name "thresh", :default 0.5}
-              {:name "slopeBelow", :default 1.0}
-              {:name "slopeAbove", :default 1.0}
-              {:name "clampTime", :default 0.01}
-              {:name "relaxTime", :default 0.1}],
+       :args [{:name "in", :default 0.0 :doc "The signal to be compressed / expanded / gated"}
+              {:name "control", :default 0.0 :doc "The signal whose amplitude determines the gain applied to the input signal. Often the same as in (for standard gating or compression) but should be different for ducking."}
+              {:name "thresh", :default 0.5 :doc "Control signal amplitude threshold, which determines the break point between slopeBelow and slopeAbove. Usually 0..1. The control signal amplitude is calculated using RMS."}
+              {:name "slopeBelow", :default 1.0 :doc "Slope of the amplitude curve below the threshold. If this slope > 1.0, the amplitude will drop off more quickly the softer the control signal gets; when the control signal is close to 0 amplitude, the output should be exactly zero -- hence, noise gating. Values < 1.0 are possible, but it means that a very low-level control signal will cause the input signal to be amplified, which would raise the noise floor."}
+              {:name "slopeAbove", :default 1.0 :doc "Same thing, but above the threshold. Values < 1.0 achieve compression (louder signals are attenuated); > 1.0, you get expansion (louder signals are made even louder). For 3:1 compression, you would use a value of 1/3 here."}
+              {:name "clampTime", :default 0.01 :doc "The amount of time it takes for the amplitude adjustment to kick in fully. This is usually pretty small, not much more than 10 milliseconds (the default value). I often set it as low as 2 milliseconds (0.002)."}
+              {:name "relaxTime", :default 0.1 :doc "The amount of time for the amplitude adjustment to be released. Usually a bit longer than clampTime; if both times are too short, you can get some (possibly unwanted) artifacts."}],
        :rates #{:ar}
        :muladd true
-       :doc "compresser, expander, limiter, gate, ducker"}
+       :doc "General purpose (hard-knee) dynamics processor: compresser, expander, limiter, gate, ducker"
+       :auto-rate true}

       ;; Normalizer : UGen {
       ;;   var buffer;
@@ -50,7 +52,9 @@
               {:name "level", :default 1.0 :doc "The peak output amplitude level to which to normalize the input"}
               {:name "dur", :default 0.01 :doc "The buffer delay time. Shorter times will produce smaller delays and quicker transient response times, but may introduce amplitude modulation artifacts. (AKA lookAheadTime)"}],
        :rates #{:ar}
-       :doc "flattens dynamics"}
+       :doc "flattens dynamics. Normalizes the input amplitude to the given level. Normalize will not overshoot
+like Compander will, but it needs to look ahead in the audio. Thus there is a
+delay equal to twice the lookAheadTime."}

       ;; Limiter : Normalizer {}


Update remote commit f111003

Update remote commit f111003

--- src/overtone_workspace/console.clj
+++ src/overtone_workspace/console.clj
@@ -24,6 +24,7 @@
     ;;(swap! *fn-beats assoc rand-latchbell [_])
     ;;(swap! *fn-beats assoc rand-laser [_])
     (swap! *fn-beats assoc ambi-rand (vec (repeat 16 1)))
+    ;;(swap! *fn-beats assoc ambi-rand (take 64 (cycle [1 0 1 0 1 1])))
     ;;(swap! *fn-beats assoc ambi-rand (vec (repeat 1 _)))
     (swap! *fn-beats assoc prob-kick (take 32 (cycle [10 0 2 0 6 0 2 0 3 0 6 0 1.1 0 2 4])))
     (swap! *fn-beats assoc prob-sd (take 32 (cycle [0 0 1.1 0 1.1 0 6 0 6 0 1.1 0 1.1 0 6 0])))


Fix mongo/load-conv

Fix mongo/load-conv

--- src/polismath/components/mongo.clj
+++ src/polismath/components/mongo.clj
@@ -95,7 +95,7 @@
   [mongo zid]
   (mc/find-one-as-map
     (:db mongo)
-    (collection-name (:config mongo) "main")
+    (math-collection-name mongo "main")
     {:zid zid}))

 (defn format-for-mongo


Fix some problems with swedish translation

--- src/status_im/translations/sv.cljs
+++ src/status_im/translations/sv.cljs
@@ -46,8 +46,8 @@
    :no-messages                           "Inga meddelanden"
    :suggestions-requests                  "Begäranden"
    :suggestions-commands                  "Kommandon"
-   :faucet-success                        "Kranbegäran mottagen"
-   :faucet-error                          "Felaktig kranbegäran"
+   :faucet-success                        "Faucet-begäran mottagen"
+   :faucet-error                          "Felaktig faucet-egäran"

    ;;sync
    :sync-in-progress                      "Synkroniserar..."
@@ -195,7 +195,7 @@
    ;;location command
    :your-current-location                 "Din nuvarande plats"
    :places-nearby                         "Närliggande platser"
-   :search-results                        "Sök resultat"
+   :search-results                        "Sökresultat"
    :dropped-pin                           "Droppade nål"
    :location                              "Plats"
    :open-map                              "Öppna kartan"
@@ -224,7 +224,7 @@
    :add-new-contact                       "Lägg till ny kontakt"
    :scan-qr                               "Skanna QR kod"
    :name                                  "Namn"
-   :address-explication                   "Din offentliga nykel används för att generera din address på Ethereum och är en serie siffror och bokstäver. Du kan hitta den lätt i din profil"
+   :address-explication                   "Din offentliga nykel används för att generera din address på Ethereum och är en serie siffror och bokstäver. Du kan lätt hitta den i din profil"
    :enter-valid-public-key                "Var vänlig och ange en giltig offentlig nyckel eller skanna en QR kod"
    :contact-already-added                 "Kontakten har redan lagts till"
    :can-not-add-yourself                  "Du kan inte lägga till dig själv"
@@ -258,7 +258,7 @@
    ;;transactions
    :confirm                               "Bekräfta"
    :transaction                           "Transaktion"
-   :unsigned-transaction-expired          "Ounderskriven transaktion förföll"
+   :unsigned-transaction-expired          "Ej underskriven transaktion förföll"
    :status                                "Status"
    :recipient                             "Mottagare"
    :to                                    "Till"
@@ -273,7 +273,7 @@
    :cost-fee                              "Kostnad/Avgift"
    :nonce                                 "Nonce"
    :confirmations                         "Bekräftelser"
-   :confirmations-helper-text             "Var god och vänta på åtminståne 12 bekräftelser för att försäkra dig att transaktionen behandlas säkert"
+   :confirmations-helper-text             "Var god och vänta på minst 12 bekräftelser för att försäkra dig om att transaktionen gått igenom"
    :copy-transaction-hash                 "Kopiera transaktionshash"
    :open-on-etherscan                     "Öppna på Etherscan.io"
    :incoming                              "Inkommande"
@@ -286,7 +286,7 @@

    ;;testfairy warning
    :testfairy-title                       "Varning!"
-   :testfairy-message                     "Du använder en app som installerats från en nattlig version. För att underlätta testning spelar denna version in sessionen om wifi används. All interaktion med appen sparas (som video och loggfiler) och kan användas av utväcklarna för att undersöka möjliga fel. Sparade video/loggfiler innehåller inte lösenord. Inspelningen sker endast om appen installeras från en nattlig version. Inget spelas in om appen installeras från PlayStore eller TestFlight."
+   :testfairy-message                     "Du använder en app som installerats från en nattlig version. För att underlätta testning spelar denna version in sessionen om WiFi används. All interaktion med appen sparas (som video och loggfiler) och kan användas av utvecklarna för att undersöka möjliga fel. Sparade video/loggfiler innehåller inte lösenord. Inspelningen sker endast om appen installeras från en nattlig version. Inget spelas in om appen installeras från PlayStore eller TestFlight."

    ;; wallet
    :wallet                                "Plånbok"
@@ -303,7 +303,7 @@
    :wallet-total-value                    "Totalt värde"
    :wallet-settings                       "Plånboksinställningar"
    :wallet-manage-assets                  "Hantera tillgångar"
-   :signing-phrase-description            "Skriv under transaktionen genom att ge ditt lösenord. Kontrollera att orden ovan motsvarar din hemliga underskriftsfras"
+   :signing-phrase-description            "Skriv under transaktionen genom att ange ditt lösenord. Kontrollera att orden ovan motsvarar din hemliga underskriftsfras"
    :wallet-insufficient-funds             "Otillräckligt kapital"
    :wallet-my-token                       "Mina {{symbol}}"
    :wallet-market-value                   "Marknadsvärde"
@@ -323,21 +323,21 @@
    :transactions-delete                   "Ta bort transaktion"
    :transactions-delete-content           "Transaktionen tas bort från listan 'Ounderskrivna'"
    :transactions-history                  "Historik"
-   :transactions-unsigned                 "Ounderskrivna"
-   :transactions-history-empty            "Inga transaktioner in din historik ännu"
-   :transactions-unsigned-empty           "Du har inga ounderskrivna transaktioner"
+   :transactions-unsigned                 "Ej underskrivna"
+   :transactions-history-empty            "Inga transaktioner i din historik ännu"
+   :transactions-unsigned-empty           "Du har inga ej underskrivna transaktioner"
    :transactions-filter-title             "Filtrera historik"
    :transactions-filter-tokens            "Tokens"
    :transactions-filter-type              "Typ"
    :transactions-filter-select-all        "Välj alla"
    :view-transaction-details              "Visa transaktionsdetaljer"
-   :transaction-description               "Var god och vänta på åtminståne 12 bekräftelser för att försäkra dig att transaktionen behandlas säkert"
-   :transaction-sent                      "Transaktionen sändes"
-   :transaction-moved-text                "Transaktionen kvarblir på listan 'Ounderskrivna' de nästa 5 minuterna"
+   :transaction-description               "Var god och vänta på minst 12 bekräftelser för att försäkra dig om att transaktionen gått igenom"
+   :transaction-sent                      "Transaktionen skickad"
+   :transaction-moved-text                "Transaktionen står kvar på listan 'Ej underskrivna' i 5 minuter"
    :transaction-moved-title               "Transaktionen flyttades"
    :sign-later-title                      "Skriv under transaktionen senare?"
    :sign-later-text                       "Kontrollera transaktionshistoriken för att skriva under denna transaktion"
-   :not-applicable                        "Inte tillämplig på ounderskrivna transaktioner"
+   :not-applicable                        "Otillämplig på ej underskrivna transaktioner"

    ;; Wallet Send
    :wallet-choose-recipient               "Välj mottagare"
@@ -346,8 +346,8 @@
    :wallet-invalid-address                "Ogiltig address: \n {{data}}"
    :wallet-invalid-chain-id               "Felaktigt nätverk: \n {{data}}"
    :wallet-browse-photos                  "Bläddra foton"
-   :validation-amount-invalid-number      "Summan är inte ett giltigt tal"
-   :validation-amount-is-too-precise      "Summan är för exakt. Den minsta summan du kan skicka är 1 Wei (1x10^-18 ETH)"
+   :validation-amount-invalid-number      "Beloppet är inte ett giltigt tal"
+   :validation-amount-is-too-precise      "Summan är för precis Den minsta summan du kan skicka är 1 Wei (1x10^-18 ETH)"


Screenshot speedup.

Screenshot speedup.

--- src/brevis/core.clj
+++ src/brevis/core.clj
@@ -1,3 +1,20 @@
+#_"This file is part of brevis.
+
+    Ekman's Garden is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    Ekman's Garden is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Ekman's Garden.  If not, see <http://www.gnu.org/licenses/>.
+
+Copyright 2012, 2013 Kyle Harrington"
+
 (ns brevis.core
   (:use [penumbra opengl compute]
         [penumbra.opengl core]
@@ -13,10 +30,12 @@
             [penumbra.opengl.frame-buffer :as fb]
             [penumbra.opengl.effects :as glfx])
   (:import (java.awt AWTException Robot Rectangle Toolkit)
-           (java.awt.image BufferedImage)
+           (java.awt.geom AffineTransform)
+           (java.awt.image AffineTransformOp BufferedImage)
+           (java.nio ByteBuffer)
            (java.io File IOException)
            (javax.imageio ImageIO)
-           (org.lwjgl.opengl Display)
+           (org.lwjgl.opengl Display GL11)
            (org.lwjgl BufferUtils)))

 (def #^:dynamic *gui-state* (atom {:rotate-mode :none :translate-mode :none
@@ -182,8 +201,9 @@
 	    (draw-shape obj))
 	  (app/repaint!)))

-(defn screenshot
-  "Take a screenshot. Currently captures the entire screen."
+;; Using the java robot
+#_(defn screenshot
+  "Take a screenshot."
   [filename state]
   ;(println [(:window-x state) (:window-y state) (:window-width state) (:window-height state)])
   (let [img-type (second (re-find (re-matcher #"\.(\w+)$" filename)))
@@ -194,6 +214,31 @@
 				file (File. filename)]
     (println "Screenshot written to:" (.getAbsolutePath file))
     (ImageIO/write capture img-type file)))
+
+(defn screenshot
+  "Take a screenshot."
+  [filename state]
+  (let [pixels (int-array (* (:window-width state) (:window-height state))); Creating an rbg array of total pixels
+        fb (ByteBuffer/allocateDirect (* 3 (:window-width state) (:window-height state))); allocate space for RBG pixels
+        img-type (second (re-find (re-matcher #"\.(\w+)$" filename)))]
+    ;(GL11/glReadPixels 0 0 (:window-width state) (:window-height state) GL_RGB GL_UNSIGNED_BYTE fb)
+    ;(GL11/glReadPixels (int 0) (int 0) (int (:window-width state)) (int (:window-height state)) :rgb :unsigned-byte fb)
+    (fb/gl-read-pixels (int 0) (int 0) (int (:window-width state)) (int (:window-height state)) :rgb :unsigned-byte fb)
+    (let [imageIn (BufferedImage. (:window-width state) (:window-height state) BufferedImage/TYPE_INT_RGB)]
+      (dotimes [i (alength pixels)]
+        (let [bidx (* 3 i)]
+          (aset pixels i
+                (+ (bit-shift-left (.get fb bidx) 16)
+                   (bit-shift-left (.get fb (inc bidx)) 8)
+                   (bit-shift-left (.get fb (inc (inc bidx))) 0)))))
+     (.setRGB imageIn 0 0 (:window-width state) (:window-height state) pixels 0 (:window-width state)); Allocate colored pixel to buffered Image
+     (let [at (AffineTransform/getScaleInstance 1 -1)]; Creating the transformation direction (horizontal)
+       (.translate at 0 (- (.getHeight imageIn)))
+       (let [opRotated (AffineTransformOp. at AffineTransformOp/TYPE_BILINEAR);//Applying transformation
+             imageOut (. opRotated filter imageIn nil)
+             file (File. filename)]
+         ;; probably should use try-catch
+         (ImageIO/write imageOut img-type file))))))

 (defn key-press
   "Update the state in response to a keypress."


Resolve arguments in url tag

Resolve arguments in url tag

--- src/edge/selmer.clj
+++ src/edge/selmer.clj
@@ -4,6 +4,7 @@
   (:require
    [clojure.java.io :as io]
    [com.stuartsierra.component :refer [Lifecycle using]]
+   [selmer.filter-parser :refer [compile-filter-body]]
    [schema.core :as s]
    [hiccup.core :refer [html]]
    [selmer.parser :as selmer]
@@ -15,7 +16,12 @@
       (get (yada/uri-info ctx
                           (keyword "edge.resources" (first args))
                           {:route-params
-                           (reduce (fn [acc [k v]] (assoc acc (keyword k) v)) {} (partition 2 (rest args)))})
+                           (reduce (fn [acc [k v]]
+                                     (assoc acc
+                                            (keyword k)
+                                            ((compile-filter-body v) context-map)))
+                                   {}
+                                   (partition 2 (rest args)))})
            k))))

 (defn add-url-tag!


Generate a different dtbook template for commercial audio books

--- src/mdr2/dtbook.clj
+++ src/mdr2/dtbook.clj
@@ -1,6 +1,46 @@
 (ns mdr2.dtbook
   "Functionality around [DTBook XML](http://www.daisy.org/z3986/2005/Z3986-2005.html)"
   (:require [clojure.data.xml :as xml]))
+
+(defn default-book
+  "Return an default book sexp"
+  [title creator]
+  [:book
+   [:frontmatter
+    [:doctitle title]
+    [:docauthor creator]
+    [:level1 [:p]]]
+   [:bodymatter
+    [:level1 [:h1] [:p]]]])
+
+(defn commercial-audiobook
+  "Return an sexp for the body of a commercial audiobook"
+  [title creator]
+  [:book
+   [:frontmatter
+    [:doctitle title]
+    [:docauthor creator]
+    [:level1
+     [:h1 "Zu diesem DAISY-Buch"]
+     [:p]]
+    [:level1
+     [:h1 "Bibliographische Angaben"]
+     [:p]]
+    [:level1
+     [:h1 "Klappentexte"]
+     [:p]]]
+   [:bodymatter
+    [:level1 [:h1 "[Audioimport]"] [:p]]]
+   [:rearmatter
+    [:level1
+     [:h1 "Mitwirkende"]
+     [:p]]
+    [:level1
+     [:h1 "Hörbuchbeilagen"]
+     [:p]]
+    [:level1
+     [:h1 "Ende des Buches"]
+     [:p]]]])

 (defn- dtbook-sexp
   [{:keys [title creator subject description publisher date identifier source language rights
@@ -36,15 +76,13 @@
     [:meta {:name "dtb:producer" :content publisher}]
     [:meta {:name "dtb:producedDate" :content produceddate}]
     [:meta {:name "dtb:revision" :content revision}]
-   [:book
-    [:frontmatter
-     [:doctitle title]
-     [:docauthor creator]
-     [:level1 [:p]]]
-    [:bodymatter
-     [:level1
-      [:h1]
-      [:p]]]]])
+    [:meta {:name "dtb:revisionDate" :content revisiondate}]
+    [:meta {:name "dtb:revisionDescription" :content revisiondescription}]
+    [:meta {:name "dtb:totalTime" :content totaltime}]
+    [:meta {:name "dtb:audioFormat" :content audioformat}]]
+   (if librarynumber
+     (commercial-audiobook title creator)
+     (default-book title creator))])

 (defn dtbook
   "Create a minimal DTBook XML template according to [the spec](http://www.daisy.org/z3986/2005/Z3986-2005.html) for a given `production`"


actually random token

actually random token

--- server/src/gratefulplace/db/transactions/password_reset.clj
+++ server/src/gratefulplace/db/transactions/password_reset.clj
@@ -4,11 +4,12 @@
             [gratefulplace.db.query :as db]
             [gratefulplace.email.sending.senders :as email]
             [flyingmachine.cartographer.core :as c]
+            [crypto.random]
             [gratefulplace.utils :refer :all]))

 (defn generate-token
   []
-  "moosh")
+  (crypto.random/url-part 10))

 (defn create-token
   [user]


Fix crash if since parameter value doesn't exist

Change-Id: I4c4955318eefe29135e4f4d5e2b278b1161238a4

--- src/qcast/cache.clj
+++ src/qcast/cache.clj
@@ -12,14 +12,14 @@

 ;;; Internals
 (defn- pre-process [row]
-  (-> row
-      (update-in [:data]         db/from-edn)
-      (update-in [:publish_date] db/from-inst)))
+  (some-> row
+          (update-in [:data]         db/from-edn)
+          (update-in [:publish_date] db/from-inst)))

 (defn- post-process [row]
-  (-> row
-      (update-in [:publish_date] db/to-inst)
-      (update-in [:data]         db/to-edn)))
+  (some-> row
+          (update-in [:publish_date] db/to-inst)
+          (update-in [:data]         db/to-edn)))

 ;;; Interface


Remove configurability of interval (it's now always seconds)

--- src/radix/setup.clj
+++ src/radix/setup.clj
@@ -3,7 +3,7 @@
             [clojure.string :as str]
             [environ.core :refer [env]]
             [metrics.jvm.core :refer [instrument-jvm]]
-            [metrics.reporters.graphite :refer [reporter]])
+            [metrics.reporters.graphite :as graphite])
   (:import [java.io Reader]
            [java.net InetAddress UnknownHostException]
            [java.util Properties]
@@ -20,11 +20,8 @@
 (def ^:dynamic graphite-port
   (Integer/valueOf (env :graphite-port "2003")))

-(def ^:dynamic graphite-post-interval
-  (Integer/valueOf (env :graphite-post-interval "60")))
-
-(def ^:dynamic graphite-post-unit
-  (TimeUnit/valueOf (env :graphite-post-unit "SECONDS")))
+(def ^:dynamic graphite-post-interval-seconds
+  (Integer/valueOf (env :graphite-post-interval-seconds "60")))

 (def ^:dynamic graphite-prefix
   (env :graphite-prefix))
@@ -45,8 +42,7 @@
   {:graphite-enabled? graphite-enabled?
    :graphite-host graphite-host
    :graphite-port graphite-port
-   :graphite-post-interval graphite-post-interval
-   :graphite-post-unit graphite-post-unit
+   :graphite-post-interval-seconds graphite-post-interval-seconds
    :graphite-prefix graphite-prefix})

 (defn read-file-to-properties
@@ -73,13 +69,13 @@
 (defn start-graphite-reporting
   [& [options]]
   (instrument-jvm)
-  (let [{:keys [graphite-enabled? graphite-host graphite-port graphite-post-interval
-                graphite-post-unit graphite-prefix]} (merge graphite-defaults options)
-        graphite-reporter (reporter {:host graphite-host
-                                     :port graphite-port
-                                     :prefix graphite-prefix})]
+  (let [{:keys [graphite-enabled? graphite-host graphite-port
+                graphite-post-interval-seconds graphite-prefix]} (merge graphite-defaults options)
+        graphite-reporter (graphite/reporter {:host graphite-host
+                                              :port graphite-port
+                                              :prefix graphite-prefix})]
     (when graphite-enabled?
-      (.start graphite-reporter graphite-post-interval graphite-post-unit))))
+      (graphite/start graphite-reporter graphite-post-interval-seconds))))

 (def version
   (memoize


de-rationalize the parabolic & linear fits in P2, otherwise the memory footprint & CPU processing requirements explode

--- src/skream/core.clj
+++ src/skream/core.clj
@@ -485,13 +485,13 @@
                                              d (- (nth nps i) (nth current-ns i))]
                                          (if (or (and (>= d +1) (> (- (nth current-ns (inc i)) (nth current-ns i)) +1))
                                                  (and (<= d -1) (< (- (nth current-ns (dec i)) (nth current-ns i)) -1)))
-                                           (let [new-para-q (parabolic-fn current-ns current-qs i (sign-fn d))
+                                           (let [new-para-q (float (parabolic-fn current-ns current-qs i (sign-fn d)))
                                                  new-n (+ (nth current-ns i) (sign-fn d))]
                                              (if (and (< (nth current-qs (dec i)) new-para-q)
                                                       (< new-para-q (nth current-qs (inc i))))
                                                (recur (inc i)
                                                       { :qs (assoc current-qs i new-para-q) :ns (assoc current-ns i new-n) })
-                                               (let [new-lin-q (linear-fn ns qs i (sign-fn d))]
+                                               (let [new-lin-q (float (linear-fn ns qs i (sign-fn d)))]
                                                  (recur (inc i)
                                                         { :qs (assoc current-qs i new-lin-q) :ns (assoc current-ns i new-n) }))))
                                            (recur (inc i)
@@ -594,22 +594,23 @@
 ;; Execution Path
 ;;
 (defn run-performance-profile [sk num-fn n]
-  (let [msg-per-n 1000
+  (let [msg-per-n (if (nil? n) 100 (int (/ n 100)))
         t1 (get-time)
         elapsed-msg-fn
-        (fn [i] (let [t2 (get-time)
-                      elapsed-t (- t2 t1)]
-                  (if (not (zero? elapsed-t))
-                    (let [per-sec (float (/ i elapsed-t))]
-                      (println "Added" i "numbers at" per-sec "per-second")))))
+        (fn [current-sk i] (let [t2 (get-time)
+                                 elapsed-t (- t2 t1)]
+                             (if (not (zero? elapsed-t))
+                               (let [per-sec (float (/ i elapsed-t))
+                                     sk-len (count (with-out-str (pr current-sk)))]
+                                 (println "Added" i "numbers at" per-sec "/sec, structure is roughly" sk-len "bytes")))))
         prof-sk
         (loop [i 1 current-sk sk]
-          (if (> i n) current-sk
+          (if (and n (> i n)) current-sk
             (do
-              (if (zero? (mod i msg-per-n)) (elapsed-msg-fn i))
+              (if (zero? (mod i msg-per-n)) (elapsed-msg-fn current-sk i))
               (recur (inc i)
                      (add-num current-sk (num-fn))))))]
-    (elapsed-msg-fn n)
+    (elapsed-msg-fn prof-sk n)
     prof-sk))

 (defn run-default-performance-profile [n]
@@ -618,7 +619,9 @@

 (defn -main [& args]
   (println "Skream Performance Profile")
-  (let [n (if (empty? args) 100 (read-string (first args)))]
-    (println "Profiling w/" n "random numbers")
+  (let [n (if (empty? args) nil
+            (let [n-arg (read-string (first args))]
+              (println "Profiling w/" n-arg "random numbers")
+              n-arg))]
     (run-default-performance-profile n)
     (System/exit 0)))


make wrap-transaction's returned fn accept data-source or connection arg

--- src/asphalt/core.clj
+++ src/asphalt/core.clj
@@ -197,22 +197,28 @@

 (defn wrap-transaction
+  "Given an arity-1 connection-worker fn, wrap it such that it prepares the specified transaction context on the
+  java.sql.Connection argument first."
   ([connection-worker]
     (wrap-transaction connection-worker nil))
   ([connection-worker transaction-isolation]
-    (fn [^Connection connection]
-      (.setAutoCommit connection false)
-      (when-not (nil? transaction-isolation)
-        (.setTransactionIsolation connection ^int (i/resolve-txn-isolation transaction-isolation)))
-      (try
-        (let [result (connection-worker connection)]
-          (.commit connection)
-          result)
-        (catch Exception e
+    (fn wrapper [data-source-or-connection]
+      (if (instance? DataSource data-source-or-connection)
+        (with-open [^Connection connection (.getConnection ^DataSource data-source-or-connection)]
+          (wrapper connection))
+        (let [^Connection connection data-source-or-connection]
+          (.setAutoCommit connection false)
+          (when-not (nil? transaction-isolation)
+            (.setTransactionIsolation connection ^int (i/resolve-txn-isolation transaction-isolation)))
           (try
-            (.rollback connection)
-            (catch Exception _)) ; ignore auto-rollback exceptions
-          (throw e))))))
+            (let [result (connection-worker connection)]
+              (.commit connection)
+              result)
+            (catch Exception e
+              (try
+                (.rollback connection)
+                (catch Exception _)) ; ignore auto-rollback exceptions
+              (throw e))))))))

 (defn invoke-with-transaction


fix position of documentation string

fix position of documentation string

--- src/babel/latin.cljc
+++ src/babel/latin.cljc
@@ -84,8 +84,9 @@
       (conj {:surface (fo expr)}
             expr))))

-(defn get-spec [base-spec model]
+(defn get-spec
   "return a spec that is more specific than base-spec, specific enough to conjugate."
+  [base-spec model]
   (log/debug (str "get-spec:base-spec:" base-spec ";subj: " (get-in base-spec [:synsem :subj :pred])))
   (unifyc
    base-spec


jokes list

jokes list

--- src/cljs/server.cljs
+++ src/cljs/server.cljs
@@ -1,7 +1,7 @@
 (ns server
   (:require-macros [cljs.core.async.macros :as m :refer [go alt!]])
   (:require [cljs.nodejs :as nodejs]
-            [cljs.core.async :refer [chan close! timeout put! map<]]))
+            [cljs.core.async :as async :refer [chan close! timeout put! map<]]))

 (enable-console-print!)

@@ -36,9 +36,8 @@
 (defn handler [req res]
   (let [jokes-chan (fetch-some-jokes 500)]
     (go
-      (while
-        (when-let [joke (<! jokes-chan)]
-          (.send res joke))))))
+      (let [content (take 2 (repeatedly #(<! %) jokes-chan))]
+        (.send res (apply str content))))))

 (defn server [handler port cb]
   (let [app (express)]


Use clojush.instructions.tag in args.clj.

--- src/clojush/args.clj
+++ src/clojush/args.clj
@@ -1,6 +1,7 @@
 (ns clojush.args
   (:require [clj-random.core :as random])
   (:use [clojush globals random util pushstate]
+        [clojush.instructions.tag]
         [clojush.pushgp report]))

 (def push-argmap


Add macro?

Add macro?

--- src/detritus/var.clj
+++ src/detritus/var.clj
@@ -1,10 +1,16 @@
-(ns detritus.var
-  (:require [detritus.namespace :refer [ns->sym]]))
+(ns detritus.var)
+
+;; FIXME: remove when CLJ-1488 drops
+;; http://dev.clojure.org/jira/browse/CLJ-1488

 (defn var->ns [v]
   {:pre [(var? v)]}
-  (-> v (.ns) ns->sym))
+  (-> v (.ns) ns-name))

 (defn var->sym [v]
   {:pre [(var? v)]}
   (-> v (.sym)))
+
+(defn macro? [v]
+  {:pre [(var? v)]}
+  (:macro (meta v)))


reading vars from env as well

reading vars from env as well

--- src/eatme/config.clj
+++ src/eatme/config.clj
@@ -1,16 +1,31 @@
 (ns eatme.config
-  (:require [shoreleave.server-helpers :refer [safe-read]]))
+  (:require [clojure.string :as string]
+            [shoreleave.server-helpers :refer [safe-read]]))

 (def config-atom (atom {}))

+(defn- read-config-file
+  "Loads config from resources/config/<env>.edn"
+  [config-name]
+  (safe-read (slurp
+              (str "resources/config/" config-name ".edn"))))
+
+(defn read-env-vars []
+  (reduce
+   (fn [env [k v]] (if (.startsWith k "eatme.")
+                    (assoc env (keyword (string/replace-first k "eatme." "")) v)
+                    env))
+   {} (System/getenv)))
+
 (defn init-config
-  "Loads config from resources/config/<env>.edn"
+  "Loads config from file and overrides from system env"
   ([]
      (init-config :dev))
   ([config-name]
-     (reset! config-atom (safe-read (slurp
-                                     (str "resources/config/" (name config-name) ".edn"))))))
+     (let [config-name (name config-name)]
+       (reset! config-atom (merge (read-config-file config-name)
+                                  (read-env-vars))))))

-(def config (fn
-              ([] @config-atom)
-              ([& args] (apply @config-atom args))))
+(def config
+  (fn ([] @config-atom)
+    ([& args] (apply @config-atom args))))


Fibonacci numbers tail recursive.

Fibonacci numbers tail recursive.

Taken from Bruce Hauman's DevCards intro:
https://vimeo.com/97078905

--- src/euler/helper.clj
+++ src/euler/helper.clj
@@ -60,7 +60,7 @@
   - base case: ``fib(n <= 1) = n``

   - rec case: ``fib(n > 1) = fib(n - 1) + fib(n - 2)``"
-  (lazy-cat [0N 1N] (map + (rest fibs) fibs)))
+  (map first (iterate (fn [[a b]] [b, (+ a b)]) [0N, 1N])))

 (defn next-collatz
   "**next-collatz :: Int -> Int**


unregister repo

unregister repo

--- cloc-webapp/src-cljs/dash/dash.cljs
+++ cloc-webapp/src-cljs/dash/dash.cljs
@@ -32,7 +32,7 @@
                          (fn [e] (om/update! (current-index-cur) [0] index))}
                   (get repo "full_name")))]
         (apply dom/div nil
-          (map-indexed repo-button (:repos @app-state)))))))
+          (map-indexed repo-button (:repos @app-state)))))))

 (defn- register-repo [current-index auth-token repo-name]
   (let [register-repo-url (str/format "/api/user/%s/register" repo-name)]
@@ -46,6 +46,14 @@

              (om/update! (registered-state-cur current-index) [0] :unregistered))))))

+(defn- unregister-repo [current-index auth-token repo-name]
+  (let [unregister-repo-url (str/format "/api/user/%s/unregister" repo-name)]
+    (go (let [resp (<! (http/post unregister-repo-url {:oauth-token auth-token
+                                                       :json-params {}}))]
+           (when (= 200 (:status resp))
+              (swap! app-state (fn [state] (update-in state [:repos current-index] dissoc :registered)))
+              (om/update! (registered-state-cur current-index) [0] :unregistered))))))
+
 ;; {:auth - :repo -}
 (defn repo-config-panel [state owner]
   (reify
@@ -55,7 +63,12 @@
             current-state (nth (om/observe owner (registered-state-cur index)) 0)
             current-repo (nth (:repos @app-state) index)]
         (case current-state
-          :registered (dom/h2 nil (get current-repo "full_name"))
+          :registered (dom/div nil
+                        (dom/h2 nil (get current-repo "full_name"))
+                        (dom/button
+                          #js {:onClick #(when (= current-state :registered)
+                                            (unregister-repo index (:auth state) (get current-repo "name")))}
+                          "unregister this repo"))
           :registering (dom/h2
                           nil
                           "registering...")
@@ -83,7 +96,7 @@
             repos (:repos @app-state)]
         (if (< current-index (count repos))
           (om/build repo-config-panel {:index current-index
-                                       :auth (:auth state)})
+                                       :auth (:auth state)})
           (dom/h2 nil "Add your repos"))))))

 (defn widget [state owner]


Fixed db migration issue in workload.

Fixed db migration issue in workload.

--- metadata-db-app/src/migrations/016_add_small_to_provider_table.clj
+++ metadata-db-app/src/migrations/016_add_small_to_provider_table.clj
@@ -14,6 +14,7 @@
   ;; We use a dummy provider (the key is :small true) to invoke the create tables code.
   (let [db (config/db)]
     (ct/create-provider-concept-tables db {:provider-id "IGNORED"
+                                           :short-name "IGNORED"
                                            :cmr-only true
                                            :small true})))

@@ -24,6 +25,7 @@
   ;; Drop the SMALL_PROV tables and sequence
   (let [db (config/db)]
     (ct/delete-provider-concept-tables db {:provider-id "IGNORED"
+                                           :short-name "IGNORED"
                                            :cmr-only true
                                            :small true}))
   (h/sql "alter table providers drop column small"))


Fixed bug in STB15 - wrong files were being checked

--- src/alfresco_technical_validation/source_indexes.clj
+++ src/alfresco_technical_validation/source_indexes.clj
@@ -65,12 +65,12 @@
       }
     :spring-app-context {
         :api05          #"(?:^|\s)ref=\s*\"(?!ServiceRegistry)"
+        :stb15          #"parent=\"dictionaryModelBootstrap\""
       }
     :content-model {
         :perf02         #"<index\s+enabled\s*=\s*\"true"
         :perf03         #"<stored>\s*true\s*</stored>"
         :com08          #"<namespace\s+uri\s*=\s*\".*\"\s+prefix\s*=\s*\"(.*)\"\s*/>"
-        :stb15          #"parent=\"dictionaryModelBootstrap\""
       }
     :ant {
         :ivy            #"antlib:org\.apache\.ivy\.ant"


Join constructor

Join constructor

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -500,14 +500,36 @@
               (.down this new-var (.key-at (aget iterators 0) new-var))
               (.search this new-var)))))
   (next [this]
-        (let [iterators (aget var->iterators (- (alength var->iterators) 1))
-              iterator (aget iterators (- (alength var->iterators) 1))]
-          (.up this (alength var->iterators)))))
-
-(defn join []
-  ;; TODO check if at end in constructor
-  )
-
+        (debug)
+        (debug :next seek-key)
+        (when (false? end?)
+          (let [iterators (aget var->iterators (- (alength var->iterators) 1))
+                iterator (aget iterators (- (alength var->iterators) 1))]
+            (.up this (alength var->iterators))))))
+
+(defn join [iterators num-vars iterator->var->present?]
+  (let [seek-key (least-key num-vars)
+        join-iterators (amake [i (alength iterators)]
+                              (let [iterator (aget iterators i)
+                                    var->present? (aget iterator->var->present? i)
+                                    inner->outer (make-array (.-key-len iterator))
+                                    outer->inner (make-array num-vars)
+                                    var 0]
+                                (dotimes [j num-vars]
+                                  (when (true? (aget var->present? j))
+                                    (aset inner->outer var j)
+                                    (aset outer->inner j var)
+                                    (set!! var (+ var 1))))
+                                (JoinIterator. iterator outer->inner inner->outer (make-array (.-key-len iterator)) num-vars)))
+        var->iterators (amake [j num-vars]
+                              (let [var-iterators #js []]
+                                (dotimes [i (alength iterators)]
+                                  (when (true? (aget iterator->var->present? i j))
+                                    (apush var-iterators (aget join-iterators i))))
+                                var-iterators))
+        join (Join. seek-key join-iterators var->iterators)]
+    (.reset join)
+    join))

 (defn iter-seq
   ([iterator]


Fix tests

Fix tests

--- src/aurora/btree.cljs
+++ src/aurora/btree.cljs
@@ -896,14 +896,14 @@
         results (doall
                  (for [update updates]
                    (let [key (nth update 1)
-                         old (contains? @map key)]
+                         old (get @map key)]
                      (case (nth update 0)
                        :add (do
                               (swap! map assoc key)
-                              (false? old))
+                              old)
                        :del (do
                               (swap! map dissoc key)
-                              (true? old))))))]
+                              old)))))]
     [@map results]))

 (defn run-building-prop [min-keys key-len updates]


Destubbing

Destubbing

--- src/carambar/core.clj
+++ src/carambar/core.clj
@@ -9,7 +9,7 @@
 (defroutes app-routes
   (GET "/" [] (response {:carambar "OK"}))
   (GET "/index" [] (response (repository/create-cache)))
-  (GET "/classes" [search] (response {:classes ["java.util.List" "java.util.ArrayList"]})))
+  (GET "/classes" [search] (response {:classes (repository/find-class search)})))

 (def app (-> (handler/api app-routes)
              (middleware/wrap-json-body)


Enhance pedant sensitivity: s/it's/its/

Enhance pedant sensitivity: s/it's/its/

--- src/cheshire/core.clj
+++ src/cheshire/core.clj
@@ -73,7 +73,7 @@
 (defmacro with-writer [[writer opt-map] & body]
   "Start writing for series objects using the same json generator.
    Takes writer and options map as arguments.
-   Expects it's body as sequence of write calls.
+   Expects its body as sequence of write calls.
    Returns a given writer."
   `(let [c-wr# ~writer]
      (binding [*generator* (create-generator c-wr#)
@@ -88,7 +88,7 @@
   - no value - the same as :all
   - :all - write object in a regular way with start and end borders
   - :start - write object with start border only
-  - :start-inner - write object and it's inner object with start border only
+  - :start-inner - write object and its inner object with start border only
   - :end - write object with end border only."
   ([obj] (write obj nil))
   ([obj wholeness]


Fixing a regression caused by refactoring

--- src/movertone/api.clj
+++ src/movertone/api.clj
@@ -26,7 +26,7 @@
       p/make-html
       html-response))

-(defn show-ragam [ragam]
+(defn show-ragam [{:keys [params] :as request}]
   (let [ragam-name (keyword (:name params))
         ragam {ragam-name (r/ragams ragam-name)}]
     (->> [(p/row false ragam)]


Add functions over Whole-ASTs

Add functions over Whole-ASTs

--- src/oxcart/passes.clj
+++ src/oxcart/passes.clj
@@ -31,6 +31,40 @@
 ;; order.

+(defn whole-ast->modules
+  "  Whole-AST   (Seq Module)
+
+  Returns the modules of the ASt as a sequence."
+  [{:keys [modules] :as whole-ast}]
+  (map whole-ast modules))
+
+
+(defn whole-ast->forms
+  "  Whole-AST   (Seq AST)
+
+  Returns a sequence of all the individual top level form ASTs in the
+  given Whole-AST."
+  [whole-ast]
+  (->> whole-ast
+       whole-ast->modules
+       (mapcat :forms)))
+
+
+(defn update-forms
+  "  Whole-AST   (  Form   Form)   arg *
+
+  Updates every form in the given Whole-ast, replacing it with (apply
+  f form args). Intended to eliminate repetitive Whole-AST
+  comprehensions in pass implementations."
+  [{:keys [modules] :as whole-ast} f & args]
+  (->> (for [m modules]
+         [m {:forms
+             (for [form (:forms (get whole-ast m))]
+               (apply f form args))}])
+       (into {})
+       (merge whole-ast)))
+
+
 ;; Passes are then functions from Whole-ASTs to Whole-ASTs. For user
 ;; "friendliness" each pass shall also take an options argument which
 ;; may change the behavior of the pass by enabling or disabling a
@@ -50,16 +84,18 @@
   [whole-ast pass]
   (update-in whole-ast [:passes] conj pass))

+
 (defn require-pass
   [whole-ast pass options]
   (if (contains? (:passes whole-ast) pass)
     whole-ast
     (pass whole-ast options)))

+
 (defn do-passes
-  [ast options & passes]
+  [whole-ast options & passes]
   (reduce #(require-pass %1 %2 options)
-          ast passes))
+          whole-ast passes))

 ;; To enable this pattern however, transforming passes are required to
@@ -69,5 +105,5 @@

 (defn clobber-passes
-  [ast]
-  (assoc ast :passes #{}))
+  [whole-ast]
+  (assoc whole-ast :passes #{}))


better frontend-tx-data fn

better frontend-tx-data fn

--- src/pc/http/sente.clj
+++ src/pc/http/sente.clj
@@ -664,16 +664,17 @@
       (?reply-fn {:tx-ids tx-ids}))))

 (def ^:dynamic *db*)
-(def memo-frontend-tx-data (memo/lru (fn [tx-id]
-                                       (->> tx-id
-                                         (replay/reproduce-transaction *db*)
-                                         (datomic-common/frontend-document-transaction)
-                                         :read-only-data))
-                                     :lru/threshold 10000))
+(defn frontend-tx-data* [tx-id]
+  (->> tx-id
+    (replay/reproduce-transaction *db*)
+    (datomic-common/frontend-document-transaction)
+    :read-only-data))
+
+(def frontend-tx-data (memo/lru frontend-tx-data* :lru/threshold 10000))

 (defn get-frontend-tx-data [db tx-id]
   (binding [*db* db]
-    (memo-frontend-tx-data tx-id)))
+    (frontend-tx-data tx-id)))

 (defmethod ws-handler :document/fetch-transaction [{:keys [client-id ?data ?reply-fn] :as req}]
   (check-document-access (-> ?data :document/id) req :read)


Fix problem with logging in good-enough, and don't call it unless useful.

--- src/zprint/zprint.cljc
+++ src/zprint/zprint.cljc
@@ -368,7 +368,8 @@
 	 "hang-flow-limit:" hang-flow-limit
 	 "hang-adjust:" hang-adjust
 	 "(/ (+ p-lines hang-adjust) b-lines)"
-	   (/ (+ p-lines hang-adjust) b-lines)
+	   (when (and p-lines b-lines hang-adjust)
+	        (/ (+ p-lines hang-adjust) b-lines))
 	 "factor:" (if (= fn-style :hang) hang-type-flow hang-flow)
          "p-count:" p-count
          "p-lines:" p-lines
@@ -2388,223 +2389,234 @@
    ; (in-hang options) slows things down here, for some reason
    (let [seq-right zloc-seq
          seq-right (if zloc-count (take zloc-count seq-right) seq-right)]
-
      (if (empty? seq-right)
-        :noseq
-
-	(let[
-
-
-         [pair-seq non-paired-item-count]
-           (constant-pair caller options seq-right)
-         _ (dbg options
-                "fzprint-hang-remaining count pair-seq:"
-                (count pair-seq))
-         #_(dbg options
-                "fzprint-hang-remaining: *=*=*=*=*=*" (zstring (first zloc-seq))
-                "hindent:" hindent
-                "findent:" findent
-                "caller:" caller
-                "hang?" hang?
-                "hang-diff" hang-diff)
-         ; Now determine if there is any point in doing a hang, because
-         ; if the flow is beyond the expand limit, there is really no
-         ; chance that the hang is not beyond the expand limit.
-         ; This is what good-enough? does:
-         ;  (<= (/ (dec p-lines) p-count) hang-expand)
-         ;  Also need to account for the indent diffs.
-         ; Would be nice to move this into a common routine, since this
-         ; duplicates logic in good-enough?
-         ;
-         ; Yes, and this caused a problem when I put in the
-         ; hang-if-equal-flow? option in good-enough, so that now
-         ; we can't cancel the hang even though we are beyond the hang-expand
-         ; because the hang might be the same as the flow, and in that case
-         ; we don't really care how long the hang-expand is. We could make
-         ; this a feature, by having a large-ish hang-expand and having it
-         ; override hang-if-equal-flow.  If we do that, we have to reorder
-         ; the checks in good-enough to put the hang-expand check first.
-         ; I can't see any great reason for doing a flow if the hang and
-         ; flow are equal, though, so we won't do that now.  And this
-         ; code comes out.
-         ;
-         #_#_[flow flow-lines] (zat options flow) ; PT
-         _ (dbg options
-                "fzprint-hang-remaining: first hang?" hang?
-                "hang-avoid" hang-avoid
-                "findent:" findent
-                "hindent:" hindent
-                "(count seq-right):" (count seq-right)
-                "thing:" (when hang-avoid (* (- width hindent) hang-avoid)))
-         hang? (and
-                 hang?
-                 ; This is a key for "don't hang no matter what", it isn't
-                 ; about making it prettier. People call this routine with
-                 ; these values equal to ensure that it always flows.
-                 (not= hindent findent)
-                 ; This is not the original, below.
-                 ; If we are doing respect-nl?, then the count of seq-right
-                 ; is going to be a lot more, even if it doesn't end up
-                 ; looking different than before.  So, perhaps we should
-                 ; adjust hang-avoid here?  Perhaps double it or something?
-                 (or (not hang-avoid)
-                     (< (count seq-right) (* (- width hindent) hang-avoid)))
-                 ; If the first thing in the flow is a comment, maybe we
-                 ; shouldn't be hanging anything?
-                 #_(not= (nth (first flow) 2) :comment-inline) ; PT
-                 ;flow-lines
-                 ;;TODO make this uneval!!!
-                 #_(or (<= (- hindent findent) hang-diff)
-                       (<= (/ (dec (first flow-lines)) (count seq-right))
-                           hang-expand)))
-         _ (dbg options "fzprint-hang-remaining: second hang?" hang?)
-         hanging
-           (#?@(:clj [zfuture options]
-                :cljs [do])
-            (let [hang-result
-                    (when hang?
-                      (if-not pair-seq
-                        ; There are no paired elements
-                        (fzprint-flow-seq (in-hang options)
-                                          hindent
-                                          seq-right
-                                          :force-nl
-                                          nil ;nl-first?
-                        )
-                        (if (not (zero? non-paired-item-count))
-                          (concat-no-nil
-                            ; The elements that are not paired
-                            (dbg-form options
-                                      "fzprint-hang-remaining: mapv:"
-                                      (ensure-end-w-nl
-                                        hindent
-                                        (fzprint-flow-seq
-                                          (not-rightmost (in-hang options))
-                                          hindent
-                                          (take non-paired-item-count seq-right)
-                                          :force-nl
-                                          nil ;nl-first?
-                                        )))
-                            ; The elements that are paired
-                            (dbg-form options
-                                      "fzprint-hang-remaining: fzprint-hang:"
-                                      (fzprint-pairs (in-hang options)
-                                                     hindent
-                                                     pair-seq)))
-                          ; All elements are paired
-                          (fzprint-pairs (in-hang options) hindent pair-seq))))]
-              [hang-result (style-lines options hindent hang-result)]))
-         ; We used to calculate hang-count by doing the hang an then counting
-         ; the output.  But ultimately this is simple a series of map calls
-         ; to the elements of seq-right, so we go right to the source for this
-         ; number now.  That let's us move the interpose calls above this
-         ; point.
-         [hanging [hanging-line-count :as hanging-lines]] (zat options hanging)
-         hang-count (count seq-right)
-         flow?
-           (not
-             (use-hang? caller options hindent hang-count hanging-line-count))
-         #_(inc-pass-count)
-         flow
-           (when flow?
-             (#?@(:clj [zfuture options]
-                  :cljs [do])
-              (let [flow-result (if-not pair-seq
-                                  ; We don't have any constant pairs
-                                  (fzprint-flow-seq options
-                                                    findent
-                                                    seq-right
-                                                    :force-nl
-                                                    :nl-first)
-                                  (if (not (zero? non-paired-item-count))
-                                    ; We have constant pairs, ; but they follow
-                                    ; some stuff that isn't paired.
-                                    ; Do the elements that are not pairs
-                                    (concat-no-nil
-                                      (ensure-end-w-nl
-                                        findent
-                                        (fzprint-flow-seq
-                                          (not-rightmost options)
-                                          findent
-                                          (take non-paired-item-count seq-right)
-                                          :force-nl
-                                          :nl-first))
-                                      ; The elements that are constant pairs
-                                      (fzprint-pairs options findent pair-seq))
-                                    ; This code path is where we have all
-                                    ; constant
-                                    ; pairs.
-                                    (fzprint-pairs options findent pair-seq)))]
-                ; Skip the first line when doing the calcuation so that
-                ; good-enough doesn't change the layout from the original
-                [flow-result
-                 (style-lines
-                   options
-                   findent
-                   ; Issue #173 -- the following code caused code to
-                   ; disappear, because if there was just one thing
-                   ; in flow-result, then it would be empty and
-                   ; style-lines would return nil, causing neither
-                   ; hang nor flow to be used.
-                   ;
-                   ; (if (not pair-seq)
-                   ;   (next flow-result)
-                   ;   flow-result)
-                   ;
-                   ; Now we do a similar thing -- as long as flow-result
-                   ; has more than one thing, below when we call good-enough.
-                   flow-result)])))
-         [flow flow-lines] (when flow (zat options flow)) ; PT
-         _ (log-lines options
-                      "fzprint-hang-remaining: hanging:"
-                      hindent
-                      hanging)
-         _ (dbg options
-                "fzprint-hang-remaining: hanging-lines:" hanging-lines
-                "hang-count:" hang-count)]
-     (dbg options "fzprint-hang-remaining: flow-lines:" flow-lines)
-     (when dbg?
-       (if (zero? hang-count)
-         (println "hang-count = 0:" (str (map zstring zloc-seq)))))
-     (log-lines options "fzprint-hang-remaining: flow" findent flow)
-     ; If we did hang and not flow, then we better use it.
-     (if (and hanging-lines (not flow-lines))
-       (if (first-nl? hanging)
-         hanging
-         (concat-no-nil [[" " :none :whitespace 10]] hanging))
-       (when flow-lines
-         (if (good-enough?
-               caller
-               options
-               fn-style
-               hang-count
-               (- hindent findent)
-               hanging-lines
-               ; If we have more than one line in the flow
-               ; and we didn't have any constant pairs,
-               ; then decrease the line count for the flow.
-               ; This seems to be necessary based on the results,
-               ; but it can't be done in good-enough in all cases,
-               ; because it breaks lots of stuff.  This was
-               ; previously done above, in the call to style-lines,
-               ; where we just skipped the first line.  That
-               ; seems like a bad idea, so we now just create
-               ; a new flow-lines to cover this situation.
-               ; This was provoked by Issue #173 where we lost
-               ; code when there was only one thing in flow-result,
-               ; and we skipped that thing, causing style-lines
-               ; to return nil and the whole thing disappeared.
-               (if (and (not pair-seq) (> (first flow-lines) 1))
-                 [(dec (first flow-lines)) (second flow-lines)
-                  (nth flow-lines 2)]
-                 flow-lines)
-               #_flow-lines)
-           ; If hanging starts with a newline, don't put a blank at the
-           ; end of the previous line.
+       :noseq
+       (let [[pair-seq non-paired-item-count]
+               (constant-pair caller options seq-right)
+             _ (dbg options
+                    "fzprint-hang-remaining count pair-seq:"
+                    (count pair-seq))
+             #_(dbg options
+                    "fzprint-hang-remaining: *=*=*=*=*=*" (zstring (first
+                                                                     zloc-seq))
+                    "hindent:" hindent
+                    "findent:" findent
+                    "caller:" caller
+                    "hang?" hang?
+                    "hang-diff" hang-diff)
+             ; Now determine if there is any point in doing a hang, because
+             ; if the flow is beyond the expand limit, there is really no
+             ; chance that the hang is not beyond the expand limit.
+             ; This is what good-enough? does:
+             ;  (<= (/ (dec p-lines) p-count) hang-expand)
+             ;  Also need to account for the indent diffs.
+             ; Would be nice to move this into a common routine, since this
+             ; duplicates logic in good-enough?
+             ;
+             ; Yes, and this caused a problem when I put in the
+             ; hang-if-equal-flow? option in good-enough, so that now
+             ; we can't cancel the hang even though we are beyond the
+             ; hang-expand
+             ; because the hang might be the same as the flow, and in that case
+             ; we don't really care how long the hang-expand is. We could make
+             ; this a feature, by having a large-ish hang-expand and having it
+             ; override hang-if-equal-flow.  If we do that, we have to reorder
+             ; the checks in good-enough to put the hang-expand check first.
+             ; I can't see any great reason for doing a flow if the hang and
+             ; flow are equal, though, so we won't do that now.  And this
+             ; code comes out.
+             ;
+             #_#_[flow flow-lines] (zat options flow) ; PT
+             _ (dbg options
+                    "fzprint-hang-remaining: first hang?" hang?
+                    "hang-avoid" hang-avoid
+                    "findent:" findent
+                    "hindent:" hindent
+                    "(count seq-right):" (count seq-right)
+                    "thing:" (when hang-avoid (* (- width hindent) hang-avoid)))
+             hang? (and
+                     hang?
+                     ; This is a key for "don't hang no matter what", it isn't
+                     ; about making it prettier. People call this routine with
+                     ; these values equal to ensure that it always flows.
+                     (not= hindent findent)
+                     ; This is not the original, below.
+                     ; If we are doing respect-nl?, then the count of seq-right
+                     ; is going to be a lot more, even if it doesn't end up
+                     ; looking different than before.  So, perhaps we should
+                     ; adjust hang-avoid here?  Perhaps double it or something?
+                     (or (not hang-avoid)
+                         (< (count seq-right) (* (- width hindent) hang-avoid)))
+                     ; If the first thing in the flow is a comment, maybe we
+                     ; shouldn't be hanging anything?
+                     #_(not= (nth (first flow) 2) :comment-inline) ; PT
+                     ;flow-lines
+                     ;;TODO make this uneval!!!
+                     #_(or (<= (- hindent findent) hang-diff)
+                           (<= (/ (dec (first flow-lines)) (count seq-right))
+                               hang-expand)))
+             _ (dbg options "fzprint-hang-remaining: second hang?" hang?)
+             hanging
+               (#?@(:clj [zfuture options]
+                    :cljs [do])
+                (let [hang-result
+                        (when hang?
+                          (if-not pair-seq
+                            ; There are no paired elements
+                            (fzprint-flow-seq (in-hang options)
+                                              hindent
+                                              seq-right
+                                              :force-nl
+                                              nil ;nl-first?
+                            )
+                            (if (not (zero? non-paired-item-count))
+                              (concat-no-nil
+                                ; The elements that are not paired
+                                (dbg-form
+                                  options
+                                  "fzprint-hang-remaining: mapv:"
+                                  (ensure-end-w-nl
+                                    hindent
+                                    (fzprint-flow-seq
+                                      (not-rightmost (in-hang options))
+                                      hindent
+                                      (take non-paired-item-count seq-right)
+                                      :force-nl
+                                      nil ;nl-first?
+                                    )))
+                                ; The elements that are paired
+                                (dbg-form
+                                  options
+                                  "fzprint-hang-remaining: fzprint-hang:"
+                                  (fzprint-pairs (in-hang options)
+                                                 hindent
+                                                 pair-seq)))
+                              ; All elements are paired
+                              (fzprint-pairs (in-hang options)
+                                             hindent
+                                             pair-seq))))]
+                  [hang-result (style-lines options hindent hang-result)]))
+             ; We used to calculate hang-count by doing the hang an then
+             ; counting
+             ; the output.  But ultimately this is simple a series of map calls
+             ; to the elements of seq-right, so we go right to the source for
+             ; this
+             ; number now.  That let's us move the interpose calls above this
+             ; point.
+             [hanging [hanging-line-count :as hanging-lines]] (zat options
+                                                                   hanging)
+             hang-count (count seq-right)
+             flow? (not (use-hang? caller
+                                   options
+                                   hindent
+                                   hang-count
+                                   hanging-line-count))
+             #_(inc-pass-count)
+             flow (when flow?
+                    (#?@(:clj [zfuture options]
+                         :cljs [do])
+                     (let [flow-result
+                             (if-not pair-seq
+                               ; We don't have any constant pairs
+                               (fzprint-flow-seq options
+                                                 findent
+                                                 seq-right
+                                                 :force-nl
+                                                 :nl-first)
+                               (if (not (zero? non-paired-item-count))
+                                 ; We have constant pairs, ; but they follow
+                                 ; some stuff that isn't paired.
+                                 ; Do the elements that are not pairs
+                                 (concat-no-nil
+                                   (ensure-end-w-nl
+                                     findent
+                                     (fzprint-flow-seq
+                                       (not-rightmost options)
+                                       findent
+                                       (take non-paired-item-count seq-right)
+                                       :force-nl
+                                       :nl-first))
+                                   ; The elements that are constant pairs
+                                   (fzprint-pairs options findent pair-seq))
+                                 ; This code path is where we have all
+                                 ; constant
+                                 ; pairs.
+                                 (fzprint-pairs options findent pair-seq)))]
+                       ; Skip the first line when doing the calcuation so that
+                       ; good-enough doesn't change the layout from the original
+                       [flow-result
+                        (style-lines
+                          options
+                          findent
+                          ; Issue #173 -- the following code caused code to
+                          ; disappear, because if there was just one thing
+                          ; in flow-result, then it would be empty and
+                          ; style-lines would return nil, causing neither
+                          ; hang nor flow to be used.
+                          ;
+                          ; (if (not pair-seq)
+                          ;   (next flow-result)
+                          ;   flow-result)
+                          ;
+                          ; Now we do a similar thing -- as long as flow-result
+                          ; has more than one thing, below when we call
+                          ; good-enough.
+                          flow-result)])))
+             [flow flow-lines] (when flow (zat options flow)) ; PT
+             _ (log-lines options
+                          "fzprint-hang-remaining: hanging:"
+                          hindent
+                          hanging)
+             _ (dbg options
+                    "fzprint-hang-remaining: hanging-lines:" hanging-lines
+                    "hang-count:" hang-count)]
+         (dbg options "fzprint-hang-remaining: flow-lines:" flow-lines)
+         (when dbg?
+           (if (zero? hang-count)
+             (println "hang-count = 0:" (str (map zstring zloc-seq)))))
+         (log-lines options "fzprint-hang-remaining: flow" findent flow)
+         ; If we did hang and not flow, then we better use it.
+         (if (and hanging-lines (not flow-lines))
            (if (first-nl? hanging)
              hanging
              (concat-no-nil [[" " :none :whitespace 10]] hanging))
-           (ensure-start-w-nl findent flow))))))))
+           (when flow-lines
+             (if
+               ; Only call good-enough if we have both hanging-lines and
+               ; flow-lines!
+               (and hanging-lines
+                    (good-enough?
+                      caller
+                      options
+                      fn-style
+                      hang-count
+                      (- hindent findent)
+                      hanging-lines
+                      ; If we have more than one line in the flow
+                      ; and we didn't have any constant pairs,
+                      ; then decrease the line count for the flow.
+                      ; This seems to be necessary based on the results,
+                      ; but it can't be done in good-enough in all cases,
+                      ; because it breaks lots of stuff.  This was
+                      ; previously done above, in the call to style-lines,
+                      ; where we just skipped the first line.  That
+                      ; seems like a bad idea, so we now just create
+                      ; a new flow-lines to cover this situation.
+                      ; This was provoked by Issue #173 where we lost
+                      ; code when there was only one thing in flow-result,
+                      ; and we skipped that thing, causing style-lines
+                      ; to return nil and the whole thing disappeared.
+                      (if (and (not pair-seq) (> (first flow-lines) 1))
+                        [(dec (first flow-lines)) (second flow-lines)
+                         (nth flow-lines 2)]
+                        flow-lines)
+                      #_flow-lines))
+               ; If hanging starts with a newline, don't put a blank at the
+               ; end of the previous line.
+               (if (first-nl? hanging)
+                 hanging
+                 (concat-no-nil [[" " :none :whitespace 10]] hanging))
+               (ensure-start-w-nl findent flow))))))))
   ([caller options hindent findent zloc fn-style]
    (fzprint-hang-remaining caller options hindent findent zloc fn-style nil)))

@@ -7263,6 +7275,7 @@
                           (make-caller :prefix-tags :list [:respect-bl?]))
                       indent
                       zloc)
+
       (zns? zloc) (fzprint-ns options indent zloc)
       (or (zpromise? zloc) (zfuture? zloc) (zdelay? zloc) (zagent? zloc))
         (fzprint-future-promise-delay-agent options indent zloc)


More examples as documentation

More examples as documentation

--- test/midje/t_sweet.clj
+++ test/midje/t_sweet.clj
@@ -67,9 +67,21 @@
 (defn letter [x y z] x)
 (defn find-letter [] (letter "x" "y" "z"))

+;; provided functions using & can ignore the arity
 (fact (find-letter) => "aaa"
   (provided
     (letter & anything) => "aaa"))
+
+;; provided functions can match on parts of the arguments and ignore the rest
+(fact (find-letter) => "aaa"
+  (provided
+    (letter & "x" anything) => "aaa"))
+
+(silent-fact (find-letter) => "aaa"
+  (provided
+    (letter & "y" anything) => "aaa"))
+(note-that some-prerequisite-was-called-with-unexpected-arguments)
+

 ;; facts can see their environment
 (let [outer-value 2]


Fix missing string conversion in report.nested

--- modules/lazytest/src/main/clojure/lazytest/report/nested.clj
+++ modules/lazytest/src/main/clojure/lazytest/report/nested.clj
@@ -58,7 +58,7 @@

 (defn- report-test-case-result [result depth]
   (indent depth)
-  (println (colorize (identifier result) (if (:pass? result) :green :red))))
+  (println (colorize (str (identifier result)) (if (:pass? result) :green :red))))

 (defn- report-result [result depth]
   (if (suite-result? result)


Fixed redundant computation in test case

for c.c.dl.languages.EL-gfp-exploration.

Signed-off-by: Daniel Borchmann <25857343a15bf1edafebc2912e82ecf775c585c1@mailbox.tu-dresden.de>

--- src/conexp/contrib/tests/dl/languages/EL_gfp_exploration.clj
+++ src/conexp/contrib/tests/dl/languages/EL_gfp_exploration.clj
@@ -74,7 +74,7 @@
                             (and [(tbox All (and Father Mother (exists HasChild All))),
                                   All])))))
   (are [model gci-count] (let [gcis (model-gcis model)]
-                           (and (= gci-count (count (model-gcis model)))
+                           (and (= gci-count (count gcis))
                                 (forall [gci gcis]
                                   (holds-in-model? model gci))))
        some-model  9


(SERVER-1721) Port graphite tests from pe-tk-metrics

Ports over some tests from pe-tk-metrics which test graphite metrics
filtering behavior.

--- test/integration/puppetlabs/services/master/master_service_test.clj
+++ test/integration/puppetlabs/services/master/master_service_test.clj
@@ -9,7 +9,6 @@
     [me.raynes.fs :as fs]
     [puppetlabs.kitchensink.core :as ks]
     [puppetlabs.http.client.sync :as http-client]
-    [puppetlabs.services.jruby.jruby-puppet-testutils :as jruby-testutils]
     [cheshire.core :as json]
     [puppetlabs.services.jruby.jruby-puppet-service :as jruby-service]
     [puppetlabs.trapperkeeper.services :as tk-services]
@@ -18,7 +17,9 @@
     [schema.core :as schema]
     [puppetlabs.services.master.master-core :as master-core]
     [puppetlabs.services.puppet-profiler.puppet-profiler-core :as puppet-profiler-core]
-    [puppetlabs.services.protocols.puppet-profiler :as profiler-protocol]))
+    [puppetlabs.services.protocols.puppet-profiler :as profiler-protocol]
+    [puppetlabs.trapperkeeper.services.metrics.metrics-core :as metrics-core]
+    [puppetlabs.trapperkeeper.services.metrics.metrics-testutils :as metrics-testutils]))

 (def test-resources-path "./dev-resources/puppetlabs/services/master/master_service_test")
 (def test-resources-code-dir (str test-resources-path "/codedir"))
@@ -281,3 +282,70 @@
               (test-path! "hostcert" (str ca-files-test-runtime-dir "/certs/localhost.pem"))
               (test-path! "serial" (str ca-files-test-runtime-dir "/certs/serial"))
               (test-path! "cert_inventory" (str ca-files-test-runtime-dir "/inventory.txt")))))))))))
+
+(def graphite-enabled-config
+  {:metrics {:server-id "localhost"
+             :reporters {:graphite {:update-interval-seconds 5000
+                                    :port 10001
+                                    :host "foo.localdomain"}}
+             :registries {:puppetserver
+                          {:reporters {:graphite {:enabled true}}}}}
+   :jruby-puppet {:master-code-dir test-resources-code-dir
+                  :master-conf-dir master-service-test-runtime-dir}})
+
+(defn get-puppetserver-registry-context
+      [app]
+      (-> app
+          (tk-app/get-service :MetricsService)
+          tk-services/service-context
+          :registries
+          deref
+          :puppetserver))
+
+(defn get-puppetserver-graphite-reporter
+      [app]
+      (:graphite-reporter (get-puppetserver-registry-context app)))
+
+(deftest graphite-filtering-works
+  (testing "default filter works"
+    (let [reported-metrics-atom (atom {})]
+      (with-redefs [metrics-core/build-graphite-sender
+                    (fn [_ domain]
+                      (metrics-testutils/make-graphite-sender reported-metrics-atom domain))]
+        (logutils/with-test-logging
+          (bootstrap-testutils/with-puppetserver-running
+           app
+           graphite-enabled-config
+           (http-get "/puppet/v3/catalog/localhost?environment=production")
+           (.report (get-puppetserver-graphite-reporter app))
+           (testing "reports metrics on the default list"
+             (is (metrics-testutils/reported? @reported-metrics-atom
+                                              :puppetserver
+                                              "puppetlabs.localhost.compiler.compile.mean")))
+           (testing "doesn't report metrics not on the default list"
+             (is (not (metrics-testutils/reported?
+                       @reported-metrics-atom
+                       :puppetserver
+                       "puppetlabs.localhost.compiler.compile.production.mean")))))))))
+  (testing "can add metrics to export to Graphite with the `metrics-allowed` setting"
+      (let [reported-metrics-atom (atom {})]
+        (with-redefs [metrics-core/build-graphite-sender
+                      (fn [_ domain]
+                        (metrics-testutils/make-graphite-sender reported-metrics-atom domain))]
+          (logutils/with-test-logging
+            (bootstrap-testutils/with-puppetserver-running
+             app
+             (assoc-in graphite-enabled-config [:metrics :registries :puppetserver :metrics-allowed]
+                       ["compiler.compile.production"])
+             (http-get "/puppet/v3/catalog/localhost?environment=production")
+             (.report (get-puppetserver-graphite-reporter app))
+             (testing "reports metrics on the default list"
+               (is (metrics-testutils/reported?
+                    @reported-metrics-atom
+                    :puppetserver
+                    "puppetlabs.localhost.compiler.compile.mean")))
+             (testing "reports metrics on the metrics-allowed list"
+               (is (metrics-testutils/reported?
+                    @reported-metrics-atom
+                    :puppetserver
+                    "puppetlabs.localhost.compiler.compile.production.mean")))))))))


Improve tailing

Improve tailing

--- test/com/nomistech/clojure_the_language/c_920_io/tailing.clj
+++ test/com/nomistech/clojure_the_language/c_920_io/tailing.clj
@@ -1,5 +1,6 @@
 (ns com.nomistech.clojure-the-language.c-920-io.tailing
   (:require [clojure.core.async :as a]
+            [clojure.java.io :as io]
             [clojure.string :as str]
             [midje.sweet :refer :all])
   (:import (java.io File)
@@ -20,9 +21,11 @@
   (reify TailerListener
     (init [this tailer] ())
     (fileNotFound [this]
-      (println "File not found"))
+      ;; (println "File not found")
+      )
     (fileRotated [this]
-      (println "Rotation detected"))
+      ;; (println "Rotation detected")
+      )
     (^void handle [this ^String line]
      (a/>!! c line))
     (^void handle [this ^Exception i]
@@ -41,19 +44,28 @@
   (.stop tailer)
   (a/close! channel))

-(fact (let [lines     ["a" "b" "c" "d" "e"]
-            file      (File. "test/_work-dir/plop.log")
-            t-and-c   (tailer-and-channel file 100)
-            result-ch (a/thread (doall (tailer-and-channel->seq t-and-c)))]
-        (Thread/sleep 1000)
-        (spit file "")
-        (spit file (str (str/join "\n" lines)
-                        "\n"))
-        (Thread/sleep 1000)
-        (println "Stopping")
+(defn delete-and-spit-with-waits [f content sleep-ms]
+  (io/delete-file f)
+  (Thread/sleep sleep-ms)
+  (spit f content)
+  (Thread/sleep sleep-ms))
+
+(fact (let [delay-ms        100
+            sleep-ms        500 ; (+ delay-ms 100)
+            lines           ["a" "b" "c" "d" "e"]
+            file-content    (str (str/join "\n" lines)
+                                 "\n")
+            file            (File. "test/_work-dir/plop.log")
+            t-and-c         (tailer-and-channel file delay-ms)
+            result-ch       (a/thread (doall (tailer-and-channel->seq t-and-c)))
+            n-rotations     3
+            expected-result (apply concat (repeat n-rotations lines))]
+        (Thread/sleep sleep-ms)
+        (dotimes [_ n-rotations]
+          (delete-and-spit-with-waits file file-content sleep-ms))
         (stop-tailer-and-channel t-and-c)
         (a/<!! result-ch)
-        => lines))
+        => expected-result))

 ;; TODO
 ;; Check that bug.


executing cleanup no matter what

executing cleanup no matter what

--- src/celestial/puppet_standalone.clj
+++ src/celestial/puppet_standalone.clj
@@ -19,11 +19,14 @@
   Provision
   (apply- [this]
     (use 'celestial.puppet-standalone)
-    (copy-module machine module)
-    (execute machine
-      (step :extract "cd /tmp" (<< "tar -xzf ~(:name module).tar.gz"))
-      (step :run (<< "cd /tmp/~(:name module)") "./scripts/run.sh ")
-      (step :cleanup "cd /tmp" (<< "rm -rf ~(:name module)*")))))
+    (try (copy-module machine module)
+      (execute machine
+        (step :extract "cd /tmp" (<< "tar -xzf ~(:name module).tar.gz"))
+        (step :run (<< "cd /tmp/~(:name module)") "./scripts/run.sh "))
+      (finally
+        (execute machine (step :cleanup "cd /tmp" (<< "rm -rf ~(:name module)*")))
+        )
+      )))

 #_(.apply-
     (Standalone. {:host "192.168.5.203"} {:name "puppet-base-env" :src "/home/ronen/code/"}))


adjusted apply queries

adjusted apply queries

--- src/clj/forma/classify/logistic.clj
+++ src/clj/forma/classify/logistic.clj
@@ -208,4 +208,3 @@
     (assoc (apply merge-with identity
                   (map make-dict beta-vec))
       :full (last (first beta-full)))))
-


Use seti theme by default

Use seti theme by default

--- src/cljs/asciinema_player/core.cljs
+++ src/cljs/asciinema_player/core.cljs
@@ -14,7 +14,7 @@
    :duration 148.297910690308
    :frames-url "/frames.json"
    :font-size "small"
-   :theme "solarized-dark"
+   :theme "seti"
    :lines snapshot }))

 (defn apply-changes [state changes]


change phone number

change phone number

--- src/cljs/good/production/state.cljs
+++ src/cljs/good/production/state.cljs
@@ -12,7 +12,7 @@

 (def soundcloud "https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/users/3262970&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true")

-(def contacts-phone "+380953705458")
+(def contacts-phone "+380-63-247-31-37")

 (def contacts-email "productiongood@gmail.com")


cleanup

cleanup

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -74,15 +74,12 @@
       (>! cards-channel cards)))

 (defn distinct-by [f coll]
-  (let [step (fn step [xs seen]
-               (lazy-seq
-                ((fn [[x :as xs] seen]
-                   (when-let [s (seq xs)]
-                     (let [fx (f x)]
-                       (if (contains? seen fx)
-                         (recur (rest s) seen)
-                         (cons x (step (rest s) (conj seen fx)))))))
-                 xs seen)))]
+  (letfn [(step [xs seen]
+            (lazy-seq (when-let [[x & more] (seq xs)]
+                        (let [k (f x)]
+                          (if (seen k)
+                            (step more seen)
+                            (cons x (step more (conj seen k))))))))]
     (step coll #{})))

 (defn side-identities [side]
@@ -169,15 +166,6 @@
                  new-deck (if (:_id deck) deck (assoc deck :_id new-id))]
              (om/update! cursor :decks (conj decks new-deck))
              (om/set-state! owner :deck new-deck)))))))
-
-(defn distinct-by [f coll]
-  (letfn [(step [xs seen]
-            (lazy-seq (when-let [[x & more] (seq xs)]
-                        (let [k (f x)]
-                          (if (seen k)
-                            (step more seen)
-                            (cons x (step more (conj seen k))))))))]
-    (step coll #{})))

 (defn match [identity query]
   (if (empty? query)


Support the command key on OSX

Support the command key on OSX

--- src/clojure/nightcode/shortcuts.clj
+++ src/clojure/nightcode/shortcuts.clj
@@ -1,8 +1,10 @@
 (ns nightcode.shortcuts
   (:require [nightcode.utils :as utils]
             [seesaw.core :as s]
-            [seesaw.keymap :as keymap])
-  (:import [java.awt Color KeyboardFocusManager KeyEventDispatcher]
+            [seesaw.keymap :as keymap]
+            [seesaw.keystroke :as keystroke])
+  (:import [java.awt Toolkit]
+           [java.awt Color KeyboardFocusManager KeyEventDispatcher]
            [java.awt.event ActionEvent KeyEvent]
            [net.java.balloontip BalloonTip]
            [net.java.balloontip.positioners CenteredPositioner]
@@ -33,7 +35,7 @@
   (doseq [[id func] pairs]
     (when-let [mapping (get mappings id)]
       (keymap/map-key panel
-                      (str "control " mapping)
+                      (str "menu " mapping)
                       (fn [e]
                         ; only run the function if the button is enabled
                         (let [button-id (keyword (str "#" (name id)))
@@ -79,18 +81,21 @@
     (KeyboardFocusManager/getCurrentKeyboardFocusManager)
     (proxy [KeyEventDispatcher] []
       (dispatchKeyEvent [e]
-        (toggle-hints target (.isControlDown e))
-        (if (and (.isControlDown e) (= (.getID e) KeyEvent/KEY_PRESSED))
-          (case (.getKeyCode e)
-            ; enter
-            10 (utils/toggle-project-tree-selection)
-            ; up
-            38 (utils/move-project-tree-selection -1)
-            ; down
-            40 (utils/move-project-tree-selection 1)
-            ; Q
-            81 (utils/shut-down)
-            false)
-          false))))
+        (let [modifier (.getMenuShortcutKeyMask (Toolkit/getDefaultToolkit))
+              current-modifier (.getModifiers e)
+              is-down? (= (bit-and modifier current-modifier) modifier)]
+          (toggle-hints target is-down?)
+          (if (and is-down? (= (.getID e) KeyEvent/KEY_PRESSED))
+            (case (.getKeyCode e)
+              ; enter
+              10 (utils/toggle-project-tree-selection)
+              ; up
+              38 (utils/move-project-tree-selection -1)
+              ; down
+              40 (utils/move-project-tree-selection 1)
+              ; Q
+              81 (utils/shut-down)
+              false)
+            false)))))
   ; return target
   target)


Add return_fromgenome instruction

Add return_fromgenome instruction

--- src/clojush/instructions/return.clj
+++ src/clojush/instructions/return.clj
@@ -19,6 +19,7 @@
 (define-registered return_fromboolean (with-meta (returner :zip) {:stack-types [:environment :zip]}))
 (define-registered return_fromstring (with-meta (returner :string) {:stack-types [:environment :string]}))
 (define-registered return_fromchar (with-meta (returner :char) {:stack-types [:environment :char]}))
+(define-registered return_fromgenome (with-meta (returner :genome) {:stack-types [:environment :genome]}))

 (define-registered
   return_exec_pop


Exception handling for jobs w/o proper results

--- src/emender_jenkins/jenkins_api.clj
+++ src/emender_jenkins/jenkins_api.clj
@@ -25,5 +25,9 @@
     [job-name jenkins-url]
     (let [url (str jenkins-url "job/" (.replaceAll job-name " " "%20") "/lastSuccessfulBuild/artifact/results.json/")]
         (println "Using the following URL to retrieve job results: " url)
-        (slurp url)))
+        (try
+            (slurp url)
+            (catch Exception e
+                 (.printStackTrace e)
+                 nil))))


remove any nil entries from fileuploader

--- src/ez_form/field/fileuploader.cljs
+++ src/ez_form/field/fileuploader.cljs
@@ -115,5 +115,7 @@
                        :value (or @c "")
                        :on-change (file-select-handler c true)} opts)]
        (if one-file?
-          (map #(show-file field form-options c %) [@c])
-          (map #(show-file field form-options c %) @c))])))
+         (map #(show-file field form-options c %) (->> [@c]
+                                                       (remove nil?)))
+         (map #(show-file field form-options c %) (->> @c
+                                                       (remove nil?))))])))


(Fixup) Remove unsed function stop-job

(Fixup) Remove unsed function stop-job

--- src/clj/puppetlabs/services/master/master_service.clj
+++ src/clj/puppetlabs/services/master/master_service.clj
@@ -17,7 +17,7 @@
    [:CaService initialize-master-ssl! retrieve-ca-cert! retrieve-ca-crl! get-auth-handler]
    [:JRubyPuppetService]
    [:AuthorizationService wrap-with-authorization-check]
-   [:SchedulerService interspaced stop-job]
+   [:SchedulerService interspaced]
    [:VersionedCodeService get-code-content]]
   (init
    [this context]


Add more forecast data

Add more forecast data

--- src/clj_simple_chart/ncs/oilforecast/forecastdata.clj
+++ src/clj_simple_chart/ncs/oilforecast/forecastdata.clj
@@ -1,86 +1,100 @@
 (ns clj-simple-chart.ncs.oilforecast.forecastdata)

-(def data {
-           "2005"
-           ; Sokkelåret 2005 http://www.npd.no/no/Nyheter/Nyheter/2006/Sokkelaret-2005-/Sokkelaret-2005---petroleumsproduksjon-/
-           {:prfPrdOilNetMillSm3 [140.8 152.7 152.6 145.8 143.6]}
+(def data
+  {
+   "2005"
+   ; Sokkelåret 2005 http://www.npd.no/no/Nyheter/Nyheter/2006/Sokkelaret-2005-/Sokkelaret-2005---petroleumsproduksjon-/
+   {:prfPrdOilNetMillSm3        [140.8 152.7 152.6 145.8 143.6]
+    :prfPrdCondensateNetMillSm3 [5.6 3.4 5.1 5.1 5.6]
+    :prfPrdNGLNetMillSm3        [8.7 9.4 10.4 10.1 9.8]}

-           "2006"
-           ; Sokkelåret 2006 http://www.npd.no/no/Nyheter/Nyheter/2007/Sokkelaret-2006/Sokkelaret-2006---petroleumsproduksjon-/
-           {:prfPrdOilNetMillSm3 [129.4 130.0 126.5 120.6 119.0]}
+   "2006"
+   ; Sokkelåret 2006 http://www.npd.no/no/Nyheter/Nyheter/2007/Sokkelaret-2006/Sokkelaret-2006---petroleumsproduksjon-/
+   {:prfPrdOilNetMillSm3        [129.4 130.0 126.5 120.6 119.0]
+    :prfPrdCondensateNetMillSm3 [3.4 4.4 4.7 5.3 5.7]
+    :prfPrdNGLNetMillSm3        [17.3 18.6 17.8 16.1 15.7]
+    :prfPrdGasNetBillSm3        [93.0 108.8 115.3 117.8 117.7]}

-           "2007"
-           ; Sokkelåret 2007 http://www.npd.no/no/Nyheter/Nyheter/2008/Sokkelaret-2007/Sokkelaret-2007---Petroleumsproduksjon-/
-           {:prfPrdOilNetMillSm3 [117.9 115.3 114.3 112.9 110.3]}
+   "2007"
+   ; Sokkelåret 2007 http://www.npd.no/no/Nyheter/Nyheter/2008/Sokkelaret-2007/Sokkelaret-2007---Petroleumsproduksjon-/
+   {:prfPrdOilNetMillSm3        [117.9 115.3 114.3 112.9 110.3]
+    :prfPrdCondensateNetMillSm3 [4.0 4.9 5.1 6.2 6.6]
+    :prfPrdNGLNetMillSm3        [18.8 19.6 17.8 18.8 19.1]
+    :prfPrdGasNetBillSm3        [99.4 108.8 110.4 115.9 115.3]}

-           "2008"
-           ; Sokkelåret 2008 http://www.npd.no/no/Nyheter/Nyheter/2009/Sokkelaret-2008/Sokkelaret-2008---Petroleumsproduksjon/
-           {:prfPrdOilNetMillSm3 [110.8 104.4 98.5 95.0 94.4]}
+   "2008"
+   ; Sokkelåret 2008 http://www.npd.no/no/Nyheter/Nyheter/2009/Sokkelaret-2008/Sokkelaret-2008---Petroleumsproduksjon/
+   {:prfPrdOilNetMillSm3        [110.8 104.4 98.5 95.0 94.4]
+    :prfPrdCondensateNetMillSm3 [4.4 4.6 5.3 5.3 5.5]
+    :prfPrdNGLNetMillSm3        [17.5 17.3 17.4 17.5 16.7]
+    :prfPrdGasNetBillSm3        [102.9 106.7 112.0 111.6 111.9]}

-           "2009"
-           ; Sokkelåret 2009 http://www.npd.no/no/Nyheter/Nyheter/2010/Sokkelaret-2009/Sokkelaret-2009---Petroleumsproduksjon/
-           {:prfPrdOilNetMillSm3 [108.7 100.1 97.6 93.0 91.6]}
-           ;:prfPrdGasNetBillSm3 [105.0 109.0 112.0 112.0 112.2]
+   "2009"
+   ; Sokkelåret 2009 http://www.npd.no/no/Nyheter/Nyheter/2010/Sokkelaret-2009/Sokkelaret-2009---Petroleumsproduksjon/
+   {:prfPrdOilNetMillSm3        [108.7 100.1 97.6 93.0 91.6]
+    :prfPrdCondensateNetMillSm3 [4.2 4.0 3.8 3.3 3.5]
+    :prfPrdNGLNetMillSm3        [16.9 17.1 17.0 16.3 16.1]
+    :prfPrdGasNetBillSm3        [105.0 109.0 112.0 112.0 112.2]}

-           "2010"
-           ; Sokkelåret 2010 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkel%C3%A5ret-2010/Tabell.pdf
-           {:prfPrdOilNetMillSm3        [98.3 94.0 91.9 89.8 88.9]
-            :prfPrdCondensateNetMillSm3 [4.4 4.2 4.0 3.4 3.2]
-            :prfPrdNGLNetMillSm3        [16.8 16.9 16.2 16.9 16.8]
-            :prfPrdGasNetBillSm3        [109.1 111.0 111.6 111.6 112.2]}
+   "2010"
+   ; Sokkelåret 2010 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkel%C3%A5ret-2010/Tabell.pdf
+   {:prfPrdOilNetMillSm3        [98.3 94.0 91.9 89.8 88.9]
+    :prfPrdCondensateNetMillSm3 [4.4 4.2 4.0 3.4 3.2]
+    :prfPrdNGLNetMillSm3        [16.8 16.9 16.2 16.9 16.8]
+    :prfPrdGasNetBillSm3        [109.1 111.0 111.6 111.6 112.2]}

-           "2011"
-           ; Sokkelåret 2011 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaret2011/Produksjon-tabell.pdf
-           {:prfPrdOilNetMillSm3        [93.8 92.7 90.8 90.6 90.2]
-            :prfPrdCondensateNetMillSm3 [4.3 3.4 2.9 2.7 2.4]
-            :prfPrdNGLNetMillSm3        [17.5 17.6 18.3 18.7 18.1]
-            :prfPrdGasNetBillSm3        [106.7 109.5 111.8 112.0 112.1]}
+   "2011"
+   ; Sokkelåret 2011 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaret2011/Produksjon-tabell.pdf
+   {:prfPrdOilNetMillSm3        [93.8 92.7 90.8 90.6 90.2]
+    :prfPrdCondensateNetMillSm3 [4.3 3.4 2.9 2.7 2.4]
+    :prfPrdNGLNetMillSm3        [17.5 17.6 18.3 18.7 18.1]
+    :prfPrdGasNetBillSm3        [106.7 109.5 111.8 112.0 112.1]}

-           "2012"
-           ; Sokkelåret 2012 http://www.npd.no/Nyheter/Nyheter/2013/Sokkelaret-2012---pressemeldinger/Petroleumsproduksjon/
-           {:prfPrdOilNetMillSm3        [85.5 88.3 90.7 90.1 91.0]
-            :prfPrdCondensateNetMillSm3 [3.7 3.2 2.9 2.6 2.8]
-            :prfPrdNGLNetMillSm3        [16.8 19.2 20.6 21.5 20.1]
-            :prfPrdGasNetBillSm3        [106.5 109.5 110.5 110.6 111.2]}
+   "2012"
+   ; Sokkelåret 2012 http://www.npd.no/Nyheter/Nyheter/2013/Sokkelaret-2012---pressemeldinger/Petroleumsproduksjon/
+   {:prfPrdOilNetMillSm3        [85.5 88.3 90.7 90.1 91.0]
+    :prfPrdCondensateNetMillSm3 [3.7 3.2 2.9 2.6 2.8]
+    :prfPrdNGLNetMillSm3        [16.8 19.2 20.6 21.5 20.1]
+    :prfPrdGasNetBillSm3        [106.5 109.5 110.5 110.6 111.2]}

-           "2013"
-           ; Sokkelåret 2013 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaret-2013/Datagrunnlag_til_nettpubl_alle.xlsx
-           {:prfPrdOilNetMillSm3        [85.50 86.50 86.70 86.98 85.94]
-            :prfPrdCondensateNetMillSm3 [3.17 2.85 2.62 2.91 3.53]
-            :prfPrdNGLNetMillSm3        [18.89 19.43 19.94 19.38 19.62]
-            :prfPrdGasNetBillSm3        [107.01 106.29 107.69 113.33 115.79]}
+   "2013"
+   ; Sokkelåret 2013 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaret-2013/Datagrunnlag_til_nettpubl_alle.xlsx
+   {:prfPrdOilNetMillSm3        [85.50 86.50 86.70 86.98 85.94]
+    :prfPrdCondensateNetMillSm3 [3.17 2.85 2.62 2.91 3.53]
+    :prfPrdNGLNetMillSm3        [18.89 19.43 19.94 19.38 19.62]
+    :prfPrdGasNetBillSm3        [107.01 106.29 107.69 113.33 115.79]}

-           "2014"
-           ; Sokkelåret 2014 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaaret-2014/Datagrunnlag-til-publisering.xlsx
-           {:prfPrdOilNetMillSm3        [86.31 86.62 85.68 82.41 80.68]
-            :prfPrdCondensateNetMillSm3 [2.10 2.09 2.44 2.76 3.00]
-            :prfPrdNGLNetMillSm3        [19.55 19.55 19.08 19.04 18.29]
-            :prfPrdGasNetBillSm3        [107.59 107.08 109.96 112.91 112.89]}
+   "2014"
+   ; Sokkelåret 2014 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaaret-2014/Datagrunnlag-til-publisering.xlsx
+   {:prfPrdOilNetMillSm3        [86.31 86.62 85.68 82.41 80.68]
+    :prfPrdCondensateNetMillSm3 [2.10 2.09 2.44 2.76 3.00]
+    :prfPrdNGLNetMillSm3        [19.55 19.55 19.08 19.04 18.29]
+    :prfPrdGasNetBillSm3        [107.59 107.08 109.96 112.91 112.89]}

-           "2015"
-           ; Sokkelåret 2015 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaret-2015/Sokkelaaret-figur-grunnlag.xlsx
-           {:prfPrdOilNetMillSm3        [89.04 87.25 81.96 80.21 81.67]
-            :prfPrdCondensateNetMillSm3 [2.01 1.83 2.37 2.61 2.30]
-            :prfPrdNGLNetMillSm3        [19.43 18.79 18.44 17.92 17.09]
-            :prfPrdGasNetBillSm3        [106.57 107.25 109.71 110.96 111.05]}
+   "2015"
+   ; Sokkelåret 2015 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaret-2015/Sokkelaaret-figur-grunnlag.xlsx
+   {:prfPrdOilNetMillSm3        [89.04 87.25 81.96 80.21 81.67]
+    :prfPrdCondensateNetMillSm3 [2.01 1.83 2.37 2.61 2.30]
+    :prfPrdNGLNetMillSm3        [19.43 18.79 18.44 17.92 17.09]
+    :prfPrdGasNetBillSm3        [106.57 107.25 109.71 110.96 111.05]}

-           "2016"
-           ; Sokkelåret 2016 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaret-2016/Figurgrunnlag-Sokkelaret-2016.xlsx
-           {:prfPrdOilNetMillSm3        [93.88 88.05 83.30 91.27 98.90]
-            :prfPrdCondensateNetMillSm3 [1.83 2.37 2.61 2.30 2.22]
-            :prfPrdNGLNetMillSm3        [19.37 18.42 18.56 18.13 17.32]
-            :prfPrdLiquidsNetMillMboed  [1.98 1.88 1.80 1.92 2.04]
-            :prfPrdLiquidsNetMillSm3    [115.08 108.84 104.47 111.70 118.44]
-            :prfPrdGasNetBillSm3        [114.47 114.54 114.46 114.34 113.76]}
+   "2016"
+   ; Sokkelåret 2016 http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaret-2016/Figurgrunnlag-Sokkelaret-2016.xlsx
+   {:prfPrdOilNetMillSm3        [93.88 88.05 83.30 91.27 98.90]
+    :prfPrdCondensateNetMillSm3 [1.83 2.37 2.61 2.30 2.22]
+    :prfPrdNGLNetMillSm3        [19.37 18.42 18.56 18.13 17.32]
+    :prfPrdLiquidsNetMillMboed  [1.98 1.88 1.80 1.92 2.04]
+    :prfPrdLiquidsNetMillSm3    [115.08 108.84 104.47 111.70 118.44]
+    :prfPrdGasNetBillSm3        [114.47 114.54 114.46 114.34 113.76]}

-           "2017"
-           ; http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaret-2017/Figurgrunnlag-til-publisering-Sokkelaret2017.xlsx
-           {:prfPrdOilNetMillSm3        [90.15 87.23 100.69 109.50 111.32]
-            :prfPrdCondensateNetMillSm3 [1.78 1.69 1.50 1.50 1.40]
-            :prfPrdNGLNetMillSm3        [19.84 19.28 18.70 20.10 20.69]
-            :prfPrdLiquidsNetMillMboed  [1.93 1.86 2.08 2.26 2.30]
-            :prfPrdLiquidsNetMillSm3    [111.77 108.20 120.89 131.10 133.41]
-            :prfPrdGasNetBillSm3        [121.17 121.27 121.76 122.59 122.68]}})
+   "2017"
+   ; http://www.npd.no/Global/Norsk/1-Aktuelt/Nyheter/Sokkelaret-2017/Figurgrunnlag-til-publisering-Sokkelaret2017.xlsx
+   {:prfPrdOilNetMillSm3        [90.15 87.23 100.69 109.50 111.32]
+    :prfPrdCondensateNetMillSm3 [1.78 1.69 1.50 1.50 1.40]
+    :prfPrdNGLNetMillSm3        [19.84 19.28 18.70 20.10 20.69]
+    :prfPrdLiquidsNetMillMboed  [1.93 1.86 2.08 2.26 2.30]
+    :prfPrdLiquidsNetMillSm3    [111.77 108.20 120.89 131.10 133.41]
+    :prfPrdGasNetBillSm3        [121.17 121.27 121.76 122.59 122.68]}})

 (defn process-prediction-year [[yr values]]


Extract complexity* so that we can get out of the macro world more quickly.

--- src/kolmogorov_music/kolmogorov.clj
+++ src/kolmogorov_music/kolmogorov.clj
@@ -24,7 +24,10 @@
        (map #(complexity-sym % ns))
        (reduce + (count sexpr)))))

-(defmacro complexity [expr]
+(defn complexity* [expr]
   (if (seq? expr)
     (complexity-sexpr *ns* expr)
     (complexity-sym expr *ns*)))
+
+(defmacro complexity [expr]
+  (complexity* expr))


Don't read from cursor outside render

Don't read from cursor outside render

--- src/omchaya/components/sidebar.cljs
+++ src/omchaya/components/sidebar.cljs
@@ -45,6 +45,7 @@

 (defn playlist-entry [comm opts entry]
   (let [src (:src entry)
+        order (:order entry)
         name (-> (:src entry)
                  (string/split #"/")
                  last
@@ -52,14 +53,14 @@
                  first
                  gstring/urlDecode)]
     [:li.user
-     (merge {:title (:src entry)
+     (merge {:title src
              :key (str (:order entry) src)}
             (when (= (:order entry) (get-in opts [:channels (:selected-channel opts) :player :playing-order]))
               {:style #js {:background-color "#ccc"}}))
      [:a
       {:style #js {:cursor "pointer"}
        :on-click (comp (constantly false)
-                       #(put! comm [:playlist-entry-played [(:order entry) (:selected-channel opts)]]))}
+                       #(put! comm [:playlist-entry-played [order (:selected-channel opts)]]))}
       (:order entry) ". " name]]))

 (defn playlist-widget [player-data owner opts]


Fixes double ::

Fixes double ::

--- src/onyx/sql/information_model.cljc
+++ src/onyx/sql/information_model.cljc
@@ -41,7 +41,7 @@
               :optional? true
               :default 1000
               :doc "The number of messages to buffer via core.async, default is `1000`."}}}
-    ::onyx.plugin.sql/read-rows
+    :onyx.plugin.sql/read-rows
     {:summary "Reads a partition of a rows from a SQL table."
      :model {:sql/classname
              {:type :string


add instructions

add instructions

--- src/overtone_workshop/session-2.clj
+++ src/overtone_workshop/session-2.clj
@@ -2,6 +2,10 @@
   (require [overtone.live :refer :all]))

 ;; Session 2 : Making our own instruments
+
+;; load the shit
+;; lein repl
+;; (use 'overtone.live)

 ;; first, two essential functions
 ;; (odoc)