clean up time

clean up time

--- src/cljx/jamesmacaulay/zelkova/time.cljx
+++ src/cljx/jamesmacaulay/zelkova/time.cljx
@@ -20,12 +20,12 @@
 (def minute (* 60 second))
 (def hour (* 60 minute))

-(defn in-milliseconds [n] (/ n millisecond))
-(defn in-seconds [n] (/ n second))
-(defn in-minutes [n] (/ n minute))
-(defn in-hours [n] (/ n hour))
+(defn in-milliseconds [ms] ms)
+(defn in-seconds [ms] (/ ms second))
+(defn in-minutes [ms] (/ ms minute))
+(defn in-hours [ms] (/ ms hour))

-(defn fps-channel-fn
+(defn- fps-channel-fn
   [n]
   (fn [graph opts]
     (let [ms-per-frame (/ 1000 n)
@@ -40,10 +40,13 @@
       out)))

 (defn fps
+  "Takes desired number of frames per second (fps). The resulting signal gives
+  a sequence of time deltas as quickly as possible until it reaches the desired
+  FPS. A time delta is the time between the last frame and the current frame."
   [n]
   (z/input 0 [::fps n] (fps-channel-fn n)))

-(defn every-channel-fn
+(defn- every-channel-fn
   [ms]
   (fn [graph opts]
     (let [out (async/chan)]
@@ -56,6 +59,8 @@
       out)))

 (defn every
+  "Takes a time interval `ms`. The resulting signal is the current time, updated
+  every `ms` milliseconds."
   [ms]
   (z/input (t/now) [::every ms] (every-channel-fn ms)))

@@ -64,6 +69,10 @@
         impl/value))

 (defn timestamp
+  "Add a timestamp to any signal. Returns a signal of `[timestamp value]`
+  vectors. Timestamps are tied to the origin events of a signal value, so
+  `(timestamp mouse/x)` and `(timestamp mouse/y)` will always have the same
+  timestamp because they rely on the same underlying event (`mouse/position`)."
   [sig]
   (impl/make-signal {:init [0 (impl/init sig)]
                      :sources [sig]
@@ -73,6 +82,7 @@

 #+cljs
 (defn delay
+  "Delay a signal by `ms` milliseconds."
   [ms sig]
   (z/splice (fn [to from]
               (let [waiting (async/chan (+ 1000 ms))
@@ -90,6 +100,8 @@

 #+cljs
 (defn since
+  "Returns a signal of boolean values: true when `sig` has updated in the past
+  `ms` milliseconds, false otherwise."
   [ms sig]
   (let [start (z/map (constantly 1) sig)
         stop (z/map (constantly -1) (delay ms sig))
@@ -98,6 +110,10 @@

 #+cljs
 (defn debounce
+  "Returns a signal which relays the latest value from `sig` only after `ms`
+  milliseconds have passed since `sig` last updated. Useful when you want to
+  wait until a user stops typing before doing something with the text, for
+  example."
   [ms sig]
   (let [timeouts (->> sig (since ms) (z/keep-if not false))]
     (->> sig (z/sample-on timeouts))))


change property name

change property name

--- frontend/analytics.cljs
+++ frontend/analytics.cljs
@@ -118,4 +118,4 @@
   (mixpanel/track "View Page" {:zone zone :title js/document.title :url js/location.href}))

 (defn track-link-clicked [target]
-  (mixpanel/track "Track Link Clicked" {:target target}))
+  (mixpanel/track "Track Link Clicked" {:link-class target}))


Improve REPL experience; add disable-load/unload

* Print namespaces which will be reloaded
* Lock the tracker during updates
* Allow namespaces to opt-out of unloading/reloading

--- src/main/clojure/clojure/tools/namespace/repl.clj
+++ src/main/clojure/clojure/tools/namespace/repl.clj
@@ -25,11 +25,43 @@
         e)
     :ok))

-(defn- do-refresh [f]
-  (let [current-ns (ns-name *ns*)]
-    (alter-var-root #'refresh-tracker f)
-    (print-and-return refresh-tracker)
-    (in-ns current-ns)))
+(defn- print-pending-reloads [tracker]
+  (prn :reloading (::track/load tracker)))
+
+(defn- load-disabled? [sym]
+  (false? (::load (meta (find-ns sym)))))
+
+(defn- unload-disabled? [sym]
+  (or (false? (::unload (meta (find-ns sym))))
+      (load-disabled? sym)))
+
+(defn- remove-disabled [tracker]
+  (-> tracker
+      (update-in [::track/unload] #(remove unload-disabled? %))
+      (update-in [::track/load] #(remove load-disabled? %))))
+
+(defn- do-refresh [scan-fn]
+  (locking #'refresh-tracker
+    (let [current-ns (ns-name *ns*)]
+      (alter-var-root #'refresh-tracker scan-fn)
+      (alter-var-root #'refresh-tracker remove-disabled)
+      (print-pending-reloads refresh-tracker)
+      (alter-var-root #'refresh-tracker reload/track-reload)
+      (print-and-return refresh-tracker)
+      (in-ns current-ns))))
+
+(defn disable-unload!
+  "Adds metadata to namespace (or *ns* if unspecified) telling
+  'refresh' not to unload it. The namespace may still be reloaded, it
+  just won't be removed first."
+  ([] (disable-unload! *ns*))
+  ([namespace] (alter-meta! namespace assoc ::unload false)))
+
+(defn disable-reload!
+  "Adds metadata to namespace (or *ns* if unspecified) telling
+  'refresh' not to load it. Implies disable-unload! also."
+  ([] (disable-reload! *ns*))
+  ([namespace] (alter-meta! namespace assoc ::load false)))

 (defn refresh
   "Scans source code directories for files which have changed (since
@@ -40,7 +72,7 @@
   The directories to be scanned are controlled by 'set-refresh-dirs';
   defaults to all directories on the Java classpath."
   []
-  (do-refresh #(-> % dir/scan reload/track-reload)))
+  (do-refresh dir/scan))

 (defn refresh-all
   "Scans source code directories for all Clojure source files and
@@ -49,7 +81,7 @@
   The directories to be scanned are controlled by 'set-refresh-dirs';
   defaults to all directories on the Java classpath."
   []
-  (do-refresh #(-> % dir/scan-all reload/track-reload)))
+  (do-refresh dir/scan-all))

 (defn set-refresh-dirs
   "Sets the directories which are scanned by 'refresh'. Supports the


make-single-file-name function does real work now.

--- nav-obj-splitter.clj
+++ nav-obj-splitter.clj
@@ -25,12 +25,14 @@
         name (nth matches 3)]
     {:type-id (type-id type) :type type :id id :name name}))

-(defn make-single-file-name [{type-id :type-id type :type id :id}]
-  "1-Table-100-Test Table")
+(defn make-single-file-name [object-metadata]
+  (let [type-id (:type-id object-metadata)
+        type (:type object-metadata)
+        id (:id object-metadata)
+        file-name (join "-" [type-id, type, id])]
+    (join [file-name ".txt"])))

-(defn make-single-file-name []
-  (+ "1" "test"))

-(join ["1" "test"])
-(join "-" ["1" "test"])
 (parse-first-line "Table 100 Test Table")
+(def objmeta (parse-first-line "Table 100 Test Table"))
+(make-single-file-name objmeta)


remove filename*= portion of Content-Disposition header. Looks like utf8 characters still work as-expected when sent through filename anyway.

--- src/vignette/util/image_response.clj
+++ src/vignette/util/image_response.clj
@@ -35,8 +35,7 @@
         (header "Content-Length" (content-length image))
         (cond->
           (:original image-map) (header "Content-Disposition"
-                                        (format "inline; filename=\"%s\"; filename*=utf-8' '%s"
-                                                (:original image-map)
+                                        (format "inline; filename=\"%s\""
                                                 (:original image-map))))))
   ([image]
     (create-image-response image nil)))


[CS] Use a table directly in `column-names`

--- src/vip/data_processor/db/sqlite.clj
+++ src/vip/data_processor/db/sqlite.clj
@@ -55,11 +55,11 @@
 (defn column-names
   "Find the names of all columns for a table. Uses a JDBC connection
   directly."
-  [db table]
-  (let [url (str "jdbc:sqlite:" (:db db))]
+  [table]
+  (let [url (str "jdbc:sqlite:" (get-in table [:db :db]))]
     (with-open [conn (java.sql.DriverManager/getConnection url)]
       (let [statement (.createStatement conn)
-            result-set (.executeQuery statement (str "PRAGMA table_info(" table ")"))]
+            result-set (.executeQuery statement (str "PRAGMA table_info(" (:name table) ")"))]
         (loop [columns []]
           (if (.next result-set)
             (recur (conj columns (.getString result-set "name")))


State import no longer needed

State import no longer needed

--- src/deferst/system.cljc
+++ src/deferst/system.cljc
@@ -15,12 +15,7 @@
    #?(:clj [cats.labs.manifold :as dm]
       :cljs [cats.labs.promise :as pm])
    #?(:clj [manifold.deferred :as d]
-      :cljs [promesa.core :as p]))
-
-  #?(:clj
-     (:import
-      [cats.labs.state State]))
-  )
+      :cljs [promesa.core :as p])))

 ;; the monad context - the monadic values are
 ;; (fn [state :- SystemStateSchema] :- Deferred<[Any SystemStateSchema]>)


DRY up category_creation.

DRY up category_creation.

--- test/fcms/unit/resources/taxonomy/category_creation.clj
+++ test/fcms/unit/resources/taxonomy/category_creation.clj
@@ -15,50 +15,42 @@
       (create-category "not-here" "/t/new" "New") => :bad-collection)

     (fact "with a bad taxonomy"
-      (create-category e "not-here/new") => :bad-taxonomy
-      (create-category e "not-here/new/") => :bad-taxonomy
-      (create-category e "/not-here/new") => :bad-taxonomy
-      (create-category e "/not-here/new/") => :bad-taxonomy
-      (create-category e "not-here/new" "New") => :bad-taxonomy
-      (create-category e "not-here/new/" "New") => :bad-taxonomy
-      (create-category e "/not-here/new" "New") => :bad-taxonomy
-      (create-category e "/not-here/new/" "New") => :bad-taxonomy)
+      (doseq [category ["not-here/new" "not-here/new/"
+                        "/not-here/new" "/not-here/new/"]]
+        (create-category e category) => :bad-taxonomy
+        (create-category e category "New") => :bad-taxonomy))

     (fact "with a bad name"
-       (create-category e "/t/new" nil) => :invalid-category-name
-       (create-category e "/t/new" "") => :invalid-category-name
-       (create-category e "/t/new" 42) => :invalid-category-name)
+      (doseq [name [nil "" "  " "\n" "\r\n\t\n" 42]]
+        (create-category e "/t/new" name) => :invalid-category-name))

-    (fact "with a bad category slug"
-      (create-category e "t/new/sl ug/new") => :invalid-category-slug
-      (create-category e "t/new/sl ug/new/") => :invalid-category-slug
-      (create-category e "/t/new/sl ug/new") => :invalid-category-slug
-      (create-category e "/t/new/sl ug/new/") => :invalid-category-slug
-
-      (create-category e "t/new/s!ug/new") => :invalid-category-slug
-      (create-category e "t/new/s!ug/new/") => :invalid-category-slug
-      (create-category e "/t/new/s!ug/new") => :invalid-category-slug
-      (create-category e "/t/new/s!ug/new/") => :invalid-category-slug
-
-      (create-category e "t/new/slüg/new") => :invalid-category-slug
-      (create-category e "t/new/slüg/new/") => :invalid-category-slug
-      (create-category e "/t/new/slüg/new") => :invalid-category-slug
-      (create-category e "/t/new/slüg/new/") => :invalid-category-slug
-
-      (create-category e "t/new/sluG/new") => :invalid-category-slug
-      (create-category e "t/new/sluG/new/") => :invalid-category-slug
-      (create-category e "/t/new/sluG/new") => :invalid-category-slug
-      (create-category e "/t/new/sluG/new/") => :invalid-category-slug
-
-      (create-category e "t/new/-slug/new") => :invalid-category-slug
-      (create-category e "t/new/-slug/new/") => :invalid-category-slug
-      (create-category e "/t/new/-slug/new") => :invalid-category-slug
-      (create-category e "/t/new/-slug/new/") => :invalid-category-slug
-
-      (create-category e "t/new/sl--ug/new") => :invalid-category-slug
-      (create-category e "t/new/sl--ug/new/") => :invalid-category-slug
-      (create-category e "/t/new/sl--ug/new") => :invalid-category-slug
-      (create-category e "/t/new/sl--ug/new/") => :invalid-category-slug))
+    (tabular (fact "with a bad category slug"
+      (create-category e ?slug) => :invalid-category-slug)
+      ?slug
+      "t/new/sl ug/new"
+      "t/new/sl ug/new/"
+      "/t/new/sl ug/new"
+      "/t/new/sl ug/new/"
+      "t/new/s!ug/new"
+      "t/new/s!ug/new/"
+      "/t/new/s!ug/new"
+      "/t/new/s!ug/new/"
+      "t/new/slüg/new"
+      "t/new/slüg/new/"
+      "/t/new/slüg/new"
+      "/t/new/slüg/new/"
+      "t/new/sluG/new"
+      "t/new/sluG/new/"
+      "/t/new/sluG/new"
+      "/t/new/sluG/new/"
+      "t/new/-slug/new"
+      "t/new/-slug/new/"
+      "/t/new/-slug/new"
+      "/t/new/-slug/new/"
+      "t/new/sl--ug/new"
+      "t/new/sl--ug/new/"
+      "/t/new/sl--ug/new"
+      "/t/new/sl--ug/new/"))

   (facts "about creating categories 1 level at a time"


Replace typed env values with strings

Replace typed env values with strings

Using typed values in the project.clj env map can produce subtle bugs
that only appear after development when the app is deployed. The env map
will only contain strings when deployed, since it will be populated via
environment variables or system properties. Including typed values in
the project.clj can cause apps to use env map values without parsing
them correctly.

We should try to make it as clear as possible that the way environ
works effectively dictates that env maps should only contain strings.

--- src/leiningen/new/mr_clojure/project.clj
+++ src/leiningen/new/mr_clojure/project.clj
@@ -34,27 +34,27 @@
             [lein-release "1.0.5"]
             [lein-ring "0.8.12"]]

-  :env {:auto-reload true
+  :env {:auto-reload "true"
         :environment-name "poke"
-        :graphite-enabled false
+        :graphite-enabled "false"
         :graphite-host ""
-        :graphite-port 2003
-        :graphite-post-interval-seconds 60
+        :graphite-port "2003"
+        :graphite-post-interval-seconds "60"
         :logging-consolethreshold "info"
         :logging-filethreshold "info"
         :logging-level "info"
         :logging-path "/tmp"
         :logging-stashthreshold "off"
-        :production false
-        :requestlog-enabled false
-        :requestlog-retainhours 24
-        :restdriver-port 8081
+        :production "false"
+        :requestlog-enabled "false"
+        :requestlog-retainhours "24"
+        :restdriver-port "8081"
         :service-name "{{name}}"
-        :service-port 8080
+        :service-port "8080"
         :service-url "http://localhost:%s"
-        :shutdown-timeout-millis 5000
-        :start-timeout-seconds 120
-        :threads 254}
+        :shutdown-timeout-millis "5000"
+        :start-timeout-seconds "120"
+        :threads "254"}

   :lein-release {:deploy-via :shell
                  :shell ["lein" "do" "clean," "uberjar," "pom," "rpm"]}


Pretty-print floating point numbers

Pretty-print floating point numbers

--- src/main/hbase_region_inspector/core.clj
+++ src/main/hbase_region_inspector/core.clj
@@ -56,7 +56,8 @@
       :compaction               ["Compaction" (apply format "%d / %d" val)]
       :used-heap-mb             ["Used heap" (str val " MB")]
       :max-heap-mb              ["Max heap" (str val " MB")]
-      [(util/keyword->str (str type)) val])))
+      [(util/keyword->str (str type))
+       (if (instance? Number val) (rate val) val)])))

 (defn build-region-popover
   "Builds a small HTML snippet for each region to be used in bootstrap popover"


1.3-ifying examples.sextic

1.3-ifying examples.sextic

--- src/examples/sextic.clj
+++ src/examples/sextic.clj
@@ -3,8 +3,8 @@
 ;; Lee Spector, lspector@hampshire.edu, 2010

 (ns examples.sextic
-  (:require [clojush] [clojure.contrib.math])
-  (:use [clojush] [clojure.contrib.math]))
+  (:use [clojush]
+	[clojure.math.numeric-tower]))

 ;;;;;;;;;;;;
 ;; Floating point symbolic regression of the "sextic polynomial" y=x^6-2x^4+x^2. This uses


Sort maps

Sort maps

--- src/datafrisk/core.cljs
+++ src/datafrisk/core.cljs
@@ -79,7 +79,7 @@
 (defn KeySet [keyset]
   [:span
    (->> keyset
-        (sort-by (partial str))
+        (sort-by str)
         (map-indexed
           (fn [i data] ^{:key i} [:span
                                   (cond (nil? data) [NilText]
@@ -236,7 +236,9 @@
          [:span "}"]]])
      (when expanded?
        [:div {:style {:flex "0 1 auto" :paddingLeft "20px"}}
-        (map-indexed (fn [i x] ^{:key i} [KeyValNode (assoc all :data x)]) data)])]))
+        (->> data
+             (sort-by (fn [[k _]] (str k)))
+             (map-indexed (fn [i x] ^{:key i} [KeyValNode (assoc all :data x)])))])]))

 (defn DataFrisk [{:keys [data] :as all}]
   (cond (map? data) [MapNode all]


Remove the 'flip page' button.

Remove the 'flip page' button.

--- src-cljs/pepa/components/page.cljs
+++ src-cljs/pepa/components/page.cljs
@@ -40,8 +40,6 @@
       [:.rotate
        [:.right {:on-click (partial rotate-clicked page (+ rotation 90))
                  :title "Rotate Clockwise"}]
-       [:.flip.vertical {:on-click (partial rotate-clicked page (+ rotation 180))
-                         :title "Flip Vertical"}]
        [:.left  {:on-click (partial rotate-clicked page (- rotation 90))
                  :title "Rotate Counterclockwise"}]]))))


Removes "Dependencies, Conjuntions, Disjunctions".

Seems not to be used.

--- src/active/clojure/match.clj
+++ src/active/clojure/match.clj
@@ -1183,74 +1183,3 @@
   [event & args]
   `((matcher ~@args) ~event))

-;; FIXME: Is this used/needed?
-(define-record-type Dependency
-  (make-dependency path matcher for-pattern) dependency?
-  [^{:doc "The path that this [[Dependency]] has a restriction on."}
-   path dependency-path
-   ^{:doc "The matcher that must be successful for the `path`."}
-   matcher dependency-matcher
-   ^{:doc "The [[Pattern]] that depends on this."}
-   for-pattern dependency-for-pattern])
-
-(defn clause->dependency
-  [pattern clause]
-  (make-dependency
-   (lens/yank clause (path-lens clause))
-   (lens/yank clause (matcher-lens clause))
-   pattern))
-
-(defn pattern->dependencies
-  [pattern]
-  (mapv (partial clause->dependency pattern) (pattern-clauses pattern)))
-
-(defn dependencies->graph
-  [dependencies]
-  (reduce (fn [acc dependency]
-            (update acc
-                    [(dependency-path dependency)
-                         (dependency-matcher dependency)]
-                    conj
-                    (dependency-for-pattern dependency)))
-
-          {}
-          dependencies))
-
-;;;; Compose patterns. A composition of patterns is one of the following
-;; - A pattern
-;; - A conjunction of two compositions
-;; - A disjunction of two compositions
-
-(define-record-type Conjunction
-  (make-conjunction comp-1 comp-2) conjunction?
-  [comp-1 conjunction-comp-1
-   comp-2 conjunction-comp-2])
-
-(defn conjunction
-  [composition & compositions]
-  (reduce make-conjunction composition compositions))
-
-(define-record-type Disjunction
-  (make-disjunction comp-1 comp-2) disjunction?
-  [comp-1 disjunction-comp-1
-   comp-2 disjunction-comp-2])
-
-(defn disjuction
-  [composition & compositions]
-  (reduce make-disjunction composition compositions))
-
-(defn composition->dependencies
-  [composition]
-  (cond
-    (pattern? composition)
-    (pattern->dependencies composition)
-
-    (conjunction? composition)
-    (concat (composition->dependencies (conjunction-comp-1 composition))
-            (composition->dependencies (conjunction-comp-2 composition)))
-
-    (conjunction? composition)
-    (concat (composition->dependencies (disjunction-comp-1 composition))
-            (composition->dependencies (disjunction-comp-2 composition)))
-
-    :else (c/assertion-violation `composition->dependencies "not a composition" composition)))


Update description

Update description

--- modules/cylon/project.clj
+++ modules/cylon/project.clj
@@ -13,7 +13,7 @@
 ;; limitations under the License.

 (defproject juxt.modular/cylon "0.2.3-SNAPSHOT"
-  :description "A modular extension that provides secure login through cookie-based and HTTP basic auth with pluggable credential management."
+  :description "A one-stop security solution for applications built on modular"
   :url "https://github.com/juxt/modular/tree/master/modules/cylon"
   :license {:name "Apache License, Version 2.0"
             :url "http://www.apache.org/licenses/LICENSE-2.0.html"}


Add Geyser RGB fogger.

Add Geyser RGB fogger.

--- src/afterglow/fixtures/chauvet.clj
+++ src/afterglow/fixtures/chauvet.clj
@@ -36,6 +36,28 @@
               (chan/color 3 :green)
               (chan/color 4 :blue)]
    :name "ColorStrip"})
+
+(defn geyser-rgb
+  "[Geyser RGB](http://www.chauvetlighting.com/geyser-rgb.html) illuminated effect fogger."
+  {:doc/format :markdown}
+  []
+  {:channels [(chan/functions :fog 1
+                              0 nil
+                              10 "Fog")
+              (chan/color 2 :red)
+              (chan/color 3 :green)
+              (chan/color 4 :blue)
+              (chan/functions :control 5
+                              0 nil
+                              10 :color-mixing)
+              (chan/functions :control 6
+                              0 nil
+                              10 :auto-speed)
+              (chan/functions :strobe 7
+                              0 nil
+                              10 :strobe)
+              (chan/dimmer 8)]
+   :name "Geyser RGB"})

 (defn intimidator-spot-led-150
   "[Intimidator Spot LED 150](http://www.chauvetlighting.com/intimidator-spot-led-150.html) moving yoke.


New HTTP endpoints

New HTTP endpoints

--- src/hurvinek/server.clj
+++ src/hurvinek/server.clj
@@ -45,6 +45,27 @@
     (let [params        (:params request)
           url-prefix    (get-url-prefix request)]
           (-> (http-response/response (html-renderer/render-front-page url-prefix title))
+              (http-response/content-type "text/html"))))
+
+(defn finish-processing-help-page
+    [request title]
+    (let [params        (:params request)
+          url-prefix    (get-url-prefix request)]
+          (-> (http-response/response (html-renderer/render-help-page url-prefix title))
+              (http-response/content-type "text/html"))))
+
+(defn finish-processing-database-statistic-page
+    [request title]
+    (let [params        (:params request)
+          url-prefix    (get-url-prefix request)]
+          (-> (http-response/response (html-renderer/render-database-statistic-page url-prefix title))
+              (http-response/content-type "text/html"))))
+
+(defn finish-processing-export-database-page
+    [request title]
+    (let [params        (:params request)
+          url-prefix    (get-url-prefix request)]
+          (-> (http-response/response (html-renderer/render-export-database-page url-prefix title))
               (http-response/content-type "text/html"))))

 (defn finish-processing-product-list
@@ -99,6 +120,18 @@
     [request title]
     (finish-processing-front-page request title))

+(defn process-help-page
+    [request title]
+    (finish-processing-help-page request title))
+
+(defn process-database-statistic
+    [request title]
+    (finish-processing-database-statistic-page request title))
+
+(defn process-export-database
+    [request title]
+    (finish-processing-export-database-page request title))
+
 (defn process-select-product-page
     "Function that prepares data for the 'Select product' page."
     [request title]
@@ -147,6 +180,9 @@
             "/hurvinek.css"               (return-file "hurvinek.css"      "text/css")
             "/bootstrap.min.js"           (return-file "bootstrap.min.js"  "application/javascript")
             "/"                           (process-front-page          request title)
+            "/help"                       (process-help-page           request title)
+            "/database-statistic"         (process-database-statistic  request title)
+            "/export-database"            (process-export-database     request title)
             "/select-product"             (process-select-product-page request title)
             )))


Add CORS header

Add CORS header

--- src/kostlee/handler.clj
+++ src/kostlee/handler.clj
@@ -7,6 +7,14 @@
             [compojure.route :as route]))

 (defn uuid [] (str (java.util.UUID/randomUUID)))
+
+(defn allow-cross-origin
+  "middleware function to allow crosss origin"
+  [handler]
+  (fn [request]
+   (let [response (handler request)]
+    (assoc-in response [:headers "Access-Control-Allow-Origin"] "*"))))
+

 ;;; TODO Read in from somewhere™ at startup
 (def daymoney-state (atom [
@@ -58,4 +66,5 @@
 (def app
   (-> (handler/api api-routes)
     (middleware/wrap-json-body)
-    (middleware/wrap-json-response)))
+    (middleware/wrap-json-response)
+    (allow-cross-origin)))


Disable the dummy user

Disable the dummy user

--- src/langnostic/core.clj
+++ src/langnostic/core.clj
@@ -112,7 +112,7 @@

 (defroutes langnostic-routes
   (GET "/" [] home)
-  (GET "/dev/dummy-user" [] dummy-user)
+  ;; (GET "/dev/dummy-user" [] dummy-user)
   (GET "/blog" [] home)
   (GET "/posts/:name" [name] (post name))


open-path should open existing tab for same relative file - close #1427

--- src/lt/objs/opener.cljs
+++ src/lt/objs/opener.cljs
@@ -141,11 +141,12 @@
                         (if (files/dir? path)
                           (notifos/set-msg! (str "Cannot open a directory: " path))
                           (notifos/set-msg! (str "No such file: " path)))
-                        (if-let [ed (first (pool/by-path path))]
-                          (if (:open-linked-doc @obj)
-                            (open-linked-path ed obj path {})
-                            (tabs/active! ed))
-                          (open-path obj path)))))
+                        (let [resolved-path (files/resolve files/cwd path)]
+                          (if-let [ed (first (pool/by-path resolved-path))]
+                            (if (:open-linked-doc @obj)
+                              (open-linked-path ed obj resolved-path {})
+                              (tabs/active! ed))
+                            (open-path obj resolved-path))))))

 (behavior ::track-open-files
           :triggers #{:open}


Cleaned up appengine-magic.core/start and stop functions; implemented a serve function which tries to do the right thing to start and restart intelligently.

--- src/appengine_magic/core_local.clj
+++ src/appengine_magic/core_local.clj
@@ -8,9 +8,14 @@
          '[appengine-magic.jetty :as jetty]
          '[appengine-magic.blobstore-upload :as blobstore-upload])

-(import java.io.File)
+(import java.io.File
+        com.google.apphosting.api.ApiProxy)

-(import com.google.apphosting.api.ApiProxy)
+
+
+;;; ----------------------------------------------------------------------------
+;;; appengine-magic core API functions
+;;; ----------------------------------------------------------------------------

 (defn default-war-root []
   (-> (clojure.lang.RT/baseLoader)
@@ -63,61 +68,67 @@
       (.doFilter chain req resp))))

-(defn start* [appengine-app & {:keys [port join?]}]
+
+;;; ----------------------------------------------------------------------------
+;;; development server controls
+;;; ----------------------------------------------------------------------------
+
+(defonce *server* (atom nil))
+
+
+(defn start [appengine-app & {:keys [port join?] :or {port 8080, join? false}}]
   (let [war-root (java.io.File. (:war-root appengine-app))
         handler-servlet (servlet (:handler appengine-app))]
     (appengine-init war-root port)
-    (jetty/start
-     {"/*" [(make-appengine-request-environment-filter)
-            (com.google.apphosting.utils.servlet.TransactionCleanupFilter.)
-            (com.google.appengine.api.blobstore.dev.ServeBlobFilter.)]}
-     {"/" handler-servlet
-      "/_ah/login" (com.google.appengine.api.users.dev.LocalLoginServlet.)
-      "/_ah/logout" (com.google.appengine.api.users.dev.LocalLogoutServlet.)
-      "/_ah/upload" (servlet (blobstore-upload/make-blob-upload-handler war-root))
-      ;;"/_ah/img" (com.google.appengine.api.images.dev.LocalBlobImageServlet.)
-      "/_ah/channel/jsapi" (com.google.appengine.api.channel.dev.ServeScriptServlet.)
-      "/_ah/channel/dev" (com.google.appengine.api.channel.dev.LocalChannelServlet.)
-      ;; These mappings are from webdefault.xml in appengine-local-runtime-*.jar.
-      "/_ah/sessioncleanup" (com.google.apphosting.utils.servlet.SessionCleanupServlet.)
-      "/_ah/admin" (com.google.apphosting.utils.servlet.DatastoreViewerServlet.)
-      "/_ah/admin/" (com.google.apphosting.utils.servlet.DatastoreViewerServlet.)
-      "/_ah/admin/datastore" (com.google.apphosting.utils.servlet.DatastoreViewerServlet.)
-      "/_ah/admin/taskqueue" (com.google.apphosting.utils.servlet.TaskQueueViewerServlet.)
-      "/_ah/admin/xmpp" (com.google.apphosting.utils.servlet.XmppServlet.)
-      "/_ah/admin/inboundmail" (com.google.apphosting.utils.servlet.InboundMailServlet.)
-      "/_ah/resources" (com.google.apphosting.utils.servlet.AdminConsoleResourceServlet.)
-      "/_ah/adminConsole" (org.apache.jsp.ah.adminConsole_jsp.)
-      "/_ah/datastoreViewerHead" (org.apache.jsp.ah.datastoreViewerHead_jsp.)
-      "/_ah/datastoreViewerBody" (org.apache.jsp.ah.datastoreViewerBody_jsp.)
-      "/_ah/datastoreViewerFinal" (org.apache.jsp.ah.datastoreViewerFinal_jsp.)
-      "/_ah/entityDetailsHead" (org.apache.jsp.ah.entityDetailsHead_jsp.)
-      "/_ah/entityDetailsBody" (org.apache.jsp.ah.entityDetailsBody_jsp.)
-      "/_ah/entityDetailsFinal" (org.apache.jsp.ah.entityDetailsFinal_jsp.)
-      "/_ah/taskqueueViewerHead" (org.apache.jsp.ah.taskqueueViewerHead_jsp.)
-      "/_ah/taskqueueViewerBody" (org.apache.jsp.ah.taskqueueViewerBody_jsp.)
-      "/_ah/taskqueueViewerFinal" (org.apache.jsp.ah.taskqueueViewerFinal_jsp.)
-      "/_ah/xmppHead" (org.apache.jsp.ah.xmppHead_jsp.)
-      "/_ah/xmppBody" (org.apache.jsp.ah.xmppBody_jsp.)
-      "/_ah/xmppFinal" (org.apache.jsp.ah.xmppFinal_jsp.)
-      "/_ah/inboundmailHead" (org.apache.jsp.ah.inboundMailHead_jsp.)
-      "/_ah/inboundmailBody" (org.apache.jsp.ah.inboundMailBody_jsp.)
-      "/_ah/inboundmailFinal" (org.apache.jsp.ah.inboundMailFinal_jsp.)}
-     :port port
-     :join? join?)))
+    (reset!
+     *server*
+     (jetty/start
+      {"/*" [(make-appengine-request-environment-filter)
+             (com.google.apphosting.utils.servlet.TransactionCleanupFilter.)
+             (com.google.appengine.api.blobstore.dev.ServeBlobFilter.)]}
+      {"/" handler-servlet
+       "/_ah/login" (com.google.appengine.api.users.dev.LocalLoginServlet.)
+       "/_ah/logout" (com.google.appengine.api.users.dev.LocalLogoutServlet.)
+       "/_ah/upload" (servlet (blobstore-upload/make-blob-upload-handler war-root))
+       ;;"/_ah/img" (com.google.appengine.api.images.dev.LocalBlobImageServlet.)
+       "/_ah/channel/jsapi" (com.google.appengine.api.channel.dev.ServeScriptServlet.)
+       "/_ah/channel/dev" (com.google.appengine.api.channel.dev.LocalChannelServlet.)
+       ;; These mappings are from webdefault.xml in appengine-local-runtime-*.jar.
+       "/_ah/sessioncleanup" (com.google.apphosting.utils.servlet.SessionCleanupServlet.)
+       "/_ah/admin" (com.google.apphosting.utils.servlet.DatastoreViewerServlet.)
+       "/_ah/admin/" (com.google.apphosting.utils.servlet.DatastoreViewerServlet.)
+       "/_ah/admin/datastore" (com.google.apphosting.utils.servlet.DatastoreViewerServlet.)
+       "/_ah/admin/taskqueue" (com.google.apphosting.utils.servlet.TaskQueueViewerServlet.)
+       "/_ah/admin/xmpp" (com.google.apphosting.utils.servlet.XmppServlet.)
+       "/_ah/admin/inboundmail" (com.google.apphosting.utils.servlet.InboundMailServlet.)
+       "/_ah/resources" (com.google.apphosting.utils.servlet.AdminConsoleResourceServlet.)
+       "/_ah/adminConsole" (org.apache.jsp.ah.adminConsole_jsp.)
+       "/_ah/datastoreViewerHead" (org.apache.jsp.ah.datastoreViewerHead_jsp.)
+       "/_ah/datastoreViewerBody" (org.apache.jsp.ah.datastoreViewerBody_jsp.)
+       "/_ah/datastoreViewerFinal" (org.apache.jsp.ah.datastoreViewerFinal_jsp.)
+       "/_ah/entityDetailsHead" (org.apache.jsp.ah.entityDetailsHead_jsp.)
+       "/_ah/entityDetailsBody" (org.apache.jsp.ah.entityDetailsBody_jsp.)
+       "/_ah/entityDetailsFinal" (org.apache.jsp.ah.entityDetailsFinal_jsp.)
+       "/_ah/taskqueueViewerHead" (org.apache.jsp.ah.taskqueueViewerHead_jsp.)
+       "/_ah/taskqueueViewerBody" (org.apache.jsp.ah.taskqueueViewerBody_jsp.)
+       "/_ah/taskqueueViewerFinal" (org.apache.jsp.ah.taskqueueViewerFinal_jsp.)
+       "/_ah/xmppHead" (org.apache.jsp.ah.xmppHead_jsp.)
+       "/_ah/xmppBody" (org.apache.jsp.ah.xmppBody_jsp.)
+       "/_ah/xmppFinal" (org.apache.jsp.ah.xmppFinal_jsp.)
+       "/_ah/inboundmailHead" (org.apache.jsp.ah.inboundMailHead_jsp.)
+       "/_ah/inboundmailBody" (org.apache.jsp.ah.inboundMailBody_jsp.)
+       "/_ah/inboundmailFinal" (org.apache.jsp.ah.inboundMailFinal_jsp.)}
+      :port port
+      :join? join?))))

-(defn stop* [server]
-  (appengine-clear)
-  (jetty/stop server))
+(defn stop []
+  (when-not (nil? @*server*)
+    (appengine-clear)
+    (jetty/stop @*server*)
+    (reset! *server* nil)))

-(defmacro start [appengine-app &
-                 {:keys [server port join?]
-                  :or {server '*server* port 8080 join? false}}]
-  `(do (defonce ~server (atom nil))
-       (reset! ~server (start* ~appengine-app :port ~port :join? ~join?))))
-
-
-(defmacro stop [& {:keys [server] :or {server '*server*}}]
-  `(stop* @~server))
+(defn serve [appengine-app & {:keys [port] :or {port 8080}}]
+  (stop)
+  (start appengine-app :port port))


fix raw sql template asphalt.type.ISqlSource impl

--- src/asphalt/internal/sql.clj
+++ src/asphalt/internal/sql.clj
@@ -297,7 +297,12 @@
   ;;============
   java.util.List
   ;;============
-  (get-sql    [this params] (make-sql this params))
-  (set-params [this prepared-stmt params] (p/set-params prepared-stmt params))
+  (get-sql    [this params] (make-sql (first this) params))
+  (set-params [this prepared-stmt params] (if-let [kt-pairs (seq (filter vector? (first this)))]
+                                            (p/set-params prepared-stmt
+                                              (mapv first kt-pairs) (mapv second kt-pairs) params)
+                                            (p/set-params prepared-stmt params)))
   (read-col   [this result-set col-index] (r/read-column-value result-set col-index))
-  (read-row   [this result-set col-count] (r/read-columns result-set col-count)))
+  (read-row   [this result-set col-count] (if-let [ts (seq (second this))]
+                                            (r/read-columns ts result-set col-count)
+                                            (r/read-columns result-set col-count))))


Pull out tick steps for easier profiling

--- src/aurora/runtime/core.cljs
+++ src/aurora/runtime/core.cljs
@@ -15,11 +15,23 @@
     (swap! env assoc :queued? (js/setTimeout (partial handle-feed env) 0)))
   (.push (:feed @env) fact))

+(defn tick-inductive [kn tick-rules]
+  (stratifier/run-ruleset tick-rules kn))
+
+(defn tick-deductive [kn rules]
+  (stratifier/run-ruleset rules kn))
+
+(defn tick-watchers [kn watchers feeder-fn]
+  (doseq [watch watchers]
+    (watch kn feeder-fn))
+  kn)
+
 (defn tick [kn tick-rules rules watchers feeder-fn]
-  (let [kn (->> kn (stratifier/run-ruleset tick-rules) (stratifier/run-ruleset rules))]
-    (doseq [watch watchers]
-      (watch kn feeder-fn))
-    (datalog/tick kn)))
+  (-> kn
+      (tick-inductive tick-rules)
+      (tick-deductive rules)
+      (tick-watchers watchers feeder-fn)
+      (datalog/tick)))

 (defn handle-feed [env]
   (when-not (:paused @env)


add quotes in log message

add quotes in log message

--- src/babel/english/writer.clj
+++ src/babel/english/writer.clj
@@ -44,8 +44,8 @@
                              ;; else, no existing expression: generate a new one.
                              (do
                                (log/debug (str "generating from spec: " spec))
-                               (log/info (str "generating using source expression: "
-                                              (:surface source-expression)))
+                               (log/info (str "generating using source expression: '"
+                                              (:surface source-expression) "'"))
                                (try
                                  (let [result
                                        (process [{:fill-one-language


fix typo

fix typo

--- src/babel/english/writer.clj
+++ src/babel/english/writer.clj
@@ -39,7 +39,7 @@

         spec (if root
                (unify spec
-                      {:root {:espanol {:espanol root}}})
+                      {:root {:english {:english root}}})
                spec)

         use-map-fn pmap


fixed regression introduced in 7d3f7

fixed regression introduced in 7d3f7

--- src/me/panzoo/story.clj
+++ src/me/panzoo/story.clj
@@ -411,10 +411,17 @@
   []
   (re-pattern (str "^" (Pattern/quote *single-comment*))))

+(defn markdown*
+  ""
+  []
+  (if (= :markdown (canonical-lang *language*))
+    (comment)
+    (re-pattern (str (comment) " "))))
+
 (defn markdown
   ""
   []
-  (re-pattern (str (comment) " ")))
+  (re-pattern (str (markdown*) "|" (comment) "$")))

 (defn hidden-comment
   "A regular expression matching the beginning of a commented line that will
@@ -430,7 +437,7 @@
 (defn heading
   "A regular expression matching the beginning of a heading line."
   []
-  (re-pattern (str (markdown) "#+ *")))
+  (re-pattern (str (markdown*) "\\#+ *")))

 (defn include
   "A regular expression matching the beginning of an include line."
@@ -564,7 +571,7 @@
       (m anchor) [[:anchor text]]
       (m heading) [[:anchor text]
                    [:comment (m markdown)]]
-      (m comment) [[:comment text]]
+      (m markdown) [[:comment text]]
       (m hidden-comment) []
       :else (conj (maybe-code-anchor line (lines-reader lines))
                   [:code line]))))


Separate browse code and editing mode

Separate browse code and editing mode

Added a Browse and Edit button

--- src/webapp/framework/client/webhosting/hostmain.cljs
+++ src/webapp/framework/client/webhosting/hostmain.cljs
@@ -19,6 +19,22 @@

+(defn-ui-component     editor-component   [app]
+ {:on-mount
+   (do  (go (let [x (remote  !getfilecontents  {:file-name nil})]
+              (js/createEditor)
+              (js/populateEditor (get x :value)))))}
+
+
+  (div {}
+            (div {:style {:display "inline-block" :width "1200" :height "800" :verticalAlign "top"}}
+                 (textarea {:id "cm" :style {:display "inline-block" :width "1200" :height "800"}} ""))
+
+            (iframe {:style {:display "inline-block"} :src "http://127.0.0.1:3450" :width "600" :height "800"})))
+
+
+
+

@@ -35,19 +51,35 @@

             (button {:className    "btn btn-default"
                      :style       {:display "inline-block" :marginLeft "30px" :fontFamily "Ubuntu" :fontSize "1em" :marginTop "-0.9em"}
+                     :onClick     #(write-ui app [:mode] "browse")} "Browse")
+
+            (button {:className    "btn btn-default"
+                     :style       {:display "inline-block" :marginLeft "30px" :fontFamily "Ubuntu" :fontSize "1em" :marginTop "-0.9em"}
+                     :onClick     #(write-ui app [:mode] "edit")} "Edit")
+
+
+
+            (a {:className    "btn btn-default"
+                :target       "new"
+                :style       {:float "right"  :display "inline-block" :marginLeft "30px" :fontFamily "Ubuntu" :fontSize "1em"  :marginTop "0.2em" }
+                :href         "http://127.0.0.1:3450"} "Run in own window")
+
+            (button {:className    "btn btn-default"
+                     :style       {:float "right" :display "inline-block" :marginLeft "30px" :fontFamily "Ubuntu" :fontSize "1em" :marginTop "0.2em"  }
                      :onClick     #(go
                                      (let [code (.getValue js/myCodeMirror) ]
                                        (remote !savecode {} code))   )} "Save")

-            (a {:className    "btn btn-default"
-                :target       "new"
-                :style       {:display "inline-block" :marginLeft "30px" :fontFamily "Ubuntu" :fontSize "1em"  :marginTop "-0.9em"}
-                :href         "http://127.0.0.1:3450"} "Run in own window"))
-       (div {}
-            (div {:style {:display "inline-block" :width "1200" :height "800" :verticalAlign "top"}}
-                 (textarea {:id "cm" :style {:display "inline-block" :width "1200" :height "800"}} ""))
+            )
+       (cond
+         (or (= (read-ui app [:mode]) nil) (= (read-ui app [:mode]) "browse"))
+         (div {} "Browse")

-            (iframe {:style {:display "inline-block"} :src "http://127.0.0.1:3450" :width "600" :height "800"}))))
+         (= (read-ui app [:mode]) "edit")
+         (component editor-component app [])
+
+         :else
+         (div {} "Nothing selected"))))


Code review comments and fix formatting

Code review comments and fix formatting

--- src/cljs/main/broadfcui/page/workspace/monitor/workflow_details.cljs
+++ src/cljs/main/broadfcui/page/workspace/monitor/workflow_details.cljs
@@ -142,41 +142,39 @@
                              (:data props))}])])})

 (react/defc OperationDialog
-            {:render
-             (fn [{:keys [props state]}]
-                 [comps/OKCancelForm
-                  {:header "Operation Details"
-                   :content
-                   (let [server-response (:server-response @state)]
-                        (cond
-                         (nil? server-response)
-                         [:div {} [comps/Spinner {:text "Loading operation details..."}]]
-                         (not (:success? server-response))
-                         (style/create-server-error-message (:response server-response))
-                         :else
-                         [CodeMirror {:text (:raw-response server-response)}]))
-                   :show-cancel? false
-                   :ok-button {:text "Done" :onClick modal/pop-modal}}])
-
-             :component-did-mount
-             (fn [{:keys [props state]}]
-                 (endpoints/call-ajax-orch
-                  {:endpoint
-                   (endpoints/get-workspace-genomic-operations
-                    ;; strip out operations/ from the job id
-                    (last (string/split (:job-id props) #"/")))
-                   :on-done (fn [{:keys [success? get-parsed-response status-text raw-response]}]
-                                (swap! state assoc :server-response
-                                       {:success? success?
-                                        :response (if success? (get-parsed-response false) status-text)
-                                        :raw-response raw-response}))}))})
-
-(react/defc OperationLink
-            {:render
-             (fn [{:keys [props]}]
-                 (let [{:keys [job-id]} props]
-                      [:a {:href "javascript:;"
-                           :onClick #(modal/push-modal [OperationDialog props])} job-id]))})
+  {:render
+   (fn [{:keys [props state]}]
+     [comps/OKCancelForm
+      {:header "Operation Details"
+       :content
+       (let [server-response (:server-response @state)]
+         (cond
+           (nil? server-response)
+           [:div {} [comps/Spinner {:text "Loading operation details..."}]]
+           (not (:success? server-response))
+           (style/create-server-error-message (:response server-response))
+           :else
+           [CodeMirror {:text (:raw-response server-response)}]))
+       :show-cancel? false
+       :ok-button {:text "Done" :onClick modal/pop-modal}}])
+
+   :component-did-mount
+   (fn [{:keys [props state]}]
+     (endpoints/call-ajax-orch
+      {:endpoint
+       (endpoints/get-workspace-genomic-operations
+        ;; strip out operations/ from the job id
+        (last (string/split (:job-id props) #"/")))
+       :on-done (fn [{:keys [success? get-parsed-response status-text raw-response]}]
+                  (swap! state assoc :server-response
+                         {:success? success?
+                          :response (if success? (get-parsed-response false) status-text)
+                          :raw-response raw-response}))}))})
+
+(defn operation-link [job-id]
+  ;; Note: using [:a ...] instead of style/create-link to be consistent with GCSFilePreviewLink
+  [:a {:href "javascript:;"
+       :onClick #(modal/push-modal [OperationDialog props])} job-id])

 (react/defc CallDetail
   {:get-initial-state
@@ -201,7 +199,7 @@
             [:div {:style {:padding "0.5em 0 0 0.5em"}}
              [:div {:style {:paddingBottom "0.25em"}} (str "Call #" (inc index) ":")]
              [:div {:style {:paddingLeft "0.5em"}}
-              (create-field "ID" [OperationLink {:job-id (data "jobId")}])
+              (create-field "ID" (operation-link (data "jobId")))
               (let [status (data "executionStatus")]
                 (create-field "Status" (moncommon/icon-for-call-status status) status))
               (when (= (-> (data "callCaching") (get "effectiveCallCachingMode")) "ReadAndWriteCache")


put 'select tracks' button back (#515)

put 'select tracks' button back (#515)

--- src/cljs/org/broadinstitute/firecloud_ui/page/workspace/details.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/page/workspace/details.cljs
@@ -143,7 +143,9 @@
                            [monitor-tab/Page {:ref MONITOR
                                               :workspace-id workspace-id
                                               :nav-context (nav/terminate-when (not= tab MONITOR) nav-context)}])
-                         :onTabRefreshed #(react/call :refresh (@refs MONITOR))}]}]]))
+                         :onTabRefreshed #(react/call :refresh (@refs MONITOR))}]
+                       :toolbar-right (when-let [analysis-tab (:analysis-tab @state)]
+                                        (react/call :get-tracks-button analysis-tab))}]]))
    :component-did-update
    (fn [{:keys [prev-state state refs]}]
      ;; when switching to the analysis tab, grab the ref to it so we can access the track picker button


don't force row-count to be an integer when analyzing table.  nil is a valid value if driver couldn't get an appropriate value.

--- src/metabase/driver.clj
+++ src/metabase/driver.clj
@@ -45,7 +45,7 @@

 (def AnalyzeTable
   "Schema for the expected output of `analyze-table`."
-  {(schema/optional-key :row_count) schema/Int
+  {(schema/optional-key :row_count) (schema/maybe schema/Int)
    (schema/optional-key :fields)    [{:id                                    schema/Int
                                       (schema/optional-key :special-type)    (apply schema/enum field/special-types)
                                       (schema/optional-key :preview-display) schema/Bool


catch and diagnose string/replace exceptions: can be thrown due to typos like $l (lowercase 'L') (rather than $1)

--- src/babel/italiano/morphology.cljc
+++ src/babel/italiano/morphology.cljc
@@ -1400,7 +1400,13 @@
                  unify-with (if (:u replace-pattern)
                               (:u replace-pattern)
                               :top) ;; default unify-with
-                 potential-lexical-form (string/replace surface-form from to)]
+                 debug (log/debug (str "surface-form: " surface-form "; from: " from "; to:" to))
+                 potential-lexical-form
+                 (try
+                   (string/replace surface-form from to)
+                   (catch Exception e
+                     (throw (Exception. (str "Can't string/replace on: "
+                                             "surface-form: " surface-form "; from: " from "; to:" to)))))]
              (filter (fn [result] (not (= :fail result)))
                      (pmap (fn [lexical-entry]
                              (let [result (unifyc unify-with lexical-entry)]


rename circles to isoquants

rename circles to isoquants

--- src/minkowski/core.cljs
+++ src/minkowski/core.cljs
@@ -13,7 +13,7 @@
 (def height (* 8 unit-pixels))
 (def minkowski-order 2.0)
 (def minkowski-distance (distance/minkowski minkowski-order))
-(def circles [])
+(def isoquants [])
 (def mouse-point [0 0])

@@ -27,8 +27,8 @@
   (map (fn [angle]
     (point-euclidean angle (* radius (/ radius (minkowski-distance (point-euclidean angle radius)))))) (angles n)))

-(defn recalculate-circles []
-    (set! circles (map (fn [n] (points 360 n)) (range 1 7))))
+(defn recalculate-isoquants []
+    (set! isoquants (map (fn [n] (points 360 n)) (range 1 7))))

 ; UI elements
@@ -60,7 +60,7 @@
     (if (> minkowski-order 3.0) (set! minkowski-order distance/infinity)
       (if (> minkowski-order 2.0) (set! minkowski-order (+ 2.0 (* (- minkowski-order 2.0) 20)))))
     (minkowski-order-changed)
-    (recalculate-circles)))
+    (recalculate-isoquants)))

 (defn coordinates-point [[x y]] [(/ (- x (/ width 2)) unit-pixels) (/ (- y (/ height 2)) unit-pixels)])

@@ -125,11 +125,11 @@
     (.closePath drawing)
     (.restore drawing)))

-(defn draw-circle [circle]
+(defn draw-isoquant [isoquant]
   (do
     (.save drawing)
     (.beginPath drawing)
-    (doall (for [point circle] (let [[x y] (canvas-point point)] (.lineTo drawing x y))))
+    (doall (for [point isoquant] (let [[x y] (canvas-point point)] (.lineTo drawing x y))))
     (.closePath drawing)
     (.setLineDash drawing (array 3 5))
     (aset drawing "strokeStyle" "gray")
@@ -140,7 +140,7 @@
   (do
     (.clearRect drawing 0 0 (aget canvas "width") (aget canvas "height"))
     (draw-coordinates)
-    (doall (for [circle circles] (draw-circle circle)))
+    (doall (for [isoquant isoquants] (draw-isoquant isoquant)))
     (draw-mouse-point)))

 (defn request-frame []
@@ -153,7 +153,7 @@
   (aset canvas "width" width)
   (aset canvas "height" height)

-  (recalculate-circles)
+  (recalculate-isoquants)
   (minkowski-order-changed)
   (window-resized)


Fix "bot :bots key" error when creating group

--- src/braid/client/schema.cljs
+++ src/braid/client/schema.cljs
@@ -26,7 +26,8 @@
    :admins #{}
    :intro nil
    :avatar nil
-   :public? false})
+   :public? false
+   :bots #{}})

 (defn make-invitation [data]
   {:id (or (data :id) (uuid/make-random-squuid))


Nicer usage of clojure.test/are.

Nicer usage of clojure.test/are.

--- test/cljs/clj_templates/pages/templates_test.cljs
+++ test/cljs/clj_templates/pages/templates_test.cljs
@@ -30,12 +30,11 @@
 (facts "page-count"
   (fact "returns an appropriate number of pages for a number of hits"
     (are
-      [expected-count page-count-result]
-      (= expected-count page-count-result)
-
-      1 (templates/page-count 1)
-      1 (templates/page-count 30)
-      2 (templates/page-count 31)
-      2 (templates/page-count 60)
-      3 (templates/page-count 61)
-      3 (templates/page-count 90))))
+      [expected-page-count hit-count]
+      (= expected-page-count (templates/page-count hit-count))
+      1 1
+      1 30
+      2 31
+      2 60
+      3 61
+      3 90)))


Adds Contact label to footer.

Adds Contact label to footer.

--- src/cadence/views/common.clj
+++ src/cadence/views/common.clj
@@ -93,8 +93,9 @@
       content
       [:footer#footer.footer
        [:a.label.label-inverse {:href "/#privacy"} "Privacy"]
-       [:a.label {:href "/#security"} "Security"] " "
-       "© 2012 Ryan McGowan"]]]))
+       [:a.label {:href "/#security"} "Security"]
+       [:a.label.label-success {:href "/#contact"} "Contact"]
+       " © 2012 Ryan McGowan"]]]))

 (defn format-errors
   "Takes a collection of error messages and formats it into html."


removed whitespace.

removed whitespace.

--- src/clj/forma/hadoop/predicate.clj
+++ src/clj/forma/hadoop/predicate.clj
@@ -6,7 +6,6 @@
         [forma.matrix.utils :only (sparse-vector matrix-of)])
   (:require [cascalog.ops :as c]
             [cascalog.vars :as v]))
-

 ;; ### Cascalog Helpers

@@ -90,3 +89,4 @@
                 (construct (swap [nextpos outpos outval])
                            [[src :>> (swap [inpos nextpos inval])]
                             [aggr inpos inval :> outpos outval]]))))))
+


Avoid bombing on tab-complete attempts

Avoid bombing on tab-complete attempts

refs #32

--- src/clj/reply/eval_modes/nrepl.clj
+++ src/clj/reply/eval_modes/nrepl.clj
@@ -92,13 +92,13 @@
       (load-drawbridge))
     (nrepl/url-connect url)))

-(defn adhoc-eval [client session form]
+(defn completion-eval [client session form]
   (let [results (atom "nil")]
     (execute-with-client
       client
       {:value (partial reset! results)
        :out print
-       :err print
+       :err (constantly nil)
        :session session}
       (pr-str `(binding [*ns* (symbol ~(deref current-ns))] ~form)))
     (read-string @results)))
@@ -114,7 +114,7 @@
     (let [options (assoc options :prompt
                     (fn [ns]
                       (reader.jline/prepare-for-read
-                        (partial adhoc-eval client completion-session)
+                        (partial completion-eval client completion-session)
                         ns)))
           options (if (:color options)
                     (merge options nrepl.cmdline/colored-output)


Add on-the-fly font reloading

Add on-the-fly font reloading

--- src/clj/robinson/swingterminal.clj
+++ src/clj/robinson/swingterminal.clj
@@ -4,7 +4,9 @@
             robinson.aterminal)
   (:require [robinson.macros :as rm]
             [taoensso.timbre :as timbre]
+            [clojure-watch.core :as cwc]
             [clojure.core.async :as async :refer [go go-loop]]
+            clojure.core.memoize
             clojure.java.io)
   (:import
             java.util.concurrent.LinkedBlockingQueue
@@ -91,7 +93,7 @@
           character-map    (atom character-map-cleared)
           cursor-xy        (atom nil)
           ;; draws a character to an image and returns the image.
-          glyph-cache      (memoize (fn [component font-metrics highlight char-width char-height c]
+          glyph-cache      (clojure.core.memoize/memo (fn [component font-metrics highlight char-width char-height c]
                              (info "Creating glyph for" c)
                              (let [glyph-image                       (.createImage component char-width char-height)
                                    offscreen-graphics-2d ^Graphics2D (.getGraphics glyph-image)
@@ -251,6 +253,17 @@
                              (.setFocusTraversalKeysEnabled false)
                              (.setResizable false)
                              (.pack))]
+      ;; Start font file change listener thread
+      (cwc/start-watch [{:path "./fonts"
+                         :event-types [:modify]
+                         :bootstrap (fn [path] (println "Starting to watch " path))
+                         :callback (fn [event filename]
+                                     (println "Reloading font" filename)
+                                     (reset! normal-font
+                                             (make-font filename Font/PLAIN font-size))
+                                     (clojure.core.memoize/memo-clear! glyph-cache))
+                         :options {:recursive true}}])
+      ;; Create and return terminal
       (reify ATerminal
         (get-size [this]
           [columns rows])


Minor: remove println

Minor: remove println

--- src/cljs/mandelbrot_cljs/core.cljs
+++ src/cljs/mandelbrot_cljs/core.cljs
@@ -116,7 +116,6 @@

         escape-radius-squared    (* escape-radius escape-radius)]

-    (println rendered-rectangle)
     (swap! app-state assoc :rendered-rectangle rendered-rectangle)

     (forloop


Fix emoji regex

Fix emoji regex

--- src/cljs/openslack/views/text.cljs
+++ src/cljs/openslack/views/text.cljs
@@ -934,7 +934,7 @@
     "zero"
     "zzz"})

-(def emoji-regex #"\:[^\\s:]+\:")
+(def emoji-regex #"\:[^:\s]+\:")
 (defn emoji-converter
   [e]
   (let [emoji (unsurround e)]


more refactor

more refactor

--- src/cljs/tictactoe/logic/game.cljs
+++ src/cljs/tictactoe/logic/game.cljs
@@ -8,6 +8,8 @@
   []
   [turn/start-turn])

+(def get-board (comp :board peek))                          ;; TODO - output the current turn instead
+
 (defn play-move
   "On reception of the move command"
   [game-state [x y]]
@@ -15,15 +17,6 @@
     (if-let [next-turn (turn/play-move current x y)]
       (conj game-state next-turn)
       game-state)))
-
-(defn on-undo
-  "Remove the last game if there is enough game played"
-  [game-state]
-  (if (< 1 (count game-state))
-    (pop game-state)
-    game-state))
-
-(def get-board (comp :board peek))

 (defn handle-event
   "Callback to dispath the event on the game"
@@ -34,6 +27,14 @@
     :else (play-move game-state event)
     ))

+(defn on-undo
+  "Remove the last game if there is enough game played"
+  [game-state]
+  (if (< 1 (count game-state))
+    (pop game-state)
+    game-state))
+
+

 ;; ---- TODO - remove (only there for the tests, but could be done better)


reorganized the stop and start timer code

--- src/clojure/com/gt/metime/main.clj
+++ src/clojure/com/gt/metime/main.clj
@@ -28,25 +28,23 @@
 (defn show-picker [activity picker picker-type]
   (. picker show (. activity getFragmentManager) picker-type))

-(declare start-timer-set)
-(declare stop-timer-set)
+(declare start-timer)
+(declare stop-timer)

 (defrecord TimerContext [running offset base])

-(defn stop-timer-set [event-chonometer event-button-view timer-context]
+(defn start-timer [event-chonometer event-button-view timer-context]
+  (.stop event-chonometer)
+  (config event-button-view :text "Start")
+  (reset! timer-context (apply ->TimerContext [false (- (.getBase event-chonometer) (SystemClock/elapsedRealtime)) (.getBase event-chonometer)]))
+  (config event-button-view :on-click (fn [_] (stop-timer event-chonometer event-button-view timer-context))))
+
+(defn stop-timer [event-chonometer event-button-view timer-context]
+  (reset! timer-context (apply ->TimerContext [true (:offset @timer-context)  (+ (SystemClock/elapsedRealtime) (:offset @timer-context))]))
+  (.setBase event-chonometer (:base @timer-context))
   (config event-button-view :text "Stop")
-  (config event-button-view :on-click (fn [_]
-                                        (.stop event-chonometer)
-                                        (reset! timer-context (apply ->TimerContext [false (- (.getBase event-chonometer) (SystemClock/elapsedRealtime)) (.getBase event-chonometer)]))
-                                        (start-timer-set event-chonometer event-button-view timer-context))))
-
-(defn start-timer-set [event-chonometer event-button-view timer-context]
-  (config event-button-view :text "Start")
-  (config event-button-view :on-click (fn [_]
-                                        (reset! timer-context (apply ->TimerContext [true (:offset @timer-context) (+ (SystemClock/elapsedRealtime) (:offset @timer-context))]))
-                                        (.setBase event-chonometer (:base @timer-context))
-                                        (.start event-chonometer)
-                                        (stop-timer-set event-chonometer event-button-view timer-context))))
+  (.start event-chonometer)
+  (config event-button-view :on-click (fn [_] (start-timer event-chonometer event-button-view timer-context))))

 (defelement :chronometer
             :classname android.widget.Chronometer
@@ -96,11 +94,15 @@
              (.setBase event-chonometer (:base @timer-context))
              (.start event-chonometer)
              (config event-button-view :text "Stop")
-             (stop-timer-set event-chonometer event-button-view timer-context)))
+
+             (config event-button-view :on-click (fn [_] (start-timer event-chonometer event-button-view timer-context)))
+             ))
           ((fn []
+             (config event-chonometer :text (millis-to-format-time (* (:offset @timer-context) -1)))
              (config event-button-view :text "Start")
-             (config event-chonometer :text (millis-to-format-time (* (:offset @timer-context) -1)))
-             (start-timer-set event-chonometer event-button-view timer-context))))
+
+             (config event-button-view :on-click (fn [_] (stop-timer event-chonometer event-button-view timer-context)))
+             )))

         (config event-text-view :text (str (:name task) " (Goal: " (millis-to-format-time (* 1000 60 (:duration task))) ") "))


minor tweaks

minor tweaks

moved arena to be final arg to be consistent with other functions.
use get-in to access value in 2D vector

--- src/clj/battlebots/arena.clj
+++ src/clj/battlebots/arena.clj
@@ -27,7 +27,7 @@
 (defn pos-open
   "returns true of false depending if a given coodinate in a given arena is open"
   [[x y] arena]
-  (= (:open arena-key) (get (get arena x) y)))
+  (= (:open arena-key) (get-in arena [x y])))

 (defn generate-random-coords
   "generates random coordinates from a given dimension set"
@@ -51,13 +51,13 @@

 (defn replacer
   "replaces an empty cell with a value in a given arena"
-  [arena item]
+  [item arena]
     (update-cell (find-random-open-space arena) item arena))

 (defn sprinkle
   "sprinkles given items into an arena"
   [amount item arena]
-  (reduce replacer arena (repeat amount item)))
+  (reduce replacer (repeat amount item) arena))
 ;; ----------------------------------
 ;; END MAP GENERATION HELPERS
 ;; ----------------------------------


unwrap collection attribute errors on level

--- src/clj_money/validation.clj
+++ src/clj_money/validation.clj
@@ -39,7 +39,11 @@
       (assoc validated ::errors (->> errors
                                      (group-by first)
                                      (map (fn [[k tuples]]
-                                            [k (map second tuples)])) ; TODO don't double wrap vectors in lists
+                                            (let [error-list (map second tuples)
+                                                  error-list (if (vector? (k model))
+                                                                          (first error-list)
+                                                                          error-list)]
+                                              [k error-list])))
                                      (into {})))
       validated)))


lotsa lose pieces!

lotsa lose pieces!

--- src/cljs/uberblick/core.cljs
+++ src/cljs/uberblick/core.cljs
@@ -16,25 +16,15 @@
     (:import goog.History))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Example data
+(def Max {:IsObjectivesAdmin false, :LaborCategoryID "TECHNCAL", :FirstName "Maximilian", :LaborRoleID "APPLDEVL", :OversightPercent 25, :WorkTeamID "101", :BusinessUnitName "KH4 Tech", :PhotoFileName "4966_2688_sq.jpg", :IsCandidateAdmin false, :CanCommunicateClient false, :UserSystemID 80, :Email "mgerlach@klick.com", :CreatedDate "/Date(1370232000000-0000)/", :BillingTargetHoursPerYear 1650, :Title "Senior Mobile Developer", :IsClient false, :IsScheduleConfirmationRulesEnforced true, :LastName "Gerlach", :IsScheduleAdmin false, :UserName "mgerlach", :Extension "2381", :TimeZoneName "America/Toronto", :IsNotAPerson false, :UserID 4966, :KeyscanUpdated "/Date(1447455535000-0000)/", :HasDirectReports false, :IsAdmin false, :BusinessUnitID 24, :CountryID "CA", :CompanyBusinessUnitID 1, :TimeZoneID 90, :PhotoPath "https://genome.klick.com:443/local-instance/staff%20images/4966_2688_sq.jpg", :Name "Max Gerlach", :Roles [{:RoleID "DWFullAccess", :IsBusinessUnitScope true} {:RoleID "ws", :IsBusinessUnitScope false}], :CompanyBusinessUnitName "Klick Health", :IsWeeklyReviewAdmin false, :Enabled true, :TagName "Max_Gerlach", :Supervisors [3642 3990 4363 3446 3438 3424 3449], :Status {:CanSMS false, :IsOnGenome true, :CanGTalk false}})
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;; Actions

 ;; Network
 (defn- extract-content [] (map #(-> % :body :Entries)))
-
-(defn <get-klickster
-  [userid]
-  (http/jsonp "https://genome.klick.com:443/api/User.json"
-              {:query-params {"UserID" userid}
-               :channel (chan 1 (extract-content))}))
-
-(defn <search-user
-  [keyword]
-  (http/jsonp "https://genome.klick.com:443/api/User.json"
-              {:query-params {:ForAutocompleter true
-                              :Enabled true
-                              :IsNotAPerson false
-                              :Keyword keyword}
-               :channel (chan 1 (extract-content))}))

 (defn <all-active-users []
   (http/jsonp "https://genome.klick.com:443/api/User/Search"
@@ -42,17 +32,60 @@

 (defn extract-userids [users] (map :UserID users))

+(defn <users-details [userids]
+  (let [param-string (clojure.string/join "," userids)]
+    (http/jsonp "https://genome.klick.com:443/api/User.json"
+                {:query-params {:UserIDs param-string}
+                 :channel (chan 1 (extract-content))})))
+
+(defn add-full-picturepath
+  [user]
+  (update-in user [:PhotoPath] #(str "https://genome.klick.com:443" (clojure.string/replace %1 #" " "%20"))))
+
+(defn filter-in? [grouped-users]
+  (reduce-kv (fn [m k v]
+               (when (and k
+                          (.startsWith k "In"))
+                 (assoc m k v))) {} grouped-users))
+
 (go
-  (-> (<! (<all-active-users))
-      (extract-userids)
-      prn))
+  (as-> [5702 4966] $
+    (<! (<users-details $))
+    (map add-full-picturepath $)
+    (prn $)))
+
+(go
+  (as-> (<! (<all-active-users)) $
+    (extract-userids $)
+    (drop 200 $)
+    (take 200 $) ; chunk the data!
+    (<! (<users-details $))
+    (group-by :KeyscanStatus $)
+    (filter-in? $)
+    (def people $)
+    (prn $)))
+
+;; TODO:
+;; partition-by :KeyscanStatus. Then display and add filters.
+;; add a <users-details test data set monday morning
+;; partition the users by 200
+

 ;; -------------------------
 ;; Views

+(defn PersonCard [user]
+  [:div.z-depth-1 {:style {:max-width 100
+                           :text-align :center}}
+   [:div {:style {:width 100
+                  :height 100
+                  :background-image (str "url(" (:PhotoPath user) ")")}}]
+   [:span {:style {:width "100%"
+                   :font-size 16}}
+    (:FirstName user)]])
+
 (defn home-page []
-  [:div [:h2 "Welcome to uberblick!!!"]
-   [:div [:a {:href "/about"} "go to about page"]]])
+  [PersonCard Max])

 (defn About
 "Take the readme, render it to HTML, and set it as the element!"


clean up buf-rd metadata

clean up buf-rd metadata

--- src/overtone/sc/ugen/metadata/buf_io.clj
+++ src/overtone/sc/ugen/metadata/buf_io.clj
@@ -32,18 +32,27 @@

       {:name "BufRd",
-       :args [{:name "numChannels"    :default 1, :mode :num-outs,
+       :args [{:name "num-channels"
+               :default 1
+               :mode :num-outs
                :doc "The number of channels of the supplied buffer. This must be a fixed integer. The architecture of the SynthDef cannot change after it is compiled. (Warning: if you supply a bufnum of a buffer that has a different numChannels than you have specified to the BufRd, it will fail silently)."}
-              {:name "bufnum",        :default 0
+
+              {:name "bufnum"
+               :default 0
                :doc "The index of the buffer to use"}
-              {:name "phase",         :default 0.0
+
+              {:name "phase"
+               :default 0.0
                :doc "Audio rate modulatable index into the buffer. Warning: The phase argument only offers precision for addressing 2**24 samples (about 6.3 minutes at 44100Hz)"}
-              {:name "loop",          :default 1.0
+
+              {:name "loop"
+               :default 1.0
                :doc "1 means true, 0 means false.  This is modulatable."}
-              {:name "interpolation", :default 2
+
+              {:name "interpolation"
+               :default 2
                :doc "1 means no interpolation, 2 is linear, 4 is cubic interpolation"}]
-       :check (when-ar (nth-input-ar 1))   ; check phase. NB numChannels has already been popped.
-
+       :summary "Read the contents of a buffer at a specified index"
        :doc "reads the contents of a buffer at a given index."}

       {:name "BufWr",


more data processor testing code

more data processor testing code

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

--- acqEngine/src/org/micromanager/test.clj
+++ acqEngine/src/org/micromanager/test.clj
@@ -1,5 +1,7 @@
 (ns org.micromanager.test
   (:import (java.util List)
+           (mmcorej TaggedImage)
+           (org.json JSONObject)
            (org.micromanager MMStudioMainFrame)
            (org.micromanager.api DataProcessor))
   (:use [org.micromanager.mm :only (load-mm gui mmc)]))
@@ -11,15 +13,19 @@
 (defn simple-data-processor
   "Make a DataProcessor whose process method is implemented by
    process-function, which should accept a single image and return
-   one image or several images in a sequence."
+   one image or several images in a sequence. Passes
+   through Poison image unchanged."
   [process-function]
   (proxy [DataProcessor] []
     (process []
-             (let [result (process-function (.poll this))]
-               (if (counted? result)
-                 (doseq [image (process-function (.poll this))]
-                   (.produce this image))
-                 (.produce this result))))))
+             (let [img (.poll this)]
+               (if (.tags img)
+                 (let [result (process-function img)]
+                   (if (counted? result)
+                     (doseq [image (process-function (.poll this))]
+                       (.produce this image))
+                     (.produce this result)))
+                 (.produce this img))))))

 ;A list of image processors that have been attached to
@@ -42,8 +48,37 @@
   "Remove all DataProcessors from the acquisition engine's list of image processors."
   []
   (doseq [proc @image-processors]
-    (remove-image-processor proc)))
+    (remove-image-processor! proc)))

-(def identity-proc
+(defn identity-proc []
   "A simple data processor that passes images through, but prints out tagged image."
-  (simple-data-processor #(do (println %) %)))
+  (simple-data-processor #(do (println (.get (.tags %) "Channel")) %)))
+
+(defn json-clone
+  "Clone a JSONObject."
+  [json-data]
+  (-> json-data .toString (JSONObject.)))
+
+(defn update-tag!
+  "Destructive update: changes a json tag at key by applying (update-fn val args)."
+  [tags key update-fn & args]
+  (let [original-value (.get tags key)]
+    (.put tags key (apply update-fn original-value args))))
+
+(defn duplicator-proc []
+  "Duplicates channels"
+  (simple-data-processor
+    (fn [img]
+      (if (= 0 (.get (.tags img) "ChannelIndex"))
+        (let [tags (json-clone (.tags img))]
+          (println (.get tags "Channel"))
+          (update-tag! tags "ChannelIndex" #(+ 2 %))
+          (update-tag! tags "Channel" #(str % "-2"))
+          (println (.get tags "Channel"))
+          [img (TaggedImage. (.pix img) tags)])
+        img))))
+
+(defn restart-test []
+  (remove-all-image-processors!)
+  (add-image-processor! (duplicator-proc))
+  (add-image-processor! (identity-proc)))


Generate correct app main class name

Generate correct app main class name

Use the correct replacements to go from a Clojure namespace to a main
class name.

This fixes #93.

--- templates/gradle-clj-app/src/main/clojure/clj/new/gradle_clj_app.clj
+++ templates/gradle-clj-app/src/main/clojure/clj/new/gradle_clj_app.clj
@@ -1,10 +1,6 @@
 (ns clj.new.gradle-clj-app
   (:require [clj.new.templates :as t]
             [clojure.string :as string]))
-
-(defn unsanitize-ns
-  [s]
-  (string/replace s "_" "-"))

 (defn gradle-clj-app
   [name]
@@ -15,7 +11,7 @@
               :group (t/group-name name)
               :name (t/project-name name)
               :namespace main-ns
-              :main-class (unsanitize-ns main-ns)
+              :main-class (t/sanitize main-ns)
               :nested-dirs (t/name-to-path main-ns)
               :year (t/year)
               :date (t/date)}]


gdpr 1.0 remove unactivated user and remove activated user emails

--- src/clj/salava/user/db.clj
+++ src/clj/salava/user/db.clj
@@ -357,16 +357,23 @@
          #_(update-user-pages-set-deleted! {:user_id user-id} {:connection tr-cn})
          (delete-user-profile! {:user_id user-id} {:connection tr-cn})

-         (if activated
+         #_(if activated
            (doall (map #(update-user-email-set-deleted! {:user_id user-id :email (:email %) :deletedemail (str "deleted-" (:email %) ".so.deleted")} {:connection tr-cn} ) emails))
            (delete-email-addresses! {:user_id user-id} {:connection tr-cn}))

+         (delete-email-addresses! {:user_id user-id} {:connection tr-cn});delete user email-addresses anyway
+
          (if (some #(= % :oauth) (get-in ctx [:config :core :plugins]))
            (o/remove-oauth-user-all-services ctx user-id))

-         (if activated
+         #_(if activated
            (delete-user! {:id user-id} {:connection tr-cn})
-           (update-user-set-deleted! {:first_name "deleted" :last_name "deleted" :id user-id } {:connection tr-cn})))
+           (update-user-set-deleted! {:first_name "deleted" :last_name "deleted" :id user-id } {:connection tr-cn}))
+
+         (delete-user! {:id user-id} {:connection tr-cn});delete user anyway
+         )
+
+
        {:status "success"})
      (catch Object _
        {:status "error"}))))


change map a bit

change map a bit


Remove redundant call to keywordize-keys

First call to parent data-structure affects to nested ones

--- backend/test/akvo/lumen/test_utils.clj
+++ backend/test/akvo/lumen/test_utils.clj
@@ -30,7 +30,6 @@
     (-> (keywordize-keys dsv)
         (update :columns #(mapv (fn [e]
                                   (cond-> e
-                                    true keywordize-keys
                                     true (update :type keyword)
                                     true (update :id (fn [o] (if o (keyword o) (keyword (:columnName e)))))
                                     (:multipleType e) >mult)) %)))))


fix typo

fix typo

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -622,7 +622,7 @@

 ;; how to use:
 ;;(map flatten (cross-product [1 2 3][4 5 6 7][8 9 10]))
-
+;;(time (map flatten (apply cross-product (take 5 (repeatedly #(range 0 10))))))
 (defn cross-product [a b & more]
   (if (not (empty? more))
     (reduce
@@ -633,7 +633,8 @@
        (map (fn [each-b]
               [(first a) each-b])
             b)
-       (f (rest a) b)))))
+       (cross-product (rest a) b)))))
+


remove "the man's dog": not ready yet

remove "the man's dog": not ready yet

--- test/babel/test/en.cljc
+++ test/babel/test/en.cljc
@@ -199,10 +199,5 @@
          (fo (generate {:synsem {:cat :verb :sem {:pred :be-called
                                                   :subj {:pred :lei}
                                                   :obj {:pred :luisa}}}})))))
-(deftest the-mans-dog
-  (is (= "the man's dog"
-         (fo (generate {:synsem {:cat :verb :sem {:pred :be-called
-                                                  :subj {:pred :lei}
-                                                  :obj {:pred :luisa}}}})))))
-
-
+
+


whitespace

whitespace

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -334,7 +334,7 @@
   (take n
         (repeatedly #(let [generated
                            (morph (generate {:synsem {:cat :verb
-                                                               :subcat '()}}))
+                                                      :subcat '()}}))
                            parsed (reduce concat (map :parses (parse generated medium)))]
                        (log/info (str "generated: " generated))
                        (log/info (str "semantics: "


fix test

fix test

--- test/babel/test/it.cljc
+++ test/babel/test/it.cljc
@@ -55,10 +55,13 @@

 (deftest passato-prossimo
   (let [result (generate {:root {:italiano {:italiano "bere"}}
-                          :synsem {:subcat ()
-                                   :sem {:subj {:pred :I}
-                                         :tense :past
-                                         :aspect :perfect}}})]
+                          :modified false
+                          :synsem {:cat :verb
+                                   :subcat ()
+                                   :sem {:aspect :perfect
+                                         :obj :unspec
+                                         :subj {:pred :I}
+                                         :tense :past}}})]
     (is (not (nil? result)))
     (is (= "io ho bevuto" (morph result)))))


fix some latin tests

fix some latin tests

--- test/babel/test/la.cljc
+++ test/babel/test/la.cljc
@@ -28,32 +28,32 @@
 (deftest conjugate-ere
   (is (= "ardemus"
          (conjugate "ardēre"
-                    {:synsem {:sem {:subj {:pred :noi}}}}))))
+                    {:synsem {:agr {:person :1st :number :plur}}}))))

 (deftest generate-present
   (is (= "ardetis"
          (fo (generate
               {:root "ardēre"
-               :synsem {:sem {:subj {:pred :voi}
-                              :tense :present}}})))))
+               :synsem {:agr {:person :2nd :number :plur}
+                        :sem {:tense :present}}})))))

 (deftest generate-imperfect
   (is (= "ardebam"
          (fo (generate
               {:root "ardēre"
-               :synsem {:sem {:subj {:pred :I}
-                              :tense :past
+               :synsem {:agr {:person :1st :number :sing}
+                        :sem {:tense :past
                               :aspect :progressive}}})))))

 (deftest generate-future
   (is (= "ardebunt"
          (fo (generate
               {:root "ardēre"
-               :synsem {:sem {:subj {:pred :loro}
-                              :tense :future}}})))))
+               :synsem {:agr {:person :3rd :number :plur}
+                        :sem {:tense :future}}})))))
 (deftest reader1
-  (let [spec {:synsem {:sem {:subj {:pred :lui}
-                             :obj :unspec
+  (let [spec {:synsem {:agr {:person :3rd :number :sing :gender :masc}
+                       :sem {:obj :unspec
                              :tense :past
                              :aspect :progressive
                              :pred :answer}}}


doc: udpated doc of expose

doc: udpated doc of expose

--- src/fnx/meta/expose.clj
+++ src/fnx/meta/expose.clj
@@ -1,18 +1,27 @@
+;; This is usefull to display the functions, ask the user for the
+;; input parameters, and then execute them, presenting the result to
+;; the user.
+;; Intended to expose the functions in a Browser, but it could be
+;; anything else: command line, rich client, ...
+;;
 (ns fnx.meta.expose
   "Get the public functions of a namespace"
   (:use [midje.sweet]))

-
+;;
 ;; * First we load the ns with `require`
-;; * Then we use `ns-publics` to get all public vars
-;; * Then we filter functions: They have an `:arglists` in their meta
+;; * Then we get the public functions (read from bottom to top):
+;; * We want only functions, not the other vars: We can spot them because they have an `:arglists` in their meta.
+;; * Don't really know why, but we need to `ns-resolve` the symbols(?)
+;; * Get the public vars with `ns-publics`
+;;
 (defn ns-public-fn
   "Given a ns symbol, returns all the public fns of this ns."
   [ns] (do (require ns)
-           (filter (fn [s] (:arglists (meta s)))
+           (filter #(:arglists (meta %))
                    (map #(ns-resolve ns %)
                         (keys (ns-publics (find-ns ns)))))))
-
+
 (fact "ns-public-fn"
       (second (ns-public-fn 'fnx.meta.example)) => (resolve 'fnx.meta.example/hello-noir))


added stefon to the list of hosted scripts

--- src/frontend/stefon.clj
+++ src/frontend/stefon.clj
@@ -5,7 +5,9 @@
                      {:path "js/hosted/pusher.min.js"
                       :url "https://js.pusher.com/2.2/pusher.min.js"}
                      {:path "js/hosted/elevio.js"
-                      :url "https://static.elev.io/js/v3.js"}])
+                      :url "https://static.elev.io/js/v3.js"}
+                     {:path "js/hosted/segment.js"
+                      :url "http://cdn.segment.com/analytics.js/v1/AbgkrgN4cbRhAVEwlzMkHbwvrXnxHh35/analytics.min.js"}])

 (def asset-roots ["resources/assets"])


remove duplicate fn

remove duplicate fn

--- src/pc/http/datomic.clj
+++ src/pc/http/datomic.clj
@@ -121,13 +121,6 @@
            :v (chat-model/find-chat-name db (:v d)))
     d))

-(defmethod translate-datom :cust/uuid [db d]
-  (if (:chat/body (d/entity db (:e d)))
-    (assoc d
-           :a :chat/cust-name
-           :v (chat-model/find-chat-name db (:v d)))
-    d))
-
 (defmethod translate-datom :permission/cust [db d]
   (update-in d [:v] #(:cust/email (d/entity db %))))


update fallback data for ph post

update fallback data for ph post

--- src/pc/product_hunt.clj
+++ src/pc/product_hunt.clj
@@ -36,8 +36,8 @@
           "votes" [{"user"
                     {"image_url" {"30px" "http://avatars-cdn.producthunt.com/7824/30?1430236722"}}}]}
    19567 {"name" "Precursor for Teams",
-          "votes_count" 86,
-          "comments_count" 7,
+          "votes_count" 127,
+          "comments_count" 8,
           "tagline" "We make prototyping and team collaboration simple and easy"
           "discussion_url" "http://www.producthunt.com/posts/precursor-for-teams"
           "makers" [{"image_url" {"30px" "http://avatars-cdn.producthunt.com/106624/30?1430244521"}}


Fix bug that prevented new app keys to be used

--- src/photon/security.clj
+++ src/photon/security.clj
@@ -95,9 +95,10 @@
   (let [proj (get (:projections @(:state ms)) "__security-state__")
         v (:current-value @(:projection-descriptor proj))
         all-apps (mapcat vals (vals v))
-        valid-app (first (filter #(and (= (:client-id %) client-id)
-                                       (= (:client-secret %) client-secret))
-                                 all-apps))]
+        valid-app (first
+                   (filter #(and (= (str (:client-id %)) client-id)
+                                 (= (str (:client-secret %)) client-secret))
+                           all-apps))]
     (when-not (nil? valid-app) (second (:tks valid-app)))))

 (defrecord SecurityImpl [jws-tokens tokens secret username password]


fix faulty test (#408)

fix faulty test (#408)

--- exercises/concept/lucians-luscious-lasagna/test/lucians_luscious_lasagna_test.clj
+++ exercises/concept/lucians-luscious-lasagna/test/lucians_luscious_lasagna_test.clj
@@ -3,7 +3,7 @@
             lucians-luscious-lasagna))

 (deftest expected-time-test
-  (is (= 40 (lucians-luscious-lasagna/expected-time))))
+  (is (= 40 lucians-luscious-lasagna/expected-time)))

 (deftest remaining-time-test
   (is (= 15 (lucians-luscious-lasagna/remaining-time 25))))


Fix indentation

Fix indentation

--- src/core/cljs/virt/core.cljs
+++ src/core/cljs/virt/core.cljs
@@ -100,22 +100,22 @@
                 body (:body response)]
             (om/update! app [:apps] body))
           (while true
-              (let [[msg data] (<! comm)]
-                (case msg
-                  :set-channel
-                  (let [channel-link (:link ((:app data) (:apps @app-state)))]
-                    (set! (.-location js/window) (str channel-link "?id=" (:id data))))
-                  :navigate
-                  (case data
-                    :new (om/set-state! owner :page-id data)
-                    :back (om/set-state! owner :page-id nil))
-                  :new-channel
-                  (let [response
-                        (<! (http/post "/api/channels"
-                                       {:edn-params {:channel-name data}}))]
-                    (om/update! app [:channels] (:body response))
-                    (om/set-state! owner :page-id nil))
-                  nil))))
+            (let [[msg data] (<! comm)]
+              (case msg
+                :set-channel
+                (let [channel-link (:link ((:app data) (:apps @app-state)))]
+                  (set! (.-location js/window) (str channel-link "?id=" (:id data))))
+                :navigate
+                (case data
+                  :new (om/set-state! owner :page-id data)
+                  :back (om/set-state! owner :page-id nil))
+                :new-channel
+                (let [response
+                      (<! (http/post "/api/channels"
+                                     {:edn-params {:channel-name data}}))]
+                  (om/update! app [:channels] (:body response))
+                  (om/set-state! owner :page-id nil))
+                nil))))
         (set-up-history comm)))
     om/IRenderState
     (render-state [_ {:keys [comm page-id]}]


Add dead outcome

Add dead outcome

--- src/angelic/search/function_sets.clj
+++ src/angelic/search/function_sets.clj
@@ -32,12 +32,12 @@
 (defn get-logger [fs input-set]
   (state/get-logger input-set (precondition-context-set fs input-set)))

-
+(def dead-outcome [nil Double/NEGATIVE_INFINITY :blocked])
 (defn- output-or-nil [desc-fn stat-fn action input-set]
   (or (when-let [[out-set rew] (desc-fn action input-set)]
         (when (and (not (state-set/empty? out-set)) (> rew Double/NEGATIVE_INFINITY))
           [out-set rew (stat-fn input-set)]))
-      [nil Double/NEGATIVE_INFINITY :blocked]))
+      dead-outcome))

 (defn- make-fs [action status-fn child-seq-fn]
   (let [n (env/action-name action)]


CMR-688: Removed comment code.

CMR-688: Removed comment code.

--- system-int-test/test/cmr/system_int_test/search/collection_search_format_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_search_format_test.clj
@@ -34,59 +34,6 @@
     (ingest/create-provider "provguid2" "PROV2")  )

-
-  (let [x {:description "Summary of coll1",
-                :accessLevel "public",
-                :bureauCode ["026:00"],
-                :format "application/octet-stream",
-                :publisher
-                "National Aeronautics and Space Administration",
-                :mbox "support@earthdata.nasa.gov",
-                :spatial
-                "<gml:Polygon srsName=\"EPSG:4326\"><gml:outerBoundaryIs><gml:LinearRing><gml:posList>20.0 -70.0 20.0 70.0 30.0 70.0 30.0 -70.0 20.0 -70.0</gml:posList></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs></gml:innerBoundaryIs></gml:Polygon>",
-                :references
-                ["http://example.com" "http://example2.com"],
-                :contactPoint "undefined",
-                :modified "2012-01-19T18:00:00.000Z",
-                :title "Dataset1",
-                :language ["en-US"],
-                :programCode ["026:001"],
-                :identifier "C1200000000-PROV1",
-                :distribution
-                [{:accessURL "http://example.com",
-                  :format "application/octet-stream"}
-                 {:accessURL "http://example2.com",
-                  :format "application/octet-stream"}],
-                :issued "2012-01-11T10:00:00.000Z",
-                :accessURL "http://example.com",
-                :temporal "2010-01-01T12:00:00Z/2010-01-11T12:00:00Z"}
-        y {:description "Summary of coll1",
-                :accessLevel "public",
-                :bureauCode ["026:00"],
-                :format "application/octet-stream",
-                :publisher
-                "National Aeronautics and Space Administration",
-                :mbox "support@earthdata.nasa.gov",
-                :spatial
-                "<gml:Polygon srsName=\"EPSG:4326\"><gml:outerBoundaryIs><gml:LinearRing><gml:posList>20.0 -70.0 20.0 70.0 30.0 70.0 30.0 -70.0 20.0 -70.0</gml:posList></gml:LinearRing></gml:outerBoundaryIs><gml:innerBoundaryIs></gml:innerBoundaryIs></gml:Polygon>",
-                :references
-                ["http://example.com" "http://example2.com"],
-                :contactPoint "undefined",
-                :modified "2012-01-19T18:00:00.000Z",
-                :title "Dataset1",
-                :keyword (),
-                :language ["en-US"],
-                :programCode ["026:001"],
-                :identifier "C1200000000-PROV1",
-                :distribution
-                [{:accessURL "http://example.com",
-                  :format "application/octet-stream"}
-                 {:accessURL "http://example2.com",
-                  :format "application/octet-stream"}],
-                :issued "2012-01-11T10:00:00.000Z",
-                :accessURL "http://example.com",
-                :temporal "2010-01-01T12:00:00Z/2010-01-11T12:00:00Z"}]
-    (clojure.data/diff x y))

   )


Set closed specs in http-swagger example

--- examples/http-swagger/src/example/server.clj
+++ examples/http-swagger/src/example/server.clj
@@ -13,6 +13,7 @@
             [reitit.http.interceptors.dev :as dev]
             [reitit.interceptor.sieppari :as sieppari]
             [reitit.dev.pretty :as pretty]
+            [spec-tools.spell :as spell]
             [ring.adapter.jetty :as jetty]
             [aleph.http :as client]
             [muuntaja.core :as m]
@@ -74,7 +75,7 @@
                               "https://randomuser.me/api/"
                               {:query-params {:seed seed, :results results}})
                             :body
-                            (partial m/decode m/instance "application/json")
+                            (partial m/decode "application/json")
                             :results
                             (fn [results]
                               {:status 200
@@ -112,7 +113,7 @@
                              :body {:total (- x y)}})}}]]]

       {;;:reitit.interceptor/transform dev/print-context-diffs
-       ;;:wrap-spec reitit.dev.pretty/closed-keys
+       :wrap-spec spell/closed-keys
        :validate spec/validate
        :exception pretty/exception
        :data {:coercion spec-coercion/coercion


Slight tweaks to Clojure runner - Only running tests for the testing namespace - No longer writing log files

--- frameworks/clojure/clojure/test/codewars.clj
+++ frameworks/clojure/clojure/test/codewars.clj
@@ -1,7 +1,7 @@
 (ns clojure.test.codewars
   (:refer-clojure :exclude [time])
   (:require
-   [clojure.test :refer :all :exclude [run-all-tests]]
+   [clojure.test :refer :all :exclude [run-tests]]
    [clojure.stacktrace :as stack]))

 (defmulti codewars-report :type)
@@ -59,7 +59,7 @@
                    " msecs"))
      ret#))

-(defmacro run-all-tests []
+(defmacro run-tests []
   (binding [clojure.test/report
             clojure.test.codewars/codewars-report]
-    (time (clojure.test/run-all-tests))))
+    (time (clojure.test/run-tests))))


add future irregular tests

add future irregular tests

--- test/babel/test/fr.cljc
+++ test/babel/test/fr.cljc
@@ -267,6 +267,22 @@
                           :root {:français {:français "dormir"}}}
                          :model (small))]
     (is (= "je dormirais" (fo result)))))
+
+(deftest generate-future-with-irregular-future-stem-1
+  (let [result (generate {:synsem {:subcat '()
+                                   :sem {:pred :call
+                                         :subj {:pred :tu}
+                                         :tense :future}}}
+                         :model (medium))]
+    (is (= "tu appelas" (fo result)))))
+
+(deftest generate-future-with-irregular-future-stem-2
+  (let [result (generate {:synsem {:subcat '()
+                                   :sem {:subj {:pred :tu}
+                                         :tense :future}}
+                          :root {:français {:français "appeler"}}}
+                         :model (medium))]
+    (is (= "tu appelas" (fo result)))))

 (deftest generate-regular-conditional-reflexive
   (let [result (generate {:synsem {:subcat '()


Prevent a comment from being considered an expression.

--- src/enoki_lang_clj/core.cljs
+++ src/enoki_lang_clj/core.cljs
@@ -20,7 +20,6 @@
                | ASSIGNMENT
                | BLOCK
                | JSBLOCK
-               | COMMENT
                | RANGE

     EXPRESSIONS = {EXPRESSION <WS>?}


fix incorrect type hints on keys

fix incorrect type hints on keys

--- src/clj/elephantdb/cascalog/impl.clj
+++ src/clj/elephantdb/cascalog/impl.clj
@@ -25,11 +25,11 @@
     ))

 (defmapop [shardify [#^Integer num-shards]]
-  [#^BytesWritable k]
+  [k]
   (Utils/keyShard (Common/serializeElephantVal k) num-shards))

 (defmapop [mk-sortable-key [#^LocalPersistenceFactory fact]]
-  [#^BytesWritable k]
+  [k]
   (BytesWritable.
    (.getSortableKey
     (.getKeySorter fact)


[TEMP COMMIT] Implement timetable-prune-empty-rows

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -915,7 +915,59 @@

 (defn- timetable-prune-empty-rows
   "Removes empty rows resulting from the removal of lessons on given days."
-  [affectedDaysSet])
+  [affectedDaysSet]
+  (doseq [day affectedDaysSet]
+    (let [nrRows          (get-nr-rows-in-timetable-day day)
+          ttDay           (get-timetable-day day)
+
+          rowsPartition
+          (reduce (fn [rPart [rowIdx ttRow]]
+                    (if (empty? ttRow)
+                      (update-in rPart [:emptyRows]
+                                 (fn [emptyRowsVec]
+                                   (conj emptyRowsVec rowIdx)))
+                      (update-in rPart [:nonEmptyRows]
+                                 (fn [nonEmptyRowsVec]
+                                   (conj nonEmptyRowsVec rowIdx)))))
+                  {:emptyRows [], :nonEmptyRows []}
+                  (map vector (range (count ttDay)) ttDay))
+
+          emptyRowsVec    (:emptyRows rowsPartition)
+          nonEmptyRowsVec (:nonEmptyRows rowsPartition)
+          nrEmptyRows     (count emptyRowsVec)
+          nrNonEmptyRows  (- nrRows nrEmptyRows)
+          $day            (nth HTML-Timetable day)]
+      (if (>= nrNonEmptyRows 2)
+          ; we have at least 2 non empty rows, so remove all empty rows
+          (do (set! Timetable
+                    (update-in Timetable [day]
+                               (fn [ttDay]
+                                 (vec (map (fn [rowIdx] (nth ttDay rowIdx))
+                                           nonEmptyRowsVec)))))
+              ; remove empty <tr> elements
+              (doseq [[idx rowIdx] (map vector (range nrEmptyRows)
+                                        emptyRowsVec)]
+                (.remove (nth (children $day "tr") (- rowIdx idx)))))
+
+          ; We have less than 2 non empty rows. We remove as many empty rows
+          ; as we can, while ensuring that there are 2 rows for that day.
+          (let [nrEmptyRowsToKeep    (- 2 nrNonEmptyRows)
+                emptyRowsToKeepVec   (take nrEmptyRowsToKeep emptyRowsVec)
+                rowsToKeepSeq        (sort (fn [a b] (< a b))
+                                          (concat nonEmptyRowsVec
+                                                  emptyRowsToKeepVec))
+                emptyRowsToRemoveVec (drop nrEmptyRowsToKeep emptyRowsVec)]
+            (do (set! Timetable
+                      (update-in Timetable [day]
+                                 (fn [ttDay]
+                                   (vec (map (fn [rowIdx] (nth ttDay rowIdx))
+                                             rowsToKeepSeq)))))
+                ; remove empty <tr> elements
+                (doseq [[idx rowIdx]
+                        (map vector
+                             (range (count emptyRowsToRemoveVec))
+                             emptyRowsToRemoveVec)]
+                  (.remove (nth (children $day "tr") (- rowIdx idx))))))))))

 (defn remove-module
   "Removes a module from the timetable.


[REFACTOR] Use uppercase letters for vars

Signed-off-by: Pang Yan Han <22594c345857f664c61cd411f607c4d40a9d4af9@gmail.com>

--- src/cljs/cljs_nusmods/timetable.cljs
+++ src/cljs/cljs_nusmods/timetable.cljs
@@ -194,19 +194,19 @@

 (def ^{:doc     "Number of available background colors for lesson divs"
        :private true}
-  Nr-Available-Bg-Colors 24)
+  NR-AVAILABLE-BG-COLORS 24)

 (def ^{:doc     "Sequence of background color indices"
        :private true}
-  Bg-Colors-Seq [])
+  BG-COLORS-SEQ [])

 (defn get-next-lesson-bg-color-css-class
   "Returns the next css background color class for a lesson div"
   []
-  (if (empty? Bg-Colors-Seq)
-      (set! Bg-Colors-Seq (shuffle (range 0 Nr-Available-Bg-Colors))))
-  (let [currentIdx (first Bg-Colors-Seq)]
-    (set! Bg-Colors-Seq (rest Bg-Colors-Seq))
+  (if (empty? BG-COLORS-SEQ)
+      (set! BG-COLORS-SEQ (shuffle (range 0 NR-AVAILABLE-BG-COLORS))))
+  (let [currentIdx (first BG-COLORS-SEQ)]
+    (set! BG-COLORS-SEQ (rest BG-COLORS-SEQ))
     (str "lesson-bg-"
          (if (< currentIdx 10)
              "0"


Fix copyright year on sign.util ns.

Fix copyright year on sign.util ns.

--- src/clojure/buddy/core/sign/util.clj
+++ src/clojure/buddy/core/sign/util.clj
@@ -1,4 +1,4 @@
-;; Copyright 2014 Andrey Antukh <niwi@niwi.be>
+;; Copyright 2014-2015 Andrey Antukh <niwi@niwi.be>
 ;;
 ;; Licensed under the Apache License, Version 2.0 (the "License")
 ;; you may not use this file except in compliance with the License.


Fixed bug where a float could read too large of numbers from integers

--- src/clojush/instructions/numbers.clj
+++ src/clojush/instructions/numbers.clj
@@ -158,7 +158,7 @@
   (fn [state]
     (if (not (empty? (:string state)))
       (try (pop-item :string
-                     (push-item (Integer/parseInt (top-item :string state))
+                     (push-item (keep-number-reasonable (Long/parseLong (top-item :string state)))
                                 :integer state))
         (catch Exception e state))
       state)))
@@ -169,7 +169,7 @@
   (fn [state]
     (if (not (empty? (:string state)))
       (try (pop-item :string
-                     (push-item (Float/parseFloat (top-item :string state))
+                     (push-item (keep-number-reasonable (Float/parseFloat (top-item :string state)))
                                 :float state))
         (catch Exception e state))
       state)))
@@ -259,7 +259,7 @@
   ^{:stack-types [:integer]}
   (fn [state]
     (if (not (empty? (:integer state)))
-      (push-item (inc (stack-ref :integer 0 state))
+      (push-item (keep-number-reasonable (inc (stack-ref :integer 0 state)))
                  :integer
                  (pop-item :integer state))
       state)))
@@ -269,7 +269,7 @@
   ^{:stack-types [:integer]}
   (fn [state]
     (if (not (empty? (:integer state)))
-      (push-item (dec (stack-ref :integer 0 state))
+      (push-item (keep-number-reasonable (dec (stack-ref :integer 0 state)))
                  :integer
                  (pop-item :integer state))
       state)))
@@ -279,7 +279,7 @@
   ^{:stack-types [:float]}
   (fn [state]
     (if (not (empty? (:float state)))
-      (push-item (inc (stack-ref :float 0 state))
+      (push-item (keep-number-reasonable (inc (stack-ref :float 0 state)))
                  :float
                  (pop-item :float state))
       state)))
@@ -289,7 +289,7 @@
   ^{:stack-types [:float]}
   (fn [state]
     (if (not (empty? (:float state)))
-      (push-item (dec (stack-ref :float 0 state))
-                 :float
-                 (pop-item :float state))
-      state)))
+      (push-item (keep-number-reasonable (dec (stack-ref :float 0 state)))
+                 :float
+                 (pop-item :float state))
+      state)))