Update to Clojure 1.7.0

Update to Clojure 1.7.0

--- project.clj
+++ project.clj
@@ -7,7 +7,7 @@
   :url "http://github.com/containium/containium"
   :license {:name "Mozilla Public License 2.0"
             :url "http://mozilla.org/MPL/2.0/"}
-  :dependencies [[boxure/clojure "1.6.0"]
+  :dependencies [[boxure/clojure "1.7.0"]
                  [boxure "0.1.0-SNAPSHOT"]
                  [jline "2.12.1"]
                  [ring/ring-core "1.3.2"]


Use clojurescript 2342

Use clojurescript 2342

Later versions won't work with Light Table yet

--- project.clj
+++ project.clj
@@ -4,7 +4,7 @@
   :license {:name "MIT"}
   :description "A simple ClojureScript interface to React"
   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-2356"]]
+                 [org.clojure/clojurescript "0.0-2342"]]
   :plugins [[lein-cljsbuild "1.0.3"]
             [com.cemerick/clojurescript.test "0.3.1"]]
   :profiles {:dev {:source-paths ["src" "demo"]}


added piggieback for clojurescript support in vim

--- project.clj
+++ project.clj
@@ -7,10 +7,13 @@
   :dependencies [[org.clojure/clojure "1.5.1"]
                  [org.clojure/clojurescript "6969"]
                  [prismatic/dommy "0.1.1"]
-                 [com.cemerick/clojurescript.test "0.2.1"]]
+                 [com.cemerick/clojurescript.test "0.2.1"]
+                 [com.cemerick/piggieback "0.1.2"]]
   :plugins [[lein-cljsbuild "1.0.1"]
             [com.cemerick/clojurescript.test "0.2.1"]]
+  :externs ["externs/react.js"]
   :hooks  [leiningen.cljsbuild]
+  :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
   :cljsbuild {:builds {:dev {:source-paths ["src"]
                              :compiler {:output-to "resources/js/main.js"
                                         :optimizations :whitespace


Deps: 2.5.0-RC2

Deps: 2.5.0-RC2

--- project.clj
+++ project.clj
@@ -8,7 +8,7 @@
                  ;; TODO ; 1.5.x seems to cause problems with (at least)
                  ;; `create-table`: needs investigation
                  [com.amazonaws/aws-java-sdk "1.4.4.2"]
-                 [com.taoensso/nippy         "2.5.0-RC1"]]
+                 [com.taoensso/nippy         "2.5.0-RC2"]]
   :profiles {:1.5   {:dependencies [[org.clojure/clojure "1.5.1"]]}
              :1.6   {:dependencies [[org.clojure/clojure "1.6.0-master-SNAPSHOT"]]}
              :dev   {:dependencies []}


pass proto-path into extract-dependencies

--- src/leiningen/protobuf.clj
+++ src/leiningen/protobuf.clj
@@ -36,20 +36,20 @@

 (defn extract-dependencies
   "extract all files proto is dependent on"
-  [proto-file target]
-  (loop [files (vec (proto-dependencies proto-file))]
-    (when-not (empty? files)
-      (let [proto (peek files)
-            files (pop files)]
-        ;; TODO Somehow check for :proto-path too?
-        (if (or (.exists (io/file "proto" proto))
-                (.exists (io/file target "proto" proto)))
-          (recur files)
-          (let [location (str "proto/" proto)
-                proto-file (io/file target location)]
-            (.mkdirs (.getParentFile proto-file))
-            (io/copy (io/reader (io/resource location)) proto-file)
-            (recur (into files (proto-dependencies proto-file)))))))))
+  [proto-path proto-file target]
+  (let [proto-file (io/file proto-path proto-file)]
+    (loop [files (vec (proto-dependencies proto-file))]
+      (when-not (empty? files)
+        (let [proto (peek files)
+              files (pop files)]
+          (if (or (.exists (io/file proto-path proto))
+                  (.exists (io/file target "proto" proto)))
+            (recur files)
+            (let [location (str "proto/" proto)
+                  proto-file (io/file target location)]
+              (.mkdirs (.getParentFile proto-file))
+              (io/copy (io/reader (io/resource location)) proto-file)
+              (recur (into files (proto-dependencies proto-file))))))))))

 (defn modtime [dir]
   (let [files (-> dir io/file file-seq rest)]
@@ -135,7 +135,7 @@
          (.mkdirs dest)
          (.mkdirs proto-path)
          (doseq [proto protos]
-           (extract-dependencies (io/file proto-path proto) target)
+           (extract-dependencies proto-path proto target)
            (let [args ["protoc" proto (str "--java_out=" dest-path) "-I."
                        (str "-I" proto-path)]]
              (println " > " (join " " args))


up version

up version

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject fileape "0.7.4-SNAPSHOT"
+(defproject fileape "0.7.4"
   :description "Write data to files split by topic and rolled over on size or a timeout, files can be compressed using lzo, snappy or gzip"
   :url "https://github.com/gerritjvv/fileape"
   :license {:name "Eclipse Public License"


updated to handle empty :path-info

updated to handle empty :path-info

Added a check to ensure that the resulting path for the `:path-info` key is not empty. The only time this should occur is when the uri is the same as the context path for the servlet.

--- src/leiningen/ring/war.clj
+++ src/leiningen/ring/war.clj
@@ -9,8 +9,8 @@
   (:import [java.util.jar Manifest
                           JarEntry
                           JarOutputStream]
-           [java.io BufferedOutputStream
-                    FileOutputStream
+           [java.io BufferedOutputStream
+                    FileOutputStream
                     ByteArrayInputStream]))

 (defn default-war-name [project]
@@ -143,7 +143,7 @@
          (~handler-sym
           (assoc request#
             :context context#
-            :path-info (subs (:uri request#) (.length context#))))))
+            :path-info (-> (:uri request#) (subs (.length context#)) not-empty (or "/"))))))
     handler-sym))

 (defn compile-servlet [project]
@@ -226,7 +226,7 @@
                            (lju/try-resolve 'leiningen.core.project/unmerge-profiles))]
     (unmerge-fn project [:default])
     project))
-
+
 (defn add-servlet-dep [project]
   (-> project
       (deps/add-if-missing '[ring/ring-servlet "1.2.1"])


Advance version number to 0.1.12-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject io.aviso/rook "0.1.11"
+(defproject io.aviso/rook "0.1.12-SNAPSHOT"
   :description "Sane, smart, fast, Clojure web services"
   :url "http://howardlewisship.com/io.aviso/documentation/rook"
   :license {:name "Apache Sofware License 2.0"


version 1.0.0-SNAPSHOT

version 1.0.0-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject org.zalando.stups/friboo "1.0.0-RC3"
+(defproject org.zalando.stups/friboo "1.0.0-SNAPSHOT"
   :description "A utility library to write microservices in clojure."
   :url "https://github.com/zalando-stups/friboo"


CLJS 0.0-2411

CLJS 0.0-2411

--- project.clj
+++ project.clj
@@ -1,7 +1,7 @@
 (defproject mkremins/flense-nw "0.0-SNAPSHOT"
   :dependencies
   [[org.clojure/clojure "1.6.0"]
-   [org.clojure/clojurescript "0.0-2341"]
+   [org.clojure/clojurescript "0.0-2411"]
    [org.clojure/core.async "0.1.346.0-17112a-alpha"]
    [com.facebook/react "0.11.2"]
    [om "0.7.3"]


update server deps

update server deps


Update library versions.

Update library versions.

--- project.clj
+++ project.clj
@@ -7,8 +7,8 @@
   :dependencies
   [[byte-streams "0.1.13"]
    [clj-time "0.8.0"]
-   [environ "0.5.0"]
-   [potemkin "0.3.8"]
+   [environ "1.0.0"]
+   [potemkin "0.3.9"]
    [mvxcvi/clj-pgp "0.5.3"]
    [mvxcvi/puget "0.6.3"]
    [org.clojure/clojure "1.6.0"]
@@ -27,7 +27,7 @@
    :tool
    {:dependencies
     [[mvxcvi/directive "0.4.2"]
-     [org.clojure/tools.namespace "0.2.4"]]
+     [org.clojure/tools.namespace "0.2.7"]]
     :jvm-opts []
     :repl-options {:init-ns vault.system}
     :source-paths ["tool"]}


Update version for 7.8.1-SNAPSHOT development

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(def pdb-version "7.8.0")
+(def pdb-version "7.8.1-SNAPSHOT")

 (def clj-parent-version "4.8.4")


Upgraded dependencies

Upgraded dependencies

--- project.clj
+++ project.clj
@@ -1,6 +1,6 @@
 (defproject vorrichtung "0.8.1"
-  :dependencies [[org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "1.7.170"]
+  :dependencies [[org.clojure/clojure "1.8.0"]
+                 [org.clojure/clojurescript "1.7.228"]
                  [com.cognitect/transit-cljs "0.8.237"]
                  [reagent "0.5.1"]
                  [re-frame "0.6.0"]]
@@ -9,8 +9,8 @@

   :source-paths ["src"]

-  :plugins [[lein-cljsbuild "1.1.1"]
-            [lein-figwheel "0.5.0-2"]
+  :plugins [[lein-cljsbuild "1.1.2"]
+            [lein-figwheel "0.5.0-6"]
             [lein-doo "0.1.6"]
             [lein-ancient "0.6.8"]]


v0.0.5

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject fqcss "0.0.4"
+(defproject fqcss "0.0.5"
   :description "FQCSS: namespaced CSS classes"

   :url "https://github.com/JoelSanchez/fqcss"


Bump to released jclouds-1.2

Bump to released jclouds-1.2

--- project.clj
+++ project.clj
@@ -24,13 +24,13 @@

                  [org.cloudhoist/pallet "0.6.5-SNAPSHOT"]

-                 [org.jclouds/jclouds-core "1.2.0-SNAPSHOT"]
-                 [org.jclouds/jclouds-compute "1.2.0-SNAPSHOT"]
-                 [org.jclouds/jclouds-blobstore "1.2.0-SNAPSHOT"]
-                 [org.jclouds/jclouds-loadbalancer "1.2.0-SNAPSHOT"]
-                 [org.jclouds.driver/jclouds-log4j "1.2.0-SNAPSHOT"]
-                 [org.jclouds.driver/jclouds-jsch "1.2.0-SNAPSHOT"]
-                 [org.jclouds.provider/aws-ec2 "1.2.0-SNAPSHOT"]
+                 [org.jclouds/jclouds-core "1.2.0"]
+                 [org.jclouds/jclouds-compute "1.2.0"]
+                 [org.jclouds/jclouds-blobstore "1.2.0"]
+                 [org.jclouds/jclouds-loadbalancer "1.2.0"]
+                 [org.jclouds.driver/jclouds-log4j "1.2.0"]
+                 [org.jclouds.driver/jclouds-jsch "1.2.0"]
+                 [org.jclouds.provider/aws-ec2 "1.2.0"]

                  ;; Pallet Crates
                  [org.cloudhoist/automated-admin-user "0.6.0"]


Cut a release for callbacks

Cut a release for callbacks

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject net.uncontended/beehive "0.5.2-SNAPSHOT"
+(defproject net.uncontended/beehive "0.5.2"
   :description "Beehive is a Clojure facade for the Precipice library."
   :url "https://github.com/tbrooks8/Beehive"
   :license {:name "Apache License, Version 2.0"


Require clojure 1.7.0.

Require clojure 1.7.0.

--- project.clj
+++ project.clj
@@ -2,7 +2,7 @@
   :description "An IPython kernel for executing Clojure code"
   :url "http://github.com/roryk/ipython-clojure"
   :license {:name "MIT"}
-  :dependencies [[org.clojure/clojure "1.5.1"]
+  :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.zeromq/jeromq "0.3.3"]
                  [cheshire "5.3.1"]
                  [clj-time "0.7.0"]


Fix a typo causing to missing styles on the active navigation tab

--- src/web/app.cljs
+++ src/web/app.cljs
@@ -55,7 +55,7 @@

   (render [this]
     (dom/div #js {:className "app"}
-      (let [header-props [:custard/state :custard/states :View]]
+      (let [header-props [:custard/state :custard/states :view]]
         (header
           (om/computed (select-keys (om/props this) header-props)
                        {:select-state-fn #(.select-state this %)


debugger UI: label is now clickable

debugger UI: label is now clickable

--- src/frontend/devtools.cljs
+++ src/frontend/devtools.cljs
@@ -213,11 +213,11 @@
                    :border-bottom-width 1
                    :border-bottom-style "solid"
                    :border-color        "#4F5A65"}}
-     [:input.toggle {:title     "Persist debug session into local storage?"
-                     :type      "checkbox"
-                     :checked   @persist?
-                     :on-change #(dispatch ::on-toggle-persist)}
-      "Persist session"]
+     [:input#persist-toggle.toggle {:title     "Persist debug session into local storage?"
+                                    :type      "checkbox"
+                                    :checked   @persist?
+                                    :on-change #(dispatch ::on-toggle-persist)}]
+     [:label {:for "persist-toggle"} "Persist session"]
      [-menu-button "Sweep" #(dispatch ::on-sweep) "Removes disabled actions and \"orphaned\" signals from history"]
      [-menu-button "Reset" #(dispatch ::on-reset) "Removes all actions and signals resetting the model to initial state"]]


don't send chat message if no text

don't send chat message if no text

--- src/frontend/renderer.cljs
+++ src/frontend/renderer.cljs
@@ -151,10 +151,12 @@
                                                 (when (and (= 13 (.-keyCode event))
                                                            (not (.-shiftKey event)))
                                                   (.preventDefault event)
-                                                  (.emit g/socket
-                                                         "chat-message"
-                                                         (dommy/value (sel1 :#chat-input)))
-                                                  (dommy/set-value! (sel1 :#chat-input) ""))))
+                                                  (let [message (dommy/value (sel1 :#chat-input))]
+                                                    (when-not (empty? message)
+                                                      (.emit g/socket
+                                                             "chat-message"
+                                                             message)
+                                                      (dommy/set-value! (sel1 :#chat-input) "")))))
       (dommy/listen! (sel1 :#chat-input) :keydown (om/get-state owner :enter-key-handler)))
     om/IWillUnmount
     (will-unmount [_]


updated common with a comment on why *.py and *.rb files are not working

--- storm-multicore/src/clj/backtype/storm/daemon/common.clj
+++ storm-multicore/src/clj/backtype/storm/daemon/common.clj
@@ -222,6 +222,13 @@
 ;;; this avoid situation where node goes down and task doesn't know what to do information-wise
 ;(defrecord Assignment [master-code-dir node->host executor->node+port executor->start-time-secs])

+(def SYSTEM-STREAM-ID "__system")
+
+
+(defn has-ackers? [storm-conf]
+  (or (nil? (storm-conf TOPOLOGY-ACKER-EXECUTORS)) (> (storm-conf TOPOLOGY-ACKER-EXECUTORS) 0)))
+
+
 (defrecord Assignment [executor->worker-uuid executor->start-time-secs])

@@ -249,6 +256,8 @@
     (:component->sorted-tasks worker)
     (:component->stream->fields worker)
     (:storm-id worker)
+    ;; TODO: this is where *.py and *.rb files are looked for
+    ;; should be multilang, is distributed stuff right now
     (supervisor-storm-resources-path
       (supervisor-stormdist-root (:conf worker) (:storm-id worker)))
     (worker-pids-root (:conf worker) (:worker-id worker))


Add initialize indexes on app start

Add initialize indexes on app start

--- src/clj/clojuredocs/main.clj
+++ src/clj/clojuredocs/main.clj
@@ -40,6 +40,10 @@
   (mon/set-connection! (mon/make-connection mongo-url))
   (mon/add-index! :examples [:ns :name :library-url])
   (mon/add-index! :vars [:ns :name :library-url])
+  (mon/add-index! :namespaces [:name])
+  (mon/add-index! :see-alsos [:name :ns :library-url])
+  (mon/add-index! :libraries [:namespaces])
+  (mon/add-index! :var-comments [:var.ns :var.name :var.library-url])
   (let [stop-server (start-http-server entry
                       {:port port :join? false})]
     (println (format "Server running on port %d" port))


Remove unused static assets

Remove unused static assets

--- src/clj/geoforms/handler.clj
+++ src/clj/geoforms/handler.clj
@@ -17,8 +17,7 @@
              :content "width=device-width, initial-scale=1"}]
      (include-css "//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css")
      (include-css "//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css")
-     (include-css (if (env :dev) "css/site.css" "css/site.min.css"))
-     (include-css "https://www.votepour.ca/assets/stylesheets/geoforms.css")]
+     (include-css (if (env :dev) "css/site.css" "css/site.min.css"))]
     [:body {:style "height: 100%"}
      [:div#app
       [:p "Votepour.ca / Geoforms"]
@@ -30,8 +29,7 @@
         [:p "Problèmes de chargement ? SVP contactez info@votepour.ca / Not loading? Please contact info@votepour.ca"])]
      (include-js "https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.1.10/es5-shim.min.js")
      (include-js "https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.1.10/es5-sham.min.js")
-     (include-js "js/app.js")
-     (include-js "https://www.votepour.ca/assets/javascripts/geoforms.js")]]))
+     (include-js "js/app.js")]]))

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


add user endorsements to badge

add user endorsements to badge

--- src/clj/salava/badge/pdf.clj
+++ src/clj/salava/badge/pdf.clj
@@ -10,7 +10,8 @@
             [clojure.string :refer [ends-with? blank?]]
             [salava.user.db :as ud]
             [ring.util.io :as io]
-            [clojure.tools.logging :as log]))
+            [clojure.tools.logging :as log]
+            [salava.badge.endorsement :refer [user-badge-endorsements]]))

 (defqueries "sql/badge/main.sql")

@@ -33,7 +34,9 @@
         badges (map #(-> %1
                          (dissoc :content)
                          (assoc :qr_code (str->qr-base64 (badge-url ctx (:id %1)))
-                           :endorsements (vec (select-badge-endorsements {:id (:badge_id %1)} (u/get-db ctx)))
+                           :endorsements (->> [(vec (select-badge-endorsements {:id (:badge_id %1)} (u/get-db ctx)))
+                                               (user-badge-endorsements ctx (:id %1))]
+                                              flatten) #_(->> (vec (select-badge-endorsements {:id (:badge_id %1)} (u/get-db ctx))))
                            :evidences (remove (fn [e] (= true (get-in e [:properties :hidden]))) (badge-evidences ctx (:id %1) user-id))
                            :content %2)) badge-with-content temp)]
     (replace-nils badges)))
@@ -145,16 +148,16 @@
                                                                                [:spacer 2]])
                                                                             ) [:list {:numbered true :indent 0}] $evidences)])

-                                                               (when-not (empty? $endorsements)
+                                                               (when (seq $endorsements)
                                                                  [:paragraph.generic
                                                                   [:spacer 0]
                                                                   [:phrase {:size 12 :style :bold} (t :badge/BadgeEndorsedBy ul)]
                                                                   [:spacer 0]
                                                                   (into [:paragraph {:indent 0} ] (for [e $endorsements]
                                                                                [:paragraph
-                                                                                (:issuer_name e) "\n"
+                                                                                (if (or (= "-" (:issuer_name e)) (blank? (:issuer_name e))) (str (:first_name e) " " (:last_name e))(:issuer_name e)) "\n"
                                                                                [:anchor {:target (:issuer_url e) :style{:family :times-roman :color [66 100 162]}} (or (:issuer_url e) "-")] "\n"
-                                                                                [:chunk (if (number? (:issued_on e)) (date-from-unix-time (long (* 1000 (:issued_on e)))) (:issued_on e))] "\n"
+                                                                                [:chunk (if (number? (or (:issued_on e) (:mtime e))) (date-from-unix-time (long (* 1000 (or (:issued_on e) (:mtime e))))) (or (:issued_on e) (:mtime e)))] "\n"
                                                                                (process-markdown (:content e) $id "Endorsements")]))])

                                                                [:line {:dotted true}]


Inject base url from environment variable SWARMPIT_BASE_URL

fixed #326

--- src/clj/swarmpit/handler.clj
+++ src/clj/swarmpit/handler.clj
@@ -1,11 +1,17 @@
 (ns swarmpit.handler
   (:require [clojure.walk :refer [keywordize-keys]]
             [clojure.java.io :as io]
+            [environ.core :refer [env]]
+            [net.cgrand.enlive-html :as html :refer [deftemplate]]
             [swarmpit.version :as version]
             [swarmpit.api :as api]
             [swarmpit.slt :as slt]
             [swarmpit.token :as token]))

+(deftemplate index "public/index.html"
+  [{:keys [base-url]}]
+  [:base] (html/set-attr :href base-url))
+
 (defn resp-error
   [status response]
   {:status status
@@ -41,7 +47,7 @@
   (fn [_]
     {:status  200
      :headers {"Content-Type" "text/html"}
-     :body    (slurp (io/resource "public/index.html"))}))
+     :body    (apply str (index {:base-url (env :swarmpit-base-url "/")}))}))

 ;; Version handler


Extend js/Phaser.game have restart fn for button.

--- src/cljs/reversi/phaser.cljs
+++ src/cljs/reversi/phaser.cljs
@@ -190,7 +190,7 @@
     (set! (.-inputEnabled restart-button) true)
     (set! (.-useHandCursor (.-input restart-button)) true)
     (.add (.-onInputDown (.-events restart-button))
-          (fn [b] (.restartGame game game)) game)
+          (fn [b] (restart (.-game b))) game)
     (set! (.-restartButton game) restart-button)))

 (def ^:dynamic *assets-table*
@@ -233,4 +233,12 @@
     (.start (.-state game) "main"))
 (set! (.-restartGame *game*) start)

+(defprotocol Functor
+  (restart [this]))
+
+(extend-type js/Phaser.Game
+  Functor
+  (restart
+    ([this] (start this))))
+
 (start *game*)


Fixing call wrong function into on logging module (must to be doto)

--- src/clojure/apio/logging.clj
+++ src/clojure/apio/logging.clj
@@ -13,15 +13,15 @@

 (defn info
   [^String message & args]
-  (into *root-logger*
+  (doto *root-logger*
     (.info (apply format (into [message] args)))))

 (defn error
   [^String message & args]
-  (into *root-logger*
+  (doto *root-logger*
     (.error (apply format (into [message] args)))))

 (defn debug
   [^String message & args]
-  (into *root-logger*
+  (doto *root-logger*
     (.debug (apply format (into [message] args)))))


Fix parsing 'Block'

Fix parsing 'Block'

--- src/clojure_fabric/proto.clj
+++ src/clojure_fabric/proto.clj
@@ -183,7 +183,6 @@
       id-bytes (.setIdBytes (ByteString/copyFromUtf8 id-bytes))
       true (.build))))

-
 (defn make-serialized-identity
   [& {:keys [mspid id-bytes]}]
   (map->SerializedIdentity {:mspid mspid :id-bytes id-bytes}))
@@ -457,8 +456,8 @@
 (defrecord ChaincodeEvent [^String chaincode-id ^String tx-id ^String event-name ^bytes payload])
 (defn make-chaincode-event
   [& {:keys [chaincode-id tx-id event-name payload]}]
-  (map->ChaincodeAction {:chaincode-id chaincode-id :tx-id tx-id :event-name event-name
-                         :payload payload}))
+  (map->ChaincodeEvent {:chaincode-id chaincode-id :tx-id tx-id :event-name event-name
+                        :payload payload}))

 (defrecord ProposalResponsePayload [^bytes proposal-hash ^bytes extension])
 (defn make-proposal-response-payload
@@ -563,7 +562,7 @@
 (defmacro maybe-applying-proto->clj-transform [[tx-map data-call]]
   `(let [data# ~data-call]
      (if-let [tx-fn# (:fn ~tx-map)]
-       (proto->clj (tx-fn# data#) (:next ~tx-map))
+       (proto->clj (tx-fn# data#) (dissoc ~tx-map :fn))
        data#)))

@@ -572,25 +571,35 @@
    {:data
     {:data
      {:fn #(Common$Envelope/parseFrom ^ByteString %)
-      :next
-      {:payload
-       {:data {:fn #(TransactionPackage$Transaction/parseFrom ^ByteString %)
-               :next {:actions
-                      {;;:header
-                       :payload {:fn #(TransactionPackage$ChaincodeActionPayload/parseFrom ^ByteString %)
-                                 :next {:chaincode-proposal-payload
-                                        {:fn #(ProposalResponsePackage$ProposalResponsePayload/parseFrom ^ByteString %)
-                                         :next {:extension {:fn #(ProposalPackage$ChaincodeAction/parseFrom ^ByteString %)
-                                                            ;; NB: name is ':events' but in case of ChaincodeEvent, it is an event
-                                                            :next {:events {:fn #(ChaincodeEventPackage$ChaincodeEvent/parseFrom ^ByteString %)
-                                                                            :next nil}}}}}
-                                        ;;:action ??
-                                        ;;{:proposal-response-payload }
-                                        }}}}}}}}}}
+      :payload
+      {:data {:fn #(Configtx$ConfigUpdateEnvelope/parseFrom ^ByteString %)
+              :config-update {:fn #(Configtx$ConfigUpdate/parseFrom ^ByteString %)}}}
+
+      ;; This is here for future reference
+      ;;
+      ;; {;;:fn #(Common$Payload/parseFrom ^ByteString %)
+      ;;  :data {:fn #(TransactionPackage$Transaction/parseFrom ^ByteString %)
+      ;;         :actions
+      ;;         { ;;:header
+      ;;          :payload {:fn #(TransactionPackage$ChaincodeActionPayload/parseFrom ^ByteString %)
+      ;;                    :chaincode-proposal-payload
+      ;;                    {:fn #(ProposalPackage$ChaincodeProposalPayload/parseFrom ^ByteString %)
+      ;;                     :input {:fn #(Chaincode$ChaincodeInvocationSpec/parseFrom ^ByteString %)}}
+
+      ;;                    :action
+      ;;                    {:proposal-response-payload
+      ;;                     {;;:fn #(ProposalResponsePackage$ProposalResponsePayload/parseFrom ^ByteString %)
+      ;;                      :extension {:fn #(ProposalPackage$ChaincodeAction/parseFrom ^ByteString %)
+      ;;                                  ;; NB: name is ':events' but in case of ChaincodeEvent, it is an event
+      ;;                                  :events {:fn #(ChaincodeEventPackage$ChaincodeEvent/parseFrom ^ByteString %)
+      ;;                                           }}}}}}}}
+      }}}

    :envelope-for-config-update
-   {:payload {:data {:fn #(Configtx$ConfigUpdateEnvelope/parseFrom ^ByteString %)
-                     :next {:config-update {:fn #(Configtx$ConfigUpdate/parseFrom ^ByteString %)}}}}}})
+   {:payload
+    {;;:fn #(Common$Payload/parseFrom ^ByteString %)
+     :data {:fn #(Configtx$ConfigUpdateEnvelope/parseFrom ^ByteString %)
+            :config-update {:fn #(Configtx$ConfigUpdate/parseFrom ^ByteString %)}}}}})

 (extend-protocol IProtoToClj

@@ -630,11 +639,17 @@
                 :data           (proto->clj (.getData this) data)
                 :metadata       (proto->clj (.getMetadata this) metadata)))

-  ;; ProposalResponsePackage$Response
-  ;; (proto->clj [this opts]
-  ;;   (make-response :status (proto->clj)
-  ;;                  :message (proto->clj)
-  ;;                  :payload (proto->clj)))
+  ProposalResponsePackage$Response
+  (proto->clj [this opts]
+    (make-response :status (.getStatus this)
+                   :message (.getMessage this)
+                   :payload (.getPayload this)))
+
+  Chaincode$ChaincodeID
+  (proto->clj [this opts]
+    (make-chaincode-id :path (.getPath this)
+                       :name (.getName this)
+                       :version (.getVersion this)))

   ProposalResponsePackage$ProposalResponsePayload
   (proto->clj [this {:keys [extension]}]
@@ -657,14 +672,41 @@

   TransactionPackage$ChaincodeEndorsedAction
   (proto->clj [this {:keys [proposal-response-payload]}]
-    (make-chaincode-endorsed-action :proposal-response-payload (proto->clj (.getProposalResponsePayload this) proposal-response-payload)
+    (make-chaincode-endorsed-action :proposal-response-payload
+                                    (maybe-applying-proto->clj-transform [proposal-response-payload
+                                                                          (.getProposalResponsePayload this)])
                                     :endorsements (.getEndorsementsList this)))

+  Chaincode$ChaincodeInput
+  (proto->clj [this ignore]
+    (make-chaincode-input :args (.getArgsList this)
+                          :decorations (utils/map-vals #(proto->clj % nil)
+                                                       (.getDecorations this))))
+
+  Chaincode$ChaincodeSpec
+  (proto->clj [this ignore]
+    (make-chaincode-spec :type (.getTypeValue this)
+                         :chaincode-id (proto->clj (.getChaincodeId this) ignore)
+                         :chaincode-input (proto->clj (.getInput this) ignore)
+                         :timeout (.getTimeout this)))
+
+  Chaincode$ChaincodeInvocationSpec
+  (proto->clj [this ignore]
+    (make-chaincode-invocation-spec :chaincode-spec (proto->clj (.getChaincodeSpec this) ignore)
+                                    :id-generation-alg (.getIdGenerationAlg this)))
+
+  ProposalPackage$ChaincodeProposalPayload
+  (proto->clj [this {:keys [input]}]
+    (make-chaincode-proposal-payload :input
+                                     (maybe-applying-proto->clj-transform [input (.getInput this)])
+
+                                     :transiten-map (utils/map-vals #(proto->clj % nil) (.getTransientMap this))))

   TransactionPackage$ChaincodeActionPayload
   (proto->clj [this {:keys [action chaincode-proposal-payload]}]
     (make-chaincode-action-payload :chaincode-proposal-payload
-                                   (maybe-applying-proto->clj-transform [chaincode-proposal-payload (.getChaincodeProposalPayload this)])
+                                   (maybe-applying-proto->clj-transform [chaincode-proposal-payload
+                                                                         (.getChaincodeProposalPayload this)])

                                    :action (proto->clj (.getAction this) action)))


Max genome size is 1/4 of max points

Max genome size is 1/4 of max points

--- src/clojush/pushgp/breed.clj
+++ src/clojush/pushgp/breed.clj
@@ -33,7 +33,7 @@
   (case replace-child-that-exceeds-size-limit-with
     :parent parent
     :empty (make-individual :genome '() :genetic-operators :empty)
-    :truncate (assoc child :genome (take (/ max-points 2) (:genome child)))
+    :truncate (assoc child :genome (take (/ max-points 4) (:genome child)))
     :random (make-individual :genome (random-plush-genome max-genome-size-in-initial-program atom-generators argmap)
                              :genetic-operators :random)
     ))
@@ -94,7 +94,7 @@
                                              (assoc first-parent :parent-uuids (vector (:uuid first-parent)))
                                              population location rand-gen argmap)]
     (if (> (count (:genome child))
-           (/ max-points 2)) ; Check if too big
+           (/ max-points 4)) ; Check if too big
       (revert-too-big-child first-parent child argmap)
         (assoc child
                :genetic-operators operator


add cljs.js/*load-fn*

add cljs.js/*load-fn*

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -14,6 +14,14 @@
             [cljs.tools.reader :as r]
             [cljs.tools.reader-types :as rt]
             [cljs.tagged-literals :as tags]))
+
+(defonce
+  ^{:doc "Each runtime environment provides a different way to print error output.
+  Whatever function *print-fn* is bound to will be passed any
+  Strings which should be printed." :dynamic true}
+  *load-fn*
+  (fn [_]
+    (throw (js/Error. "No *load-fn* set"))))

 (defn empty-env []
   (env/default-compiler-env))


fix cljs.js/*load-fn* docstring

fix cljs.js/*load-fn* docstring

--- src/main/cljs/cljs/js.cljs
+++ src/main/cljs/cljs/js.cljs
@@ -16,11 +16,12 @@
             [cljs.tagged-literals :as tags]))

 (defonce
-  ^{:doc "Each runtime environment provides a different way to print error output.
-  Whatever function *print-fn* is bound to will be passed any
-  Strings which should be printed." :dynamic true}
+  ^{:doc "Each runtime environment provides a different way to load libraries.
+  Whatever function *load-fn* is bound to will be passed a library name and a
+  callback. The callback should be invoked with source of the library (a string)."
+    :dynamic true}
   *load-fn*
-  (fn [_]
+  (fn [name cb]
     (throw (js/Error. "No *load-fn* set"))))

 (defn empty-env []


Reformat and simplify code

Reformat and simplify code

--- src/io/aviso/rook/core.clj
+++ src/io/aviso/rook/core.clj
@@ -45,8 +45,7 @@
       (get (:route-params request) api-kw)
       (get (:route-params request) arg-kw)
       (get (:params request) api-kw)
-      (get (:params request) arg-kw)
-      )))
+      (get (:params request) arg-kw))))

 (defn- ns-function
   "Return the var for the given namespance and function keyword."
@@ -97,8 +96,10 @@
 (defn- scan-namespace-for-doc
   "Build a map of functions in namespace <-> url prefixes."
   [namespace]
-  (remove nil?
-          (map #(get-function-meta namespace %) (ns-paths namespace))))
+  (->> namespace
+       ns-paths
+       (map #(get-function-meta namespace %))
+       (remove nil?)))

 (defn build-map-arg-resolver
   "Build an argument resolver which takes a list of keys and constant values and when required argument
@@ -123,26 +124,26 @@
   (get request arg))

 (defn arg-resolver-middleware
-"Middleware which adds provided argument resolvers to [:rook :default-arg-resolvers] collection."
+  "Middleware which adds provided argument resolvers to [:rook :default-arg-resolvers] collection."
   [handler & arg-resolvers]
   (fn [request]
     (handler (assoc request
-               :rook (merge (or (:rook request) {})
-                      {:default-arg-resolvers (concat (:default-arg-resolvers (:rook request))  arg-resolvers)})))))
+               :rook (merge (:rook request)
+                            {:default-arg-resolvers (concat (:default-arg-resolvers (:rook request)) arg-resolvers)})))))

 (defn get-available-paths
-"Scan namespace for available routes - only those that have available function are returned.
-
-Routes are sorted by the line number from metadata - which can be troubling if you have the same namespace in many files.
-
-But then, unless your name is Rich, you're in trouble already... "
+  "Scan namespace for available routes - only those that have available function are returned.
+
+  Routes are sorted by the line number from metadata - which can be troubling if you have the same namespace in many files.
+
+  But then, unless your name is Rich, you're in trouble already... "
   [namespace]
   (->> (ns-paths namespace)
        (map (fn [[[request-method path] function-key]]
               (when-let [fun (ns-function namespace function-key)]
                 [[request-method path] fun])))
        (remove nil?)
-       (sort-by #(or (-> % second meta :line) 0))))    ;sadly, the namespace stores interned values
+       (sort-by #(or (-> % second meta :line) 0)))) ;sadly, the namespace stores interned values

 (defn- get-compiled-paths
   [namespace]
@@ -151,7 +152,8 @@
        (map (fn [[[request-method path] fun]]
               (l/debugf "Mapping %s `%s' to %s" request-method path fun)
               [[request-method (clout/route-compile path)] fun]))
-       (remove nil?)))
+       (remove nil?)
+       doall))

 (defn- identify-rook-data
   "Uses the compiled paths to identify the matching function to be invoked and returns
@@ -163,19 +165,19 @@
                                            (= (:request-method request) request-method))
                                        (clout/route-matches route request))]
             {:route-params (merge (:route-params request) route-params)
-             :rook (merge (:rook request)
-                          {:namespace namespace
-                           :function fun
-                           :metadata (meta fun)
-                           :arg-resolvers (:arg-resolvers (meta fun))})}))
+             :rook         (merge (:rook request)
+                                  {:namespace     namespace
+                                   :function      fun
+                                   :metadata      (meta fun)
+                                   :arg-resolvers (:arg-resolvers (meta fun))})}))
         compiled-paths))

 (defn namespace-middleware
-"Middleware that scans provided namespace and if any of the functions defined there matches the route spec -
-either by metadata or by default mappings from function name - sets this functions metadata in request map.
-
-This does not invoke the function; that is the responsibility of the rook-handler function. Several additional
-middleware filters will typically sit between identifying the function and actually invoking it."
+  "Middleware that scans provided namespace and if any of the functions defined there matches the route spec -
+  either by metadata or by default mappings from function name - sets this functions metadata in request map.
+
+  This does not invoke the function; that is the responsibility of the rook-handler function. Several additional
+  middleware filters will typically sit between identifying the function and actually invoking it."
   ([handler namespace]
    (let [compiled-paths (get-compiled-paths namespace)]
      (fn namespace-service-identifier [request]
@@ -184,27 +186,27 @@
          (handler request))))))

 (defn rook-handler
-"Handler that uses information from :rook entry in request map to invoke proper function
-and resolve arguments with arg-resolvers."
+  "Handler that uses information from :rook entry in request map to invoke proper function
+  and resolve arguments with arg-resolvers."
   [request]
   (let [rook-data (-> request :rook)
         arg-resolvers (concat (-> rook-data :default-arg-resolvers)
                               (-> rook-data :arg-resolvers))
-        fun  (-> rook-data :function)
+        fun (-> rook-data :function)
         args (-> rook-data :metadata :arglists first)
         argument-values (map #(extract-argument-value % request arg-resolvers) args)]
     (when fun
       (apply fun argument-values))))

 (defn namespace-handler
-"Helper handler, which wraps rook-handler in namespace middleware.
-
-The advanced version also takes a path for compojure.core/context and a list of sub-handlers that
-will be invoked BEFORE rook-handler."
+  "Helper handler, which wraps rook-handler in namespace middleware.
+
+  The advanced version also takes a path for compojure.core/context and a list of sub-handlers that
+  will be invoked BEFORE rook-handler."
   ([namespace]
    (namespace-middleware rook-handler namespace))
   ([path namespace & handlers]
    (compojure/context path []
-     (namespace-middleware
-      (apply compojure/routes (concat handlers [rook-handler]))
-      namespace))))+                      (namespace-middleware
+                        (apply compojure/routes (concat handlers [rook-handler]))
+                        namespace))))


remove unused dns

remove unused dns

--- src/terraboot/public_dns.clj
+++ src/terraboot/public_dns.clj
@@ -17,23 +17,4 @@
   (let [route53-record (partial public-route53-record dns-zone dns-zone-id)
         vpc-output-of (core/output-of-fn (core/vpc-unique-fn vpc-name))]
     (utils/merge-in
-     (route53-record "vpn" {:records [(vpc-output-of "aws_eip" "vpn" "public_ip")]})
-     (route53-record "logstash" {:records [(vpc-output-of "aws_eip" "logstash" "public_ip")]})
-     (route53-record "alerts" {:type "CNAME"
-                               :records [(core/output-of "aws_elb" "alerts" "dns_name")]}))))
-
-(defn cluster-public-dns
-  [dns-zone dns-zone-id vpc-name cluster-name]
-  (let [route53-record (partial public-route53-record dns-zone dns-zone-id)
-        cluster-identifier (core/cluster-identifier vpc-name cluster-name)
-        cluster-unique (core/cluster-unique-fn vpc-name cluster-name)
-        cluster-output-of (core/output-of-fn cluster-unique)]
-    (utils/merge-in
-     (route53-record (cluster-unique "deploy")
-                     {:alias {:name (cluster-output-of "aws_alb" "public-apps" "dns_name")
-                              :zone_id (cluster-output-of "aws_alb" "public-apps" "zone_id")
-                              :evaluate_target_health true}})
-     (route53-record cluster-identifier
-                     {:alias {:name (cluster-output-of "aws_alb" "public-apps" "dns_name")
-                              :zone_id (cluster-output-of "aws_alb" "public-apps" "zone_id")
-                              :evaluate_target_health true}}))))
+     (route53-record "vpn" {:records [(vpc-output-of "aws_eip" "vpn" "public_ip")]}))))


Remove unused fn.

Remove unused fn.

--- src/klangmeister/core.cljs
+++ src/klangmeister/core.cljs
@@ -18,9 +18,6 @@
 (defonce state-atom (empty-state))

 (def handle! (framework/handler-for state-atom))
-
-(defn reload! []
-  (swap! state-atom identity))

 (secretary/defroute "/klangmeister/"            [query-params] (session/put! :gist (:gist query-params))
                                                                (session/put! :current-page view/about))


Stubbed out the longer FFM Inventory.

Stubbed out the longer FFM Inventory.

--- src/simulacrum/bigfive.clj
+++ src/simulacrum/bigfive.clj
@@ -60,6 +60,183 @@
 (def questions-long
   (conj
     questions-base
-    {}))
-
-
+    {:title "Five Factor Model (Big Five) Long Inventory"
+     :questions [{:number 1
+                  :question "is talkative"
+                  :type :E
+                  :reversed? false}
+                 {:number 2
+                  :question "tends to find fault with others"
+                  :type :A
+                  :reversed? true}
+                 {:number 3
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 4
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 5
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 6
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 7
+                  :question "XXX"
+                  :type :A
+                  :reversed? false}
+                 {:number 8
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 9
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 10
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 11
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 12
+                  :question "XXX"
+                  :type :A
+                  :reversed? true}
+                 {:number 13
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 14
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 15
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 16
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 17
+                  :question "XXX"
+                  :type :A
+                  :reversed? false}
+                 {:number 18
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 19
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 20
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 21
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 22
+                  :question "XXX"
+                  :type :A
+                  :reversed? false}
+                 {:number 23
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 24
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 25
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 26
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 27
+                  :question "XXX"
+                  :type :A
+                  :reversed? true}
+                 {:number 28
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 29
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 30
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 31
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 32
+                  :question "XXX"
+                  :type :A
+                  :reversed? false}
+                 {:number 33
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 34
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 35
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 36
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 37
+                  :question "XXX"
+                  :type :A
+                  :reversed? true}
+                 {:number 38
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 39
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 40
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 41
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 42
+                  :question "XXX"
+                  :type :A
+                  :reversed? false}
+                 {:number 43
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+                 {:number 44
+                  :question "XXX"
+                  :type :E
+                  :reversed? true}
+     ]}))
+
+


Error handling.

Error handling.

Deal with unset KRB5CCNAME or with an empty/missing ccache file.

--- kwho-clj/src/kwho/core.clj
+++ kwho-clj/src/kwho/core.clj
@@ -11,12 +11,16 @@
 (defn get_principal
   "Get principal from $KRB5CCNAME - assumes it is type FILE:"
   []
-  (->> (System/getenv "KRB5CCNAME")
-       (#(str/replace % #"^FILE:" ""))
-       (FileCredentialsCache/acquireInstance nil)
-       (.getPrimaryPrincipal)
-       (.getNameStrings)
-       (str/join "/")))
+  (if-some [krb5ccname (System/getenv "KRB5CCNAME")]
+    (let [cachefile (str/replace krb5ccname #"^FILE:" "")]
+      (if-some [fcc (FileCredentialsCache/acquireInstance nil cachefile)]
+        (->> fcc
+            (.getPrimaryPrincipal)
+            (.getNameStrings)
+            (str/join "/"))
+        (format "No credentials cache found (ticket cache FILE:%s)"
+                cachefile)))
+    "Uh-oh, KRB5CCNAME is not set.  Quitting."))

 (defn -main


initialize stuff

initialize stuff

--- src/babel/italiano/workbook.clj
+++ src/babel/italiano/workbook.clj
@@ -219,6 +219,9 @@
        (if search-query
          (workbookq search-query))]])))

+(def foo (analyze "sono"))
+(def foo (count (parse "io mi sono seduto")))
+
 (def routes
   (compojure/routes


Changed IFn to Fn for response-from multimethod

--- src/compojure/http/response.clj
+++ src/compojure/http/response.clj
@@ -12,7 +12,7 @@

 (ns compojure.http.response
   (:use clojure.contrib.def)
-  (:import clojure.lang.IFn)
+  (:import clojure.lang.Fn)
   (:import clojure.lang.IPersistentVector)
   (:import java.util.Map)
   (:import clojure.lang.ISeq)
@@ -86,14 +86,9 @@
   (if (not= kw :next)
     (response-from (str kw))))

-(defmethod response-from IFn
+(defmethod response-from Fn
   [func]
   func)
-
-;; Don't treat keywords, maps or vectors as functions
-(prefer-method response-from Keyword IFn)
-(prefer-method response-from Map IFn)
-(prefer-method response-from IPersistentVector IFn)

 (defmethod response-from nil
   [_]


Hotfix. require db.clj

Hotfix. require db.clj

--- src/word_keeper/frontend.clj
+++ src/word_keeper/frontend.clj
@@ -1,6 +1,7 @@
 (ns word-keeper.frontend
   (:require [clostache.parser :refer [render-resource]]
-            [word-keeper.auth :refer :all]))
+            [word-keeper.auth :refer :all]
+            [word-keeper.db :refer :all]))

 (defn action-index [req]
   {:status 200


Commented out spatial plugin test which causes local elastic to become red

--- es-spatial-plugin/test/cmr/es_spatial_plugin/test/search_test.clj
+++ es-spatial-plugin/test/cmr/es_spatial_plugin/test/search_test.clj
@@ -82,7 +82,9 @@
         result (esd/search conn index-name [type-name] :filter elastic-filter)]
     (set (map (comp keyword :_id) (get-in result [:hits :hits])))))

-(deftest spatial-search-test
+;; Commented out this test as it causes my local elastic to become red with uninitialized
+;; spatial_areas shards.
+#_(deftest spatial-search-test
   (let [conn (connect)
         _ (recreate-index conn)
         idx (fn [shape-name & ords]


update did not clean the new comment cache

--- src/ontrail/newcomment.clj
+++ src/ontrail/newcomment.clj
@@ -103,7 +103,7 @@
   (if-let [ucache (@users-cache user)]
     (let [dissoced-keys (dissoc-comment-keys @ucache)]
       (dosync (apply alter ucache dissoc dissoced-keys))
-      (mc/update *db* NCCACHE {:u user} {"$set" {:ref @ucache}} :upsert true))
+      (mc/update *db* NCCACHE {:u user} {"$set" {:ref @ucache}} {:upsert true}))
     nil))

 (defn restore-cache [user]


Fixed bug where route atom was not resetted when unknown urls were used after the initial loading of the page.

--- app/src/clj_web_example/ui/route.cljs
+++ app/src/clj_web_example/ui/route.cljs
@@ -18,6 +18,9 @@
 (secretary/defroute "/new" []
   (reset! route {:id "new-message"}))

+(secretary/defroute "*" []
+  (reset! route nil))
+
 ;
 ; Listener
 ;


4clojure:: impl func: digits and any bases


format clojure asynsocket example code for more easier reading from github web code viewer

--- test/clojure/nginx/clojure/asyn_socket_handlers_for_test.clj
+++ test/clojure/nginx/clojure/asyn_socket_handlers_for_test.clj
@@ -109,13 +109,14 @@
                                         "Connection: close\r\n\r\n"))
                    :buf (byte-array 4096)
                    :resp (ByteArrayOutputStream.)})
-        as (NginxClojureAsynSocket. (fn [as, type, sc]
-																		  (case type
-																		    "connect" (connect-handler as sc)
-																		     "read"  (read-handler as sc)
-																		     "write" (write-handler as sc)
-																		     "release" (release-handler as sc))
-                                      ))]
+        as (NginxClojureAsynSocket.
+             (fn [as, type, sc]
+								(case type
+										"connect" (connect-handler as sc)
+											"read"  (read-handler as sc)
+											"write" (write-handler as sc)
+											"release" (release-handler as sc))
+         ))]
     (.setContext as ctx)
     (.connect as "mirror.bit.edu.cn:80")
     ;tell nginx clojure our work isn't done.


remove midje which is not part of production deploy

--- src/foosball/views/about.clj
+++ src/foosball/views/about.clj
@@ -33,10 +33,7 @@
     "https://github.com/Prismatic/dommy"]
    ['com.taoensso/timbre
     "Timbre"
-    "https://github.com/ptaoussanis/timbre"]
-   ['midje/midje
-    "Midje"
-    "https://github.com/marick/Midje"]])
+    "https://github.com/ptaoussanis/timbre"]])

 (defn page []
   (html5


fix: delete history delta insert [PDOK-1952]

--- src/main/clojure/pdok/featured/timeline.clj
+++ src/main/clojure/pdok/featured/timeline.clj
@@ -53,7 +53,7 @@
   (str (name *timeline-schema*) "." (name *current-delta-table*)))

 (defn map->where-clause
-  ([clauses] (str/join " AND " (map #(str (name (first %1)) " = '" (second %1) "'") clauses)))
+  ([clauses] (str/join " AND " (map #(str (name (first %1)) " = '" (second %1) "'") clauses)))
   ([clauses table] (str/join " AND " (map #(str table "." (name (first %1)) " = '" (second %1) "'") clauses))))

 (defn- execute-query [timeline query]
@@ -114,18 +114,18 @@
          clause-current (map->where-clause selector current)
          query (str "SELECT feature "
                     "FROM " history ", " history-delta " "
-                    "WHERE " history-delta".action = 'I' "
+                    "WHERE " history-delta".action = 'I' "
                     "AND " history ".version = " history-delta ".version "
                     "AND " clause-history
                     " UNION ALL "
-                    "SELECT feature "
+                    "SELECT feature "
                     "FROM " current ", " current-delta " "
                     "WHERE " current-delta ".action = 'I' "
                     "AND " current ".version = " current-delta ".version "
                     "AND " clause-current)]
      (query-with-results-on-channel timeline query feature-from-json))))

-(defn versions-deleted-in-delta
+(defn versions-deleted-in-delta
   ([timeline dataset collection] (versions-deleted-in-delta timeline {:dataset dataset :collection collection}))
   ([timeline selector]
    (let [history (qualified-history)
@@ -134,7 +134,7 @@
          current (qualified-current)
          current-delta (qualified-current-delta)
          clause-current (map->where-clause selector current-delta)
-         query (str "SELECT " history-delta ".version as version "
+         query (str "SELECT " history-delta ".version as version "
                     "FROM " history ", " history-delta " "
                     "WHERE " history-delta ".action = 'D' "
                     "AND " history ".version = " history-delta ".version "
@@ -311,13 +311,15 @@
   (str "DELETE FROM " (qualified-history)
        " WHERE ARRAY[version] <@ ?"))

-(defn- delete-history-delta-sql [] (str "INSERT INTO " (qualified-history-delta) " (dataset, collection, version, action) VALUES (?, 'D')"))
+(defn- delete-history-delta-sql [] (str "INSERT INTO " (qualified-history-delta) " (dataset, collection, version, action) VALUES (?, ?, ?, 'D')"))

 (defn- delete-history [db features]
   (try
     (let [transform-fn (juxt #(set (:_all_versions %)))
           records (map transform-fn features)
-          versions (vec (set (flatten (map juxt :_dataset :_collection :_all_versions features))))]
+          versions (mapcat
+                    (fn [f] (map #(vector (:_dataset f) (:_collection f) %) (:_all_versions f)))
+                    features)]
       (j/execute! db (cons (delete-history-sql) records) :multi? true :transaction? false)
       (j/execute! db (cons (delete-history-delta-sql) versions) :multi? true :transaction? false))
      (catch java.sql.SQLException e


add function geo-attr

add function geo-attr

--- src/gml_to_featured/code.clj
+++ src/gml_to_featured/code.clj
@@ -15,7 +15,8 @@

 (def key->fn {:s/tag `[tag]
               :s/id-attr `[id-attr]
-              :s/inner-gml `[inner-gml]})
+              :s/inner-gml `[inner-gml]
+              :s/geo-attr `[geo-attr]})

 (defn parse-selector-vector [key selector]
   (let [;; convert tags to fn, do use them in de xml1-> selector
@@ -85,9 +86,12 @@

 (defn function [name]
   (fn [& parameters]
-    [(str "~#" name) (apply params parameters)]))
+    ; use double vector --> outer vector is used as container (edn-mapping)
+    [[(str "~#" name) (apply params parameters)]]))

 (def moment (function "moment"))
+
+(def geo-attr (function "geo-attr"))

 (defn inner-gml [input]
   (let [inner (zip/down input)]


message-id -> segment-id

message-id -> segment-id

--- resources/leiningen/new/onyx_plugin/medium_input.clj
+++ resources/leiningen/new/onyx_plugin/medium_input.clj
@@ -60,27 +60,27 @@
     )

   p-ext/PipelineInput
-  (ack-segment [_ _ message-id]
+  (ack-segment [_ _ segment-id]
     ;; When a message is fully acked you can remove it from pending-messages
     ;; Generally this can be left as is.
-    (swap! pending-messages dissoc message-id))
+    (swap! pending-messages dissoc segment-id))

   (retry-segment
-    [_ {:keys [{{medium}}/example-datasource] :as event} message-id]
+    [_ {:keys [{{medium}}/example-datasource] :as event} segment-id]
     ;; Messages are retried if they are not acked in time
     ;; or if a message is forcibly retried by flow conditions.
     ;; Generally this takes place in two steps
     ;; Take the message out of your pending-messages atom, and put it
     ;; back into a datasource or a buffer that are you are reading into
-    (when-let [msg (get @pending-messages message-id)]
-      (swap! pending-messages dissoc message-id)
+    (when-let [msg (get @pending-messages segment-id)]
+      (swap! pending-messages dissoc segment-id)
       (swap! example-datasource conj msg)))

   (pending?
-    [_ _ message-id]
+    [_ _ segment-id]
     ;; Lookup a message in your pending messages map.
     ;; Generally this can be left as is
-    (get @pending-messages message-id))
+    (get @pending-messages segment-id))

   (drained?
     [_ _]


Updated to Clojure 1.7

Updated to Clojure 1.7

Mainly to use stuartsierra's component (used indirectly by
samsara-client). The component library needs conditional read which
is introduced in 1.7

--- clients/logger/project.clj
+++ clients/logger/project.clj
@@ -3,7 +3,7 @@
   :url "https://github.com/samsara/samsara-logger"
   :license {:name "Apache License V2"
             :url "http://www.apache.org/licenses/LICENSE-2.0"}
-  :dependencies [[org.clojure/clojure "1.6.0"]
+  :dependencies [[org.clojure/clojure "1.7.0"]
                  [org.slf4j/slf4j-api "1.7.12"]
                  [org.apache.logging.log4j/log4j-core "2.3"]
                  [samsara/samsara-client "0.2.0"]]


Send stdout as a stream.

Send stdout as a stream.

--- src/ipython_clojure/core.clj
+++ src/ipython_clojure/core.clj
@@ -216,11 +216,7 @@
                                   :status "ok"
                                   :started (now)} session-id signer (:idents message))
             ;; Send stdout
-            (send-message iopub-socket "pyout"
-                          {:execution_count @execution-count
-                           :data {:text/plain output}
-                           :metadata {}
-                           }
+            (send-message iopub-socket "stream" {:name "stdout",:text output}
                           parent-header {} session-id signer)
             ;; Send results
             (send-message iopub-socket "execute_result"


Refactored batch flattening and splitting into function called in actor closure

--- src/polismath/conv_man.clj
+++ src/polismath/conv_man.clj
@@ -4,6 +4,7 @@
             [polismath.metrics :as met]
             [polismath.db :as db]
             [polismath.utils :refer :all]
+            [plumbing.core :as pc]
             [clojure.core.matrix.impl.ndarray]
             [clojure.core.async
              :as as
@@ -138,11 +139,10 @@
 (defn update-fn
   "This function is what actually gets sent to the conv-actor. In addition to the conversation and vote batches
   up in the channel, we also take an error-callback. Eventually we'll want to pass opts through here as well."
-  [conv vote-batches error-callback]
+  [conv votes error-callback]
   (let [start-time (System/currentTimeMillis)]
     (try
-      (let [votes          (flatten vote-batches)
-            updated-conv   (conv/conv-update conv votes)
+      (let [updated-conv   (conv/conv-update conv votes)
             zid            (:zid updated-conv)
             finish-time    (System/currentTimeMillis)]
         (log/info "Finished computng conv-update for zid" zid "in" (- finish-time start-time) "ms")
@@ -158,7 +158,7 @@
       ; In case anything happens, run the error-callback handler. Agent error handlers do not work here, since
       ; they don't give us access to the votes.
       (catch Exception e
-        (error-callback vote-batches start-time (:opts' conv) e)
+        (error-callback votes start-time (:opts' conv) e)
         ; Wait a second before returning the origin, unmodified conv, to throttle retries
         (Thread/sleep 1000)
         conv))))
@@ -176,7 +176,7 @@
   "Returns a clojure that can be called in case there is an update error. The closure gives access to
   the queue so votes can be requeued"
   [queue conv-actor]
-  (fn [vote-batches start-time opts update-error]
+  (fn [votes start-time opts update-error]
     (let [zid-str (str "zid=" (:zid @conv-actor))]
       (log/error "Failed conversation update for" zid-str)
       (.printStackTrace update-error)
@@ -184,11 +184,10 @@
       ; XXX - this could lead to a recast vote being ignored, so maybe the sort should just always happen in
       ; the conv-actor update?
       (try
-        (log/info "Preparing to re-queue vote-batches for failed conversation update for" zid-str)
-        (doseq [vote-batch vote-batches]
-          (as/go (as/>! queue vote-batch)))
+        (log/info "Preparing to re-queue votes for failed conversation update for" zid-str)
+        (as/go (as/>! queue [:votes votes]))
         (catch Exception qe
-          (log/error "Unable to re-queue vote-batches after conversation update failed for" zid-str)
+          (log/error "Unable to re-queue votes after conversation update failed for" zid-str)
           (.printStackTrace qe)))
       ; Try to send some failed conversation time metrics, but don't stress if it fails
       (try
@@ -199,8 +198,7 @@
           (log/error "Unable to send metrics for failed compute for" zid-str)))
       ; Try to save conversation state for debugging purposes
       (try
-        (let [votes (flatten vote-batches)]
-          (conv/conv-update-dump @conv-actor votes opts update-error))
+        (conv/conv-update-dump @conv-actor votes opts update-error)
         (catch Exception e
           (log/error "Unable to perform conv-update dump for" zid-str))))))

@@ -256,6 +254,17 @@
   (add-watch (:conv conv-actor) key f))

+(defn split-batches
+  [messages]
+  (->> messages
+       (group-by first)
+       (pc/map-vals
+         (fn [[_ batches]]
+           (->> batches
+                (map second)
+                (flatten))))))
+
+
 (defn new-conv-actor [init-fn & opts]
   (let [msgbox (chan Long/MAX_VALUE) ; we want this to be as big as possible, since backpressure doesn't really work
         conv (atom (init-fn)) ; keep track of conv state in atom so it can be dereffed
@@ -268,10 +277,9 @@
         (let [first-msg (<! msgbox) ; do this so we park efficiently
               msgs      (take-all! msgbox)
               msgs      (concat [first-msg] msgs)
-              {:keys [votes moderation]}
-                        (group-by first msgs)
-              vote-batches (map second votes)]
-          (swap! conv update-fn vote-batches err-handler))
+              {votes :votes mods :moderation}
+                        (split-batches msgs)]
+          (swap! conv update-fn votes err-handler))
         (catch Exception e
           (log/error "Excpetion not handler by err-handler:" e)
           (.printStackTrace e)))


timer off at expire

timer off at expire

--- src/pomodoro/pomodoro.cljs
+++ src/pomodoro/pomodoro.cljs
@@ -29,8 +29,7 @@
    :on false})

 ; START app-state
-;; FIXME remove assoc
-(def app-state (atom (assoc (default-state) :on true)))
+(def app-state (atom (default-state)))
 ; END app-state

 ; START format-time
@@ -156,7 +155,7 @@
 ; END can-update

 ; START pom-view
-(defn pom-view [{:keys [stime on] :as app} owner]
+(defn pom-view [{:keys [stime etime on] :as cursor} owner]
   (reify
     om/IDisplayName
     (display-name [_] "pom-view")
@@ -165,18 +164,23 @@
     (will-mount [_]
       (js/setInterval
         (fn []
-          (om/transact! app #(if (can-update %)
+          (om/transact! cursor #(if (can-update %)
                                (assoc % :stime (+ 1e3 (:stime %)))
                                %)))
-        1e3))
+        10))
+
+    om/IWillUpdate
+    (will-update [_ {:keys [etime stime]} _]
+      (when (<= (- etime stime) 0)
+        (om/transact! on #(identity false))))

     om/IRender
     (render [_]
       (dom/div
         #js {:className "timer-body"}
-        (om/build timer-top app)
-        (om/build timer-middle app)
-        (om/build timer-bottom app)))))
+        (om/build timer-top cursor)
+        (om/build timer-middle cursor)
+        (om/build timer-bottom cursor)))))
 ; END pom-view

 (om/root pom-view app-state


Remove debug print statement

Remove debug print statement

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -186,7 +186,6 @@
   writing the data (defaults to 0)."
   ([buf data] (buffer-write! buf 0 data))
   ([buf start-idx data]
-     (println "yo" buf)
      (assert (buffer? buf))
      (when (> (count data) MAX-OSC-SAMPLES)
        (throw (Exception. (str "Error - the data you attempted to write to the buffer was too large to be sent via UDP."))))


fix bug that managed to slip in

fix bug that managed to slip in

--- src/overtone/sc/buffer.clj
+++ src/overtone/sc/buffer.clj
@@ -31,8 +31,8 @@
      (wait-until-booted)
      (let [buf (buffer size num-channels)]
        (while (not (buffer-ready? buf))
-         (Thread/sleep 50)))
-     buf))
+         (Thread/sleep 50))
+       buf)))

 (defn buffer? [buf]
   (isa? (type buf) ::buffer))


Changed the default id set namespace from kiao to ccp

--- kabob-build/src/main/clojure/edu/ucdenver/ccp/kabob/build/id_sets/id_set_triples.clj
+++ kabob-build/src/main/clojure/edu/ucdenver/ccp/kabob/build/id_sets/id_set_triples.clj
@@ -20,7 +20,7 @@

 ;;(def ^:dynamic *graph-db-path* "/temp/kabob/neo4j/idsets/")

-(def ^:dynamic *id-set-ns* "kiao")
+(def ^:dynamic *id-set-ns* "ccp")

 (def magic-prefixes
   (str "PREFIX franzOption_memoryLimit: <franz:85g> \n"


Removed some superfluous debugging info

Removed some superfluous debugging info

--- src/polismath/clusters.clj
+++ src/polismath/clusters.clj
@@ -116,8 +116,7 @@
         ; count uniq data points to figure out how many clusters are possible
         possible-clusters (min k (count (distinct (rows (:matrix data)))))]
     (loop [clusters uniq-clusters]
-      ; Whatever th ecase here, we want to do one more recentering
-      (println "size" (count clusters))
+      ; Whatever the case here, we want to do one more recentering
       (let [clusters (recenter-clusters data clusters)]
         (if (> possible-clusters (count clusters))
           ; first find the most distal point, and the cluster to which it's closest


Fix doc cut-and-paste error.

Fix doc cut-and-paste error.

--- src/afterglow/effects/params.clj
+++ src/afterglow/effects/params.clj
@@ -501,7 +501,7 @@
   in [[*show*]].

   If you do not specify an explicit value for `:frame-dynamic`, this
-  direction parameter will be frame dynamic if it has any incoming
+  aim parameter will be frame dynamic if it has any incoming
   parameters which themselves are."
   {:doc/format :markdown}
   [& {:keys [x y z frame-dynamic] :or {x 0 y 0 z 2 frame-dynamic :default}}]


Added clear-screen.

Added clear-screen.

--- scripts/bigfive-short.clj
+++ scripts/bigfive-short.clj
@@ -5,5 +5,6 @@
            [simulacrum.util :as util]))

+(util/clear-screen)
 (inventory/run-inventory :bigfive :short true)
 (util/exit)


Issue 245: Cache the factory function symbol for records using the class as the key to improve performance of session serialization

--- src/main/clojure/clara/rules/durability/fressian.clj
+++ src/main/clojure/clara/rules/durability/fressian.clj
@@ -39,23 +39,34 @@
             ReadHandler]
            [java.util
             ArrayList
-            IdentityHashMap]
+            IdentityHashMap
+            Map
+            WeakHashMap]
            [java.io
             InputStream
             OutputStream]))

+;; Use this map to cache the symbol for the map->RecordNameHere
+;; factory function created for every Clojure record to improve
+;; serialization performance.
+;; See https://github.com/cerner/clara-rules/issues/245 for more extensive discussion.
+(def ^:private ^Map class->factory-fn-sym (WeakHashMap.))
+
 (defn record-map-constructor-name
   "Return the 'map->' prefix, factory constructor function for a Clojure record."
   [rec]
-  (let [class-name (-> rec class .getName)
-        idx (.lastIndexOf class-name (int \.))
-        ns-nom (.substring class-name 0 idx)
-        nom (.substring class-name (inc idx))]
-    ;; There could be some sort of cache for these based on class.  It may speed
-    ;; up serialization, but doesn't seem worth it yet.
-    (symbol (str (cm/demunge ns-nom)
-                 "/map->"
-                 (cm/demunge nom)))))
+  (let [klass (class rec)]
+    (if-let [cached-sym (.get class->factory-fn-sym klass)]
+      cached-sym
+      (let [class-name (.getName ^Class klass)
+            idx (.lastIndexOf class-name (int \.))
+            ns-nom (.substring class-name 0 idx)
+            nom (.substring class-name (inc idx))
+            factory-fn-sym (symbol (str (cm/demunge ns-nom)
+                                        "/map->"
+                                        (cm/demunge nom)))]
+        (.put class->factory-fn-sym klass factory-fn-sym)
+        factory-fn-sym))))

 (defn write-map
   "Writes a map as Fressian with the tag 'map' and all keys cached."


made the nil case on index-of quicker/more-clear, it wasn't using (last paths)

--- src/lseq_tree/lseq_node.cljc
+++ src/lseq_tree/lseq_node.cljc
@@ -114,8 +114,7 @@
   "returns the zero-based index of a limb in a node"
   [node limb]
   (let [paths (indexes node limb)]
-    (if (some nil? paths)
-      nil
+    (if (last paths)
       (loop [[head & tail] paths,
              {:keys [children] :as node} node,
              acc (if (:element node) 1 0)]
@@ -123,7 +122,8 @@
           (recur tail
                  (nth children head)
                  (+ acc (left-to-right head node)))
-          (dec acc)))))) ;zero-based index
+          (dec acc)))
+      nil))) ;zero-based index

 (defn indexes
   "returns a vector of numbers for each level that the index of a limb is


CLJS-1269: realized? docstring refers to promise and future

Since `promise` and `future` are not implemented in
ClojureScript, eliminate references to them in the
docstring for `realized?`

--- src/main/cljs/cljs/core.cljs
+++ src/main/cljs/cljs/core.cljs
@@ -8883,7 +8883,7 @@
     x))

 (defn ^boolean realized?
-  "Returns true if a value has been produced for a promise, delay, future or lazy sequence."
+  "Returns true if a value has been produced for a delay or lazy sequence."
   [d]
   (-realized? d))


Provide either refseq or chromosome but not both

ClinVar fails the submission if both the refseq accession and the chromosome # are provided. We will defer to using the refseq accession if provided.

--- src/clinvar_submitter/variant.clj
+++ src/clinvar_submitter/variant.clj
@@ -29,7 +29,7 @@
      (:gene variant "") ; gene symbol - not provided since we are avoiding contextual allele representation.
      (:refseq variant) ;refseq
      (if (some? hgvs) hgvs "") ; hgvs - not providing since we are avoiding contextual allele representation
-     (:chromosome variant "")  ; chromosome - not providing since we are using the refseq field to denote the accession.
+     (if (nil? (:refseq variant) (:chromosome variant) "")  ; chromosome - only provide if the refseq field is nil - clinvar does not accept both fields.
      (if (nil? hgvs) (:start variant-coord) "") ; start + 1  (from 0-based to 1-based)
      (if (nil? hgvs) (:stop variant-coord) "")  ; stop + 1  (from 0-based to 1-based)
      (if (nil? hgvs) (:ref variant-coord) "")   ; ref


nimbus-storage-stormdist-root added to config

--- src/clj/backtype/storm/config.clj
+++ src/clj/backtype/storm/config.clj
@@ -79,6 +79,12 @@
      (str (master-local-dir conf) "/stormdist"))
   ([conf storm-id]
      (str (master-stormdist-root conf) "/" storm-id)))
+
+(defn nimbus-storage-stormdist-root
+  ([]
+    (str "/nimbus/stormdist"))
+  ([storm-id]
+    (str (master-stormdist-root) "/" storm-id)))

 (defn master-stormjar-path [stormroot]
   (str stormroot "/stormjar.jar"))


cleaner inline caching implementation

cleaner inline caching implementation

--- src/clj/com/rpl/specter/impl.cljc
+++ src/clj/com/rpl/specter/impl.cljc
@@ -635,8 +635,9 @@
 (defn direct-nav? [o]
   (-> o meta :direct-nav))

-
-;; don't do coerce-nav here... save that for resolve-magic-code
+(defn all-static? [params]
+  (every? (complement dynamic-param?) params))
+
 (defn- magic-precompilation* [o]
   (cond (sequential? o)
         (flatten (map magic-precompilation* o))
@@ -648,11 +649,7 @@
                          (or (-> o :var direct-nav?)
                              (-> o :sym direct-nav?))))

-          (maybe-direct-nav
-           (:val o)
-           (or (-> o :var direct-nav?)
-               (-> o :sym direct-nav?)
-               (-> o :val direct-nav?))))
+          (:val o))

         (instance? LocalSym o)
         (->DynamicVal (:sym o))
@@ -663,7 +660,8 @@
         (instance? FnInvocation o)
         (let [op (magic-precompilation* (:op o))
               params (doall (map magic-precompilation* (:params o)))]
-          (if (-> op meta :dynamicnav)
+          (if (or (-> op meta :dynamicnav)
+                  (all-static? (conj params op)))
             (apply op params)
             (->DynamicFunction op params)))

@@ -671,61 +669,66 @@
         ;; this handles dynamicval as well
         o))

-
-(defn all-static? [params]
-  (every? (complement dynamic-param?) params))
-
-(declare resolve-magic-code)
-
-(defn resolve-dynamic-fn-arg [o]
+(defn static-combine
+  ([o] (static-combine o true))
+  ([o nav-pos?]
+   (cond (sequential? o)
+         (do
+           (if-not nav-pos?
+             ;; should never happen...
+             (throw-illegal "Cannot statically combine sequential when not in nav pos"))
+           (continuous-subseqs-transform*
+             rich-nav?
+             (doall (map static-combine (flatten o)))
+             (fn [s] [(comp-paths* s)])))
+
+         (instance? DynamicFunction o)
+         (->DynamicFunction
+          (static-combine (:op o) false)
+          (doall (map #(static-combine % false) (:params o))))
+
+         (instance? DynamicPath o)
+         (->DynamicPath (static-combine (:path o)))
+
+         (instance? DynamicVal o)
+         o
+
+         :else
+         (if nav-pos?
+          (coerce-nav o)
+          o))))
+
+
+(declare resolve-nav-code)
+
+(defn resolve-arg-code [o]
   (cond (instance? DynamicFunction o)
-        (let [op (resolve-dynamic-fn-arg (:op o))
-              params (map resolve-dynamic-fn-arg (:params o))]
-          (if (all-static? (conj params op))
-            (apply op params)
-            (->DynamicFunction op params)))
+        (let [op (resolve-arg-code (:op o))
+              params (map resolve-arg-code (:params o))]
+          (maybe-direct-nav
+            `(~(original-obj op) ~@params)
+            (direct-nav? (:op o))))

         (instance? DynamicVal o)
-        o
+        (:code o)

         (instance? DynamicPath o)
-        (let [res (resolve-magic-code o)]
-          (if (rich-nav? res)
-            res
-            (->DynamicVal res)))
+        (resolve-nav-code o)

         :else
         o))

-(defn resolve-dynamic-fn-arg-code [o]
-  (cond (instance? DynamicFunction o)
-        (let [op (resolve-dynamic-fn-arg-code (:op o))
-              params (map resolve-dynamic-fn-arg-code (:params o))]
-          `(~(original-obj op) ~@params))
-
-        (instance? DynamicVal o)
-        (:code o)
-
-        :else
-        (original-obj o)))
-
-
-(defn resolve-magic-code [o]
+
+(defn resolve-nav-code [o]
   (cond
     (instance? DynamicPath o)
     (let [path (:path o)]
       (if (sequential? path)
-        (if (empty? path)
-          STAY*
-          (let [resolved (vec (map resolve-magic-code (flatten path)))
-                combined (continuous-subseqs-transform*
-                          rich-nav?
-                          resolved
-                          (fn [s] [(comp-paths* s)]))]
-            (if (= 1 (count combined))
-              (first combined)
-              `(comp-navs ~@combined))))
-        (resolve-magic-code path)))
+        (let [resolved (vec (map resolve-nav-code path))]
+          (cond (empty? resolved) STAY*
+                (= 1 (count resolved)) (first resolved)
+                :else `(comp-navs ~@resolved)))
+        (resolve-nav-code path)))

     (instance? DynamicVal o)
     (let [code (:code o)]
@@ -739,13 +742,8 @@
             `(coerce-nav ~code)))

     (instance? DynamicFunction o)
-    (let [op (resolve-dynamic-fn-arg (:op o))
-          params (map resolve-dynamic-fn-arg (:params o))]
-      (if (all-static? (conj params op))
-        (coerce-nav (apply op params))
-        (let [code `(~(-> op resolve-dynamic-fn-arg-code original-obj)
-                      ~@(map resolve-dynamic-fn-arg-code params))]
-          (if (direct-nav? op) code `(coerce-nav ~code)))))
+    (let [res (resolve-arg-code o)]
+      (if (direct-nav? res) res `(coerce-nav ~res)))

     :else
     (coerce-nav o)))
@@ -762,35 +760,51 @@

 (def ^:dynamic *DEBUG-INLINE-CACHING* false)

+
+;; TODO: could have a global flag about whether or not to compile and cache static
+;; portions, or whether to compile everything together on each invocation (so that
+;; it can be redefined in repl
 (defn magic-precompilation [path ns-str used-locals-list]
-;  (println "before magic-precompilation*:" path)
   (let [used-locals-set (set used-locals-list)
-        magic-path (magic-precompilation* path)
-;        _ (println "magic-precompilation*" path)
-        ns (find-ns (symbol ns-str))
-        final-code (resolve-magic-code (->DynamicPath magic-path))
-        ;; this handles the case where a dynamicnav ignores a dynamic arg and produces
-        ;; something static instead
-        static? (empty? (used-locals used-locals-set final-code))
-        maker (binding [*ns* ns]
-                (eval+
-;                 (spy
-                  `(fn [~@(if static? [] used-locals-list)]
-                     ~final-code)))]
+        magic-path (-> path magic-precompilation* static-combine)]
     (when *DEBUG-INLINE-CACHING*
       (println "Inline caching debug information")
       (println "--------------------------------")
       (println "Input path:" path "\n")
-      (println "Processed path:" magic-path "\n")
-      (println "Produced code:" final-code))
-    (if static?
-      (->CachedPathInfo false (maker))
-      (->CachedPathInfo true maker))))
-
-
-  ;; TODO: could have a global flag about whether or not to compile and cache static
-  ;; portions, or whether to compile everything together on each invocation (so that
-  ;; it can be redefined in repl
+      (println "Processed path:" magic-path "\n"))
+    (if (rich-nav? magic-path)
+      (do
+        (when *DEBUG-INLINE-CACHING*
+          (println "Static result:" magic-path))
+        (->CachedPathInfo false magic-path))
+      (let [code `(fn [~@used-locals-list]
+                    ~(resolve-nav-code (->DynamicPath magic-path)))
+            ns (find-ns (symbol ns-str))
+            maker (binding [*ns* ns] (eval+ code))]
+
+        (when *DEBUG-INLINE-CACHING*
+          (println "Produced code:" code))
+        (->CachedPathInfo true maker)))))
+
+
+; ;; one of the "possible params"
+; (defrecord LocalParam [idx])
+;
+; ;; statically precomputed
+; (defrecord StaticParam [val])
+;
+; ;; what if instead of doing dynamic binding for the params, it generates code
+; ;; to construct the path
+; ;; TODO: how to parameterize the static/local params?... that could be dynamic binding
+; ;; or this makes a function that takes in static + local params, and it executes all arguments with those...
+; ;; (fn-3 comp-navs (static-param 2) (static-param 3) (local-param 0))
+;
+; ;; TODO: redo code to:
+; ;;   - do magic-precompilation* for initial resolve
+; ;;   - compile static parameters together as much as possible
+;
+; (defn magic-precompilation-cljs [path ns-str used-locals-list possible-params])
+

 (defn compiled-setval* [path val structure]


Tweaked to output iso code along with existing fields for Vizzuality

--- src/clj/forma/hadoop/jobs/cdm.clj
+++ src/clj/forma/hadoop/jobs/cdm.clj
@@ -1,6 +1,8 @@
 (ns forma.hadoop.jobs.cdm
   "Functions and Cascalog queries for converting data into map tile coordinates."
   (:use [cascalog.api]
+        [cartodb.playground :only (insert-rows delete-all)]
+        [forma.source.gadmiso :only (gadm->iso)]
         [forma.gfw.cdm :only (latlon->tile, read-latlon, latlon-valid?)]
         [forma.utils :only (positions)])
   (:require [forma.postprocess.output :as o]
@@ -8,7 +10,6 @@
             [forma.date-time :as date]
             [cascalog.ops :as c]))

-;; TODO: https://github.com/reddmetrics/forma-clj/pull/16#r782582
 (defbufferop min-period
   "Returns the minimum value in tuples."
   [tuples]
@@ -23,9 +24,7 @@
     series - A vector of numbers.

   Example usage:
-    > (first-hit 5 [1 2 3 4 5 6 7 8 9 10])
-    > 4
-  "
+    (first-hit 5 [1 2 3 4 5 6 7 8 9 10]) => 4"
   [thresh series]
   (first (positions (partial <= thresh) series)))

@@ -53,15 +52,18 @@
   Arguments:
     start - Start period date string.
     src - The source tap for FORMA data.
+    gadm-src - a sequence file source with mod-h, mod-v, sample, line, and gadm
     thresh - The threshold number for valid detections.
     tres - The temporal resolution as a string.
     tres-out - The output temporal resolution as a string.
     zoom - The map zoom level."
-  [src zoom tres tres-out start thresh]
+  [src gadm-src zoom tres tres-out start thresh]
   (let [epoch (date/datetime->period tres-out "2000-01-01")
         start-period (date/datetime->period tres start)]
-    (<- [?x ?y ?z ?p]
+    (<- [?x ?y ?z ?p ?iso ?lat ?lon]
         (src ?sres ?modh ?modv ?s ?l ?prob-series)
+        (gadm-src _ ?modh ?modv ?s ?l ?gadm)
+        (gadm->iso ?gadm :> ?iso)
         (o/clean-probs ?prob-series :> ?clean-series)
         (first-hit thresh ?clean-series :> ?first-hit-idx)
         (+ start-period ?first-hit-idx :> ?period)
@@ -69,5 +71,5 @@
         (- ?period-new-res epoch :> ?rp)
         (min-period ?rp :> ?p)
         (r/modis->latlon ?sres ?modh ?modv ?s ?l :> ?lat ?lon)
-        (latlon-valid? ?lat ?lon) ;; Skip if lat/lon invalid.
+        (latlon-valid? ?lat ?lon)
         (latlon->tile ?lat ?lon zoom :> ?x ?y ?z))))


Firebase, android-spesific notifications

--- src/clj/salava/firebase/async.clj
+++ src/clj/salava/firebase/async.clj
@@ -75,7 +75,7 @@
          :image (png-convert-url ctx image)
          :body (str (:name badge) " " (t :badge/fromissuer lang) " " (:name issuer))}

-        {:title "You got a new Open Badge!"
+        {:title "You got a new open badge!"
          :body "Click here to see it."}))))

 (defn new-badge-notification [ctx input]
@@ -88,9 +88,15 @@
       (doseq [chunk (partition-all 100 emails)]
         (let [body (->> (select-firebase-tokens-by-emails {:emails chunk} (u/get-db ctx))
                         (map (fn [user]
-                               (http-batch-message auth url {:message
-                                                             {:token (:firebase_token user)
-                                                              :notification (content (:language user))}})))
+                               (http-batch-message
+                                 auth url
+                                 {:message
+                                  {:token (:firebase_token user)
+                                   :notification (content (:language user))
+                                   :android {:notification (merge {:default_sound true
+                                                                   :default_vibrate_timings true
+                                                                   :default_light_settings true}
+                                                                  (content (:language user)))}}})))
                         (apply str))]

           (http/http-post


Include current build url and number in airbrakes. Fixes #55

--- src/circle/backend/build/run.clj
+++ src/circle/backend/build/run.clj
@@ -5,6 +5,7 @@
   (:require [circle.env :as env])
   (:require [clj-time.core :as time])
   (:use circle.util.straight-jacket)
+  (:use [circle.globals :only (*current-build-url* *current-build-number*)])
   (:require [circle.backend.action :as action])
   (:use [circle.backend.action.nodes :only (cleanup-nodes)])
   (:require [circle.backend.build.config :as config])
@@ -76,33 +77,36 @@
      false)
     true))

+
 (defn run-build [b & {:keys [cleanup-on-failure]
                       :or {cleanup-on-failure true}}]
-  (try
-    (start b)
-    (build/with-build-log-ns b
-      (when (should-run-build? b)
-        (do-build* b)))
-    b
-    (catch Exception e
-      (println "run-build: except:" b e)
-      (error e (format "caught exception on %s" (build/build-name b)))
-      (println "assoc'ing failed=true")
-      (dosync
-       (alter b assoc :failed true)
-       (alter b assoc :infrastructure_fail true))
-      (throw e))
-    (finally
-     (finished b)
+  (binding [*current-build-url* (-> @b :build_url)
+            *current-build-number* (-> @b :build_num)]
+    (straight-jacket
+     (try
+       (start b)
+       (build/with-build-log-ns b
+         (when (should-run-build? b)
+           (do-build* b)))
+       b
+       (catch Exception e
+         (println "run-build: except:" b e)
+         (error e (format "caught exception on %s" (build/build-name b)))
+         (dosync
+          (alter b assoc :failed true)
+          (alter b assoc :infrastructure_fail true))
+         (throw e))
+       (finally
+        (finished b)

-      ;; Send build notifications, but don't let it fuck up anbything else.
-     (straight-jacket
-      (when (should-run-build? b)
-        (notify/notify-build-results b)))
+        ;; Send build notifications, but don't let it fuck up anything else.
+        (straight-jacket
+         (when (should-run-build? b)
+           (notify/notify-build-results b)))

-     (log-result b)
-     (when (and (-> @b :failed) cleanup-on-failure)
-       (cleanup-nodes b)))))
+        (log-result b)
+        (when (and (-> @b :failed) cleanup-on-failure)
+          (cleanup-nodes b)))))))

 (defn configure
   "Makes sure the build has run it's configure step (if it has one). Mainly a convenience for testing."


Support negative values for em

Support negative values for em

--- src/clj_simple_chart/opentype.clj
+++ src/clj_simple_chart/opentype.clj
@@ -127,6 +127,7 @@

 (defn em-to-number [font-size em-str]
   (cond
+    (.startsWith em-str "-") (- (em-to-number font-size (subs em-str 1)))
     (.startsWith em-str ".") (recur font-size (str "0" em-str))
     :else (* font-size (read-string (string/replace em-str "em" "")))))


Extract common operations into functions

--- src/cljs/asciinema_player/vt.cljs
+++ src/cljs/asciinema_player/vt.cljs
@@ -62,6 +62,14 @@

 ;; helper functions

+(defn show-cursor
+  ([vt] (show-cursor vt true))
+  ([vt show?]
+   (assoc-in vt [:cursor :visible] show?)))
+
+(defn set-margin [vt top bottom]
+  (assoc vt :top-margin top :bottom-margin bottom))
+
 (defn scroll-up [{:keys [width top-margin bottom-margin char-attrs] :as vt}]
   (update-in vt [:lines] (fn [lines]
                            (vec (concat
@@ -373,7 +381,7 @@
            [nil 4] (assoc vt :insert-mode true)
            [0x3f 6] (-> vt (assoc :origin-mode true) move-cursor-to-home)
            [0x3f 7] (assoc vt :auto-wrap-mode true)
-           [0x3f 25] (assoc-in vt [:cursor :visible] true)
+           [0x3f 25] (show-cursor vt)
            :else vt)))

 (defn execute-rm [vt]
@@ -383,7 +391,7 @@
            [nil 4] (assoc vt :insert-mode false)
            [0x3f 6] (-> vt (assoc :origin-mode false) move-cursor-to-home)
            [0x3f 7] (assoc vt :auto-wrap-mode false)
-           [0x3f 25] (assoc-in vt [:cursor :visible] false)
+           [0x3f 25] (show-cursor vt false)
            :else vt)))

 (defn reset-attrs [vt]
@@ -429,13 +437,12 @@
 (defn execute-decstr [{:keys [height] :as vt}]
   (if (= (get-intermediate vt 0) 0x21)
     (-> vt
+        show-cursor
+        (set-margin 0 (dec height))
         (assoc :insert-mode false
                :origin-mode false
                :char-attrs {}
-               :top-margin 0
-               :bottom-margin (dec height)
-               :saved initial-saved-cursor)
-        (assoc-in [:cursor :visible] true))
+               :saved initial-saved-cursor))
     vt))

 (defn execute-decstbm [{:keys [height] :as vt}]
@@ -443,7 +450,7 @@
         bottom (dec (get-param vt 1 height))]
     (if (< -1 top bottom height)
       (-> vt
-          (assoc :top-margin top :bottom-margin bottom)
+          (set-margin top bottom)
           move-cursor-to-home)
       vt)))


leave bug for future fix

leave bug for future fix

--- src/cljs/embodier/canvasdraw.cljs
+++ src/cljs/embodier/canvasdraw.cljs
@@ -98,7 +98,7 @@
   [layers dom-id current-layer req-id]
   (let [dom (.getElementById js/document dom-id)
         ;when (nth layers 0), index out of bounce
-        _ (d "current-layer:" (nth @layers 0))
+        ;_ (d "current-layer:" (nth @layers 0))
         center-point (get-center (nth @layers @current-layer))
         render #(.render renderer scene camera)
         control (trackball-control camera render dom)


Only open recognized file extensions

Only open recognized file extensions

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -35,22 +35,35 @@
 (def ^:const styles {"clj" SyntaxConstants/SYNTAX_STYLE_CLOJURE
                      "cljs" SyntaxConstants/SYNTAX_STYLE_CLOJURE
                      "js" SyntaxConstants/SYNTAX_STYLE_JAVASCRIPT
-                     "java" SyntaxConstants/SYNTAX_STYLE_JAVA})
+                     "java" SyntaxConstants/SYNTAX_STYLE_JAVA
+                     "xml" SyntaxConstants/SYNTAX_STYLE_XML
+                     "html" SyntaxConstants/SYNTAX_STYLE_HTML
+                     "css" SyntaxConstants/SYNTAX_STYLE_CSS
+                     "json" SyntaxConstants/SYNTAX_STYLE_NONE
+                     "md" SyntaxConstants/SYNTAX_STYLE_NONE})
+
+(defn get-extension
+  [path]
+  (->> (.lastIndexOf path ".")
+       (+ 1)
+       (subs path)
+       clojure.string/lower-case))

 (defn get-syntax-style
   [path]
-  (let [ext (->> (.lastIndexOf path ".")
-                 (+ 1)
-                 (subs path))]
-    (if (contains? styles ext)
-      (get styles ext)
-      SyntaxConstants/SYNTAX_STYLE_NONE)))
+  (or (get styles (get-extension path))
+      SyntaxConstants/SYNTAX_STYLE_NONE))
+
+(defn should-open?
+  [path]
+  (contains? styles (get-extension path)))

 (defn show-editor
   [path]
   (let [editor-pane (s/select @utils/ui-root [:#editor-pane])]
     ; create new editor if necessary
     (when (and (.isFile (java.io/file path))
+               (should-open? path)
                (not (contains? @editors path)))
       (let [text-area (org.fife.ui.rsyntaxtextarea.RSyntaxTextArea.)
             text-area-scroll (org.fife.ui.rtextarea.RTextScrollPane. text-area)


Use alphabetical order

Use alphabetical order

--- src/clojure/nightcode/editors.clj
+++ src/clojure/nightcode/editors.clj
@@ -291,8 +291,8 @@
                      "lua"        SyntaxConstants/SYNTAX_STYLE_LUA
                      "makefile"   SyntaxConstants/SYNTAX_STYLE_MAKEFILE
                      "markdown"   SyntaxConstants/SYNTAX_STYLE_NONE
+                     "md"         SyntaxConstants/SYNTAX_STYLE_NONE
                      "mustache"   SyntaxConstants/SYNTAX_STYLE_NONE
-                     "md"         SyntaxConstants/SYNTAX_STYLE_NONE
                      "pas"        SyntaxConstants/SYNTAX_STYLE_DELPHI
                      "properties" SyntaxConstants/SYNTAX_STYLE_PROPERTIES_FILE
                      "php"        SyntaxConstants/SYNTAX_STYLE_PHP


fix duplicate fn

fix duplicate fn

--- src/clojure/tcp_driver/driver.clj
+++ src/clojure/tcp_driver/driver.clj
@@ -171,6 +171,6 @@
       (routing/-blacklist! routing-policy host))

-(defn blacklist-host [{:keys [routing-policy]} host]
+(defn blacklisted? [{:keys [routing-policy]} host]
       {:pre [(s/validate tcp-conn/HostAddressSchema host)]}
       (routing/-blacklisted? routing-policy host))


refine middleware exception handling

refine middleware exception handling

--- src/clj/clj_money/middleware.clj
+++ src/clj/clj_money/middleware.clj
@@ -1,7 +1,9 @@
 (ns clj-money.middleware
   (:refer-clojure :exclude [update])
   (:require [clojure.pprint :refer [pprint]]
+            [ring.util.response :refer [response status header]]
             [environ.core :refer [env]]
+            [cheshire.core :as json]
             [slingshot.slingshot :refer [try+]]
             [clj-money.models.entities :as entities]
             [clj-money.models.accounts :as accounts]))
@@ -57,10 +59,22 @@
     (try+
       (handler request)
       (catch [:type :clj-money.models/not-found] error-data
-        {:status 404
-         :headers {}
-         :body "not found"})
+        (-> (json/generate-string {:message "not found"})
+            response
+            (status 404)
+            (header "Content-Type" "application/json"))) ; TODO respond with content type according to accept header
+      (catch [:type :clj-money.authorization/no-rules] error-data
+        (-> (json/generate-string {:message "no authorization rules"})
+            response
+            (status 500)
+            (header "Content-Type" "application/json")))
       (catch [:type :clj-money.authorization/unauthorized] error-data
-        {:status 404
-         :headers {}
-         :body "not found"})))) ; TODO create a full not-found page
+        (if (env :show-error-messages?)
+          (-> (json/generate-string {:message "unauthorized"})
+              response
+              (status 403)
+              (header "Content-Type" "application/json"))
+          (-> (json/generate-string {:message "not found"})
+              response
+              (status 404)
+              (header "Content-Type" "application/json"))))))) ; TODO create a full not-found page


Reindent web-app

Reindent web-app

--- src/clj/comic_reader/web_app.clj
+++ src/clj/comic_reader/web_app.clj
@@ -47,30 +47,30 @@

 (defn- make-routes [site-scraper]
   (c/routes
-   (c/GET "/" []
-     (render-page
-      :content
-      [[:div.row
-        [:div#app.small-12.columns]]
-       [:input#history_state {:type "hidden"}]]
-      :js [(page/include-js "js/compiled/main.js")]))
+    (c/GET "/" []
+      (render-page
+       :content
+       [[:div.row
+         [:div#app.small-12.columns]]
+        [:input#history_state {:type "hidden"}]]
+       :js [(page/include-js "js/compiled/main.js")]))

-   (c/GET "/devcards" []
-     (render-page
-      :content
-      [[:div.row
-        [:div#cards.small-12.columns]]]
-      :css [[:style (garden/css
-                     [:.com-rigsomelight-devcards_rendered-card
-                      [:a.button {:color "#FFF !important"}]])]]
-      :js [(page/include-js "js/compiled/devcards.js")]))
+    (c/GET "/devcards" []
+      (render-page
+       :content
+       [[:div.row
+         [:div#cards.small-12.columns]]]
+       :css [[:style (garden/css
+                      [:.com-rigsomelight-devcards_rendered-card
+                       [:a.button {:color "#FFF !important"}]])]]
+       :js [(page/include-js "js/compiled/devcards.js")]))

-   (c/context "/api/v1" []
-     (-> (make-api-routes site-scraper)
-         wrap-params
-         wrap-edn-params))
+    (c/context "/api/v1" []
+      (-> (make-api-routes site-scraper)
+          wrap-params
+          wrap-edn-params))

-   (route/resources "/")))
+    (route/resources "/")))

 (defrecord WebApp [routes site-scraper]
   component/Lifecycle


fix Fan Site to be forfeitable

fix Fan Site to be forfeitable

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -138,8 +138,8 @@
                 {:effect (effect (trash card {:cause :ability-cost}) (gain :credit 2)) :msg "gain 2 [Credits]"}]}

    "Fan Site"
-   {:events {:agenda-scored {:msg "add it to the Runner's score area"
-                             :effect (effect (move :runner card :scored))}}}
+   {:events {:agenda-scored {:msg "add it to their score area as an agenda worth 0 agenda points"
+                             :effect (effect (as-agenda :runner card 0))}}}

    "Fester"
    {:events {:purge {:msg "force the Corp to lose 2 [Credits] if able"


:msg for Safety First

:msg for Safety First

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -470,6 +470,7 @@
    {:effect (effect (lose :runner :max-hand-size 2))
     :leave-play (effect (gain :runner :max-hand-size 2))
     :events {:runner-turn-ends {:req (req (< (count (:hand runner)) (:max-hand-size runner)))
+                                :msg (msg "draw a card")
                                 :effect (effect (draw 1))}}}

    "Same Old Thing"


Hosting a zero cost program or hardware on Personal Workshop will now immediately install it.

--- src/clj/game/cards-resources.clj
+++ src/clj/game/cards-resources.clj
@@ -352,7 +352,9 @@
                    :choices {:req #(and (#{"Program" "Hardware"} (:type %))
                                         (= (:zone %) [:hand])
                                         (= (:side %) "Runner"))}
-                   :effect (effect (host card (assoc target :counter (:cost target))))
+                   :effect (req (if (zero? (:cost target))
+                                  (runner-install state side target)
+                                  (host state side card (assoc target :counter (:cost target)))))
                    :msg (msg "host " (:title target) "")}
                   (assoc remove-counter
                          :label "Remove 1 counter from a hosted card" :cost [:credit 1])]