pass through pos vector for text

pass through pos vector for text

--- src/cljs/infinitelives/pixi/pixelfont.cljs
+++ src/cljs/infinitelives/pixi/pixelfont.cljs
@@ -88,7 +88,7 @@
   (add-text! batch font-key text :tint tint))

 (defn make-text [font-key text & {:keys [tint scale anchor rotation
-                                         x y visible
+                                         x y pos visible
                                          xhandle yhandle]
                                   :or {scale s/*default-scale*
                                        visible true
@@ -99,6 +99,7 @@
    :particle (not tint)
    :scale scale
    :rotation rotation
+   :pos pos
    :x x
    :y y
    :visible visible
@@ -106,7 +107,7 @@
    :yhandle yhandle))

 (defn appear-text [font-key text & {:keys [tint scale anchor rotation
-                                           x y visible
+                                           x y visible pos
                                            xhandle yhandle
                                            delay]
                                     :or {scale s/*default-scale*
@@ -120,6 +121,7 @@
          :particle (not tint)
          :scale scale
          :rotation rotation
+         :pos pos
          :x x
          :y y
          :visible visible


Fix key returned by initiate/build-new-client

Caller expects client-state rather than current-client

This version gets that first message to the server's child. And then
throws an exception because the response code path hasn't been written
yet.

--- src/clojure/frereth_cp/server/initiate.clj
+++ src/clojure/frereth_cp/server/initiate.clj
@@ -723,8 +723,8 @@
                                                                                client-message-box)]
                             {::log/state log-state
                              ::templates/initiate-client-vouch-wrapper client-message-box
-                             ::state/current-client (when matched?
-                                                      active-client)})
+                             ::state/client-state (when matched?
+                                                    active-client)})
                           {::log/state log-state}))
                       (catch ExceptionInfo ex
                         {::log/state (log/exception log-state


APU: Init Phase

APU: Init Phase

--- src/clojureplayground/codingame_helper.clj
+++ src/clojureplayground/codingame_helper.clj
@@ -17,6 +17,17 @@
 (defn thor-move2 [adj opp theta]
   ((allowed-lines theta) (direction adj opp)))

+;APU: Init Phase
+(let [inp ["00" "0."]
+      node? #(when (= \0 (.charAt %2 %)) %)
+      nright #(let [x (.indexOf % %2)]
+               (if (>= x 0) [x %3] [-1 -1]))
+      nbottom #()]
+  (map-indexed (fn [y row]
+                 (map-indexed (fn [x c]
+                                (when (node? c x)
+                                  (let [ntb (nbottom (drop (inc y) inp))
+                                        ntr (nright row (inc x) y)]))) row)) inp))

@@ -26,4 +37,3 @@

-


Changed if-not to when-not when there is no else clause.

--- src/cmr/indexer/services/index_service.clj
+++ src/cmr/indexer/services/index_service.clj
@@ -35,7 +35,7 @@
         ttl (when delete-time (t/in-millis (t/interval (t/now) delete-time)))
         concept-index (idx-set/get-concept-index-name context concept-id revision-id concept)
         es-doc (concept->elastic-doc context concept umm-concept)]
-    (if-not (and ttl (<= ttl 0))
+    (when-not (and ttl (<= ttl 0))
       (es/save-document-in-elastic
         context
         concept-index


Still debugging handshake from client

Still debugging handshake from client

--- src/com/frereth/server/comms/registrar.clj
+++ src/com/frereth/server/comms/registrar.clj
@@ -59,8 +59,11 @@

 c.f. auth-socket's dispatch"
   [msg :- auth-socket/router-message]
-  (log/debug "Trying to supply the Action channel in response to:\n"
-             (util/pretty msg))
+  (let [pretty-msg] (try (util/pretty msg)
+                         (catch RuntimeException ex
+                           (log/error ex "Trying to pretty-format for logging REQUEST")))
+       (log/debug "Trying to supply the Action channel in response to:\n"
+                  pretty-msg))
   (assoc msg
          :contents {:action-url {:port 7841  ; FIXME: magic number
                                  ;; TODO: Pull this from a config
@@ -79,18 +82,23 @@
   [->out :- com-skm/async-channel
    msg :- com-comm/router-message]
   (log/debug "Possibly authorizing to: " ->out)
-  ;; Major problems:
-  ;; 1. :contents is a lazy seq, 1 per frame
-  ;;    TODO: Just take first. Or enforce the 'one frame per message' at the protocol/socket level where it belongs
-  ;; 2. :contents is a [s/Keyword]. I'm really expecting a hashmap.
-  ;; Shouldn't really matter now: solution is to ignore and worry about later.
-  ;; But it will matter shortly, so I really hate to go down that path.
-  (let [response-body (authcz (:contents msg))
-        response (assoc msg :contents response-body)
-        [sent? c] (async/alts!! [[->out response] (async/timeout 500)])]
-    (when-not sent?
-      (log/error "possibly-authorize: timed out trying to respond with\n"
-                 (util/pretty response)))))
+  (try
+    ;; Major problems:
+    ;; 1. :contents is a lazy seq, 1 per frame
+    ;;    TODO: Just take first. Or enforce the 'one frame per message' at the protocol/socket level where it belongs
+    ;; 2. :contents is a [s/Keyword]. I'm really expecting a hashmap.
+    ;; Shouldn't really matter now: solution is to ignore and worry about later.
+    ;; But it will matter shortly, so I really hate to go down that path.
+    (let [response-body (authcz (first (:contents msg)))
+          response (assoc msg :contents response-body)
+          _ (log/debug "Sending\n" (util/pretty response) "\nin response to AUTH request")
+          [sent? c] (async/alts!! [[->out response] (async/timeout 500)])]
+      (when-not sent?
+        (log/error "possibly-authorize: timed out trying to respond with\n"
+                   (util/pretty response))))
+    (catch RuntimeException ex
+      (log/error ex "At this level, really should have been handled via ribol")
+      (throw))))

 (s/defn do-registrations :- com-skm/async-channel
   ;; TODO: This really seems like it should be a defnk
@@ -109,6 +117,7 @@
             (if v
               (try
                 (possibly-authorize ->out v)
+                ;; Don't want buggy inner handling code to break the external interface
                 (catch Exception ex
                   (log/error ex "Trying to authorize:\n" v)))
               (log/debug "do-registrations: heartbeat"))


Tweaks for asset paths (still a bit broken).

--- src/eu/cassiel/reveal_js_render_clj.clj
+++ src/eu/cassiel/reveal_js_render_clj.clj
@@ -49,11 +49,14 @@

 (def image (partial image-h 480))

+;; FIXME: need to bind ./asset vs. ASSET-ROOT-URL/asset depending on mode.
+
 (defn video-h [h f]
   [:video {:height h
            :controls 1
            :data-autoplay 1}
-   [:source {:src (str ASSET-ROOT-URL f)}]])
+   [:source {:src #_ (str ASSET-ROOT-URL f)
+             (str (File. "videos" f))}]])

 (def video (partial video-h 480))


Implement full-featured table component #45 - ability to have different cell types for columns

--- src/flatgui/samples/forms/tablewin2.clj
+++ src/flatgui/samples/forms/tablewin2.clj
@@ -18,7 +18,7 @@
             [flatgui.widgets.abstractbutton :as abstractbutton]
             [flatgui.paint :as fgp]))

-(def col-count 30)
+(def col-count 10)
 (def row-count 60)

 (def header-model-pos
@@ -30,13 +30,24 @@
    (mapv (fn [_] 1) (range 0 row-count))])

-(fgp/deflookfn cell-look (:theme :id :text :background)
+(fgp/deflookfn cell-look1 (:theme :id :text :background :widget-type)
  [;(fgp/call-look flatgui.skins.flat/component-look)
   (awt/setColor background)
   (awt/fillRoundRect (awt/+px 0 2) (awt/+px 0 2) (awt/-px w- 4) (awt/-px h- 4) 0.125)
   (awt/setColor (:prime-1 theme))
   (awt/drawRoundRect (awt/+px 0 2) (awt/+px 0 2) (awt/-px w- 4) (awt/-px h- 4) 0.125)
-  (awt/drawString text 0.375 0.375)])
+  (awt/drawString text 0.375 0.375)
+  (awt/drawString widget-type 0.0 0.625)])
+
+(fgp/deflookfn cell-look2 (:theme :id :text :background :widget-type)
+ [;(fgp/call-look flatgui.skins.flat/component-look)
+  (awt/setColor background)
+  (awt/fillRoundRect (awt/+px 0 2) (awt/+px 0 2) (awt/-px w- 4) (awt/-px h- 4) 0.125)
+  (awt/setColor (:prime-1 theme))
+  (awt/drawRoundRect (awt/+px 0 2) (awt/+px 0 2) (awt/-px w- 4) (awt/-px h- 4) 0.125)
+  (awt/drawString text 0.375 0.375)
+  (awt/drawString widget-type 0.0 0.625)])
+

 (fg/defevolverfn cell-text-evolver :text
   (let [mc (get-property [:this] :model-coord)]
@@ -76,11 +87,12 @@
     selected-color
     regular-color))

-(def democell
+(def democell1
   (merge-with fg/properties-merger cell/cell
                 {:skin-key false
-                 :look cell-look
+                 :look cell-look1
                  :text "?"
+                 :widget-type "democell1"
                  :children {:exp cell-expand-checkbox}
                  :evolvers {:text cell-text-evolver
                             :atomic-state atomic-state-evolver
@@ -92,6 +104,22 @@
                             :has-mouse nil
                             :enabled nil}}))

+(def democell2
+  (merge-with fg/properties-merger cell/cell
+              {:skin-key false
+               :look cell-look2
+               :text "x"
+               :widget-type "democell2"
+               :evolvers {:text cell-text-evolver
+                          :atomic-state atomic-state-evolver
+                          :background background-evolver
+                          ;; Strip some unneeded features
+                          :look nil
+                          :coord-map nil
+                          :accepts-focus? nil
+                          :has-mouse nil
+                          :enabled nil}}))
+
 (fg/defevolverfn scroll-cs-evolver :clip-size
   (let [ win-size (get-property [] :clip-size)]
     (m/defpoint (- (m/x win-size) 0.25) (- (m/y win-size) 0.625))))
@@ -100,7 +128,9 @@
   {:header-model-loc {:positions header-model-pos
                       :sizes header-model-size}
    :selection [nil nil]
-   :cell-prototype democell
+                                  ;; 0       1   2   3   4   5   6   7   8   9
+   :model-column->cell-prototype [democell1 nil nil nil nil nil nil nil nil nil]
+   :cell-prototype democell2
    :position-matrix m/identity-matrix
    :background (awt/color 32 16 8)
    :evolvers {:header-model-loc table/shift-header-model-loc-evolver


Slightly modified implementation of subsumption for EL-gfp

seems to be correct still, but is much faster.

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

--- src/conexp/contrib/dl/languages/EL_gfp.clj
+++ src/conexp/contrib/dl/languages/EL_gfp.clj
@@ -55,9 +55,9 @@
   (let [[C-tbox C-target] (uniquify-tbox-target-pair (expression (ensure-EL-gfp-concept C))),
 	[D-tbox D-target] (uniquify-tbox-target-pair (expression (ensure-EL-gfp-concept D))),

-	tbox (tbox-union C-tbox D-tbox),
-	G (tbox->description-graph tbox)]
-    (simulates? G G D-target C-target)))
+	G-C (tbox->description-graph C-tbox),
+	G-D (tbox->description-graph D-tbox)]
+    (simulates? G-D G-C D-target C-target)))

 ;;;


Sort test data to make diffs more useful

--- dev/user.clj
+++ dev/user.clj
@@ -43,6 +43,13 @@
     (io/make-parents file)
     (spit file (with-out-str (pprint data)))))

+(defn- normalized [data]
+  (clojure.walk/postwalk
+    (fn [form] (if (map? form)
+                 (into (sorted-map) form)
+                 form))
+    data))
+
 (defn update-testdata []
   (let [api (RestRestaurantApi. (:restaurant-api-url settings/defaultsettings))
         index @(updater/get-restaurants api)
@@ -53,6 +60,7 @@
     (save-testdata "restaurants.edn" index)
     (log/info "Saved restaurants")
     (doseq [[id restaurant] restaurants]
-      (save-testdata (str "restaurant/" id ".edn") @restaurant)
+      (save-testdata (str "restaurant/" id ".edn")
+                     (normalized @restaurant))
       (log/info "Saved restaurant" id))
     (log/info "Test data updated")))


Keep invited member in database

Keep invited member in database

--- src/inviteyoself/tasks/send_invites.clj
+++ src/inviteyoself/tasks/send_invites.clj
@@ -23,7 +23,6 @@

 (defn -main [& args]
   ; clean up folks already invited
-  (invite/delete-all-invited)
   (if (> (count (invite/all-not-invited invite-limit)) 0)
     (let [not-invited (invite/all-not-invited invite-limit)
           status-code (run-inviteyoself-automator


Renaming containers component. Will pull this out into it's own ns later.

--- src-cljs/frontend/components/org_settings.cljs
+++ src-cljs/frontend/components/org_settings.cljs
@@ -453,7 +453,7 @@
                     " ended " (pluralize (Math/abs (pm/days-left-in-trial plan)) "day")
                     " ago. Pay now to enable builds of private repositories."])))]]]]])))))

-(defn containers [app owner]
+(defn pricing [app owner]
   (reify
     ;; I stole the stateful "did we load stripe checkout code" stuff
     ;; from the plan component above, but the billing-card component
@@ -1117,7 +1117,7 @@
   {:overview overview
    :users users
    :projects projects
-   :containers containers
+   :containers pricing
    :organizations organizations
    :billing billing
    :cancel cancel})


Add uuid to entry JSON representation.

Add uuid to entry JSON representation.

--- src/oc/storage/representations/entry.clj
+++ src/oc/storage/representations/entry.clj
@@ -7,7 +7,7 @@
             [oc.storage.representations.media-types :as mt]
             [oc.storage.representations.board :as board-rep]))

-(def representation-props [:topic-slug :title :headline :body :body-placeholder :image-url :image-height :image-width
+(def representation-props [:uuid :topic-slug :title :headline :body :body-placeholder :image-url :image-height :image-width
                            :chart-url :attachments :author :created-at :updated-at])

 (defun url


doall -> dorun since this more clearly describes what really happens

--- src/clj/lambdacd/internal/execution.clj
+++ src/clj/lambdacd/internal/execution.clj
@@ -160,7 +160,7 @@
 (defn duplicate-step-results-not-running-again [new-build-number retriggered-build-number pipeline-history context step-id-to-run]
   (let [do-add-result (partial add-result new-build-number retriggered-build-number context)
         history-to-duplicate (filter (partial to-be-duplicated? step-id-to-run) pipeline-history)]
-    (doall (map do-add-result history-to-duplicate))))
+    (dorun (map do-add-result history-to-duplicate))))

 (defn retrigger [pipeline context build-number step-id-to-run]
   (if (> (count step-id-to-run) 1)


adding feature visualization

adding feature visualization

--- src/clojure/zensols/nlparse/feature.clj
+++ src/clojure/zensols/nlparse/feature.clj
@@ -6,6 +6,7 @@
   (:require [clojure.tools.logging :as log]
             [clojure.pprint :refer (pprint)])
   (:require [clojure.string :as str])
+  (:require [zensols.tabres.display-results :as dr])
   (:require [zensols.nlparse.wordnet :as wn]
             [zensols.nlparse.parse :as pt]))

@@ -291,3 +292,18 @@
        (filter #(> (second %) 0))
        (take num-counts)
        (map first)))
+
+
++
+;; visualization
+(defn display-features [classifier-attributes class-attribute feature-sets]
+  (let [keys (map first (concat (list class-attribute) classifier-attributes))]
+   (->> feature-sets
+        (map (fn [tok]
+               (map (fn [tkey]
+                      (get tok tkey))
+                    keys)))
+        ((fn [data]
+           (dr/display-results data
+                               :column-names (map name keys)))))))


Split edge munging into catalog and edge functions

This change adds munge-edges, which converts the edges of the given
catalog into a set, and applies munge-edge* to each of them. The
munge-edge* function handles keywordizing the relationship of the edge.

--- src/com/puppetlabs/puppetdb/catalog.clj
+++ src/com/puppetlabs/puppetdb/catalog.clj
@@ -116,15 +116,21 @@

 ;; ## Edge normalization

-(defn keywordify-relationships
-  "Take each edge in the the supplied catalog, and make their :relationship
-  value a proper keyword"
+(defn munge-edge*
+  "Converts the `relationship` value of `edge` into a
+  keyword."
+  [edge]
+  {:pre [(:relationship edge)]
+   :post [(keyword? (:relationship %))]}
+  (update-in edge [:relationship] keyword))
+
+(defn munge-edges
+  "Munges every edge of the given `catalog` and converts the edges into a set."
   [{:keys [edges] :as catalog}]
   {:pre  [(coll? edges)]
-   :post [(every? keyword? (map :relationship (% :edges)))]}
-  (let [new-edges (for [{:keys [relationship] :as edge} edges]
-                    (merge edge {:relationship (keyword relationship)}))]
-    (assoc catalog :edges (set new-edges))))
+   :post [(set? (:edges %))
+          (every? keyword? (map :relationship (:edges %)))]}
+  (assoc catalog :edges (set (map munge-edge* edges))))
 ;;
 ;; ## Misc normalization routines

@@ -232,7 +238,7 @@
       (munge-tags)
       (munge-classes)
       (munge-resources)
-      (keywordify-relationships)
+      (munge-edges)
       (check-edge-integrity)))

 (defn parse-from-json-string


Moved ns comment to docstring.

Moved ns comment to docstring.

--- src/fcms/resources/collection_resource.clj
+++ src/fcms/resources/collection_resource.clj
@@ -1,4 +1,6 @@
 (ns fcms.resources.collection-resource
+  "A collection resource is an FCMS resource that is contained in one particular collection.
+  Collection resources are either taxonomies or items."
   (:require [clojure.set :refer (intersection)]
             [clojure.string :refer (blank?)]
             [clojure.walk :refer (keywordize-keys)]
@@ -6,9 +8,6 @@
             [fcms.resources.common :as common]
             [fcms.resources.collection :as collection]
             [fcms.lib.slugify :refer (slugify)]))
-
-;; A collection resource is an FCMS resource that is contained in a particular collection.
-;; As of now, collection resources are either taxonomies or items.

 (def reserved-properties
   "Properties that can't be specified during a create and are ignored during an update."


Safer way to remove mkey.

Safer way to remove mkey.

--- src/org/spootnik/cyanite/store_cache.clj
+++ src/org/spootnik/cyanite/store_cache.clj
@@ -43,9 +43,10 @@
                     (fn-agg (fn-get
                              (fn-key tenant period rollup time path)
                              @pkeys)) ttl)))
-      (swap! mkeys #(dissoc % mkey))
       (catch Exception e
-        (error e "Cache flushing exception")))))
+        (error e "Cache flushing exception"))
+      (finally
+        (swap! mkeys #(dissoc % mkey))))))

 (defn- run-delayer!
   [rollup fn-flusher]


Row permutation seems to be working, now remove the selection thing and look what causes the attribute names row to behave strangely when not in first view - row...

--- src/conexp/contrib/gui/editors/util.clj
+++ src/conexp/contrib/gui/editors/util.clj
@@ -542,7 +542,6 @@
                grab-list (range old-view (+ 1 new-view))
                put-list (apply conj [new-view] (range old-view new-view))
                old-table-change-hook (get-hook-function otable "table-changed")]
-          (message-box (str new-view-to-index-map))
           (set-hook otable "table-changed" (fn [_ _ _ _] nil))
           (dorun (for [put-data
                         (doall (zip put-list
@@ -553,11 +552,39 @@
               (set-value-at-view otable (first put-data)
                 (first put-cell) (second put-cell)))))
           (dosync (ref-set (:row-permutator otable) new-row-permutator))
-          (set-hook otable "table-changed" old-table-change-hook)
-          )
-
-        nil
-        ))))
+          (set-hook otable "table-changed" old-table-change-hook))
+
+        (let [ new-view-to-index-map
+               (apply conj (for [r (range row-count)]
+                             (cond (< r new-view) {r (view-to-index r)}
+                               (= r old-view) {new-view (view-to-index old-view)}
+                               (< r old-view) {(+ r 1) (view-to-index r)}
+                               :otherwise {r (view-to-index r)})))
+               new-index-to-view-map
+               (apply conj (for [r (range row-count)]
+                             (cond (< r new-view) {(view-to-index r) r}
+                               (= r old-view) {(view-to-index old-view) new-view}
+                               (< r old-view) {(view-to-index r) (+ r 1)}
+                               :otherwise {(view-to-index r) r})))
+               new-view-to-index (fn [x] (if (and (>= x 0) (< x row-count))
+                                           (new-view-to-index-map x) x))
+               new-index-to-view (fn [x] (if (and (>= x 0) (< x row-count))
+                                           (new-index-to-view-map x) x))
+               new-row-permutator [new-view-to-index new-index-to-view]
+               grab-list (range new-view (+ 1 old-view))
+               put-list (conj (vec (range (+ 1 new-view) (+ 1 old-view))) new-view)
+               old-table-change-hook (get-hook-function otable "table-changed")]
+          (set-hook otable "table-changed" (fn [_ _ _ _] nil))
+          (dorun (for [put-data
+                        (doall (zip put-list
+                           (for [r grab-list]
+                             (doall (for [c col-indices]
+                                      (get-value-at-view otable r c))))))]
+            (doseq [put-cell (zip col-indices (second put-data))]
+              (set-value-at-view otable (first put-data)
+                (first put-cell) (second put-cell)))))
+          (dosync (ref-set (:row-permutator otable) new-row-permutator))
+          (set-hook otable "table-changed" old-table-change-hook))))))

 (defn- table-change-hook
   [otable column first-row last-row type]


Add set-pixel usage.

Add set-pixel usage.

--- src/quil_cljs_examples/image/create.cljs
+++ src/quil_cljs_examples/image/create.cljs
@@ -5,7 +5,8 @@
 (def img (atom nil))

 (defn setup []
-	(reset! img (q/create-image 50 50 :rgb)))
+	(reset! img (q/create-image 50 50 :rgb))
+	(q/set-pixel @img 10 10 (q/color 0 90 102)))

 (defn draw []


initial support for rendering paragraphs

--- src-cljs/frontend/components/canvas.cljs
+++ src-cljs/frontend/components/canvas.cljs
@@ -99,10 +99,16 @@

 (defmethod svg-element :layer.type/text
   [selected-eids layer]
-  (-> (svg/layer->svg-text layer)
-    (maybe-add-selected layer selected-eids)
-    (clj->js)
-    (dom/text (:layer/text layer))))
+  (let [text-props (svg/layer->svg-text layer)]
+    (-> text-props
+      (maybe-add-selected layer selected-eids)
+      (clj->js)
+      (#(apply dom/text % (reduce (fn [tspans text]
+                                    (conj tspans (dom/tspan
+                                                   #js {:dy (if (seq tspans) "1em" "0")
+                                                        :x (:x text-props)}
+                                                   text)))
+                                  [] (str/split (:layer/text layer) #"\n")))))))

 (defmethod svg-element :layer.type/line
   [selected-eids layer]


Revert "Merge pull request #119 from circleci/use-om"

This reverts commit dfe0bf5577a4b205439a1b521ef0d3d333f945ce, reversing
changes made to 6c3390b06f5a8feae30b9ef733d9bdf46e068135.

--- src-cljs/frontend/components/header.cljs
+++ src-cljs/frontend/components/header.cljs
@@ -94,6 +94,9 @@
               [:a {:on-click #(raise! owner [:set-user-session-setting {:setting :use-local-assets
                                                                         :value (not use-local-assets)}])}
                "local assets " (if use-local-assets "off " "on ")])
+            [:a {:on-click #(raise! owner [:set-user-session-setting {:setting :use-om
+                                                                      :value false}])}
+             "om off "]
             (let [current-build-id (get user-session-settings :om_build_id "dev")]
               (for [build-id (remove (partial = current-build-id) ["dev" "whitespace" "production"])]
                 [:a.menu-item


Ability to parse commiters, compute total commits and commits per author

--- src/emender_jenkins/metadata_reader.clj
+++ src/emender_jenkins/metadata_reader.clj
@@ -45,10 +45,30 @@
          (java.lang.Integer/parseInt string)
          default-value)))

+(defn parse-commiter
+    [line]
+    (let [parts (re-matches #"\s+(\d+)(.*)" line)]
+        (if parts
+            {:name    (-> (nth parts 2) clojure.string/trim)
+             :commits (-> (second parts) (parse-int 0))})))
+
+(defn parse-commiters
+    [lines]
+    (for [line lines]
+        (parse-commiter line)))
+
+(defn count-total-commits
+    [commiters]
+    (reduce + (map #(:commits %) commiters)))
+
 (defn read-and-parse-list-of-commiters
     [jenkins-url job-name]
-    (let [raw-data (jenkins-api/read-file-from-artifact jenkins-url job-name (:commiters-list GuideStatisticResultNames) nil)]
-        (count raw-data)))
+    (let [raw-data (jenkins-api/read-file-from-artifact jenkins-url job-name (:commiters-list GuideStatisticResultNames) nil)
+          lines    (if raw-data (clojure.string/split-lines raw-data))
+          commiters (parse-commiters lines)]
+          {:commiters-count (count lines)
+           :commiters       commiters
+           :total-commits   (count-total-commits commiters)}))

 (defn read-and-parse-chunkable-tags-ids
     [jenkins-url job-name]


fixin bugs with / redirect, and everything working!

--- src/restaurant_inspections_api/core.clj
+++ src/restaurant_inspections_api/core.clj
@@ -14,6 +14,12 @@
   (:use [clojure.tools.nrepl.server :only (start-server stop-server)])
   (:gen-class))

+(def server-error-details
+  "\n\nPlease contact the administrator:
+          - Github: teh0xqb
+          - Email: quilesbaker@gmail.com
+          - or Code For Miami Slack Group (http://codefor.miami)")
+
 (defn wrap-exception-handling
   [handler]
   (fn [request]
@@ -21,16 +27,17 @@
       (handler request)
       (catch com.mysql.jdbc.exceptions.jdbc4.CommunicationsException comm-e
         (log/error comm-e "DATABASE NOT AVAILABLE!")
-        {:status 500 :body "INTERNAL SERVER ERROR: Database not available. Please contact the administrator:
-        Github: teh0xqb
-        Email: quilesbaker@gmail.com
-        or Code For Miami Slack Group (http://codefor.miami)"})
+        {:status 500 :body (str "500 INTERNAL SERVER ERROR: Database not available." server-error-details)})
       (catch Exception e
         (log/error e "GENERIC ERROR bubbled up. replace specific expection here and add to the catch statements.")
-        {:status 500 :body "INTERNAL SERVER ERROR"}))))
+        {:status 500 :body (str "500 INTERNAL SERVER ERROR." server-error-details)}))))

-(def api (->> routes
-              middleware/wrap-canonical-redirect
+(def api (->> (middleware/wrap-canonical-redirect           ;; Not using thread last in first arg
+               routes                                       ;; because handler is the second args of this middleware
+               (fn [^String uri]
+                 (if (.equals uri "/")
+                   uri
+                   (middleware/remove-trailing-slash uri))))
               wrap-exception-handling
               site
               all-cors


Squashed fix lint and store author width to its own variable

making sure that long usernames are broken in two lines

fixed nickname timestamp overlapping issue

Signed-off-by: andrey <b713972e59b8e606e23253c4a13e948139fea4d1@gmail.com>

--- src/status_im/ui/screens/status/views.cljs
+++ src/status_im/ui/screens/status/views.cljs
@@ -91,6 +91,7 @@
 (defn message-item [account profile]
   (fn [{:keys [content-type content from timestamp outgoing] :as message}
        {:keys [modal on-long-press close-modal]}]
+
     [react/view (merge {:padding-vertical   8
                         :flex-direction     :row
                         :background-color   (when modal colors/white)
@@ -107,15 +108,18 @@
          [photos/member-photo from])]]
      [react/view {:flex 1}
       [react/view {:flex-direction  :row
-                   :justify-content :space-between}
+                   :justify-content :space-between
+                   :width           :98%
+                   :word-break      :break-all}
        [react/touchable-highlight
         {:on-press #(do (when modal (close-modal))
                         (when profile (re-frame/dispatch [:navigate-back]))
                         (re-frame/dispatch [:chat.ui/show-profile from]))}
-        (if outgoing
-          [message/message-my-name {:profile? true :you? false}]
-          [message/message-author-name from {:profile? true}])]
-       [react/text {:style {:font-size 10 :color colors/gray}}
+        (let [message-author-width (* @(re-frame/subscribe [:dimensions/window-width]) 0.75)]
+          (if outgoing
+            [react/view {:style {:width message-author-width}} [message/message-my-name {:profile? true :you? false}]]
+            [react/view {:style {:width message-author-width}} [message/message-author-name from {:profile? true}]]))]
+       [react/text {:style {:font-size 10 :color colors/gray :margin-left :auto}}
         (datetime/time-ago (datetime/to-date timestamp))]]
       [react/view
        (if (= content-type constants/content-type-image)


Remove debug msg.

Remove debug msg.

--- src/uxbox/ui/workspace/canvas/selrect.cljs
+++ src/uxbox/ui/workspace/canvas/selrect.cljs
@@ -72,7 +72,6 @@
     (as-> ss $
       (rx/filter #(= (vec %) [false true]) $)
       (rx/with-latest-from vector wb/mouse-s $)
-      (rx/pr-log "kaka1" $)
       (rx/on-value $ (fn [[_ [x y :as pos]]]
                        (let [scroll (or @wb/scroll-top 0)
                              pos [x (+ y scroll)]]


Add es bindings in main file

Add es bindings in main file

--- src/in/co/sdslabs/slack_lens/listener/main.clj
+++ src/in/co/sdslabs/slack_lens/listener/main.clj
@@ -1,12 +1,44 @@
 (ns in.co.sdslabs.slack-lens.listener.main
-  (:require [in.co.sdslabs.slack-lens.lib.slack-rtm :as rtm]))
+  (:require [in.co.sdslabs.slack-lens.lib
+                                   [slack-rtm :as rtm]
+                                   [es :as es]]
+            [in.co.sdslabs.slack-lens.config.es :as es-config]
+
+            [cheshire.core :as json]
+            [clojure.java.io :as jio]))
+
+(defn get-config
+  []
+  (-> (jio/resource "config.json")
+       slurp
+       (json/parse-string true)))

 (defn- message-handler
   [& [args]]
   (println args))

+(defn- get-proper-response
+  [response]
+  (-> (json/parse-string response true)
+      (dissoc :ts)
+      (assoc :timestamp (System/currentTimeMillis))))
+
+(defn setup-elastic
+  []
+  (let [config (get-config)
+        es-conn (es/connect-es config)]
+    (if
+      (es/ensure-index!
+        es-conn (:index_name config) es-config/settings es-config/mappings)
+      {:conn es-conn
+       :index-name (:index_name config)
+       :mapping (:mapping config)}
+      nil)))
+
 (defn start
   [options]
-  (let [rtm-conn (rtm/start options)]
-    (rtm/subscribe "message" #(println %))
+  (let [rtm-conn (rtm/start options)
+        options (setup-elastic)]
+    (rtm/subscribe "message"
+        #(es/elastic-feed (assoc options :response (get-proper-response %))))
     rtm-conn))


Only push repositories on release/ branches

If travis is building anything other than a release/ branch, it
shouldn't push the repo.

--- src/leiningen/pallet_release/travis.clj
+++ src/leiningen/pallet_release/travis.clj
@@ -94,7 +94,8 @@
 (defn push
   "Push a PalletOps project from travis"
   [project args]
-  (when-not (every? (:pallet-release project) [:url :branch])
-    (fail "project.clj fails to specify :url and :branch in :pallet-release"))
-  (let [gh-token (System/getenv "GH_TOKEN")]
-    (do-push project (:pallet-release project) gh-token)))
+  (when (.startsWith (git/current-branch) "release/")
+    (when-not (every? (:pallet-release project) [:url :branch])
+      (fail "project.clj fails to specify :url and :branch in :pallet-release"))
+    (let [gh-token (System/getenv "GH_TOKEN")]
+      (do-push project (:pallet-release project) gh-token))))


Additional comments and code cleanup

Additional comments and code cleanup

--- src/main/clojure/clara/rules/engine.clj
+++ src/main/clojure/clara/rules/engine.clj
@@ -11,22 +11,27 @@
 (defprotocol IRuleSource
   (load-rules [source]))

+;; Record defining a single condition in a rule production.
 (defrecord Condition [type constraints binding-keys activate-fn text])

 ;; Record containing one or more test expressions to evaluate.
 (defrecord Test [test-fn text])

+;; Record defining a production, where lhs is the left-hand side containing constraints, and rhs is right-hand side.
 (defrecord Production [lhs rhs])

+;; Record defining a query given the parameters and expected bindings used in the query.
 (defrecord Query [params lhs binding-keys])

+;; A rulebase -- essentially an immutable Rete network with a collection of alpha and beta nodes and supporting structure.
 (defrecord Rulebase [alpha-roots beta-roots productions queries production-nodes query-nodes node-to-id id-to-node]
   IRuleSource
   (load-rules [this] this)) ; A rulebase can be viewed as a rule loader; it simply loads itself.

+;; A Rete-style token, containing facts and bound variables.
 (defrecord Token [facts bindings])

-;; A working memory element
+;; A working memory element, containing a single fact and its corresponding bound variables.
 (defrecord Element [fact bindings])

 ;; Token with no bindings, used as the root of beta nodes.
@@ -110,10 +115,12 @@
                      memory
                      transport))))

+;; Protocol for activation of Rete alpha nodes.
 (defprotocol IAlphaActivate
   (alpha-activate [node facts memory transport])
   (alpha-retract [node facts memory transport]))

+;; Record for the production node in the Rete network.
 (defrecord ProductionNode [production rhs]
   ILeftActivate
   (left-activate [node join-bindings tokens memory transport]
@@ -167,6 +174,9 @@
            :let [bindings (activation fact)] :when bindings]
        (->Element fact bindings)))))

+;; Record for the join node, a type of beta node in the rete network. This node performs joins
+;; between left and right activations, creating new tokens when joins match and sending them to
+;; its descendents.
 (defrecord JoinNode [condition children binding-keys]
   ILeftActivate
   (left-activate [node join-bindings tokens memory transport]
@@ -217,6 +227,9 @@
            token (get-tokens memory node join-bindings)]
        (->Token (conj (:facts token) fact) (conj (:bindings token) bindings))))))

+;; The NegationNode is a beta node in the Rete network that simply
+;; negates the incoming tokens from its ancestors. It sends tokens
+;; to its descendent only if the negated condition or join fails (is false).
 (defrecord NegationNode [condition children binding-keys]
   ILeftActivate
   (left-activate [node join-bindings tokens memory transport]
@@ -243,6 +256,7 @@
     (remove-elements! memory node elements join-bindings) ;; FIXME: elements must be zero to retract.
     (send-tokens transport memory children (get-tokens memory node join-bindings))))

+;; The test node represents a Rete extension in which
 (defrecord TestNode [test children]
   ILeftActivate
   (left-activate [node join-bindings tokens memory transport]
@@ -259,10 +273,14 @@

   (description [node] (str "TestNode -- " (:text test))))

-;;
+;; The accumulator is a Rete extension to run an accumulation (such as sum, average, or similar operation)
+;; over a collection of values passing through the Rete network. This object defines the behavior
+;; of an accumulator. See the AccumulatorNode for the actual node implementation in the network.
 (defrecord Accumulator [result-binding input-condition initial-value reduce-fn combine-fn convert-return-fn])

-(defn- retract-accumulated [node accumulator token result fact-bindings transport memory]
+(defn- retract-accumulated
+  "Helper function to retract an accumulated value."
+  [node accumulator token result fact-bindings transport memory]
   (let [converted-result ((get-in accumulator [:definition :convert-return-fn]) result)
         new-facts (conj (:facts token) converted-result)
         new-bindings (merge (:bindings token)
@@ -274,7 +292,9 @@
     (retract-tokens transport memory (:children node)
                     [(->Token new-facts new-bindings)])))

-(defn- send-accumulated [node accumulator token result fact-bindings transport memory]
+(defn- send-accumulated
+  "Helper function to send the result of an accumulated value to the node's children."
+  [node accumulator token result fact-bindings transport memory]
   (let [converted-result ((get-in accumulator [:definition :convert-return-fn]) result)
         new-bindings (merge (:bindings token)
                             fact-bindings
@@ -285,6 +305,9 @@
     (send-tokens transport memory (:children node)
                  [(->Token (conj (:facts token) converted-result) new-bindings)])))

+;; The AccumulateNode hosts Accumulators, a Rete extension described above, in the Rete network
+;; It behavios similarly to a JoinNode, but performs an accumulation function on the incoming
+;; working-memory elements before sending a new token to its descendents.
 (defrecord AccumulateNode [accumulator definition children binding-keys]
   ILeftActivate
   (left-activate [node join-bindings tokens memory transport]
@@ -579,7 +602,7 @@

     ;; Recursively create children, then create a new join and alpha node for the condition.
     :condition
-    (if (= "clara.rules.engine.Accumulator" (.getName (class (:content expression)))) ; FIXME: check class?
+    (if (instance? Accumulator (:content expression))
       (insert-accumulator (:content expression) more production-node alpha-roots ancestor-binding-keys)
       (let [condition (:content expression)
             join-binding-keys (s/intersection ancestor-binding-keys (:binding-keys condition))
@@ -621,7 +644,6 @@
     ;; The returned production node will be the child of a join node built as we
     ;; work our way back up the recursion stack.
     nil [production-node alpha-roots]))
-

 (defn- node-id [node]
   (->> node
@@ -711,8 +733,6 @@
 ;; The token that triggered a rule to fire.
 (def ^:dynamic *rule-context* nil)

-(declare print-memory)
-
 (defn fire-rules*
    "Fire rules for the given nodes."
    [rulebase nodes transient-memory transport]


Pass emotional state to reaction functions. Bored actions

--- src/main/clojure/emotions_demo/core.clj
+++ src/main/clojure/emotions_demo/core.clj
@@ -143,7 +143,7 @@
     (go (while true
           (let [state (<! state-chan)]
             (if (predicate state)
-              (reaction robot reaction-complete-chan)))))
+              (reaction robot state reaction-complete-chan)))))
     (go (while true
           (let [done (<! reaction-complete-chan)]
             (>! percept-chan (percept done)))))
@@ -154,7 +154,7 @@
   (> (get-in state [:sv :phys-anger] 0.0) 0.75))

 (defn anger-reaction
-  [robot complete-chan]
+  [robot state complete-chan]
   (nao/run-behaviour robot "dsnowdon-angry" complete-chan))

 (defn anger-reaction-percept
@@ -173,7 +173,7 @@
   (> (get-in state [:sv :soc-lonely] 0.0) 0.5))

 (defn lonely-reaction
-  [robot complete-chan]
+  [robot state complete-chan]
   (->
    (nao/say robot "Is anyone there? I'm feeling lonely.")
    (nao/future-callback-wrapper
@@ -195,11 +195,13 @@
   (> (get-in state [:sv :saf-bored] 0.0) 0.75))

 (defn bored-reaction
-  [robot complete-chan]
-  (->
-   (nao/say robot "Ho hum! I'm bored.")
-   (nao/future-callback-wrapper
-    (nao/callback->channel complete-chan))))
+  [robot state complete-chan]
+  (if (> (rand) 0.5)
+    (->
+     (nao/say robot "Ho hum! I'm bored.")
+     (nao/future-callback-wrapper
+      (nao/callback->channel complete-chan)))
+    (nao/run-behaviour robot "dsnowdon-hello" complete-chan)))

 (defn bored-reaction-percept
   [done-signal]
@@ -263,6 +265,7 @@
           hand-chan (chan)
           foot-chan (chan)
           clients-atom (atom [display-chan])]
+      (nao/set-volume robot (Float. 1.0))
       (nao/say robot "I'm starting to feel quite emotional")
       (let [ev-robot
             (-> robot


add date on fix me and future fact

add date on fix me and future fact

--- test/stonecutter/integration/kerodon.clj
+++ test/stonecutter/integration/kerodon.clj
@@ -326,6 +326,7 @@
           (k/visit "/sign-in")
           (kh/selector-includes-content [ks/sign-in-app-name] "My App Name")))

+;; 06 Jul 2015
 (future-fact "Replaying the same post will generate a 403 from the csrf handling"
              (-> (k/session test-app)
                  (register "csrf@email.com")


Debugging mdoe for aha*

Debugging mdoe for aha*

--- src/angelic/search/implicit/ah_astar.clj
+++ src/angelic/search/implicit/ah_astar.clj
@@ -42,6 +42,7 @@

 (defn plan-refinements [{:keys [opt-sol opt-seq]}]
   (let [[[s rfs] r stat] (first opt-seq)]
+;    (println (-> opt-seq last second))
     (assert (= stat :solved))
     (assert (seq rfs))
     (keep
@@ -71,6 +72,15 @@
   [henv]
   (-?>
    henv henv->root-plan plan->simple-node
+   (is/make-flat-incremental-dijkstra
+    #(->> % :data plan-refinements (map plan->simple-node)))
+   is/first-goal-node :data plan->solution-pair))
+
+(defn optimistic-ah-a-part*
+  "AHA* with no pessimistic descriptions, but repeated hstate elimination"
+  [ss fs]
+  (-?>
+   (make-plan [] [[ss [fs]] 0 :solved]) plan->simple-node
    (is/make-flat-incremental-dijkstra
     #(->> % :data plan-refinements (map plan->simple-node)))
    is/first-goal-node :data plan->solution-pair))


leadership awaiting added to nimbus

leadership awaiting added to nimbus

--- src/clj/backtype/storm/daemon/nimbus.clj
+++ src/clj/backtype/storm/daemon/nimbus.clj
@@ -11,7 +11,7 @@
             Cluster Topologies SchedulerAssignment SchedulerAssignmentImpl DefaultScheduler ExecutorDetails])
   (:use [backtype.storm bootstrap util])
   (:use [backtype.storm.daemon common])
-  (:use [backtype.storm.nimbus storage])
+  (:use [backtype.storm.nimbus elections storage])
   (:gen-class
     :methods [^{:static true} [launch [backtype.storm.scheduler.INimbus] void]]))

@@ -854,7 +854,8 @@
 (defserverfn service-handler [conf inimbus]
   (.prepare inimbus conf (master-inimbus-dir conf))
   (log-message "Starting Nimbus with conf " conf)
-  (let [nimbus (nimbus-data conf inimbus)
+  (let [leader-elections (await-leadership conf)
+        nimbus (nimbus-data conf inimbus)
         storage (:storage nimbus)]
     (cleanup-corrupt-topologies! nimbus)
     (doseq [storm-id (.active-storms (:storm-cluster-state nimbus))]


adding delay for testing purposes + thread id dumping

--- src/cljc/ow/starbuck/message_router.cljc
+++ src/cljc/ow/starbuck/message_router.cljc
@@ -243,16 +243,18 @@
         (let [sub-ch (a/sub input-pub comp-kw (a/chan))
               timeout (+ 20000 (rand-int 2000))]
           (a/go-loop [[msg _] (a/alts! [sub-ch (a/timeout timeout)])]
-            (println "got component msg in" comp-kw "-" msg)
+            (println "got component msg in" comp-kw "-" msg "on thread" (-> Thread .currentThread .getId))
             (when msg
+              (Thread/sleep 1000)
               (a/put! output-ch (update msg :visited-components #(conj % [comp-kw (java.util.Date.)])))
               (recur (a/alts! [sub-ch (a/timeout timeout)]))))))

       (defn start-async-router [router router-kw input-ch output-ch]
         (let [timeout (+ 20000 (rand-int 2000))]
           (a/go-loop [[msg _] (a/alts! [input-ch (a/timeout timeout)])]
-            (println "got router msg in" router-kw "-" msg)
+            (println "got router msg in" router-kw "-" msg "on thread" (-> Thread .currentThread .getId))
             (when msg
+              (Thread/sleep 1000)
               (route router msg)
               (recur (a/alts! [input-ch (a/timeout timeout)])))))))


revert bug that was showing wrong details for human genes (was showing the branch ontology instead)

--- src/cljs/gointermod/search/handlers.cljs
+++ src/cljs/gointermod/search/handlers.cljs
@@ -111,8 +111,8 @@
         :ontology-branch (get result 9)
         :data-set-name (get @original-datasource (get result 1) (str na " - original input gene"))
         :data-set-url na
-        :display-ortholog-id (lookup-original-input-identifier (get result 7) result)
-        :display-original-id (lookup-original-input-identifier (get result 7) result)
+        :display-ortholog-id (utils/get-id result :original-gene-set)
+        :display-original-id (utils/get-id result :original-gene-set)
        }
     ) results)))


add notification box for admin events to dashboard

--- src/cljs/salava/social/ui/dashboard.cljs
+++ src/cljs/salava/social/ui/dashboard.cljs
@@ -15,7 +15,8 @@
             [salava.core.ui.notactivated :refer [not-activated-banner]]
             [salava.badge.ui.pending :as pb]
             [clojure.string :refer [blank?]]
-            [dommy.core :as dommy :refer [has-class?] :refer-macros [sel sel1]]))
+            [dommy.core :as dommy :refer [has-class?] :refer-macros [sel sel1]]
+            [salava.admin.ui.helper :refer [admin?]]))

 (defn toggle-visibility [visibility-atom]
  (ajax/POST
@@ -187,6 +188,7 @@

 (defn notifications-block [state]
   (let [events (->> (:events @state) (remove #(= (:verb %) "ticket")) (take 5))
+        admin-events (->> (:events @state) (filter #(= (:verb %) "ticket")))
         tips (:tips @state)]
     [:div {:class "box col-md-4"}
      [:div#box_1
@@ -194,8 +196,8 @@
        [:div.notifications-block.row_1.notifications;.block-content
         [:div.heading_1 [:i.fa.fa-rss.icon]
          [:a {:href "social/stream"} [:span.title (t :social/Stream)]] [:span.badge (count (:events @state))]
-         [:span.icon.small]
-         #_[:i.fa.fa-angle-right.icon.small]]
+         [:span.icon.small]]
+
         (if (not-activated?)
           [:div.content
            [:div {:style {:font-size "initial"}}
@@ -206,18 +208,29 @@
              [:li (t :social/Notactivatedbody4)]
              [:li (t :social/Notactivatedbody5)]
              [:li (t :social/Notactivatedbody6)]]]]
-          (reduce (fn [r event]
-                    (conj r [:div.notification-div.ax_default
-                             (cond
-                               (and (= "badge" (:type event)) (= "follow" (:verb event))) (follow-event-badge event state)
-                               (and (= "user" (:type event)) (= "follow" (:verb event))) (follow-event-user event state)
-                               (and (= "badge" (:type event)) (= "publish" (:verb event))) (publish-event-badge event state)
-                               (and (= "page" (:type event)) (= "publish" (:verb event))) (publish-event-page event state)
-                               (= "advert" (:type event)) (badge-advert-event event state)
-                               (= "message" (:verb event)) [message-event event state]
-                               :else "")]))
-
-                  [:div.content] events))]]]]))
+          [:div.content
+           (when (and (admin?) (seq admin-events)) [:div.notification-div.ax_default {:style {:text-align "left" :margin-bottom "25px" :height "35px"}}
+                                                    [:a {:href (path-for "/admin/tickets") :style {:color "unset"}}
+                                                     [:div {:class "media"}
+                                                           [:div.media-left
+                                                            [:i.fa.fa-fw.fa-lightbulb-o]]
+                                                           [:div.media-body
+                                                            [:div.content-text
+                                                             [:p.content-heading (str (count admin-events) " " (t :social/Emailadmintickets))]]]]]])
+
+           (reduce (fn [r event]
+                       (conj r [:div.notification-div.ax_default
+                                (cond
+                                  (and (= "badge" (:type event)) (= "follow" (:verb event))) (follow-event-badge event state)
+                                  (and (= "user" (:type event)) (= "follow" (:verb event))) (follow-event-user event state)
+                                  (and (= "badge" (:type event)) (= "publish" (:verb event))) (publish-event-badge event state)
+                                  (and (= "page" (:type event)) (= "publish" (:verb event))) (publish-event-page event state)
+                                  (= "advert" (:type event)) (badge-advert-event event state)
+                                  (= "message" (:verb event)) [message-event event state]
+                                  :else "")]))
+
+                   [:div] events)])]]]]))
+

 (defn latest-earnable-badges []
   (let [block (first (plugin-fun (session/get :plugins)  "application" "latestearnablebadges"))]


Rearanged and fixed up bioavailability.clj

--- src/clojush/examples/bioavailability.clj
+++ src/clojush/examples/bioavailability.clj
@@ -20,7 +20,7 @@
 ;; prediction. In Proceedings of the 11th Annual conference on
 ;; Genetic and evolutionary computation (GECCO '09). ACM,
 ;; New York, NY, USA, 1115-1122. DOI=10.1145/1569901.1570051
-;; http://doi.acm.org/10.1145/1569901.1570051
+;; http://doi.acm.org/10.1145/1569901.1570051
 ;;
 ;; Data available from:
 ;;  http://personal.disco.unimib.it/Vanneschi/bioavailability.txt
@@ -34,11 +34,20 @@
         [clojush.random]
         [clojush.util]
         [local-file]
-        ;[clojush.evaluate] ;;remove later
-        ;[clojush.individual] ;;remove later
         [clojure.math.numeric-tower])
   (:require [clojure.string :as string]
             [clojure-csv.core :as csv]))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Helper functions
+
+(defn rmse
+  "Returns the root of the mean square error for use in error reporting."
+  [errors]
+  (sqrt (/ (apply + (map #(* % %)
+                         errors))
+           (count errors))))

 (defn read-data []
   "Reads data from data/bioavailability.txt into a sequence of sequences."
@@ -47,13 +56,6 @@
     (map #(map (fn [x] (float (read-string x)))
                %)
          lines)))
-
-;(count (read-data))
-
-;(count (first (read-data)))
-
-;(map last (read-data))
-

 (defn define-fitness-cases
   "Returns a map with two keys: train and test. Train maps to a
@@ -66,29 +68,22 @@
     {:train (subvec fitness-cases-shuffled 0 train-num)
      :test (subvec fitness-cases-shuffled train-num)}))

-;; Define the fitness cases. Do this once per run, so that train and test
-;; subsets stay the same throughout a run.
-(def bioavailability-fitness-cases (define-fitness-cases))

-;; Helper functions to get specific train and test cases
-;(defn train-fitness-case
-;  "Returns train fitness case number n for this run."
-;  [n]
-;  (nth (:train bioavailability-fitness-cases) n))
-;
-;(defn test-fitness-case
-;  "Returns test fitness case number n for this run."
-;  [n]
-;  (nth (:test bioavailability-fitness-cases) n))
-
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Define instructions and fitness cases

 ;; I want x0 through x240 to be instructions that, when executed, push
 ;; the float from that column onto the float stack.
 (doseq [[numb symb] (map #(vector % (symbol (str "x" %))) (range 241))]
   (eval `(define-registered ~symb (fn [state#] (push-item (stack-ref :auxiliary ~numb state#) :float state#)))))
-
-;(sort (map str (vec @registered-instructions)))

+;; Define the fitness cases. Do this once per run, so that train and test
+;; subsets stay the same throughout a run.
+(def bioavailability-fitness-cases (define-fitness-cases))
+
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Main functions to pass to pushgp

 ;; This definition of atom-generators makes it so that choosing a terminal
 ;; has equivalent probability of choosing one of the operators. This is
@@ -100,12 +95,8 @@
                         (symbol (str "x" n)))))
     ))

-;; Test random code generation
-;(random-code 100 bioavailability-atom-generators)
-
-
-
 (defn bioavailability-error-function
+  "Error function for the bioavailability problem."
   [fitness-set program]
     (doall
       (for [fitness-case (get bioavailability-fitness-cases fitness-set)]
@@ -120,41 +111,22 @@
             (abs (- output top-float))
             10000.0)))))

-;(run-push '(4 5 integer_add x0 x1 x2 float_add x240)
-;          (assoc (make-push-state)
-;                 :auxiliary
-;                 (butlast (first (:train (define-fitness-cases))))))
-;
-;(evaluate-individual (make-individual :program (random-code 100 bioavailability-atom-generators))
-;                     bioavailability-error-function
-;                     (new java.util.Random))
-;
-;(evaluate-individual (make-individual :program '(x2 x19 float_mult))
-;                     (partial bioavailability-error-function :train)
-;                     (new java.util.Random))
-
-(defn rmse
-  "Returns the root of the mean square error for use in error reporting."
-  [errors]
-  (sqrt (/ (apply + (map #(* % %)
-                         errors))
-           (count errors))))
-
-
 (defn bioavailability-report
   "Customize generational report."
   [best population generation error-function report-simplifications]
   (let [best-program (not-lazy (:program best))
         best-test-errors (bioavailability-error-function :test best-program)] ;;not working
     (printf ";; -*- Bioavailability problem report generation %s" generation)(flush)
-    (printf  "\nMean error on test set: %.4f"
+    (printf  "\nTest mean: %.4f"
             (float (/ (apply + best-test-errors)
                       (count best-test-errors))))(flush)
-    (printf "\nRMSE Train: %.3f" (rmse (:errors best)))(flush)
-    (printf "\nRMSE Test: %.3f" (rmse best-test-errors))(flush)
+    (printf "\nTest RMSE: %.4f" (rmse best-test-errors))(flush)
     (printf "\n\n;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;\n\n")(flush)
     ))

+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Main call

 (pushgp
   :error-function (partial bioavailability-error-function :train)
@@ -172,5 +144,6 @@
   :node-selection-tournament-size 2
   :report-simplifications 0
   :final-report-simplifications 1000
+  :use-rmse true
   :problem-specific-report bioavailability-report
   )


Fix global/local var handling

Fix global/local var handling

--- src/luaclj/core.clj
+++ src/luaclj/core.clj
@@ -3,6 +3,7 @@
             [proteus :refer [let-mutable]]
             [clojure.pprint :refer [pprint]]
             [clojure.string :as str]
+            [clojure.set :as set]
             [com.rpl.specter :refer [select
                                      ALL
                                      select-first
@@ -21,21 +22,13 @@
   (cons 'some->> (interpose '((fn [arg]
                               (when (sequential? arg) arg)))
                            args)))
+
+(def third #(nth %1 2))
+(def fourth #(nth %1 3))
+
 (defn leave [odd-or-even-kw items]
   (map second (remove #((if (= odd-or-even-kw :odd) odd? even?) (first %1)) (map #(vector %1 %2) (range) items))))

-(defn get-var-init-statements [& args]
-  (let [set-statements (select (walker #(= (safe-some-> %1 first) 'set!)) args)
-        vars (into (hash-set) (map second set-statements))
-        var-init-statements (mapcat identity (map #(vector %1 nil) vars)) ]
-    var-init-statements
-  ))
-(defn get-local-var-init-statements [& args]
-  (let [set-statements (select (walker #(= (safe-some-> %1 first) :local)) args)
-        vars (into (hash-set) (map #(nth %1 2) set-statements))
-        var-init-statements (mapcat identity (map #(vector %1 nil) vars)) ]
-    var-init-statements
-  ))
 (comment
   (let [s [[{:a 1} ['(set! a 3) :b #{'('(set! b 4))}]] ['(['(set! a 6)])]]
         walker-fn #(safe-some->> %1 (some (fn [arg] (= arg 'set!))))
@@ -53,27 +46,20 @@

 (defn chunk-fn [& args]
   (println "chunk-fn:" args)
-  (let [global-var-init-statements (get-var-init-statements args)
-        let-statements (if (= (safe-some-> args first first)
-                              'proteus/let-mutable)
-                         (-> args first second)
-                         (first args))
-        modify-set-statements-fn (fn [arg]
-                                   (mapcat #(if (= (first %1) :local)
-                                              [(nth %1 2) (nth %1 3)]
-                                              ['_ %1]) arg))
-        walker-fn (fn [arg]
-                    (or (= 'set! (safe-some-> arg first first))
-                        (= 'set! (safe-some-> arg first second))))
-        let-statements (transform (walker walker-fn)
-                                  modify-set-statements-fn
-                                  let-statements)
-        modify-let-mutables-fn (fn [arg]
-                                 (println "modify:" (next arg))
-                                 `(let-mutable ~(vec (apply concat (first (next arg))))))
-        let-statements (transform (walker #(= 'proteus/let-mutable (safe-some-> %1 first)))
-                                  modify-let-mutables-fn
-                                  let-statements)
+  (let [set-var-pred #(= 'set! (safe-some-> %1 first))
+        all-vars (set (map second
+                           (select (walker set-var-pred) args)))
+        local-pred #(= :local (safe-some-> %1 first))
+        local-vars (set (map #(second %1)
+                             (select (walker local-pred)
+                                     args)))
+        global-vars (set/difference all-vars local-vars)
+        _ (println "global-vars:" all-vars ":" local-vars ":" global-vars)
+        args (transform (walker local-pred) ; Remove occurrences of :local
+                        second
+                        ;(fn [arg] `(~(second (first arg)) ~(second arg)))
+                        args)
+        global-var-init-statements (mapcat identity (map #(vector %1 nil) global-vars))
         return-value (gensym)
         returned? (gensym)
         process-return-stmts (fn [arg]
@@ -84,21 +70,21 @@
                                                (first ret-val))]
                                  `(do (set! ~returned? true)
                                       (set! ~return-value ~ret-val))))
+        nested-block `(~'_ ~@args)
         let-statements (transform (walker #(= "return" (safe-some-> %1 first)))
                                   process-return-stmts
-                                  let-statements)
+                                  nested-block)
         process-returned? (fn [arg]
                             returned?
                             )
         let-statements (transform (walker #(= %1 :returned?))
-                                    process-returned?
-                                    let-statements)
-        expr `(let-mutable ~(vec (into [return-value nil
-                                        returned? false]
-                                       (apply concat global-var-init-statements
-                                         (next let-statements)
-                                         )))
-                ~return-value)]
+                                  process-returned?
+                                  let-statements)
+        init-statements (vec (concat [return-value nil
+                                     returned? false]
+                                    global-var-init-statements))
+        let-statements (into init-statements let-statements)
+        expr `(let-mutable ~let-statements ~return-value)]
     (println "chunk-fn2:" global-var-init-statements)
     expr
     ))
@@ -108,11 +94,17 @@
   (let [local-var-init-statements (select
                                     [ALL #(= (safe-some-> %1 first) :local)]
                                     args)
-        r (do
-            (println "local-var-init-statements:" local-var-init-statements)
-            (if (seq local-var-init-statements)
-            `(let-mutable ~(vec (transform [ALL] #(conj ['_] %1) args)))
-            `(do ~@args)))]
+        ;local-var-init-statements (get-var-init-statements :local args)
+        transform-fn (fn [arg]
+                       (cond (= :local (safe-some-> arg first))
+                         `([:local ~(third arg)] ~(fourth arg))
+                         :else `(~'_  ~arg)))
+        r (cond (seq local-var-init-statements)
+            `(let-mutable ~(vec (mapcat identity
+                                        (transform ALL transform-fn args))))
+            (next args)
+            `(do ~@args)
+            :else (first args))]
     (println "block-fn return:" r)
     r
     ))
@@ -250,7 +242,17 @@
    [:explist [:exp [:prefixexp [:var [:Name "g"]]]]]]]]

 (pprint (lua-parser (slurp "resources/test/basic1.lua")))
-
+(proteus/let-mutable
+  [G__19303 nil G__19304 false
+   g 55;nil
+   (do (cond true
+             (proteus/let-mutable
+               [l "local_var"
+                luaclj.core/_ (set! l "local_var_modified")
+                luaclj.core/_ (do (set! G__19304 true) (println "setting:" l) (set! G__19303 l))]))
+       (set! g "global_var") (do (set! G__19304 true) (println "g:" g) (set! G__19303 g)))]
+  G__19303)
+(eval (insta/transform transform-map (lua-parser (slurp "resources/test/basic1.lua"))))
   (try (pprint (insta/transform transform-map (lua-parser (slurp "resources/test/basic1.lua"))))
        (catch Exception ex (clojure.stacktrace/print-stack-trace ex)))
   (pprint tree)


ts: reformatting syncer.clj (#216)

ts: reformatting syncer.clj (#216)

--- token-syncer/src/token_syncer/syncer.clj
+++ token-syncer/src/token_syncer/syncer.clj
@@ -162,12 +162,12 @@
                            (filter
                              (fn [token]
                                (let [cluster-data (map
-                                                     (fn [cluster-url]
-                                                       (-> cluster-url->token->index-entries
-                                                           (get cluster-url)
-                                                           (get token)
-                                                           (select-keys ["deleted" "etag"])))
-                                                     cluster-urls-set)
+                                                    (fn [cluster-url]
+                                                      (-> cluster-url->token->index-entries
+                                                          (get cluster-url)
+                                                          (get token)
+                                                          (select-keys ["deleted" "etag"])))
+                                                    cluster-urls-set)
                                      cluster-deleted (map #(get % "deleted") cluster-data)
                                      cluster-etags (map #(get % "etag") cluster-data)
                                      already-synced? (and (every? false? cluster-deleted)


get RemoteView to compile - worksround apparent bug thst I have reported on Clojure groups but no-one seems interested in...

--- dada-core/src/main/clojure/org/dada/core/RemoteView.clj
+++ dada-core/src/main/clojure/org/dada/core/RemoteView.clj
@@ -17,7 +17,7 @@
  (:gen-class
   :implements [org.dada.core.View java.io.Serializable]
   :constructors {[Object] []}
-  :methods [[hack [org.dada.core.remote.Remoter] void]]
+  :methods [[hack [Object] void]]	;TODO: should be Remoter
   :init init
   :state state
   )


Fix inaccurate comment

Fix inaccurate comment

--- src/onyx/scheduling/balanced_job_scheduler.clj
+++ src/onyx/scheduling/balanced_job_scheduler.clj
@@ -25,7 +25,7 @@
                  #(.indexOf ^clojure.lang.PersistentVector (vec (:jobs replica)) %))
            (:jobs replica)))

-;; filter out saturated, then sort by is-covered? (no before yes),
+;; filter out saturated, then sort by is-covered? (yes before no),
 ;; then by number of allocated peers

 (defn select-job-requiring-peer


[#8051] TypeError (evaluating 'a.replace') when logging out with wallet is on 'Send transaction' screen

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

--- src/status_im/ui/screens/wallet/send/subs.cljs
+++ src/status_im/ui/screens/wallet/send/subs.cljs
@@ -94,4 +94,5 @@
  :wallet.send/signing-phrase-with-padding
  :<- [:account/account]
  (fn [{:keys [signing-phrase]}]
-   (clojure.string/replace-all signing-phrase #" " "     ")))
+   (when signing-phrase
+     (clojure.string/replace-all signing-phrase #" " "     "))))


(MAINT) include stack trace in log message for uncaught errors

--- src/puppetlabs/ring_middleware/core.clj
+++ src/puppetlabs/ring_middleware/core.clj
@@ -202,7 +202,7 @@
    (let [code 500
          response (fn [e]
                     (let [msg (trs "Internal Server Error: {0}" e)]
-                      (log/error msg)
+                      (log/error e msg)
                       (case type
                         :json (utils/json-response code
                                                    {:kind :application-error


Assign default values to @config atom

Assign default values to @config atom

--- src/main/hbase_region_inspector/core.clj
+++ src/main/hbase_region_inspector/core.clj
@@ -20,7 +20,12 @@
 (defonce ^{:doc "Whether we should allow region relocation or not"} read-only? (atom true))
 (defonce ^{:doc "Whether we should include system regions or not"} with-system? (atom true))
 (defonce ^{:doc "Cached result of the previous inspection"} cached
-  (atom {:updated-at nil :regions [] :response {}}))
+  (atom {:updated-at nil
+         :has-locality false
+         :regions []
+         :servers {}
+         :tables {}
+         :response {}}))
 (defonce ^{:doc "Inspection interval"} update-interval (atom 10))

 (defn long-fmt


Remove unused component

Remove unused component

--- src/onyx/system.clj
+++ src/onyx/system.clj
@@ -200,15 +200,6 @@
      :peer-group-manager (component/using (pgm/peer-group-manager peer-config onyx-vpeer-system)
                                           [:logging-config :monitoring :messaging-group])})))

-(defrecord OnyxPeerGroupManager []
-  component/Lifecycle
-  (start [component]
-    (rethrow-component
-     #(component/start-system component task-components)))
-  (stop [component]
-    (rethrow-component
-     #(component/stop-system component task-components))))
-
 (defmethod clojure.core/print-method OnyxPeer
   [system ^java.io.Writer writer]
   (.write writer "#<Onyx Peer>"))


Adapt icons sidebar to the new icons state layout.

--- src/uxbox/main/ui/workspace/sidebar/icons.cljs
+++ src/uxbox/main/ui/workspace/sidebar/icons.cljs
@@ -6,36 +6,31 @@
 ;; Copyright (c) 2015-2016 Juan de la Cruz <delacruzgarciajuan@gmail.com>

 (ns uxbox.main.ui.workspace.sidebar.icons
-  (:require [sablono.core :as html :refer-macros [html]]
-            [rum.core :as rum]
-            [lentes.core :as l]
+  (:require [lentes.core :as l]
             [uxbox.util.router :as r]
             [uxbox.util.rstore :as rs]
             [uxbox.main.state :as st]
-            [uxbox.main.library :as library]
             [uxbox.main.data.workspace :as dw]
+            [uxbox.main.data.icons :as udi]
             [uxbox.main.ui.shapes.icon :as icon]
             [uxbox.main.ui.workspace.base :as wb]
+            [uxbox.main.ui.dashboard.icons :as icons]
             [uxbox.main.ui.icons :as i]
             [uxbox.util.mixins :as mx :include-macros true]
             [uxbox.util.dom :as dom]
             [uxbox.util.data :refer (read-string)]))

-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Lenses
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; --- Refs

 (def ^:private drawing-shape
   "A focused vision of the drawing property
   of the workspace status. This avoids
   rerender the whole toolbox on each workspace
   change."
-  (as-> (l/in [:workspace :drawing]) $
-    (l/derive $ st/state)))
+  (-> (l/in [:workspace :drawing])
+      (l/derive st/state)))

-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Icons
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; --- Icons (Component)

 (defn- select-icon
   [icon]
@@ -48,50 +43,71 @@
     (swap! local assoc :collid value)
     (rs/emit! (dw/select-for-drawing nil))))

-(defn- icon-wrapper-render
-  [own icon]
-  (icon/icon-svg icon))
+(mx/defc icon-wrapper
+  {:mixins [mx/static]}
+  [icon]
+  (case (:type icon)
+    :icon (icon/icon-svg icon)
+    :icon-raw (icon/icon-raw-svg icon)))

-(def ^:private icon-wrapper
-  (mx/component
-   {:render icon-wrapper-render
-    :name "icon-wrapper"
-    :mixins [mx/static]}))
+(defn- icons-toolbox-will-mount
+  [own]
+  (let [local (:rum/local own)]
+    (rs/emit! (udi/fetch-collections))
+    (add-watch local ::key (fn [_ _ _ {:keys [id]}]
+                             (rs/emit! (udi/fetch-icons id))))
+    own))

-(defn icons-render
+(defn- icons-toolbox-will-unmount
+  [own]
+  (let [local (:rum/local own)]
+    (remove-watch local ::key)
+    own))
+
+(mx/defcs icons-toolbox
+  {:mixins [(mx/local) mx/reactive]
+   :will-mount icons-toolbox-will-mount
+   :will-unmount icons-toolbox-will-unmount}
   [own]
   (let [local (:rum/local own)
         drawing (mx/react drawing-shape)
-        collid (:collid @local)
-        icons (get-in library/+icon-collections-by-id+ [collid :icons])
-        on-close #(rs/emit! (dw/toggle-flag :icons))
-        on-select #(select-icon %)
-        on-change #(change-icon-coll local %)]
-    (html
-     [:div#form-figures.tool-window
-      [:div.tool-window-bar
-       [:div.tool-window-icon i/icon-set]
-       [:span "Icons"]
-       [:div.tool-window-close {:on-click on-close} i/close]]
-      [:div.tool-window-content
-       [:div.figures-catalog
-        ;; extract component: set selector
-        [:select.input-select.small {:on-change on-change
-                                     :value collid}
-         (for [icon-coll library/+icon-collections+]
-           [:option {:key (str "icon-coll" (:id icon-coll))
-                     :value (pr-str (:id icon-coll))}
-            (:name icon-coll)])]]
-       (for [icon icons
-             :let [selected? (= drawing icon)]]
-         [:div.figure-btn {:key (str (:id icon))
-                           :class (when selected? "selected")
-                           :on-click #(on-select icon)}
-          (icon-wrapper icon)])]])))

-(def icons-toolbox
-  (mx/component
-   {:render icons-render
-    :name "icons-toolbox"
-    :mixins [mx/reactive
-             (mx/local {:collid 1 :builtin true})]}))
+        colls-map (mx/react icons/collections-ref)
+        colls (->> (vals colls-map)
+                   (sort-by :name))
+        coll (get colls-map (:id @local))
+
+        icons (mx/react icons/icons-ref)
+        icons (->> (vals icons)
+                   (filter #(= (:id coll) (:collection %))))]
+
+    (letfn [(on-close [event]
+              (rs/emit! (dw/toggle-flag :icons)))
+            (on-select [icon event]
+              (rs/emit! (dw/select-for-drawing icon)))
+            (on-change [event]
+              (let [value (-> (dom/event->value event)
+                              (read-string))]
+                (swap! local assoc :id value)
+                (rs/emit! (dw/select-for-drawing nil))))]
+      [:div#form-figures.tool-window
+       [:div.tool-window-bar
+        [:div.tool-window-icon i/icon-set]
+        [:span "Icons"]
+        [:div.tool-window-close {:on-click on-close} i/close]]
+       [:div.tool-window-content
+        [:div.figures-catalog
+         ;; extract component: set selector
+         [:select.input-select.small {:on-change on-change
+                                      :value (pr-str (:id coll))}
+          [:option {:value (pr-str nil)} "Storage"]
+          (for [coll colls]
+            [:option {:key (str "icon-coll" (:id coll))
+                      :value (pr-str (:id coll))}
+             (:name coll)])]]
+        (for [icon icons
+              :let [selected? (= drawing icon)]]
+          [:div.figure-btn {:key (str (:id icon))
+                            :class (when selected? "selected")
+                            :on-click (partial on-select icon)}
+           (icon-wrapper icon)])]])))


Remove ITable protocol.

Remove ITable protocol.

--- lib/core/src/merkle_db/table.clj
+++ lib/core/src/merkle_db/table.clj
@@ -56,127 +56,6 @@
 (s/def ::table-info
   (s/keys :req [::node/id
                 ::name]))
-
-
-
-;; ## Table API
-
-(defprotocol ITable
-  "Protocol for an immutable table of record data."
-
-  ;; Records
-
-  (keys
-    [table]
-    [table opts]
-    "Scan the table, returning keys of the stored records which match the given
-    options. Returns a lazy sequence of keys, or nil if the table is empty.
-
-    If min and max keys are given, only records within the bounds will be
-    returned (inclusive). A nil min or max implies the beginning or end of
-    the data, respectively.
-
-    Options may include:
-
-    - `:min-key`
-      Return records with keys equal to or greater than the marker.
-    - `:max-key`
-      Return records with keys equal to or less than the marker.
-    - `:reverse` (NYI)
-      Reverse the order the keys are returned in.
-    - `:offset`
-      Skip this many records in the output.
-    - `:limit`
-      Return at most this many records.")
-
-  (scan
-    [table]
-    [table opts]
-    "Scan the table, returning data from records which match the given options.
-    Returns a lazy sequence of record data maps, sorted by key.
-
-    If min and max keys or indices are given, only records within the
-    bounds will be returned (inclusive). A nil min or max implies the beginning
-    or end of the data, respectively.
-
-    Options may include:
-
-    - `:fields`
-      Only return data for the selected set of fields. If provided, only
-      records with data for one or more of the fields are returned, otherwise
-      all fields and records (including empty ones) are returned.
-    - `:min-key`
-      Return records with keys equal to or greater than the marker.
-    - `:max-key`
-      Return records with keys equal to or less than the marker.
-    - `:reverse` (NYI)
-      Reverse the order the keys are returned in.
-    - `:offset`
-      Skip this many records in the output.
-    - `:limit`
-      Return at most this many records.")
-
-  (read
-    [table id-keys]
-    [table id-keys opts]
-    "Read a set of records from the database, returning data for each present
-    record. Returns a sequence of record data maps.
-
-    Options may include:
-
-    - `:fields`
-      Only return data for the selected set of fields. If provided, only
-      records with data for one or more of the fields are returned, otherwise
-      all fields and records are returned.")
-
-  (insert
-    [table records]
-    [table records opts]
-    "Insert some record data into the database, represented by a collection
-    of record data maps. Returns an updated table.
-
-    Options may include:
-
-    - `:update-field`
-      A function which will be called with `(f field-key old-val new-val)`, and
-      should return the new value to use for that field. By default, `new-val`
-      is used directly.
-    - `:update-record`
-      A function which will be called with `(f record-key old-data new-data)`,
-      and should return the data map to use for the record. By default, this
-      merges the data maps and removes nil-valued fields.")
-
-  (delete
-    [table id-keys]
-    "Remove some records from the table, identified by a collection of id keys.
-    Returns an updated table.")
-
-  (dirty?
-    [table]
-    "Return true if the table has local non-persisted modifications.")
-
-  (flush!
-    [table]
-    [table opts]
-    "Ensure that all local state has been persisted to the storage backend.
-    Returns an updated persisted table.
-
-    Options may include:
-
-    - `:apply-patch?`
-      If true, the current patch data will be merged into the main data tree
-      and the returned table will have no patch link.")
-
-  ;; Partitions
-
-  (list-partitions
-    [table]
-    "List the partitions which comprise the table. Returns a sequence of
-    partition nodes.")
-
-  (read-partition
-    [table partition-id opts]
-    "Read all the records in the identified partition."))

@@ -357,7 +236,12 @@
 (alter-meta! #'->Table assoc :private true)

-(defn ^:no-doc bare-table
+
+;; ## Constructors
+
+; TODO: better names and docs
+
+(defn bare-table
   "Build a new detached table value with the given backing store."
   [store table-name opts]
   (->Table
@@ -375,7 +259,7 @@
     nil))

-(defn ^:no-doc load-table
+(defn load-table
   "Load a table node from the store."
   [store table-name target]
   (let [node (mdag/get-node store target)]
@@ -390,7 +274,7 @@
       {::node/links (::node/links node)})))

-(defn ^:no-doc set-backing
+(defn set-backing
   "Change the backing store and info for a table."
   [^Table table store table-name]
   (->Table
@@ -402,24 +286,8 @@
     (._meta table)))

-(defn- update-pending
-  "Returns a new `Table` value with the given function applied to update its
-  pending data."
-  [^Table table f & args]
-  (let [patch' (apply f (.pending table) args)]
-    (if (= patch' (.pending table))
-      table
-      (->Table
-        (.store table)
-        (dissoc (.table-info table) ::node/id)
-        (.root-data table)
-        patch'
-        true
-        (._meta table)))))
-
-
-
-;; ## Protocol Implementation
+
+;; ## Internal Functions

 (defn- table-lexicoder
   "Construct a lexicoder for the keys in a table."
@@ -457,20 +325,56 @@
                [k (if (map? r) (select-keys r (:fields opts)) r)])))))

-(defn- -keys
-  "Internal `keys` implementation."
+(defn- read-batch
+  "Retrieve a batch of records from the table by key. Returns a sequence of
+  record entries."
+  [^Table table id-keys opts]
+  (let [id-keys (set id-keys)
+        patch-map (load-changes table)
+        patch-changes (filter (comp id-keys key) patch-map)
+        extra-keys (apply disj id-keys (map key patch-changes))
+        patch-changes (filter-records {:fields (:fields opts)} patch-changes)
+        data-entries (when-let [data-node (and (seq extra-keys)
+                                               (mdag/get-data
+                                                 (.store table)
+                                                 (::data table)))]
+                       (index/read-batch
+                         (.store table)
+                         data-node
+                         (:fields opts)
+                         extra-keys))]
+    (patch/patch-seq patch-changes data-entries)))
+
+
+
+;; ## Read API
+
+(defn scan
+  "Scan the table, returning data from records which match the given options.
+  Returns a lazy sequence of record data maps, sorted by key.
+
+  If min and max keys or indices are given, only records within the
+  bounds will be returned (inclusive). A nil min or max implies the beginning
+  or end of the data, respectively.
+
+  Options may include:
+
+  - `:fields`
+    Only return data for the selected set of fields. If provided, only
+    records with data for one or more of the fields are returned, otherwise
+    all fields and records (including empty ones) are returned.
+  - `:min-key`
+    Return records with keys equal to or greater than the marker.
+  - `:max-key`
+    Return records with keys equal to or less than the marker.
+  - `:reverse` (NYI)
+    Reverse the order the keys are returned in.
+  - `:offset`
+    Skip this many records in the output.
+  - `:limit`
+    Return at most this many records."
   ([table]
-   (-keys table nil))
-  ([table opts]
-   ; OPTIMIZE: push down key-only read to avoid loading non-base tablets
-   (map (comp ::record/id meta)
-        (scan table opts))))
-
-
-(defn- -scan
-  "Internal `scan` implementation."
-  ([table]
-   (-scan table nil))
+   (scan table nil))
   ([^Table table opts]
    (let [lexicoder (table-lexicoder table)
          min-k (some->> (:min-key opts) (key/encode lexicoder))
@@ -508,31 +412,46 @@
                        (::primary-key table))))))))

-(defn- read-batch
-  "Retrieve a batch of records from the table by key. Returns a sequence of
-  record entries."
-  [^Table table id-keys opts]
-  (let [id-keys (set id-keys)
-        patch-map (load-changes table)
-        patch-changes (filter (comp id-keys key) patch-map)
-        extra-keys (apply disj id-keys (map key patch-changes))
-        patch-changes (filter-records {:fields (:fields opts)} patch-changes)
-        data-entries (when-let [data-node (and (seq extra-keys)
-                                               (mdag/get-data
-                                                 (.store table)
-                                                 (::data table)))]
-                       (index/read-batch
-                         (.store table)
-                         data-node
-                         (:fields opts)
-                         extra-keys))]
-    (patch/patch-seq patch-changes data-entries)))
-
-
-(defn- -read
-  "Internal `read` implementation."
+(defn keys
+  "Scan the table, returning keys of the stored records which match the given
+  options. Returns a lazy sequence of keys, or nil if the table is empty.
+
+  If min and max keys are given, only records within the bounds will be
+  returned (inclusive). A nil min or max implies the beginning or end of
+  the data, respectively.
+
+  Options may include:
+
+  - `:min-key`
+    Return records with keys equal to or greater than the marker.
+  - `:max-key`
+    Return records with keys equal to or less than the marker.
+  - `:reverse` (NYI)
+    Reverse the order the keys are returned in.
+  - `:offset`
+    Skip this many records in the output.
+  - `:limit`
+    Return at most this many records."
+  ([table]
+   (keys table nil))
+  ([table opts]
+   ; OPTIMIZE: push down key-only read to avoid loading non-base tablets
+   (map (comp ::record/id meta)
+        (scan table opts))))
+
+
+(defn read
+  "Read a set of records from the database, returning data for each present
+  record. Returns a sequence of record data maps.
+
+  Options may include:
+
+  - `:fields`
+    Only return data for the selected set of fields. If provided, only
+    records with data for one or more of the fields are returned, otherwise
+    all fields and records are returned."
   ([table ids]
-   (-read table ids nil))
+   (read table ids nil))
   ([^Table table ids opts]
    (if (seq ids)
      (let [lexicoder (table-lexicoder table)
@@ -550,6 +469,25 @@
      (list))))

+
+;; ## Record Updates
+
+(defn- update-pending
+  "Returns a new `Table` value with the given function applied to update its
+  pending data."
+  [^Table table f & args]
+  (let [patch' (apply f (.pending table) args)]
+    (if (= patch' (.pending table))
+      table
+      (->Table
+        (.store table)
+        (dissoc (.table-info table) ::node/id)
+        (.root-data table)
+        patch'
+        true
+        (._meta table)))))
+
+
 (defn- record-updater
   "Construct a new record updating function from the given options. The
   resulting function accepts three arguments, the record key, the existing
@@ -582,10 +520,22 @@
         (merge old-data new-data))))

-(defn- -insert
-  "Internal `insert` implementation."
+(defn insert
+  "Insert some record data into the database, represented by a collection
+  of record data maps. Returns an updated table.
+
+  Options may include:
+
+  - `:update-field`
+    A function which will be called with `(f field-key old-val new-val)`, and
+    should return the new value to use for that field. By default, `new-val`
+    is used directly.
+  - `:update-record`
+    A function which will be called with `(f record-key old-data new-data)`,
+    and should return the data map to use for the record. By default, this
+    merges the data maps and removes nil-valued fields."
   ([table records]
-   (-insert table records nil))
+   (insert table records nil))
   ([table records opts]
    (if (seq records)
      (let [lexicoder (table-lexicoder table)
@@ -610,8 +560,9 @@
      table)))

-(defn- -delete
-  "Internal `delete` implementation."
+(defn delete
+  "Remove some records from the table, identified by a collection of id keys.
+  Returns an updated table."
   [table ids]
   (if (seq ids)
     (let [lexicoder (table-lexicoder table)
@@ -627,8 +578,11 @@
     table))

-(defn- -dirty?
-  "Internal `dirty?` implementation."
+
+;; ## Table Persistence
+
+(defn dirty?
+  "True if the table has local non-persisted modifications."
   [^Table table]
   (.dirty table))

@@ -656,11 +610,17 @@
       [nil (::data table)])))

-(defn- -flush!
-  "Ensure that all local state has been persisted to the storage backend and
-  return an updated non-dirty table."
+(defn flush!
+  "Ensure that all local state has been persisted to the storage backend.
+  Returns an updated persisted table.
+
+  Options may include:
+
+  - `:apply-patch?`
+    If true, the current patch data will be merged into the main data tree
+    and the returned table will have no patch link."
   ([table]
-   (-flush! table nil))
+   (flush! table nil))
   ([^Table table opts]
    (if (.dirty table)
      (let [[patch-link data-link] (flush-changes table (:apply-patch? opts))
@@ -685,16 +645,3 @@
            table-meta)))
      ; Table is clean, return directly.
      table)))
-
-
-(extend Table
-
-  ITable
-
-  {:keys -keys
-   :scan -scan
-   :read -read
-   :insert -insert
-   :delete -delete
-   :dirty? -dirty?
-   :flush! -flush!})


include the default-email in every call

include the default-email in every call

rishi needs this to set up our autopilot trial

--- src-cljs/frontend/analytics/core.cljs
+++ src-cljs/frontend/analytics/core.cljs
@@ -133,7 +133,8 @@
 (defn- add-properties-to-track-from-state [current-state]
   "Get a map of the mutable properties we want to track out of the
   state. Also add a timestamp."
-  {:user (get-in current-state state/user-login-path)
+  {:user (get-in current-state state/user-login-path)
+   :default-email (get-in current-state state/user-selected-email-path)
    :view (get-in current-state state/current-view-path)
    :repo (get-in current-state state/navigation-repo-path)
    :org (get-in current-state state/navigation-org-path)})


Improve address formatting.

Improve address formatting.

--- src-cljs/kixi/hecuba/widgets/map.cljs
+++ src-cljs/kixi/hecuba/widgets/map.cljs
@@ -28,7 +28,7 @@
 ;;      solutions from YOU! dear reader are most welcome.
 (defn build-popup [owner {:keys [id,property_data name photos] :as e}]
   (let [{:keys [address_street address_street_two address_region address_country description tech-icons]} property_data
-        full-address (str/join ", " [address_street address_street_two address_region address_country])
+        full-address (str/join ", " (remove str/blank? [address_street address_street_two address_region address_country]))
         title address_street ;; TODO what should go here?
         img-url (first photos)
         entity-url "/app"


Add middleware support.

Add middleware support.

--- src/quil/applet.clj
+++ src/quil/applet.clj
@@ -347,12 +347,20 @@
    :key-typed      - Called once every time non-modifier keys are
                      pressed.

-   :on-close       - Called once, when sketch is closed"
+   :on-close       - Called once, when sketch is closed
+
+   :middleware     - vector of middleware to be applied to the sketch.
+                     Middleware will be applied in the same order as in comp
+                     function: [f g] will be applied as (f (g options))."
   [& opts]
   (check-for-removed-opts (apply hash-map opts))
-  (let [options      (merge {:size [500 300]
-                             :target :frame}
-                            (apply hash-map opts))
+  (let [options (apply hash-map opts)
+
+        options     (->> (:middleware options [])
+                         (reverse)
+                         (reduce #(%2 %1) options)
+                         (merge {:size [500 300]
+                                 :target :frame}))

         features     (let [user-features (set (:features options))]
                        (reduce #(assoc %1 %2 (contains? user-features %2)) {}


Improve description of CSS related parameters.

--- src/re_com/box.cljs
+++ src/re_com/box.cljs
@@ -215,17 +215,17 @@

 (def h-box-args-desc
   [{:name :children   :required true                    :type "vector"  :validate-fn sequential?    :description "a vector (or list) of components"}
-   {:name :size       :required false :default "none"   :type "string"  :validate-fn string?        :description [:span "Examples: " [:code "initial"] ", " [:code "auto"] ", " [:code "100px"] ", " [:code "60%"] " or the generic :flex version " [:code "{grow} {shrink} {basis}"]]}
+   {:name :size       :required false :default "none"   :type "string"  :validate-fn string?        :description [:span "Equivalent to CSS style " [:span.bold "flex"] "." [:br]  "Examples: " [:code "initial"] ", " [:code "auto"] ", " [:code "none"]", " [:code "100px"] ", " [:code "2"] " or a generic triple of " [:code "grow/shrink/basis"]]}
    {:name :width      :required false                   :type "string"  :validate-fn string?        :description "a CSS width style"}
    {:name :height     :required false                   :type "string"  :validate-fn string?        :description "a CSS height style"}
    {:name :min-width  :required false                   :type "string"  :validate-fn string?        :description "a CSS width style. The minimum width to which the box can shrink"}
    {:name :min-height :required false                   :type "string"  :validate-fn string?        :description "a CSS height style. The minimum height to which the box can shrink"}
-   {:name :justify    :required false :default :start   :type "keyword" :validate-fn justify-style? :description [:span "one of " justify-options-list]}
-   {:name :align      :required false :default :stretch :type "keyword" :validate-fn align-style?   :description [:span "one of " align-options-list]}
-   {:name :align-self :required false                   :type "keyword" :validate-fn align-style?   :description [:span "use to override parent " [:code ":align"] " setting for this component"]}
+   {:name :justify    :required false :default :start   :type "keyword" :validate-fn justify-style? :description [:span "Equivalent to CSS style " [:span.bold "justify-content"] "." [:br] "One of " justify-options-list]}
+   {:name :align      :required false :default :stretch :type "keyword" :validate-fn align-style?   :description [:span "Equivalent to CSS style " [:span.bold "align-items"]  "." [:br] " One of " align-options-list]}
+   {:name :align-self :required false                   :type "keyword" :validate-fn align-style?   :description [:span "Equivalent to CSS style " [:span.bold "align-self"] "." [:br]  "Used when a child must override the parent's align-items setting."]}
    {:name :margin     :required false                   :type "string"  :validate-fn string?        :description "a CSS margin style"}
    {:name :padding    :required false                   :type "string"  :validate-fn string?        :description "a CSS padding style"}
-   {:name :gap        :required false                   :type "string"  :validate-fn string?        :description "a CSS size style. See gap component"}
+   {:name :gap        :required false                   :type "string"  :validate-fn string?        :description "The amount of whitespace to put between each child. Typically, an absolute CSS length like 10px or 10em, but can be a stretchy proportional amount like 2"}
    {:name :class      :required false                   :type "string"  :validate-fn string?        :description "CSS class names, space separated"}
    {:name :style      :required false                   :type "map"     :validate-fn css-style?     :description "CSS styles to add or override"}
    {:name :attr       :required false                   :type "map"     :validate-fn html-attr?     :description [:span "html attributes, like " [:code ":on-mouse-move"] [:br] "No " [:code ":class"] " or " [:code ":style"] "allowed"]}])
@@ -271,17 +271,17 @@

 (def v-box-args-desc
   [{:name :children   :required true                    :type "vector"  :validate-fn sequential?    :description "a vector (or list) of components"}
-   {:name :size       :required false :default "none"   :type "string"  :validate-fn string?        :description [:span "Examples: " [:code "initial"] ", " [:code "auto"] ", " [:code "100px"] ", " [:code "60"] " or the generic :flex version " [:code "{grow} {shrink} {basis}"]]}
+   {:name :size       :required false :default "none"   :type "string"  :validate-fn string?        :description [:span "Equivalent to CSS style " [:span.bold "flex"] "." [:br]  "Examples: " [:code "initial"] ", " [:code "auto"] ", " [:code "none"]", " [:code "100px"] ", " [:code "2"] " or a generic triple of " [:code "grow/shrink/basis"]]}
    {:name :width      :required false                   :type "string"  :validate-fn string?        :description "a CSS width style"}
    {:name :height     :required false                   :type "string"  :validate-fn string?        :description "a CSS height style"}
    {:name :min-width  :required false                   :type "string"  :validate-fn string?        :description "a CSS width style. The minimum width to which the box can shrink"}
    {:name :min-height :required false                   :type "string"  :validate-fn string?        :description "a CSS height style. The minimum height to which the box can shrink"}
-   {:name :justify    :required false :default :start   :type "keyword" :validate-fn justify-style? :description [:span "one of " justify-options-list]}
-   {:name :align      :required false :default :stretch :type "keyword" :validate-fn align-style?   :description [:span "one of " align-options-list]}
-   {:name :align-self :required false                   :type "keyword" :validate-fn align-style?   :description [:span "use to override parent " [:code ":align"] " setting for this component"]}
+   {:name :justify    :required false :default :start   :type "keyword" :validate-fn justify-style? :description [:span "Equivalent to CSS style " [:span.bold "justify-content"] "." [:br] "One of " justify-options-list]}
+   {:name :align      :required false :default :stretch :type "keyword" :validate-fn align-style?   :description [:span "Equivalent to CSS style " [:span.bold "align-items"]  "." [:br] " One of " align-options-list]}
+   {:name :align-self :required false                   :type "keyword" :validate-fn align-style?   :description [:span "Equivalent to CSS style " [:span.bold "align-self"] "." [:br]  "Used when a child must override the parent's align-items setting."]}
    {:name :margin     :required false                   :type "string"  :validate-fn string?        :description "a CSS margin style"}
    {:name :padding    :required false                   :type "string"  :validate-fn string?        :description "a CSS padding style"}
-   {:name :gap        :required false                   :type "string"  :validate-fn string?        :description "a CSS size style. See gap component"}
+   {:name :gap        :required false                   :type "string"  :validate-fn string?        :description "The amount of whitespace to put between each child. Typically, an absolute CSS length like 10px or 10em, but can be a stretchy proportional amount like 2"}
    {:name :class      :required false                   :type "string"  :validate-fn string?        :description "CSS class names, space separated"}
    {:name :style      :required false                   :type "map"     :validate-fn css-style?     :description "CSS styles to add or override"}
    {:name :attr       :required false                   :type "map"     :validate-fn html-attr?     :description [:span "html attributes, like " [:code ":on-mouse-move"] [:br] "No " [:code ":class"] " or " [:code ":style"] "allowed"]}])


Update package version in lein template. Fixes #10

--- lein-template/src/main/leiningen/new/aviary/project.clj
+++ lein-template/src/main/leiningen/new/aviary/project.clj
@@ -8,8 +8,8 @@
   :main {{namespace}}.site
   :source-paths ["src/main/clj"
                  "src/main/cljs"]
-  :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-2850"]
+  :dependencies [[org.clojure/clojure "1.7.0-RC2"]
+                 [org.clojure/clojurescript "0.0-3308"]
                  [aviary "{{aviary-version}}"]
                  [enlive "1.1.5"]
                  [garden "1.2.5"]]


Update to ClojureScript 0.0-2843

Update to ClojureScript 0.0-2843

--- Clojure/project.clj
+++ Clojure/project.clj
@@ -4,7 +4,7 @@
   :license {:name "Eclipse Public License"
             :url "http://www.eclipse.org/legal/epl-v10.html"}
   :dependencies [[org.clojure/clojure "1.6.0"]
-                 [org.clojure/clojurescript "0.0-2814"]]
+                 [org.clojure/clojurescript "0.0-2843"]]
   :source-paths ["src"]
   :compiler {
      :output-dir "out"