Refactor auxiliary and common functions; move to separate lib

--- src/discuss/views.cljs
+++ src/discuss/views.cljs
@@ -2,42 +2,17 @@
   (:require [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
             [clojure.string :as string]
+            [discuss.auth :as auth]
             [discuss.clipboard :as clipboard]
             [discuss.communication :as com]
             [discuss.extensions]
             [discuss.history :as history]
             [discuss.integration :as integration]
             [discuss.lib :as lib]
-            [discuss.sidebar :as sidebar]
-            [discuss.auth :as auth]))
-
-;; Auxiliary functions
-(defn fa-icon
-  "Wrapper for font-awesome icons."
-  ([class]
-   (dom/i #js {:className (str "fa " class)}))
-  ([class f]
-   (dom/i #js {:className (str "pointer fa " class)
-               :onClick   f})))
-
-(defn logo
-  "If no function is provided, show logo as is. Else bind function to onClick-event and add
-   pointer-class."
-  ([]
-   (fa-icon "fa-comments"))
-  ([f]
-   (fa-icon "fa-comments" f)))
-
-(defn safe-html
-  "Creates DOM element with interpreted HTML."
-  [string]
-  (dom/span #js {:dangerouslySetInnerHTML #js {:__html string}}))
-
-(defn safe-space
-  "Create a safed spacer."
-  []
-  (safe-html " "))
-
+            [discuss.lib.views :as vlib]
+            [discuss.sidebar :as sidebar]))
+
+;;;; Auxiliary functions
 (defn get-bubble-class [bubble]
   "Check bubble type and return a class-string to match the CSS styles."
   (cond
@@ -45,21 +20,8 @@
     (:is_system bubble) "bubble-system"
     (:is_status bubble) "bubble-status text-center"))

-(defn- commit-target-value
-  "Set local state of view, parse the value of the target of val."
-  [key val owner]
-  (om/set-state! owner key (.. val -target -value)))
-
-(defn display
-  "Toggle display view."
-  [show]
-  (if show
-    #js {}
-    #js {:display "none"}))
-
-(defn toggle-show [show] (if show false true))
-
-;; Elements
+
+;;;; Elements
 (defn loading-element []
   (when (lib/loading?)
     (dom/div #js {:className "loader"}
@@ -69,11 +31,11 @@
 (defn control-elements []
   (dom/div #js {:className "text-center"}
            (dom/h4 nil
-                   (fa-icon (str (lib/prefix-name "control-buttons") " fa-angle-double-left fa-border") com/init!)
+                   (vlib/fa-icon (str (lib/prefix-name "control-buttons") " fa-angle-double-left fa-border") com/init!)
                    " "
-                   (fa-icon (str (lib/prefix-name "control-buttons") " fa-angle-left fa-border") history/back!)
+                   (vlib/fa-icon (str (lib/prefix-name "control-buttons") " fa-angle-left fa-border") history/back!)
                    " "
-                   (fa-icon (str (lib/prefix-name "control-buttons") " fa fa-angle-right fa-border pointer")))))
+                   (vlib/fa-icon (str (lib/prefix-name "control-buttons") " fa fa-angle-right fa-border pointer")))))

 (defn login-view-buttons [data]
   (dom/div #js {:className "text-muted"}
@@ -105,16 +67,16 @@
                (dom/h5 #js {:className "text-center"} "Login")
                (dom/div #js {:className "input-group"}
                         (dom/span #js {:className "input-group-addon"}
-                                  (fa-icon "fa-user fa-fw"))
+                                  (vlib/fa-icon "fa-user fa-fw"))
                         (dom/input #js {:className   "form-control"
-                                        :onChange    #(commit-target-value :nickname % owner)
+                                        :onChange    #(vlib/commit-target-value :nickname % owner)
                                         :value       nickname
                                         :placeholder "nickname"}))
                (dom/div #js {:className "input-group"}
                         (dom/span #js {:className "input-group-addon"}
-                                  (fa-icon "fa-key fa-fw"))
+                                  (vlib/fa-icon "fa-key fa-fw"))
                         (dom/input #js {:className   "form-control"
-                                        :onChange    #(commit-target-value :password % owner)
+                                        :onChange    #(vlib/commit-target-value :password % owner)
                                         :value       password
                                         :type        "password"
                                         :placeholder "password"}))
@@ -133,7 +95,7 @@
         (dom/li #js {:className bubble-class}
                 (dom/div #js {:className "avatar"})
                 (dom/p #js {:className "messages"}
-                       (safe-html (:message bubble))))))))
+                       (vlib/safe-html (:message bubble))))))))

 (defn bubbles-view []
   (apply dom/ol #js {:className "bubbles"}
@@ -150,7 +112,7 @@
                                           :onClick   #(com/item-click (:id item) (:url item))
                                           :value     (:url item)})
                           " "
-                          (safe-html (string/join " and " (map :title (:premises item))))))))) ; get all premises of item and add an "and" between them
+                          (vlib/safe-html (string/join " and " (map :title (:premises item))))))))) ; get all premises of item and add an "and" between them

 (defn items-view [data]
   (dom/div nil
@@ -174,7 +136,7 @@
                               :data-dismiss "alert"
                               :aria-label   "Close"}
                          (dom/span #js {:aria-hidden "true"}
-                                   (safe-html "×")))
+                                   (vlib/safe-html "×")))
              (lib/get-error))))

 (defn add-element
@@ -191,22 +153,22 @@
                     :onDrop     discuss.clipboard/update-reference-drop}
                (dom/div #js {:className "panel-body"}
                         (dom/h4 #js {:className "text-center"} (lib/get-add-text))
-                        (dom/h5 #js {:className "text-center"} (safe-html (lib/get-add-premise-text)))
+                        (dom/h5 #js {:className "text-center"} (vlib/safe-html (lib/get-add-premise-text)))
                         (error-view)
                         (dom/div #js {:className "input-group"}
                                  (dom/span #js {:className "input-group-addon"}
-                                           (fa-icon "fa-comment"))
+                                           (vlib/fa-icon "fa-comment"))
                                  (dom/input #js {:className "form-control"
-                                                 :onChange  #(commit-target-value :statement % owner)
+                                                 :onChange  #(vlib/commit-target-value :statement % owner)
                                                  :value     statement}))
                         (when (lib/get-selection)
                           (dom/div #js {:className "input-group"}
                                    (dom/span #js {:className "input-group-addon"}
-                                             (fa-icon "fa-quote-left"))
+                                             (vlib/fa-icon "fa-quote-left"))
                                    (dom/input #js {:className "form-control"
                                                    :value     (lib/get-selection)})
                                    (dom/span #js {:className "input-group-addon"}
-                                             (fa-icon "fa-quote-right"))))
+                                             (vlib/fa-icon "fa-quote-right"))))
                         (dom/button #js {:className "btn btn-default"
                                          :onClick   #(com/dispatch-add-action statement (lib/get-selection))}
                                     "Submit"))))))
@@ -232,7 +194,7 @@
     (render [_]
       (dom/div #js {:id (lib/prefix-name "dialogue-main")}
                (dom/h4 nil
-                       (logo)
+                       (vlib/logo)
                        " "
                        (get-in data [:layout :title]))
                (main-content-view data)))))
@@ -250,7 +212,7 @@
                                :onClick   #(integration/click-reference (:text data) (:url data))}
                           (:text data)
                           " "
-                          (logo #(om/set-state! owner :show (toggle-show show))))
+                          (vlib/logo #(om/set-state! owner :show (vlib/toggle-show show))))
                 (dom/span nil (:dom-post data))))))

@@ -259,22 +221,6 @@
   (reify om/IRender
     (render [_]
       (dom/div nil
-               (logo #(sidebar/toggle))
+               (vlib/logo #(sidebar/toggle))
                (main-content-view data)
-               (om/build clipboard/view data)))))
-
-(defn tooltip-view [data owner]
-  (reify om/IRender
-    (render [_]
-      (dom/div nil
-               (logo)
-               (safe-space) " | " (safe-space)
-               (dom/span #js {:className "pointer"
-                              :onClick clipboard/add-selection}
-                         (fa-icon "fa-bookmark-o")
-                         " Save")
-               (safe-space) "  " (safe-space)
-               (dom/span #js {:className "pointer"
-                              :onClick   sidebar/show}
-                         (fa-icon "fa-comment")
-                         " Discuss")))))+               (om/build clipboard/view data)))))


Bump kehaar version to 0.7.2 in generated app

--- resources/leiningen/new/kraken_works/project.clj
+++ resources/leiningen/new/kraken_works/project.clj
@@ -17,7 +17,7 @@
                   :exclusions [commons-codec commons-logging]]
                  [ch.qos.logback/logback-classic "1.1.7"]
                  [org.immutant/core "2.1.5"]
-                 [democracyworks/kehaar "0.6.0"]]
+                 [democracyworks/kehaar "0.7.2"]]
   :plugins [[lein-immutant "2.1.0"]]
   :main ^:skip-aot {{name}}.core
   :target-path "target/%s"


Add options to 'expound' and 'expound-str'

--- src/expound/alpha.cljc
+++ src/expound/alpha.cljc
@@ -937,30 +937,36 @@

 (s/fdef expound-str
   :args (s/cat :spec :expound.spec/spec
-               :form any?)
+               :form any?
+               :opts (s/? :expound.printer/opts))
   :ret string?)
 (defn expound-str
   "Given a `spec` and a `form`, either returns success message or a human-readable error message."
-  [spec form]
-  ;; expound was initially released with support
-  ;; for CLJS 1.9.542 which did not include
-  ;; the value in the explain data, so we patch it
-  ;; in to avoid breaking back compat (at least for now)
-  (let [explain-data (s/explain-data spec form)]
-    (printer-str {}
-                 (if explain-data
-                   (assoc explain-data
-                          ::s/value form)
-                   nil))))
+  ([spec form]
+   (expound-str spec form {}))
+  ([spec form opts]
+   ;; expound was initially released with support
+   ;; for CLJS 1.9.542 which did not include
+   ;; the value in the explain data, so we patch it
+   ;; in to avoid breaking back compat (at least for now)
+   (let [explain-data (s/explain-data spec form)]
+     (printer-str opts
+                  (if explain-data
+                    (assoc explain-data
+                           ::s/value form)
+                    nil)))))

 (s/fdef expound
   :args (s/cat :spec :expound.spec/spec
-               :form any?)
+               :form any?
+               :opts (s/? :expound.printer/opts))
   :ret nil?)
 (defn expound
   "Given a `spec` and a `form`, either prints a success message or a human-readable error message."
-  [spec form]
-  (print (expound-str spec form)))
+  ([spec form]
+   (expound spec form {}))
+  ([spec form opts]
+   (print (expound-str spec form opts))))

 (s/fdef defmsg
   :args (s/cat :k qualified-keyword?


Fix latent bug if info messages ever suppressed.

As well as some more innocuous formatting issues.

--- src/afterglow/ola_client.clj
+++ src/afterglow/ola_client.clj
@@ -187,8 +187,7 @@
             (write-safely header-bytes request-bytes connection))
           (recur (<! channel))))
       ;; The channel has been closed, so signal the main thread to shut down as well
-      (swap! connection disconnect-server))
-))
+      (swap! connection disconnect-server))))

 (declare shutdown)

@@ -238,7 +237,8 @@
   [old-channel]
   (or old-channel
       (let [c (chan)]
-        (info "Created OLA request processor." (future (process-requests c)))
+        (info "Created OLA request processor.")
+        (future (process-requests c))
         c)))

 (defn- destroy-channel


Removed HTML unit test namespaces from test/run.clj

--- test/run.clj
+++ test/run.clj
@@ -15,9 +15,6 @@

 (run-tests
   'test.compojure.crypto
-  'test.compojure.html.gen
-  'test.compojure.html.form-helpers
-  'test.compojure.html.page-helpers
   'test.compojure.http.helpers
   'test.compojure.http.middleware
   'test.compojure.http.routes


don't generate with null pronouns

don't generate with null pronouns

--- src/babel/espanol/writer.clj
+++ src/babel/espanol/writer.clj
@@ -215,9 +215,10 @@
                         (mapcat (fn [tense]
                                   (filter #(not (= :fail %))
                                           (list
-                                           (unify/unify tense
-                                                        {:comp {:synsem {:pronoun true
-                                                                         :null-pronoun true}}})
+                                           ;; don't generate with null-pronouns - too confusing and inconsistent.
+;                                           (unify/unify tense
+;                                                        {:comp {:synsem {:pronoun true
+;                                                                         :null-pronoun true}}})
                                            (unify/unify tense
                                                         {:comp {:synsem {:pronoun true
                                                                          :null-pronoun false}}})


list of addresses is *probably* pretty straightforward

--- src/bitsplit_cli/client.cljs
+++ src/bitsplit_cli/client.cljs
@@ -29,13 +29,10 @@
 (defprotocol Shutdown
   (shutdown! [this]))

-(defrecord Client [coin storage]
+(defrecord Client [wallet]
     Queries
     (addresses [this]
-        (->> coin
-            .-aaccounts
-            (.keys js/Object)
-            js->clj))
+        (-> wallet .-addresses js->clj))
     (unspent-amounts [this]
         (let [unspent (->> coin .-accounts (map account->amount))]
             (apply merge unspent)))


Fix meta-table and meta-row.

Fix meta-table and meta-row.

--- src/cadence/views/common.clj
+++ src/cadence/views/common.clj
@@ -4,18 +4,21 @@
             [cemerick.friend :as friend]
             [ring.util.anti-forgery :refer [anti-forgery-metas]]
             [cadence.model :as m]
+            (clj-time [coerce :as time-coerce]
+                      [format :as time-format])
             [dieter.core :refer [link-to-asset]]
             [cadence.security :refer [admin?]]
             [noir.validation :as vali]
             [cadence.model.flash :as flash])
   (:use (hiccup core def page))
-  (:import (java.io StringWriter)))
+  (:import (org.bson.types ObjectId)
+           (java.io StringWriter)))

 (defhtml meta-row
   "Used by meta-table for creating rows."
   [[key-name value]]
   (let [str-name (str (name key-name))]
-  [:tr {:class str-name}
+  [:tr {:class (string/replace str-name #"\s+" "-")}
    [:td.name (string/capitalize str-name)] [:td.value value]]))

 (defhtml meta-table


fix index-bug

fix index-bug

--- src/ceres_collector/core.clj
+++ src/ceres_collector/core.clj
@@ -32,10 +32,11 @@
   (timbre/set-config! [:appenders :spit :enabled?] true)
   (timbre/set-config! [:shared-appender-config :spit-filename] (:logfile @server-state))
   (info "Starting twitter collector...")
-  (when (:init? @server-state)
-    (mongo/create-index))
+
   (let [{{:keys [follow track credentials]} :app} @server-state
         db (mongo/init :name "juno")]
+    (when (:init? @server-state)
+      (mongo/create-index (:db db)))
     (start-filter-stream follow track (fn [status] (proc/process db status)) credentials))
   (when (:backup? @server-state)
     (scheduler/start (:backup-folder @server-state))))


Log error during dotfile request

Log error during dotfile request

--- src/cider_ci/builder/web.clj
+++ src/cider_ci/builder/web.clj
@@ -21,6 +21,7 @@
     [drtom.logbug.catcher :as catcher]
     [drtom.logbug.debug :as debug]
     [drtom.logbug.ring :refer [wrap-handler-with-logging]]
+    [drtom.logbug.thrown :as thrown]
     [ring.middleware.json]
     ))

@@ -86,12 +87,12 @@

 (defn dotfile [request]
   (try
-    {:status 200
-     :headers {"content-type" "application/json;charset=utf-8"}
-     :body (json/write-str
-             (cider-ci.builder.dotfile/get-dotfile
-               (-> request :route-params :tree_id)))
-     }
+    (let [dotfile-content (cider-ci.builder.dotfile/get-dotfile
+                            (-> request :route-params :tree_id))]
+      (logging/debug {:dotfile-content dotfile-content})
+      {:status 200
+       :headers {"content-type" "application/json;charset=utf-8"}
+       :body (json/write-str dotfile-content)})
     (catch clojure.lang.ExceptionInfo e
       (logging/warn e)
       (logging/warn (-> e .getData :object ))
@@ -100,16 +101,11 @@
               :body (str "The dotfile itself or a included resource doesn't exist. \n\n"
                          (-> e .getData :object ))}
         {:status 500
-         :body "See the builder logs for details."
-         }
-        )
-      )
+         :body "See the builder logs for details."}))
     (catch Exception e
-      (logging/error e)
+      (logging/error (thrown/stringify e))
       {:status 500
-       :body "See the builder logs for details."
-       }
-      )))
+       :body "See the builder logs for details." })))

 (defn wrap-jobs [default-handler]
   (cpj/routes


Mention other fields in the project model

--- src/circle/model/project.clj
+++ src/circle/model/project.clj
@@ -21,7 +21,11 @@
                          vcs_url ;; the canonical url for the repo. Must match the URL that github will provide in the post-commit hook
                          aws_credentials
                          ssh_private_key ;; an SSH private key authorized to checkout code
-                         ssh_public_key]
+                         ssh_public_key
+                         test
+                         setup
+                         extra
+                         dependencies]
                   :as args}]
   (validate! project-validation args)
   args)


add terminal-val

add terminal-val

--- src/clj/com/rpl/specter.cljx
+++ src/clj/com/rpl/specter.cljx
@@ -9,6 +9,7 @@
                defnav
                defpathedfn
                richnav
+               defnavconstructor
               ]]
             [com.rpl.specter.util-macros :refer
               [doseqres]]
@@ -21,7 +22,8 @@
              defcollector
              defnav
              defpathedfn
-             richnav]]
+             richnav
+             defnavconstructor]]
     #+clj [com.rpl.specter.util-macros :only [doseqres]]
     )
   (:require [com.rpl.specter.impl :as i]
@@ -218,6 +220,13 @@
     (transform* [params params-idx vals structure next-fn]
       (i/terminal* params params-idx vals structure)
       )))
+
+(defnavconstructor terminal-val
+  "Like `terminal` but specifies a val to set at the location regardless of
+   the collected values or the value at the location."
+  [p terminal]
+  [v]
+  (p (constantly v)))

 (def
   ^{:doc "Navigate to every element of the collection. For maps navigates to


added libs in static html for designer - 4

--- src/clj/geoforms/handler.clj
+++ src/clj/geoforms/handler.clj
@@ -18,7 +18,7 @@
      (include-css "//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css")
      (include-css "//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css")
      (include-css (if (env :dev) "css/site.css" "css/site.min.css"))
-     #_(include-css "https://www.votepour.ca/assets/stylesheets/geoforms.css")]
+     (include-css "https://www.votepour.ca/assets/stylesheets/geoforms.css")]
     [:body {:style "height: 100%"}
      [:div#app
       [:p "Votepour.ca / Geoforms"]
@@ -31,7 +31,7 @@
      (include-js "https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.1.10/es5-shim.min.js")
      (include-js "https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.1.10/es5-sham.min.js")
      (include-js "js/app.js")
-     #_(include-js "https://www.votepour.ca/assets/javascripts/geoforms.js")]]))
+     (include-js "https://www.votepour.ca/assets/javascripts/geoforms.js")]]))

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


fixes spurious results

fixes spurious results

--- src/datascript/pull_api.cljc
+++ src/datascript/pull_api.cljc
@@ -240,7 +240,8 @@
         (let [spec       (first specs)
               pattern    (:pattern frame)
               new-frames (conj frames (assoc frame :specs (rest specs)))]
-          (pull-attr db spec (first eids) new-frames))
+          (when (first eids)
+            (pull-attr db spec (first eids) new-frames)))
         (->> frame :kvps persistent! not-empty
              (reset-frame frame (rest eids))
              (conj frames)
@@ -262,7 +263,8 @@
                            result (update :kvps assoc! (:attr f) result))
                          (conj (rest remaining))
                          (recur db))
-                    result))))
+                    result))
+    nil))

 (defn pull-spec
   [db pattern eids multi?]


Make add project button in header medium size to match other buttons

--- src-cljs/frontend/components/pages/projects.cljs
+++ src-cljs/frontend/components/pages/projects.cljs
@@ -81,6 +81,7 @@
       (button/link
        {:href (routes/v1-add-projects)
         :kind :primary
+        :size :medium
         :on-click #(analytics/track! this {:event-type :add-project-clicked
                                            :properties {:is-empty-state empty-state?}})}
        "Add Project"))))


Add branch picker to workflow runs page

Add branch picker to workflow runs page

--- src-cljs/frontend/components/pages/workflow.cljs
+++ src-cljs/frontend/components/pages/workflow.cljs
@@ -1,5 +1,7 @@
 (ns frontend.components.pages.workflow
   (:require [clojure.string :as string]
+            [frontend.api :as api]
+            [frontend.components.aside :as aside]
             [frontend.components.common :as common]
             [frontend.components.pieces.button :as button]
             [frontend.components.pieces.card :as card]
@@ -8,10 +10,12 @@
             [frontend.datetime :as datetime]
             [frontend.models.build :as build-model]
             [frontend.routes :as routes]
+            [frontend.state :as state]
             [frontend.utils :refer-macros [component element html]]
             [frontend.utils.github :as gh-utils]
             [frontend.utils.legacy :refer [build-legacy]]
             [frontend.utils.vcs-url :as vcs-url]
+            [om.core :as om]
             [om.next :as om-next :refer-macros [defui]]))

 (defn- status-class [run-status]
@@ -187,6 +191,23 @@
       :title "Project settings"}
      [:i.material-icons "settings"]]]))

+(defn- legacy-branch-picker
+  "Wraps the branch picker in a legacy component which can load the project data
+  on mount."
+  [app owner]
+  (reify
+    om/IWillMount
+    (will-mount [_]
+      (let [projects-loaded? (seq (get-in app state/projects-path))
+            current-user (get-in app state/user-path)]
+        (when (and (not projects-loaded?)
+                   (not (empty? current-user)))
+          (api/get-projects (om/get-shared owner [:comms :api])))))
+
+    om/IRender
+    (render [_]
+      (om/build aside/branch-activity-list app))))
+
 (defui ^:once Page
   static om-next/IQuery
   (query [this]
@@ -226,5 +247,6 @@
                   :project project-name
                   :vcs_type vcs-type}]
         :header-actions (settings-link vcs-type org-name project-name)
+        :sidebar (build-legacy legacy-branch-picker (:legacy/state (om-next/props this)))
         :main-content (when-let [project (:project-for-runs (om-next/props this))]
                         (workflow-runs project))}))))


problem 66 tests fixed

problem 66 tests fixed

--- src/foreclojure/data_set.clj
+++ src/foreclojure/data_set.clj
@@ -693,7 +693,7 @@
             :description "A power set is the set of all subsets of a given set. Given a list, produce a set of sublists while preserving the order of elements."
             :tags ["medium" "seqs"]
             :tests ["(= (__ '(1 :a)) #{'(1 :a) '(:a) '() '(1)})"
-                    "(= (__ '()) '())"
+                    "(= (__ #{'()}) '())"
                     "(= (__ '(1 2 3)) #{'() '(1) '(2) '(3) '(1 2) '(1 3) '(2 3) '(1 2 3)})"
                     "(= (count (__ (range 10))) 1024)"]})
       ))


fix #472

fix #472

--- src/status_im/chat/handlers/receive_message.cljs
+++ src/status_im/chat/handlers/receive_message.cljs
@@ -6,6 +6,7 @@
             [status-im.commands.utils :refer [generate-hiccup]]
             [status-im.utils.random :as random]
             [status-im.constants :refer [wallet-chat-id
+                                         content-type-command
                                          content-type-command-request]
              :as c]
             [cljs.reader :refer [read-string]]
@@ -61,8 +62,10 @@
         (when (= (:content-type message') content-type-command-request)
           (dispatch [:add-request chat-id' message']))
         (dispatch [:add-unviewed-message chat-id' message-id]))
-      (if (and (not= chat-id wallet-chat-id)
-               (= "send" (get-in message [:content :command])))
+      (if (and
+            (= (:content-type message) content-type-command)
+            (not= chat-id wallet-chat-id)
+            (= "send" (get-in message [:content :command])))
         (add-message-to-wallet db message)))))

 (defn add-message-to-wallet [db {:keys [content-type] :as message}]


Avoid compiler warnings

Avoid compiler warnings

--- src/status_im/chat/styles/input/suggestions.cljs
+++ src/status_im/chat/styles/input/suggestions.cljs
@@ -1,6 +1,7 @@
 (ns status-im.chat.styles.input.suggestions
   (:require-macros [status-im.utils.styles :refer [defnstyle]])
-  (:require [status-im.ui.components.styles :as common]))
+  (:require [status-im.ui.components.styles :as common]
+            [status-im.utils.platform :as platform]))

 (def color-item-title-text "rgb(147, 155, 161)")
 (def color-item-suggestion-name "rgb(98, 143, 227)")
@@ -42,4 +43,4 @@
    :font-size    14
    :margin-left  16
    :margin-right 16
-   :color        color-item-title-text})+   :color        color-item-title-text})


PDOK-2292: Fix -elem-at test. Work was done on branch but in the meantime the json-reader on master was altered.

--- src/test/clojure/pdok/featured/extracts_test.clj
+++ src/test/clojure/pdok/featured/extracts_test.clj
@@ -55,7 +55,7 @@

 ;; The -elem-at- construction can be used in mustache templates to get an element from a specific position in a list. For instance elem-at-1 returns the second element in list.
 ;; In the example template 3 elements are used. In the example input data there are two elements in "nummeraanduidingreeks" present. In the output only these two elements can be found.
-(def elem-at-inputdata  (file-to-features (io/resource "templates/test/elemat/bgt_pand.json") "bgtmutatie" ))
+(def elem-at-inputdata  (second (file-to-features (io/resource "templates/test/elemat/bgt_pand.json") "bgtmutatie" )))
 (def test-indexed-section (slurp (io/resource "templates/test/elemat/indexedsection.mustache")))
 (def elem-at-expectedoutput "<imgeo-s:Pand><elem1>1111111111111111<hoek1>A</hoek1><hoek2>B</hoek2></elem1><elem2>9999999999999999<hoek3>C</hoek3></elem2></imgeo-s:Pand>")
 (deftest test-elem-at


[CS EN] Make street-segment/xml-nodes lazy

--- src/vip/data_processor/output/street_segment.clj
+++ src/vip/data_processor/output/street_segment.clj
@@ -32,7 +32,7 @@
     (letfn [(chunked-sexps [page]
               (let [offset (* page chunk-size)]
                 (when (< offset total)
-                  (concat
+                  (lazy-cat
                    (let [street-segments (korma/select sql-table
                                                        (korma/offset offset)
                                                        (korma/limit chunk-size))]


use a non-tx cache for the non-tx test.

use a non-tx cache for the non-tx test.

--- transactions/test/immutant/transactions_test.clj
+++ transactions/test/immutant/transactions_test.clj
@@ -23,7 +23,8 @@
             [clojure.java.jdbc :as sql]))

 (set-log-level! (or (System/getenv "LOG_LEVEL") :OFF))
-(def cache (csh/cache "tx-test" :transactional? true))
+(def tx-cache (csh/cache "tx-test" :transactional? true))
+(def non-tx-cache (csh/cache "non-tx-test" :transactional? false))
 (def queue (msg/queue "/queue/test" :durable? false))
 (def local-remote-queue (msg/queue "remote" :durable? false))
 (def conn (msg/context (cond-> {:host "localhost" :xa? true}
@@ -37,7 +38,8 @@

 (use-fixtures :each
   (fn [f]
-    (.clear cache)
+    (.clear tx-cache)
+    (.clear non-tx-cache)
     (try
       (sql/db-do-commands spec
         (sql/drop-table-ddl :things)
@@ -63,17 +65,19 @@
     int))

 (defn work [m]
-  (csh/swap-in! cache :a (constantly 1))
-  (msg/publish queue "kiwi")
-  (msg/publish remote-queue "starfruit")
-  (not-supported
-    (csh/swap-in! cache :deliveries (fnil inc 0)))
-  (sql/with-db-transaction [t spec]
-    (write-thing-to-db t "tangerine")
-    (when (:throw? m) (throw (Exception. "rollback")))
-    (when (:rollback? m)
-      (set-rollback-only)
-      (sql/db-set-rollback-only! t))))
+  (let [{:keys [non-tx-cache? throw? rollback?]} m
+        cache (if non-tx-cache? non-tx-cache tx-cache)]
+    (csh/swap-in! cache :a (constantly 1))
+    (msg/publish queue "kiwi")
+    (msg/publish remote-queue "starfruit")
+    (not-supported
+      (csh/swap-in! cache :deliveries (fnil inc 0)))
+    (sql/with-db-transaction [t spec]
+      (write-thing-to-db t "tangerine")
+      (when throw? (throw (Exception. "rollback")))
+      (when rollback?
+        (set-rollback-only)
+        (sql/db-set-rollback-only! t)))))

 (defn listener [m]
   (if (:tx? m)
@@ -99,14 +103,14 @@
 (defn verify-success []
   (is (= "kiwi" (msg/receive queue :timeout 1000)))
   (is (= "starfruit" (msg/receive local-remote-queue :timeout 1000)))
-  (is (= 1 (:a cache)))
+  (is (= 1 (:a tx-cache)))
   (is (= "tangerine" (:name (read-thing-from-db spec "tangerine"))))
   (is (= 1 (count-things-in-db spec))))

 (defn verify-failure []
   (is (nil? (msg/receive queue :timeout 1000)))
   (is (nil? (msg/receive local-remote-queue :timeout 1000)))
-  (is (nil? (:a cache)))
+  (is (nil? (:a tx-cache)))
   (is (nil? (read-thing-from-db spec "tangerine")))
   (is (= 0 (count-things-in-db spec))))

@@ -143,22 +147,22 @@
   (with-open [_ (msg/listen trigger listener)]
     (msg/publish trigger {:tx? true :throw? true})
     (verify-failure)
-    (is (= 10 (:deliveries cache)))))
+    (is (= 10 (:deliveries tx-cache)))))

 (deftest transactional-writes-in-listener-should-fail-on-rollback
   (with-open [_ (msg/listen trigger listener)]
     (msg/publish trigger {:tx? true :rollback? true})
     (verify-failure)
-    (is (= 1 (:deliveries cache)))))
+    (is (= 1 (:deliveries tx-cache)))))

 (deftest non-transactional-writes-in-listener-with-exception
   (with-open [_ (msg/listen trigger listener :mode :auto-ack)]
-    (msg/publish trigger {:throw? true})
+    (msg/publish trigger {:throw? true :non-tx-cache? true})
     (is (= 10 (loop [i 0]
                 (Thread/sleep 100)
-                (if (or (= 50 i) (= 10 (:deliveries cache)))
-                  (:deliveries cache)
+                (if (or (= 50 i) (= 10 (:deliveries non-tx-cache)))
+                  (:deliveries non-tx-cache)
                   (recur (inc i))))))
-    (is (= 1 (:a cache)))
+    (is (= 1 (:a non-tx-cache)))
     (is (= (repeat 10 "kiwi")      (repeatedly 10 #(msg/receive queue))))
     (is (= (repeat 10 "starfruit") (repeatedly 10 #(msg/receive local-remote-queue))))))


Added Clear Completed to todo demo

Added Clear Completed to todo demo

Ok, this is good enough to show now

--- src/webapp/framework/client/components/main_view.cljs
+++ src/webapp/framework/client/components/main_view.cljs
@@ -85,29 +85,39 @@

-                (let [active-items  (select id from  coils_todo_items where item_status = 'ACTIVE' {})
-                      total-items   (select id from  coils_todo_items {})
+                (let [active-items      (select id from  coils_todo_items where item_status = 'ACTIVE' {})
+                      total-items       (select id from  coils_todo_items {})
+                      completed-items   (select id from  coils_todo_items where item_status = 'COMPLETED' {})
                       ]

                   (if (pos? (count total-items))
                     (do
                       (div {:style {:height "30px"}})
-                      (div {:id "footer" :style {:backgroundColor "white"}}
+                      (div {:id "footer" :style {:backgroundColor "white" :fontSize "12"}}
                            (container
-                            (inline "25%" (str (count active-items) " items left"))
+                            (div {:style { :width "32%" :display "inline-block;" :textAlign "left"}}  (str (count active-items) " items left"))

-                            (button {:style {  :width "25%" :border (str (if (nil? (read-ui app [:show])) "1px solid"))}
+                            (button {:style { :width "12%" :border (str (if (nil? (read-ui app [:show])) "1px solid"))}
                                      :onClick (fn [e]
                                                 (write-ui app [:show] nil)
                                                 ) } "ALL")
-                            (button {:style {  :width "25%" :border (str (if (= "ACTIVE" (read-ui app [:show])) "1px solid"))}
+                            (button {:style {  :width "12%" :border (str (if (= "ACTIVE" (read-ui app [:show])) "1px solid"))}
                                      :onClick (fn [e]
                                                 (write-ui app [:show] "ACTIVE")
                                                 ) } "Active")
-                            (button {:style {  :width "25%" :border (str (if (= "COMPLETED" (read-ui app [:show])) "1px solid"))}
+                            (button {:style {  :width "12%" :border (str (if (= "COMPLETED" (read-ui app [:show])) "1px solid"))}
                                      :onClick (fn [e]
                                                 (write-ui app [:show] "COMPLETED")
                                                 ) } "Completed")
+
+                            (if (pos? (count completed-items))
+                              (button {:style {  :width "32%" :textAlign "right"}
+                                       :onClick (fn [e]
+                                                  (go
+                                                   (sql "delete from  coils_todo_items  where item_status = 'COMPLETED'"
+                                                        []  ))
+                                                  ) } "Clear completed"))
+
                             ))))))))


update to return hashmaps not just strings

--- src/hivewing_core/worker.clj
+++ src/hivewing_core/worker.clj
@@ -13,11 +13,10 @@
         ]
     (println params)
     (println hive-uuid)
-    (map :uuid (jdbc/query sql-db ["SELECT uuid FROM workers WHERE hive_uuid = ? LIMIT ? OFFSET ?"
+    (jdbc/query sql-db ["SELECT uuid FROM workers WHERE hive_uuid = ? LIMIT ? OFFSET ?"
                         (ensure-uuid hive-uuid)
                         per-page
-                        (* (- page 1) per-page)])
-    )))
+                        (* (- page 1) per-page)])))

 (defn worker-get
   "Get the data for worker record.  You pass in the worker via the worker uuid.  Returns the data


Исправление

Исправление

--- src/ixinfestor/core_handler.clj
+++ src/ixinfestor/core_handler.clj
@@ -49,22 +49,22 @@
 ;;**************************************************************************************************

 (defn routes-ix* [cms-roles-set]
-  (routes routes-for-ix-pathes*
-
-          (ANY "/ix/set" request
-               (cw/ix-accoc-parametr request))
-
-          (GET "/ixinfestor" request
-               (friend/authorize
-                cms-roles-set
-                (-> request
-                    cwb/page-ixcms-main
-                    ring.util.response/response
-                    (ring.util.response/header "Content-Type" "text/html; charset=utf-8"))
-                )
-               )
-
-          ))
+  (routes
+
+   (ANY "/ix/set" request
+        (cw/ix-accoc-parametr request))
+
+   (GET "/ixinfestor" request
+        (friend/authorize
+         cms-roles-set
+         (-> request
+             cwb/page-ixcms-main
+             ring.util.response/response
+             (ring.util.response/header "Content-Type" "text/html; charset=utf-8"))
+         )
+        )
+
+   ))


Testing the virtuoso connection url

Testing the virtuoso connection url

--- src/kabob/build/input_kb.clj
+++ src/kabob/build/input_kb.clj
@@ -19,7 +19,7 @@
 (defn virtuoso-kb [args]
   ;;Init source KB connection
   (println "forcing a virtuoso connection")
-  (let [kb (kb (VirtuosoRepository. "jdbc:virtuoso://localhost:1111","dba","dba"))]
+  (let [kb (kb (VirtuosoRepository. "jdbc:virtuoso://virtuoso-prod:1111","dba","dba"))]
     (initialize-kb kb)))

 (defn open-kb [args]


Add Access-Control-Max-Age to CORS

Add Access-Control-Max-Age to CORS

--- src/lens/middleware/cors.clj
+++ src/lens/middleware/cors.clj
@@ -12,6 +12,7 @@
       {:status 204
        :headers {"Access-Control-Allow-Origin" "*"
                  "Access-Control-Allow-Methods" "GET, POST, PUT"
-                 "Access-Control-Allow-Headers" "Authorization, Accept, If-Match"}}
+                 "Access-Control-Allow-Headers" "Authorization, Accept, If-Match"
+                 "Access-Control-Max-Age" "3600"}}
       (-> (handler request)
           (assoc-header)))))


add clear-project command

add clear-project command

--- src/lt/plugins/ltinator.cljs
+++ src/lt/plugins/ltinator.cljs
@@ -147,6 +147,11 @@
   (reset! opened-project-path path)
   (add-project-name-to-title path))

+(defn- clear-opened-project
+  []
+  (reset! opened-project-path nil)
+  (change-title "Light Table"))
+

 ;;;
 ;;; UIs
@@ -232,3 +237,8 @@
                         (if (project-opened?)
                           (save @opened-project-path (current-project))
                           (cmd/exec! :ltinator.save-project-as))))})
+
+(cmd/command {:command :ltinator.clear-project
+              :desc "Ltinator: Clear opened project"
+              :exec (fn []
+                      (clear-opened-project))})


remove debug print

remove debug print

--- src/lt/plugins/ltinator.cljs
+++ src/lt/plugins/ltinator.cljs
@@ -210,7 +210,6 @@
 (cmd/command {:command :ltinator.save-project-as
               :desc "Ltinator: Save project as.."
               :exec (fn []
-                      (println "Save project as..")
                       (when (check-project-dir)
                         (let [path (str @project-directory "/new-project.edn")
                               s (save-project path (current-project))]


05_MongoDB.

--- from-repl.clj
+++ from-repl.clj
@@ -23,3 +23,4 @@
 (render-site "WebServices/01_running_Flask")
 (render-site "WebServices/02_AJAX")
 (render-site "WebServices/04_data_visualisation")
+(render-site "WebServices/05_MongoDB")


CLJS-1282: Add a :pprint option to the default reporter in cljs.test

--- src/main/cljs/cljs/test.cljs
+++ src/main/cljs/cljs/test.cljs
@@ -243,18 +243,28 @@
   cljs.test
   (:require-macros [clojure.template :as temp]
                    [cljs.test :as test])
-  (:require [clojure.string :as string]))
+  (:require [clojure.string :as string]
+            [cljs.pprint :as pprint]))

 ;; =============================================================================
 ;; Default Reporting

 (defn empty-env
+  "Generates a testing environment with a reporter.
+   (empty-env) - uses the :cljs.test/default reporter.
+   (empty-env :cljs.test/pprint) - pretty prints all data structures.
+   (empty-env reporter) - uses a reporter of your choosing.
+
+   To create your own reporter see cljs.test/report"
   ([] (empty-env ::default))
   ([reporter]
-   {:report-counters {:test 0 :pass 0 :fail 0 :error 0}
-    :testing-vars ()
-    :testing-contexts ()
-    :reporter reporter}))
+   (cond-> {:report-counters {:test 0 :pass 0 :fail 0 :error 0}
+            :testing-vars ()
+            :testing-contexts ()
+            :formatter pr-str
+            :reporter reporter}
+     (= ::pprint reporter) (assoc :reporter ::default
+                             :formatter pprint/pprint))))

 (def ^:dynamic *current-env* nil)

@@ -312,14 +322,18 @@
 (defmethod report [::default :pass] [m]
   (inc-report-counter! :pass))

+(defn- print-comparison [m]
+  (let [formatter-fn (or (:formatter (get-current-env)) pr-str)]
+    (println "expected:" (formatter-fn (:expected m)))
+    (println "  actual:" (formatter-fn (:actual m)))))
+
 (defmethod report [::default :fail] [m]
   (inc-report-counter! :fail)
   (println "\nFAIL in" (testing-vars-str m))
   (when (seq (:testing-contexts (get-current-env)))
     (println (testing-contexts-str)))
   (when-let [message (:message m)] (println message))
-  (println "expected:" (pr-str (:expected m)))
-  (println "  actual:" (pr-str (:actual m))))
+  (print-comparison m))

 (defmethod report [::default :error] [m]
   (inc-report-counter! :error)
@@ -327,8 +341,7 @@
   (when (seq (:testing-contexts (get-current-env)))
     (println (testing-contexts-str)))
   (when-let [message (:message m)] (println message))
-  (println "expected:" (pr-str (:expected m)))
-  (print "  actual: ") (prn (:actual m)))
+  (print-comparison m))

 (defmethod report [::default :summary] [m]
   (println "\nRan" (:test m) "tests containing"
@@ -344,6 +357,9 @@
   #_(println ":begin-test-var" (testing-vars-str m)))
 (defmethod report [::default :end-test-var] [m])
 (defmethod report [::default :end-run-tests] [m])
+
+;; =============================================================================
+;; File, Line, and Column Helpers

 (defn js-line-and-column [stack-element]
   (let [parts (.split stack-element ":")


tweak nrepl-debug util

tweak nrepl-debug util

pprint was delaying messages too much so Cursive got into weird states.
now abusing an agent to write messages off thread

--- src/main/shadow/nrepl_debug.clj
+++ src/main/shadow/nrepl_debug.clj
@@ -8,7 +8,10 @@

 (defonce print-lock (Object.))

-(defn log [out from msg]
+;; using an agent so log writes don't delay messages
+(defonce write-agent (agent {}))
+
+(defn log [agent-state out from msg]
   (let [text (with-out-str (pprint msg))]
     (prn [:msg from (count text)])
     (locking print-lock
@@ -16,8 +19,8 @@
         (println ";; ----------------------------------------")
         (println ";; -- FROM " from)
         (println ";; ----------------------------------------")
-        (println text))
-      )))
+        (println text))))
+  agent-state)

 (defn client-loop [id client to-port]
   (let [target (Socket. "localhost" to-port)
@@ -40,7 +43,7 @@
               #(do (try
                      (loop []
                        (when-some [target-msg (transport/recv target-transport)]
-                         (log log-out :target target-msg)
+                         (send write-agent log log-out :target target-msg)
                          (transport/send client-transport target-msg)
                          (recur)))
                      (catch Exception e
@@ -52,7 +55,7 @@
         ;; client -> target
         (loop []
           (when-some [client-msg (transport/recv client-transport)]
-            (log log-out :client client-msg)
+            (send write-agent log log-out :client client-msg)
             (transport/send target-transport client-msg)
             (recur)))
         (catch Exception e


Add :onyx/batch? to information model orderings

--- src/onyx/information_model.cljc
+++ src/onyx/information_model.cljc
@@ -1392,9 +1392,10 @@
     :onyx/input-retry-timeout
     :onyx/max-pending
     :onyx/fn
+    :onyx/bulk?
+    :onyx/batch?
     :onyx/group-by-key
     :onyx/group-by-fn
-    :onyx/bulk?
     :onyx/flux-policy
     :onyx/uniqueness-key
     :onyx/deduplicate?


Remove :keycode from key events

Remove :keycode from key events

--- src/play_clj/core_listeners.clj
+++ src/play_clj/core_listeners.clj
@@ -8,13 +8,13 @@
    execute-fn!]
   (reify InputProcessor
     (keyDown [this k]
-      (execute-fn! on-key-down :key k :keycode k)
+      (execute-fn! on-key-down :key k)
       false)
     (keyTyped [this c]
       (execute-fn! on-key-typed :character c)
       false)
     (keyUp [this k]
-      (execute-fn! on-key-up :key k :keycode k)
+      (execute-fn! on-key-up :key k)
       false)
     (mouseMoved [this sx sy]
       (execute-fn! on-mouse-moved :input-x sx :input-y sy)


ensure s is a sequence of integers before attempting to work out if they are consecutive - therefore avoiding unnecessary exceptions.

--- src/overtone/helpers/seq.clj
+++ src/overtone/helpers/seq.clj
@@ -9,7 +9,10 @@
    (consecutive-ints? [1 2 3 4 5]) ;=> true
    (consecutive-ints? [1 2 3 5 4]) ;=> false"
   [s]
-  (apply = (map - (rest s) (seq s))))
+  (and
+   (sequential? s)
+   (every? integer? (seq s))
+   (apply = (map - (rest s) (seq s)))))

 (defn indexed
   "Takes a seq and returns a list of index val pairs for each successive val in


add control rate version of the bus->buf synth

--- src/overtone/studio/util.clj
+++ src/overtone/studio/util.clj
@@ -8,6 +8,9 @@
 ;; Some utility synths for signal routing and scoping
 (defonce __UTIL-SYNTHS__
   (do
+    (defsynth control-bus->buf [bus 20 buf 0]
+      (record-buf:kr (in:kr bus) buf))
+
     (defsynth bus->buf [bus 20 buf 0]
       (record-buf (in bus) buf))


Updated support for EIP1577

Updated support for EIP1577

Signed-off-by: Julien Eluard <c768e13f1ba4c3ebed2909a1fc1e4b50bb021a2f@gmail.com>

--- src/status_im/browser/core.cljs
+++ src/status_im/browser/core.cljs
@@ -82,16 +82,21 @@
   (let [history-host (http/url-host (try (nth history history-index) (catch js/Error _)))]
     (assoc browser :unsafe? (dependencies/phishing-detect history-host))))

+(def ipfs-proto-code "e3")
+(def swarm-proto-code "e4")
+
 (defn resolve-ens-content-callback [hex]
   (let [hash (when hex (multihash/base58 (multihash/create :sha2-256 (subs hex 2))))]
     (if (and hash (not= hash resolver/default-hash))
-      (re-frame/dispatch [:browser.callback/resolve-ens-multihash-success "01" hash])
+      (re-frame/dispatch [:browser.callback/resolve-ens-multihash-success ipfs-proto-code hash])
       (re-frame/dispatch [:browser.callback/resolve-ens-contenthash]))))

 (defn resolve-ens-contenthash-callback [hex]
   (let [proto-code (subs hex 2 4)
-        hash (when hex (multihash/base58 (multihash/create :sha2-256 (subs hex 8))))]
-    (if (and (#{"00" "01"} proto-code) hash (not= hash resolver/default-hash))
+        hash (when hex (multihash/base58 (multihash/create :sha2-256 (subs hex 12))))]
+    ;; We only support IPFS and SWARM
+    ;; TODO Once more implementations / providers are published this will have to be improved
+    (if (and ((#{swarm-proto-code ipfs-proto-code} proto-code) hash (not= hash resolver/default-hash)))
       (re-frame/dispatch [:browser.callback/resolve-ens-multihash-success proto-code hash])
       (re-frame/dispatch [:browser.callback/resolve-ens-multihash-error]))))

@@ -172,7 +177,7 @@
   [{:keys [db] :as cofx} proto-code hash]
   (let [current-url (get-current-url (get-current-browser db))
         host (http/url-host current-url)
-        gateways (if (= "00" proto-code) "swarm-gateways.net/bzz:/" "ipfs.infura.io/ipfs/")]
+        gateways (if (= swarm-proto-code proto-code) "swarm-gateways.net/bzz:/" "ipfs.infura.io/ipfs/")]
     (fx/merge cofx
               {:db (-> (update db :browser/options
                                assoc


[#11764] Data that was added before pairing devices is not synced anymore across synced devices

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

--- src/status_im/pairing/core.cljs
+++ src/status_im/pairing/core.cljs
@@ -180,7 +180,7 @@
  :pairing/get-our-installations
  get-our-installations)

-(defn send-installation-messages
+(fx/defn send-installation-messages
   {:events [:pairing.ui/synchronize-installation-pressed]}
   [{:keys [db]}]
   (let [multiaccount                             (:multiaccount db)


cleanup

cleanup

--- src/tailrecursion/boot/core.clj
+++ src/tailrecursion/boot/core.clj
@@ -63,7 +63,7 @@
     (cond (symbol? m) ((load-sym m) boot) (seq? m) ((eval m) boot))
     (swap! boot dissoc :main)
     (flush)
-    :ok))
+    ::okay))

 (defn run-next-task! [boot & [spec]]
   (prep-next-task! boot spec)


fix runtime errors.

fix runtime errors.

--- clojure/abcdefghppp.clj
+++ clojure/abcdefghppp.clj
@@ -1,48 +1,30 @@
 ; http://m2.hkgolden.com/view.aspx?message=6307521&type=SW&page=1
 ; binc
+
+(require 'clojure.set)
+
 (defn make-seq []
-
   (map read-string
-
        (for [x (range 10)
-
              y (range 10)
-
              :when (and (not= x y) (not= x 0))]
-
          (apply str [x y]))))

-
-
 (defn test-form []
-
-  (let [mq (make-seq)]
-
+  (let [mq (make-seq)
+        v2s (fn [v] (reduce #(clojure.set/union %1 (set (str %2))) #{} v))]
     (->>
-
      (for [ab mq
-
            cd mq
-
            gh mq
-
            :let [ef (- ab cd)
-
-                 ppp (+ ef gh)
-
-                 v2s (fn [v] (reduce #(clojure.set/union %1 (set (str %2))) #{} v))]
-
+                 ppp (+ ef gh)]
            :when (and (= 1 (count (set (str ppp))))
-
                       (> ppp 99))]
-
        [ab cd ef gh ppp])
-
      (filter #(= 9 (count (v2s %)))))))

+(prn (test-form))

-
-
-(test-form)
-
+;; $ java -cp /opt/clojure/clojure-1.8.0.jar clojure.main abcdefghppp.clj
 ;; ([85 46 39 72 111] [86 54 32 79 111] [90 27 63 48 111] [90 63 27 84 111] [95 27 68 43 111])


Work even when strobe variable unset by user.

--- src/afterglow/effects/fun.clj
+++ src/afterglow/effects/fun.clj
@@ -194,6 +194,8 @@
   (let [saved-hue (show/get-variable :strobe-hue)
         saved-saturation (show/get-variable :strobe-saturation)]
     (when-not saved-saturation (show/set-variable! :strobe-saturation 100))
+    (when-not saved-hue (show/set-variable! :strobe-hue 277))
+
     (Effect. "Strobe Adjust" always-active
             (fn [show snapshot] nil)
             (fn [show snapshot]


better key

better key

Signed-off-by: Chris Granger <5654cde260ae99bc4d30054171b8bcd902efd19a@gmail.com>

--- src/aurora/compiler/code.cljs
+++ src/aurora/compiler/code.cljs
@@ -18,7 +18,7 @@

    [(exclusive :step? :data :call :match)]

-   [(rule [?notebook :notebook/pages ?pages] (:in ?page ?pages) :return [page :notebook/page notebook])]
+   [(rule [?notebook :notebook/pages ?pages] (:in ?page ?pages) :return [page :page/notebook notebook])]

    [(rule [?page :page/args ?args] (:in ?arg ?args) :return [arg :arg page])
     (rule [?page :page/steps ?steps] (:in ?step ?steps) :return [step :step page])]


aded Juan and I

aded Juan and I

--- src/babel/english/lexicon.clj
+++ src/babel/english/lexicon.clj
@@ -508,6 +508,19 @@
                    :obj {:animate true}}}
     :english {:past "hugged"
               :participle "hugging"}}
+
+    "Juan and I"
+      [{:synsem {:cat :noun
+                 :pronoun true
+                 :case :nom
+                 :agr {:gender :masc
+                       :person :1st
+                       :number :plur}
+                 :sem {:human true
+                       :pred :Juan-and-i}
+                 :subcat '()}}]
+
+
    "I"
    [{:english {:note "♂"}
      :synsem {:cat :noun


added tener

added tener

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -658,6 +658,23 @@
                         :number :sing}
                   :subcat '()}}

+    "tener" {:espanol {:future-stem "tendr"
+                   :present {:1sing "tengo"
+                             :2sing "tienes"
+                             :3sing "tiene"
+                             :1plur "tenemos"
+                             :2plur "tenéis"
+                             :3plur "tienen"}
+                   :preterito {:1sing "tuve"
+                               :2sing "tuviste"
+                               :3sing "tuvo"
+                               :1plur "tuvimos"
+                               :2plur "tuvisteis"
+                               :3plur "tuvieron"}}
+                             :synsem {:cat :verb
+                  :sem {:subj {:animate true}
+                        :pred :have}}}
+
    "tirar" [{:synsem {:cat :verb
                       :sem {:pred :throw-out}}}
             {:synsem {:cat :verb


catch legitimately-thrown generation exceptions

--- src/babel/francais/writer.clj
+++ src/babel/francais/writer.clj
@@ -72,20 +72,31 @@
                                                                                :model medium
                                                                                }}]
                                                                               "fr")
+                                                                     ;; TODO: move this to *before*
+                                                                     ;; attempting generation that fails.
                                                                      (catch Exception e
                                                                        (cond

-                                                                        ;; TODO: make this conditional on
-                                                                        ;; there being a legitimate reason for the exception -
-                                                                        ;; e.g. the verb is "funzionare" (which takes a non-human
-                                                                        ;; subject), but we're trying to generate with
-                                                                        ;; {:agr {:person :1st or :2nd}}, for which the only lexemes
-                                                                        ;; are human.
-                                                                        false
-
-                                                                        (log/warn (str "ignoring exception: " e))
-                                                                        true
-                                                                       (throw e))))
+                                                                         ;; "se appeler": there is currently only singular
+                                                                         ;; proper male names, so any attempt to use
+                                                                         ;; plural number with this verb will fail.
+                                                                         ;; Also verb is constrained in lexicon
+                                                                         ;; to only be present progressive.
+                                                                         (and
+                                                                          (= (get-in spec [:root :français :français])
+                                                                             "se appeler")
+                                                                          (or (= (get-in spec [:comp :synsem :agr :number])
+                                                                                :plur)
+                                                                              (= (get-in spec [:comp :synsem :agr :gender])
+                                                                                :fem)
+                                                                              (and (not (= (get-in spec [:synsem :sem :tense])
+                                                                                :present))
+                                                                                (not (= (get-in spec [:synsem :sem :aspect])
+                                                                                :progressive)))))
+                                                                         (do (log/info (str "ignoring exception (se-appeler): " e)))
+
+                                                                         true
+                                                                         (throw e))))
                                                                    ))
                                                                [:sing :plur]))))
                                                      [:1st :2nd :3rd]))))


Fix inconsistent textarea font-size on Firefox

--- src/braid/ui/styles/body.cljs
+++ src/braid/ui/styles/body.cljs
@@ -8,4 +8,5 @@
     :font-size "12px"
     :background "#eee"}
    [:textarea :input
-    {:font-family "inherit"}]])
+    {:font-family "inherit"
+     :font-size "1em"}]])


Refactor the server code

Refactor the server code

--- src/clojure/picard/server.clj
+++ src/clojure/picard/server.clj
@@ -22,106 +22,131 @@
     HttpResponseStatus
     HttpVersion]))

+(defrecord State
+    [app
+     ch
+     keepalive?
+     chunked?
+     streaming?
+     responded?
+     next-up-fn
+     next-dn-fn
+     upstream
+     last-write
+     options])
+
 ;; Declare some functions in advance -- letfn might be better
 (declare incoming-request stream-request-body waiting-for-response)

-(defn- fresh-args
-  [args]
-  (-> args
-      (select-keys [:app :opts])
-      (assoc :last-args args :keepalive? true)))
-
-(defn- finalize-ch
-  [ch {:keys [keepalive? streaming? chunked? last-write]}]
-  (let [last-write (if (and streaming? chunked?)
-                     (.write ch HttpChunk/LAST_CHUNK)
-                     last-write)]
-    (when-not last-write
-      (throw (Exception. "Somehow the last-write is nil")))
-
-    (when-not keepalive?
-      (.addListener last-write netty/close-channel-future-listener))))
-
-(defn- finalized-resp
-  [_ _]
-  (throw (Exception. "This response is finished")))
+(defn- mk-initial-state
+  ([app options] (mk-initial-state app options nil))
+  ([app options ch]
+     (State. app               ;; Application for the server
+             ch                ;; Netty channel
+             true              ;; Is the exchange keepalive?
+             nil               ;; Is the request chunked?
+             nil               ;; Is the response streaming?
+             nil               ;; Has the response been sent?
+             incoming-request  ;; Next upstream event handler
+             nil               ;; Next downstream event handler
+             nil               ;; Upstream handler (external interface)
+             nil               ;; Last write to the channel
+             options)))         ;; Server options
+
+(defn- fresh-state
+  [state]
+  (mk-initial-state (.app state) (.options state) (.ch state)))
+
+(defn- finalize-exchange
+  [state current-state]
+  (when (= incoming-request (.next-up-fn current-state))
+    (swap! state fresh-state)
+    (let [last-write (if (and (.streaming? current-state)
+                              (.chunked? current-state))
+                       (.write (.ch current-state) HttpChunk/LAST_CHUNK)
+                       (.last-write current-state))]
+      (when-not last-write
+        (throw (Exception. "Somehow the last-write is nil")))
+
+      (when-not (.keepalive? current-state)
+        (.addListener last-write netty/close-channel-future-listener)))))

 (defn- aborted-req
   [_ _ _ _]
   (throw (Exception. "This request has been aborted")))

 (defn- finalize-resp
-  [state ch]
+  [state _]
   (swap-then!
    state
-   (fn [[up-f _ args]]
-     (if (= up-f waiting-for-response)
-       [incoming-request nil (fresh-args args)]
-       [up-f finalize-resp (assoc args :responded? true)]))
-   (fn [[next-fn _ {args :last-args}]]
-     (when (= next-fn incoming-request)
-       (finalize-ch ch args)))))
+   (fn [current-state]
+     (if (= waiting-for-response (.next-up-fn current-state))
+       (assoc current-state
+         :next-up-fn incoming-request)
+       (assoc current-state
+         :next-dn-fn nil
+         :responded? true)))
+   #(finalize-exchange state %)))

 (defn- stream-or-finalize-resp
-  [state ch evt val]
+  [state evt val current-state]
   (cond
    (= :body evt)
-   (let [write (.write ch (mk-netty-chunk val))]
+   (let [write (.write (.ch current-state) (mk-netty-chunk val))]
      (swap!
       state
-      (fn [[up-f _ args]]
-        [up-f stream-or-finalize-resp (assoc args :last-write write)])))
+      (fn [current-state]
+        (assoc current-state
+          :next-dn-fn stream-or-finalize-resp
+          :last-write write))))

    (= :done evt)
-   (finalize-resp state ch)
+   (finalize-resp state current-state)

    :else
    (throw (Exception. "Unknown event: " evt))))

-;; TODO: Handle HTTP 1.0 responses
-(defn- is-keepalive?
-  [req-keepalive? hdrs]
-  (and req-keepalive?
-       (not= "close" (hdrs "connection"))
-       (or (hdrs "content-length")
-           (= (hdrs "transfer-encoding") "chunked"))))
-
 (defn- initialize-resp
-  [state ch evt [_ hdrs body :as val]]
+  [state evt [_ hdrs body :as val] current-state]
   (when-not (= :response evt)
     (throw (Exception. "Um... responses start with the head?")))
-  (let [write (.write ch (resp->netty-resp val))]
-    (swap! state
-           (fn [[up-f dn-f {keepalive? :keepalive? :as args}]]
-             [up-f
-              (if (= :chunked body) stream-or-finalize-resp nil)
-              (assoc args
-                :streaming? (= :chunked body)
-                :chunked?   (= (hdrs "transfer-encoding") "chunked")
-                :keepalive? (is-keepalive? keepalive? hdrs)
-                :last-write write)]))
+  (let [write (.write (.ch current-state) (resp->netty-resp val))]
+    (swap!
+     state
+     (fn [current-state]
+       (assoc current-state
+         :next-dn-fn (if (= :chunked body) stream-or-finalize-resp)
+         :streaming? (= :chunked body)
+         :chunked?   (= (hdrs "transfer-encoding") "chunked")
+         :last-write write
+         ;; TODO: Handle HTTP 1.0 responses
+         :keepalive? (and (.keepalive? current-state)
+                          (not= "close" (hdrs "connection"))
+                          (or (hdrs "content-length")
+                              (= (hdrs "transfer-encoding") "chunked"))))))
     (if (not= :chunked body)
-      (finalize-resp state ch))))
+      (finalize-resp state current-state))))

 (defn- downstream-fn
-  [state ^Channel ch]
+  [state]
   ;; The state of the response needs to be tracked
   (swap!
    state
-   (fn [[up-f _ args]] [up-f initialize-resp args]))
+   (fn [current-state]
+     (assoc current-state :next-dn-fn initialize-resp)))

   (fn [evt val]
-    (cond
-     (= evt :pause)
-     (.setReadable ch false)
-
-     (= evt :resume)
-     (.setReadable ch true)
-
-     :else
-     (let [[_ dn-f _] @state]
-       (when dn-f
-         (dn-f state ch evt val))))
+    (let [current-state @state]
+      (cond
+       (= evt :pause)
+       (.setReadable (.ch current-state) false)
+
+       (= evt :resume)
+       (.setReadable (.ch current-state) true)
+
+       :else
+       (when-let [next-dn-fn (.next-dn-fn current-state)]
+         (next-dn-fn state evt val current-state))))
     true))

 (defn- waiting-for-response
@@ -129,136 +154,137 @@
    In this state, any further downstream messages are unexpected
    since pipelining is not (yet?) supported. Also, if the connection
    does not support keep alives, the connection will get into this state."
-  [_ _ _ _]
+  [_ _ _]
   (throw (Exception. "Not expecting a message right now")))

 (defn- handle-err
-  [state ch err]
-  (let [[_ _ {upstream :upstream last-write :last-write}] @state]
-    (when upstream
-      (try
-        (upstream :abort err)
-        (catch Exception e nil))
-      (swap!
-       state
-       (fn [[_ _ args]]
-         [nil aborted-req (dissoc args :upstream)])))
-    (if last-write
-      (.addListener last-write netty/close-channel-future-listener)
-      (.close ch))))
+  [state err current-state]
+  (when (.upstream current-state)
+    (try
+      ((.upstream current-state) :abort err)
+      (catch Exception e nil))
+    (swap!
+     state
+     (fn [current-state]
+       (assoc current-state
+         :next-up-fn nil
+         :upstream   nil))))
+  (if (.last-write current-state)
+    (.addListener (.last-write current-state)
+                  netty/close-channel-future-listener)
+    (.close (.ch current-state))))

 (defn- handling-request
   "The initial HTTP request is being handled and we're not expected
    further messages"
-  [_ _ _ _]
+  [_ _ _]
   (throw (Exception. "Not expecting a message right now")))

 (defn- transition-from-req-done
   "State transition from an HTTP request has finished being processed.
    If the response has already been sent, then the next state is to
    listen for new requests."
-  [state ch]
+  [state current-state]
   (swap-then!
    state
-   (fn [[_ dn-f args]]
-     (if (args :responded?)
-       [incoming-request dn-f (fresh-args args)]
-       [waiting-for-response dn-f args]))
-   (fn [[next-fn _ {args :last-args :as lol}]]
-     (when (= next-fn incoming-request)
-       (finalize-ch ch args)))))
+   (fn [current-state]
+     (if (.responded? current-state)
+       (assoc current-state :next-up-fn incoming-request)
+       (assoc current-state :next-up-fn waiting-for-response)))
+   #(finalize-exchange state %)))

 (defn- transition-to-streaming-body
   [state]
-  (swap! state (fn [[_ dn-f args]] [stream-request-body dn-f args])))
+  (swap!
+   state
+   (fn [current-state]
+     (assoc current-state :next-up-fn stream-request-body))))

 (defn- stream-request-body
-  [state ch ^HttpChunk chunk {upstream :upstream}]
-  (if (.isLast chunk)
-    (do
-      (upstream :done nil)
-      (transition-from-req-done state ch))
-    (upstream :body (.getContent chunk))))
+  [state chunk current-state]
+  (let [upstream (.upstream current-state)]
+    (if (.isLast chunk)
+      (do
+        (upstream :done nil)
+        (transition-from-req-done state current-state))
+      (upstream :body (.getContent chunk)))))

 (defn- incoming-request
-  [state ch ^HttpMessage msg {app :app :as args}]
-  (swap! state (fn [[_ dn-f args]] [handling-request dn-f args]))
+  [state msg {app :app :as current-state}]
+  ;; First track that a request is currently being handled
+  (swap!
+   state
+   (fn [current-state]
+     (assoc current-state :next-up-fn handling-request)))
+  ;; Now, handle the request
   (try
-    (let [upstream   (app (downstream-fn state ch) (netty-req->req msg))]
+    (let [upstream (app (downstream-fn state) (netty-req->req msg))]
       ;; Add the upstream handler to the state
-      (swap! state (fn [[up-f dn-f {keepalive? :keepalive? :as args}]]
-                     [up-f dn-f
-                      (assoc args
-                        :keepalive? (and keepalive? (HttpHeaders/isKeepAlive msg))
-                        :upstream   upstream)]))
-
+      (swap!
+       state
+       (fn [current-state]
+         ;; TODO: refactor this?
+         (assoc current-state
+           :keepalive? (and (.keepalive? current-state)
+                            (HttpHeaders/isKeepAlive msg))
+           :upstream upstream)))
       ;; Send the HTTP headers upstream
       (if (.isChunked msg)
         (transition-to-streaming-body state)
-        (transition-from-req-done state ch)))
+        (transition-from-req-done state current-state)))
     (catch Exception err
-      (handle-err state ch err))))
+      (handle-err state err current-state))))

 (defn- handle-ch-interest-change
-  [state ch [_ _ {upstream :upstream}] writable?]
-  (when (and upstream (not= (.isWritable ch) @writable?))
-    (swap-then!
-     writable?
-     not
-     #(try
-        (upstream (if % :resume :pause) nil)
-        (catch Exception err
-          (handle-err state ch err))))))
+  [state writable? current-state]
+  (when-let [upstream (.upstream current-state)]
+    (when-not (= (.isWritable (.ch current-state)) @writable?)
+      (swap-then!
+       writable? not
+       #(try
+          (upstream (if % :resume :pause) nil)
+          (catch Exception err
+            (handle-err state err current-state)))))))

 (defn- handle-ch-disconnected
-  [state]
-  (let [[_ _ {upstream :upstream}] @state]
-    (when upstream
-      (upstream :abort nil)
-      (swap!
-       state
-       (fn [[up-f _ args]]
-         [up-f aborted-req args])))))
+  [state current-state]
+  (when-let [upstream (.upstream current-state)]
+    (upstream :abort nil)
+    (swap!
+     state
+     (fn [current-state]
+       (assoc current-state :next-dn-fn aborted-req)))))

 (defn- netty-bridge
   [app opts]
   "Bridges the netty pipeline API to the picard API. This is done with
-   a simple state machine that is tracked with an atom. The atom is
-   always a 3-tuple: [ next-fn args responded? ].
-
-   next-fn:    The function to call when the next message is received. These
-               functions must return a function that transitions the current
-               state to the next state using swap!
-
-   args:       The first argument (usually a vector) that gets passed to
-               next-fn when it is invoked.
-
-   responded?: Whether or not the application has responded to the current
-               request"
-  (let [state     (atom [incoming-request nil
-                         {:app app :opts opts :keepalive? true}])
+   a simple state machine that is tracked with an atom."
+  (let [state     (atom (mk-initial-state app opts))
         writable? (atom true)]
     (netty/upstream-stage
      (fn [ch evt]
-       (cond-let
-        ;; An actual HTTP message has been received
-        [msg (netty/message-event evt)]
-        (let [[next-fn _ args] @state]
-          (next-fn state ch msg args))
-
-        ;; The channel interest has changed to writable
-        ;; or not writable
-        [[ch-state val] (netty/channel-state-event evt)]
-        (cond
-         (= ch-state ChannelState/INTEREST_OPS)
-         (handle-ch-interest-change state ch @state writable?)
-
-         (and (= ch-state ChannelState/CONNECTED)
-              (nil? val))
-         (handle-ch-disconnected state))
-
-        [err (netty/exception-event evt)]
-        (handle-err state ch err))))))
+       (let [current-state @state]
+         (cond-let
+          ;; An actual HTTP message has been received
+          [msg (netty/message-event evt)]
+          ((.next-up-fn current-state) state msg current-state)
+
+          ;; The channel interest has changed to writable
+          ;; or not writable
+          [[ch-state val] (netty/channel-state-event evt)]
+          (cond
+           (= ch-state ChannelState/INTEREST_OPS)
+           (handle-ch-interest-change state writable? current-state)
+
+           ;; Connecting the channel - stash it.
+           (and (= ch-state ChannelState/CONNECTED) val)
+           (swap! state (fn [current-state] (assoc current-state :ch ch)))
+
+           (= ch-state ChannelState/CONNECTED)
+           (handle-ch-disconnected state current-state))
+
+          [err (netty/exception-event evt)]
+          (handle-err state err current-state)))))))

 (defn- create-pipeline
   [app]


CMR-563: Removed default type.

CMR-563: Removed default type.

--- src/cmr/common/mime_types.clj
+++ src/cmr/common/mime_types.clj
@@ -25,10 +25,9 @@
 (defn mime-type->format
   "Converts a mime-type into the format requested."
   [mime-type]
-  (if mime-type
+  (when mime-type
     (get base-mime-type-to-format
-         (str (mt/base-type (mt/parse mime-type))))
-    default-result-format))
+         (str (mt/base-type (mt/parse mime-type))))))

 (defn validate-request-mime-type
   "Validates the requested mime type is supported."


[adam2] Remove this namespace. (#119)

[adam2] Remove this namespace. (#119)

Doesn't seem to be used anywhere. Maybe it was checked in by accident?

--- src/cortex/optimize/adam2.clj
+++ src/cortex/optimize/adam2.clj
@@ -1,196 +0,0 @@
-(ns cortex.optimize.adam2
-  (:require
-   [cortex.optimize :refer [PGradientOptimizer create-optimizer]]
-   [cortex.compute.math :as math]
-   [think.datatype.core :as dtype]
-   [cortex.compute.nn.backend :as backend]
-   [cortex.compute.driver :as drv]
-   [cortex.compute.cpu-driver :as cpu-drv]
-   [cortex.compute.cuda-driver :as cuda-drv]
-   [cortex.util :as util]
-   [think.datatype.core :refer [v-aget-rem v-aset-rem v-aget v-aset] :as dtype]
-   [think.datatype.marshal :as marshal]
-   [think.parallel.core :as parallel])
-  (:import
-   [think.datatype ArrayView IntArrayView]))
-
-(set! *warn-on-reflection* true)
-(set! *unchecked-math* :warn-on-boxed)
-
-(def POW-BETA1-T 1.0)
-(def POW-BETA2-T 1.0)
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Generalized functions not specific to adam
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defn- ensure-datatype
-  [datatype & args]
-  (when-not (every? #(= datatype (dtype/get-datatype %)) args)
-    (throw (ex-info "Buffer datatype mismatch"
-                    {:expected-datatype datatype
-                     :actual-datatypes (mapv #(dtype/get-datatype %) args)}))))
-
-
-(defn- dispatch-to-cpu
-  [stream dispatch-fn item-count & args]
-  (cpu-drv/with-stream-dispatch stream
-    (apply dispatch-fn args)))
-
-
-(defn- dispatch-to-gpu
-  [stream dispatch-fn item-count & args]
-  (apply cuda-drv/launch-linear-kernel
-         stream dispatch-fn item-count 0
-         args))
-
-
-(defn- ->buffer
-  ([backend array ^long offset]
-   (drv/sub-buffer (drv/get-driver backend)
-                   (math/device-buffer array)
-                   offset
-                   (- (dtype/ecount array) offset)))
-  ([backend buffer]
-   (->buffer backend buffer 0)))
-
-
-
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; Begin adam implementation
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defmacro cpu-adam-step-impl!
-  [scalar-type-fn view-type-fn
-   alpha beta1 beta2 epsilon pow-beta1-t pow-beta2-t
-   gradient-alpha gradient parameters m v]
-  ;;Type the scalars and buffers completely.
-  `(let [gradient-alpha# (~scalar-type-fn ~gradient-alpha)
-         alpha# (~scalar-type-fn ~alpha)
-         beta1# (~scalar-type-fn ~beta1)
-         beta2# (~scalar-type-fn ~beta2)
-         epsilon# (~scalar-type-fn ~epsilon)
-         pow-beta1-t# (~scalar-type-fn ~pow-beta1-t)
-         pow-beta2-t# (~scalar-type-fn ~pow-beta2-t)
-         m# (~view-type-fn ~m)
-         v# (~view-type-fn ~v)
-         gradient# (~view-type-fn ~gradient)
-         parameters# (~view-type-fn ~parameters)
-         n-elems# (long (dtype/ecount ~gradient))
-         one-val# (~scalar-type-fn 1.0)
-         one-minus-beta1# (- one-val# beta1#)
-         one-minus-beta2# (- one-val# beta2#)]
-     (parallel/parallel-for
-      idx# n-elems#
-      (let [gradient-val# (* gradient-alpha# (v-aget gradient# idx#))
-            param-val# (v-aget parameters# idx#)
-            local-m# (+ (* beta1# (v-aget m# idx#))
-                        (* one-minus-beta1# gradient-val#))
-            local-v# (+ (* beta2# (v-aget v# idx#))
-                        (* one-minus-beta2# gradient-val# gradient-val#))
-            dx# (* alpha# (/ local-m# (* (- one-val# pow-beta1-t#)
-                                         (+ (Math/sqrt (/ local-v#
-                                                          (- one-val# pow-beta2-t#)))
-                                            epsilon#))))]
-        (v-aset m# idx# local-m#)
-        (v-aset v# idx# local-v#)
-        (v-aset parameters# idx# (- param-val# dx#))))))
-
-
-;;Adds item count to make the signature match the gpu version.  Item count is not used.
-(defmacro create-cpu-adam-step-fn
-  [scalar-cast-fn buffer-cast-fn]
-  `{:fn
-    (fn [alpha# beta1# beta2# epsilon# pow-beta1-t# pow-beta2-t#
-         gradient-alpha# gradient# parameters# m# v# item-count#]
-      (cpu-adam-step-impl! ~scalar-cast-fn ~buffer-cast-fn
-                           alpha# beta1# beta2# epsilon# pow-beta1-t# pow-beta2-t#
-                           gradient-alpha# gradient# parameters# m# v#))})
-
-
-
-(defn- adam-optimise-step!
-  [backend fn-map dev-dispatch-fn
-   param-offset
-   alpha beta1 beta2 epsilon pow-beta1-t pow-beta2-t
-   gradient-alpha gradient parameters m v]
-  (let [datatype (dtype/get-datatype backend)
-        stream (drv/get-stream backend)
-        item-count (dtype/ecount gradient)
-        ->d #(cuda-drv/dtype-cast % datatype)]
-    (ensure-datatype datatype gradient parameters m v)
-    (dev-dispatch-fn stream (get-in fn-map [datatype :fn]) item-count
-                     (->d alpha) (->d beta1) (->d beta2) (->d epsilon)
-                     (->d pow-beta1-t) (->d pow-beta2-t)
-                     (->d gradient-alpha)
-                     (->buffer backend gradient)
-                     (->buffer backend parameters)
-                     (->buffer backend m param-offset)
-                     (->buffer backend v param-offset)
-                     item-count)))
-
-
-(defn- adam-step-fn
-  [backend fn-map dev-dispatch-fn]
-  (fn [offset
-       alpha beta1 beta2 epsilon pow-beta1-t pow-beta2-t
-       gradient-alpha gradient parameters m v]
-    (adam-optimise-step! backend fn-map dev-dispatch-fn offset
-                         alpha beta1 beta2 epsilon pow-beta1-t pow-beta2-t
-                         gradient-alpha gradient parameters m v)))
-
-
-(defrecord Adam [backend optimizer step-fn param-count m v pow-beta1-t pow-beta2-t]
-  PGradientOptimizer
-  (batch-update [this]
-    (let [{:keys [beta1 beta2]} optimizer]
-      (-> this
-          (update :pow-beta1-t #(* (double %) (double beta1)))
-          (update :pow-beta2-t #(* (double %) (double beta2))))))
-  (compute-parameters! [this gradient-alpha offset gradient parameters]
-    (let [{:keys [alpha beta1 beta2 epsilon]} optimizer]
-      (step-fn offset
-               alpha beta1 beta2 epsilon pow-beta1-t pow-beta2-t
-               gradient-alpha gradient parameters m v))))
-
-
-(defn- setup-optimizer
-  [backend optimizer step-fn param-count]
-  (let [m (math/new-array driver stream datatype [param-count])
-        v (math/new-array driver stream datatype [param-count])]
-    (->Adam backend optimizer step-fn param-count m v POW-BETA1-T POW-BETA2-T)))
-
-
-(defmethod create-optimizer [:cpu :adam :float]
-  [backend optimizer param-count]
-  (let [cpu-fn (create-cpu-adam-step-fn float marshal/as-float-array-view)]
-    (setup-optimizer backend optimizer
-                     (adam-step-fn backend cpu-fn dispatch-to-cpu)
-                     param-count)))
-
-
-(defmethod create-optimizer [:cpu :adam :double]
-  [backend optimizer param-count]
-  (let [cpu-fn (create-cpu-adam-step-fn double marshal/as-double-array-view)]
-    (setup-optimizer backend optimizer
-                     (adam-step-fn backend cpu-fn dispatch-to-cpu)
-                     param-count)))
-
-
-(defmethod create-optimizer [:cuda :adam]
-  [backend optimizer param-count]
-  ;; Load the compiled GPU kernel for floats and doubles
-  (let [cuda-fns (cuda-drv/load-float-double-function "adam.fatbin" "adam_step")]
-    (setup-optimizer backend optimizer
-                     (adam-step-fn backend cuda-fns dispatch-to-gpu)
-                     param-count)))
-
-(defn adam
-  [& args]
-  (util/merge-args
-   {:type :adam
-    :alpha 0.001
-    :beta1 0.9
-    :beta2 0.999
-    :epsilon 1e-8}
-   args))
-


Move Java 8 & 11 images to eclipse-temurin too

The openjdk:8 & 11 images are being deprecated too

--- src/docker_clojure/config.clj
+++ src/docker_clojure/config.clj
@@ -43,9 +43,7 @@

 (def base-images
   "Map of JDK version to base image name with :default as a fallback"
-  {8        "openjdk"
-   11       "openjdk"
-   :default "eclipse-temurin"})
+  {:default "eclipse-temurin"})

 ;; The default JDK version to use for tags that don't specify one; usually the latest LTS release
 (def default-jdk-version 17)
@@ -53,9 +51,7 @@
 (def distros
   "Map of base image name to set of distro tags to use, namespaced by Linux
   distro type. :default key is a fallback for base images not o/w specified."
-  {"openjdk" #{:debian/buster :debian-slim/slim-buster :debian/bullseye
-               :debian-slim/slim-bullseye :alpine/alpine}
-   :default  #{:alpine/alpine :ubuntu/focal}})
+  {:default  #{:alpine/alpine :ubuntu/focal :ubuntu/jammy}})

 (def default-architectures
   #{"amd64" "arm64v8"})
@@ -68,9 +64,7 @@
 (def default-distros
   "The default distro to use for tags that don't specify one, keyed by jdk-version.
   :default is a fallback for jdk versions not o/w specified."
-  {8        :debian-slim/slim-bullseye
-   11       :debian-slim/slim-bullseye
-   :default :ubuntu/focal})
+  {:default :ubuntu/jammy})

 (def build-tools
   {"lein"       "2.9.8"
@@ -91,10 +85,9 @@
                  "1.11.1.1149" "9aadc1a1840a458517a6efb111eba72be93c17bbdc874c833ef781e77aacc55e"}})

 (def exclusions ; don't build these for whatever reason(s)
-  #{{:jdk-version 8
-     :distro      :alpine/alpine}
-    {:jdk-version 11
-     :distro      :alpine/alpine}})
+  ;; commented out example
+  #{#_{:jdk-version 8
+       :distro      :alpine/alpine}})

 (def maintainers
   ["Paul Lam <paul@quantisan.com> (@Quantisan)"


Update the keys that are stored in local store

--- src/elfeed_cljsrn/events.cljs
+++ src/elfeed_cljsrn/events.cljs
@@ -51,7 +51,7 @@
 (def ->ls
   (after
    (fn [db]
-     (let [keys-to-store '(:entry/by-id :entries :nav :server :update-time)]
+     (let [keys-to-store '(:entry/by-id :feed/by-id :total-entries :entries :feeds :nav :server :update-time)]
        (ls/save (select-keys db keys-to-store))))))

 ;; -- Effect Handlers ----------------------------------------------------------


Add new synonyms.

Add new synonyms.

--- src/haystack/create_index.clj
+++ src/haystack/create_index.clj
@@ -10,6 +10,7 @@
              [clojurewerkz.elastisch.common.bulk   :as bulk]
              [clojure.set :as set]
              [clojure.pprint :as pp]
+             [clojure.string :as string]

              [haystack.ecommerce :as ecommerce]
              [haystack.query :as query]
@@ -23,6 +24,21 @@
   "[,; /<>?:'\"+=`~_|!@#$%^&*\\(\\)\\[\\]\\{\\}\\\\-]+"
   ;; "[,; /<>?:'\"+=`~_!@#$%^&*\\(\\)-]+"
   )
+
+(def synonym-list
+  ["romex nm"
+   "so seoow seow soow sow"
+   "pipe conduit"
+   "gfi gfci"
+   "bx mc"])
+
+(defn synonyms
+  []
+  (let [groups (map #(string/split % #" ") synonym-list)
+        syns (map (fn [[main & others]] (map #(string/join #"," [main %]) others)) groups)]
+    (flatten syns)))
+
+;; (synonyms)

 (def ecommerce-mapping-types
   (let [;; analyzers


update to boot2 api

update to boot2 api

--- src/adzerk/boot_reload.clj
+++ src/adzerk/boot_reload.clj
@@ -19,7 +19,7 @@
     (->> (fileset-diff before after :hash)
          output-files
          (sort-by :dependency-order)
-         (map tmppath))))
+         (map tmp-path))))

 (defn- start-server [pod {:keys [ip port] :as opts}]
   (let [{:keys [ip port]}
@@ -67,8 +67,8 @@
    j on-jsload SYM sym "The (optional) callback to call when JS files are reloaded."]

   (let [pod  (make-pod)
-        src  (temp-dir!)
-        tmp  (temp-dir!)
+        src  (tmp-dir!)
+        tmp  (tmp-dir!)
         prev (atom nil)
         out  (doto (io/file src "adzerk" "boot_reload.cljs") io/make-parents)]
     (set-env! :source-paths #(conj % (.getPath src)))
@@ -76,8 +76,8 @@
     (comp
       (with-pre-wrap fileset
         (doseq [f (->> fileset input-files (by-ext [".cljs.edn"]))]
-          (let [path     (tmppath f)
-                in-file  (tmpfile f)
+          (let [path     (tmp-path f)
+                in-file  (tmp-file f)
                 out-file (io/file tmp path)]
             (add-init! in-file out-file)))
         (-> fileset (add-resource tmp) commit!))


wrap size

wrap size

--- src/bardo/interpolate.cljx
+++ src/bardo/interpolate.cljx
@@ -63,6 +63,22 @@
              [([& _] :seq) [& _]] (coerce [x (seq y)])
              [_ _] [nil nil]))))

+(def hash-map? (every-pred coll? (complement sequential?)))
+
+(defn wrap-size
+  "removed keys not present in start or end of interpolation"
+  [start end]
+  (let []
+    (fn [intrpl]
+      (fn [t]
+        (let [v (intrpl t)]
+          (match [t v]
+                 [0 (_ :guard hash-map?)] (select-keys v (keys start))
+                 [1 (_ :guard hash-map?)] (select-keys v (keys end))
+                 [0 (_ :guard sequential?)] (take (count start) v)
+                 [1 (_ :guard sequential?)] (take (count end) v)
+                 [_ _] v))))))
+
 (defprotocol IInterpolate (-interpolate [start end]))

 (defn interpolate [start end]
@@ -72,7 +88,7 @@
     (let [can-interpolate (->> coerced
                                (mapv (partial satisfies? IInterpolate)))]
       (if (apply = true can-interpolate)
-        (apply -interpolate coerced)
+        ((apply wrap-size coerced) (apply -interpolate coerced))
         (do
           (throw
            (Exception. (str "Cannot interpolate between " start " and " end))))))))
@@ -112,19 +128,23 @@

 (comment
   (defn intrpl [start end]
-    ((interpolate start end) 0.5))
+    (let [i (interpolate start end)]
+      (mapv #(i %) [0 0.5 1])))

   (mapv #(satisfies? IInterpolate %) [1 ""])
   (satisfies? IInterpolate "")
   (intrpl 1 2)
   (intrpl [1 2] [5 6])
+  (intrpl [1 2] (repeat 5))
+
+  (intrpl [1 2] (into [] (range 5)))
+  ;; size not wrapped correctly.
+  ;; coerce is taking from them since they are lazy
+  ;; maybe this is correct behavior?
+  (intrpl (range 5) [1 2])
+
   ;; fails correctly
   (intrpl [1 5] [2 [1 2]])
-  ;; works
-  (intrpl [1 2] (range 5))
-  (intrpl (range 5) [1 2])
-  (intrpl [1 2] (repeat 5))
-
   (intrpl (repeat 5) (repeat 2))

   (intrpl {:a 0 :c 1} {:a 5 :b 2})


Add integration test for ranged open.

Add integration test for ranged open.

--- src/blocks/store/tests.clj
+++ src/blocks/store/tests.clj
@@ -123,6 +123,12 @@
       (test-section "querying non-existent block"
         (is (nil? (block/stat store (multihash/sha1 "foo"))))
         (is (nil? (block/get store (multihash/sha1 "bar")))))
+      (test-section "ranged open"
+        (let [block (block/store! store "012 345 678")]
+          (is (= "345" (with-open [subrange (block/open block 4 7)]
+                         (slurp subrange)))
+              "subrange should return correct bytes")
+          (is (true? (block/delete! store (:id block))))))
       (test-section "put attributes"
         (test-put-attributes store))
       (let [stored-content (test-section (str "populating " blocks " blocks")


Reload migrations with each access to the page.

--- src/cadence/views/user.clj
+++ src/cadence/views/user.clj
@@ -173,7 +173,7 @@
          [:th.applied "Applied?"]
          [:th.controls]]]
        [:tbody
-        (require 'cadence.migrations)
+        (require :reload 'cadence.migrations)
         (map migration-row (migration/list-migrations))]])))

 (defn post-migrations


Minor stylistic changes

Minor stylistic changes

--- src/catalog/layout/fop.clj
+++ src/catalog/layout/fop.clj
@@ -709,22 +709,22 @@
   [title issue _]
   (coverpage-verso-internal
    title issue
-   [:fo:block
+   (block
     (block {:space-after "1em"} "Für Kundinnen und Kunden der SBS")
     (block                      "Erscheint kostenlos sechsmal jährlich in Schwarzschrift")
     (block                      "und listet alle seit der letzten Ausgabe neu in die SBS")
-    (block                      "aufgenommenen Grossdruckbücher auf")]))
+    (block                      "aufgenommenen Grossdruckbücher auf"))))

 (defmethod coverpage-verso :default
   [title issue _]
   (coverpage-verso-internal
    title issue
-   [:fo:block
+   (block
     (block {:space-after "1em"} "Für Kundinnen und Kunden der SBS sowie für Interessenten")
     (block                      "Erscheint sechsmal jährlich und listet alle seit der letzten")
     (block {:space-after "1em"} "Ausgabe neu in die SBS aufgenommenen Bücher auf")
     (block                      "«Neu im Sortiment» kann im Jahresabonnement per Post")
-    (block {:space-after "1em"} "zu CHF / € 78.– oder per E-Mail gratis bezogen werden")]))
+    (block                      "zu CHF / € 78.– oder per E-Mail gratis bezogen werden"))))

 (defn- layout-master-set []
   [:fo:layout-master-set


Small fixes to the DTBook XML for OBI

Small fixes to the DTBook XML for OBI

--- src/catalog/layout/obi.clj
+++ src/catalog/layout/obi.clj
@@ -60,8 +60,7 @@
                             :recommendations recommendations))
         path-to-numbers (layout/path-to-number subitems)]
     [:dtbook {:xmlns "http://www.daisy.org/z3986/2005/dtbook/"
-              :xmlns:brl "http://www.daisy.org/z3986/2009/braille/"
-              :version "2005-3-sbs-minimal" :xml:lang language}
+              :version "2005-3" :xml:lang language}
      [:head
       (for [[k v]
             {:dc:Title title


Support s_tag_id setting for corpora

Support s_tag_id setting for corpora

--- src/clj/cglossa/search.clj
+++ src/clj/cglossa/search.clj
@@ -62,13 +62,14 @@
         corpus      (first (db/sql-query "select from #TARGET" {:target corpus-id}))
         named-query (cwb-query-name corpus search-id)
         s-tag       (:s_tag corpus "s")
+        s-tag-id    (:s_tag_id corpus (str s-tag "_id"))
         commands    [(str "set DataDirectory \"" (fs/tmpdir) \")
                      (cwb-corpus-name corpus queries)
                      (construct-query-commands corpus queries named-query search-id 100)
                      (str "set Context 1 " s-tag)
                      "set LD \"{{\""
                      "set RD \"}}\""
-                     (str "show +" s-tag "_id")
+                     (str "show +" s-tag-id)
                      "cat Last"]
         results     (run-cqp-commands (flatten commands))]
     (-> search


Add terrain-type where bases are -Determine terrain-type by most common neighboring terrain-type

--- src/cljs/zetawar/data.cljs
+++ src/cljs/zetawar/data.cljs
@@ -1196,6 +1196,7 @@
      {:q 14, :r 3, :terrain-type :plains}
      {:q 15, :r 3, :terrain-type :plains}
      {:q 16, :r 3, :terrain-type :ford}
+     {:q 17, :r 3, :terrain-type :shallow-water}
      {:q 18, :r 3, :terrain-type :shallow-water}
      {:q 19, :r 3, :terrain-type :deep-water}
      {:q 20, :r 3, :terrain-type :deep-water}
@@ -1214,7 +1215,9 @@
      {:q 10, :r 4, :terrain-type :shallow-water}
      {:q 11, :r 4, :terrain-type :woods}
      {:q 12, :r 4, :terrain-type :plains}
+     {:q 13, :r 4, :terrain-type :plains}
      {:q 14, :r 4, :terrain-type :plains}
+     {:q 15, :r 4, :terrain-type :plains}
      {:q 16, :r 4, :terrain-type :plains}
      {:q 17, :r 4, :terrain-type :ford}
      {:q 18, :r 4, :terrain-type :swamp}
@@ -1229,6 +1232,7 @@
      {:q 3, :r 5, :terrain-type :deep-water}
      {:q 4, :r 5, :terrain-type :shallow-water}
      {:q 5, :r 5, :terrain-type :plains}
+     {:q 6, :r 5, :terrain-type :plains}
      {:q 7, :r 5, :terrain-type :plains}
      {:q 8, :r 5, :terrain-type :woods}
      {:q 9, :r 5, :terrain-type :woods}
@@ -1250,6 +1254,7 @@
      {:q 2, :r 6, :terrain-type :deep-water}
      {:q 3, :r 6, :terrain-type :deep-water}
      {:q 4, :r 6, :terrain-type :shallow-water}
+     {:q 5, :r 6, :terrain-type :plains}
      {:q 6, :r 6, :terrain-type :plains}
      {:q 7, :r 6, :terrain-type :plains}
      {:q 8, :r 6, :terrain-type :woods}
@@ -1272,6 +1277,7 @@
      {:q 1, :r 7, :terrain-type :deep-water}
      {:q 2, :r 7, :terrain-type :deep-water}
      {:q 3, :r 7, :terrain-type :deep-water}
+     {:q 4, :r 7, :terrain-type :deep-water}
      {:q 5, :r 7, :terrain-type :plains}
      {:q 6, :r 7, :terrain-type :plains}
      {:q 7, :r 7, :terrain-type :woods}
@@ -1303,6 +1309,7 @@
      {:q 10, :r 8, :terrain-type :plains}
      {:q 11, :r 8, :terrain-type :plains}
      {:q 12, :r 8, :terrain-type :shallow-water}
+     {:q 13, :r 8, :terrain-type :shallow-water}
      {:q 14, :r 8, :terrain-type :swamp}
      {:q 15, :r 8, :terrain-type :shallow-water}
      {:q 16, :r 8, :terrain-type :woods}
@@ -1345,6 +1352,7 @@
      {:q 6, :r 10, :terrain-type :plains}
      {:q 7, :r 10, :terrain-type :plains}
      {:q 8, :r 10, :terrain-type :plains}
+     {:q 9, :r 10, :terrain-type :woods}
      {:q 10, :r 10, :terrain-type :woods}
      {:q 11, :r 10, :terrain-type :plains}
      {:q 12, :r 10, :terrain-type :plains}
@@ -1396,6 +1404,7 @@
      {:q 11, :r 12, :terrain-type :plains}
      {:q 12, :r 12, :terrain-type :plains}
      {:q 13, :r 12, :terrain-type :woods}
+     {:q 14, :r 12, :terrain-type :plains}
      {:q 15, :r 12, :terrain-type :plains}
      {:q 16, :r 12, :terrain-type :plains}
      {:q 17, :r 12, :terrain-type :plains}
@@ -1438,6 +1447,7 @@
      {:q 7, :r 14, :terrain-type :woods}
      {:q 8, :r 14, :terrain-type :shallow-water}
      {:q 9, :r 14, :terrain-type :swamp}
+     {:q 10, :r 14, :terrain-type :shallow-water}
      {:q 11, :r 14, :terrain-type :shallow-water}
      {:q 12, :r 14, :terrain-type :plains}
      {:q 13, :r 14, :terrain-type :plains}
@@ -1469,6 +1479,7 @@
      {:q 15, :r 15, :terrain-type :woods}
      {:q 16, :r 15, :terrain-type :plains}
      {:q 17, :r 15, :terrain-type :plains}
+     {:q 18, :r 15, :terrain-type :plains}
      {:q 19, :r 15, :terrain-type :deep-water}
      {:q 20, :r 15, :terrain-type :deep-water}
      {:q 21, :r 15, :terrain-type :deep-water}
@@ -1491,6 +1502,7 @@
      {:q 15, :r 16, :terrain-type :woods}
      {:q 16, :r 16, :terrain-type :plains}
      {:q 17, :r 16, :terrain-type :plains}
+     {:q 18, :r 16, :terrain-type :plains}
      {:q 19, :r 16, :terrain-type :shallow-water}
      {:q 20, :r 16, :terrain-type :deep-water}
      {:q 21, :r 16, :terrain-type :deep-water}
@@ -1512,6 +1524,7 @@
      {:q 13, :r 17, :terrain-type :woods}
      {:q 14, :r 17, :terrain-type :woods}
      {:q 15, :r 17, :terrain-type :plains}
+     {:q 16, :r 17, :terrain-type :plains}
      {:q 17, :r 17, :terrain-type :plains}
      {:q 18, :r 17, :terrain-type :shallow-water}
      {:q 19, :r 17, :terrain-type :deep-water}
@@ -1526,7 +1539,9 @@
      {:q 5, :r 18, :terrain-type :swamp}
      {:q 6, :r 18, :terrain-type :ford}
      {:q 7, :r 18, :terrain-type :plains}
+     {:q 8, :r 18, :terrain-type :plains}
      {:q 9, :r 18, :terrain-type :plains}
+     {:q 10, :r 18, :terrain-type :plains}
      {:q 11, :r 18, :terrain-type :plains}
      {:q 12, :r 18, :terrain-type :woods}
      {:q 13, :r 18, :terrain-type :shallow-water}
@@ -1545,6 +1560,7 @@
      {:q 2, :r 19, :terrain-type :deep-water}
      {:q 3, :r 19, :terrain-type :deep-water}
      {:q 4, :r 19, :terrain-type :shallow-water}
+     {:q 5, :r 19, :terrain-type :shallow-water}
      {:q 6, :r 19, :terrain-type :ford}
      {:q 7, :r 19, :terrain-type :plains}
      {:q 8, :r 19, :terrain-type :plains}


Fixed error in computing the annotation of a layout

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

--- src/conexp/layout/base.clj
+++ src/conexp/layout/base.clj
@@ -169,10 +169,11 @@
     (let [uppers (upper-neighbours layout),
 	  lowers (lower-neighbours layout)]
       (into {} (for [node (nodes layout)]
-                 [(set-to-label
-                   (apply difference (second node) (map second (uppers node))))
-                  (set-to-label
-                   (apply difference (first node) (map first (lowers node))))])))))
+                 [node
+                  [(set-to-label
+                    (apply difference (second node) (map second (uppers node))))
+                   (set-to-label
+                    (apply difference (first node) (map first (lowers node))))]])))))

 ;;;


use natal-shell 0.1.4

use natal-shell 0.1.4

--- resources/project.clj
+++ resources/project.clj
@@ -7,7 +7,7 @@
                  [org.clojure/clojurescript "1.7.189"]
                  [$REACT_INTERFACE$]
                  [org.omcljs/ambly "0.6.0"]
-                 [natal-shell "0.1.2"]]
+                 [natal-shell "0.1.4"]]
  :plugins [[lein-cljsbuild "1.1.2"]]
  :cljsbuild {:builds {:dev {:source-paths ["src"]
                             :compiler {:output-to "target/out/main.js"