make "attend" transitive

make "attend" transitive

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -110,7 +110,12 @@
                           :pred :at}}})

    "attend" {:synsem {:cat :verb
-                      :sem {:pred :attend}}}
+                      :subcat {:1 {:cat :noun
+                                   :sem {:human true}}
+                               :2 {:cat :noun
+                                   :pronoun false
+                                   :sem {:event true
+                                         :human false}}}}}

    "avoid" {:synsem {:cat :verb
                      :sem {:pred :avoid}}}


making get-packages private

making get-packages private

--- src/leiningen/docstring_checker.clj
+++ src/leiningen/docstring_checker.clj
@@ -9,7 +9,7 @@
             version))
         plugins))

-(defn get-packages [paths]
+(defn- get-packages [paths]
   (map #(re-pattern (str "^" (name %)))
        (b/namespaces-on-classpath :classpath
                                   (map io/file paths))))


+short

+short

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1590,6 +1590,14 @@
                                     :agr subject-agr
                                     :sem subject-sem}
                                 :2 '()}}}))]
+   "short"
+   [;; non-comparative:
+    (unify adjective
+           {:synsem {:cat :adjective
+                     :sem {:mod {:pred :short}
+                           :comparative false}
+                     :subcat {:1 {:cat :det}
+                              :2 '()}}})]

    "teach"  {:synsem {:cat :verb
                       :sem {:pred :teach}}


Commit Commit

Commit Commit

--- project.clj
+++ project.clj
@@ -5,3 +5,5 @@

   :dependencies [[org.clojure/clojure "1.3.0"]
                  [org.clojure/core.match "0.2.0-alpha8"]])
+
+; Comment Comment


{animate true} rather than more strict {human true} for 'get off' and 'get on'

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -590,7 +590,7 @@
                 :present {:3sing "gets dressed"}
                 :past "got dressed"}})
    "get off"
-   (let [subject-semantics (atom {:human true})]
+   (let [subject-semantics (atom {:animate true})]
      {:synsem {:cat :verb
                :sem {:pred :get-off
                      :subj subject-semantics}
@@ -600,7 +600,7 @@
                 :present {:3sing "gets off"}
                 :past "got off"}})
    "get on"
-   (let [subject-semantics (atom {:human true})]
+   (let [subject-semantics (atom {:animate true})]
      {:synsem {:cat :verb
                :sem {:pred :get-on
                      :subj subject-semantics}
@@ -1859,8 +1859,8 @@
                  ;; subject-and-reflexive-pronoun agreement
                  (if-then {:synsem {:sem {:reflexive true}
                                     :cat :verb
-                                    :subcat {:1 :top
-                                             :2 :top}}}
+                                    :subcat {:1 {:agr :top}
+                                             :2 {:agr :top}}}}

                           (let [subject-agr (atom :top)]
                             {:synsem {:subcat {:1 {:agr subject-agr}


Updated versions of Clojure / ClojureScript.

--- project.clj
+++ project.clj
@@ -1,8 +1,8 @@
 (defproject test-utils-cljs "0.1.0-SNAPSHOT"
   :description "FIXME: write this!"
   :url "http://example.com/FIXME"
-  :dependencies [[org.clojure/clojure "1.7.0"]
-                 [org.clojure/clojurescript "1.7.122" :classifier "aot"
+  :dependencies [[org.clojure/clojure "1.8.0"]
+                 [org.clojure/clojurescript "1.8.51" :classifier "aot"
                   :exclusion [org.clojure/data.json]]
                  [org.clojure/data.json "0.2.6" :classifier "aot"]]
   :jvm-opts ^:replace ["-Xmx1g" "-server"]


add reflexive-specific rules

add reflexive-specific rules

--- src/babel/italiano/grammar.clj
+++ src/babel/italiano/grammar.clj
@@ -202,6 +202,15 @@
                                            :tense :past}}})
                    (unifyc c10
                            root-is-head-root
+                           {:rule "s-future-reflexive"
+                            :head {:sem {:reflexive true}
+                                   :phrasal true}
+                            :synsem {:aux false
+                                     :infl :futuro
+                                     :cat :verb
+                                     :sem {:tense :futuro}}})
+                   (unifyc c10
+                           root-is-head-root
                            {:rule "s-future-phrasal"
                             :head {:phrasal true}
                             :synsem {:aux false
@@ -216,7 +225,15 @@
                                      :infl :futuro
                                      :cat :verb
                                      :sem {:tense :futuro}}})
-
+                   (unifyc c10
+                           root-is-head-root
+                           {:rule "s-conditional-reflexive"
+                            :head {:sem {:reflexive true}
+                                   :phrasal true}
+                            :synsem {:aux false
+                                     :infl :conditional
+                                     :cat :verb
+                                     :sem {:tense :conditional}}})
                    (unifyc c10
                            root-is-head-root
                            {:rule "s-conditional-phrasal"
@@ -251,6 +268,16 @@
                                      :cat :verb
                                      :sem {:aspect :progressive
                                            :tense :past}}})
+                   (unifyc c10
+                           root-is-head-root
+                           {:rule "s-present-reflexive"
+                            :head {:sem {:reflexive true}
+                                   :phrasal true}
+                            :synsem {:aux false
+                                     :infl :present
+                                     :cat :verb
+                                     :sem {:aspect :progressive
+                                           :tense :present}}})
                    (unifyc c10
                            root-is-head
                            {:rule "s-present-nonphrasal"
@@ -295,9 +322,11 @@
                               :synsem {:aux true
                                        :cat :verb
                                        :infl :present
-                                       :sem {:tense :past}
+                                       :sem {:reflexive true
+                                             :tense :past}
                                        :subcat {:2 {:agr obj-agr}}}
                               :italiano {:b {:obj-agr obj-agr}}}))
+
                    (unifyc h21
                            root-is-head
                            {:rule "vp-future"
@@ -333,7 +362,8 @@
                                      :infl {:not :past}}})
                    (unifyc c21
                            root-is-head
-                           {:head {:phrasal false}
+                           {:head {:phrasal false
+                                   :synsem {:sem {:reflexive true}}}
                             :comp {:synsem {:cat :noun
                                             :pronoun true}}
                             :rule "vp-pronoun-nonphrasal"


need to fix this in order to relase to clojars... wondering why.

--- project.clj
+++ project.clj
@@ -16,6 +16,8 @@

                                         ;[com.esotericsoftware.kryo/kryo "2.24.0" :scope "provided"]
                  ]
+
+                 :deploy-repositories {"clojars-https" {:url "https://clojars.org/repo"}}

   :aliases {"all" ["with-profile" "default"]}


Version 0.7.1

Version 0.7.1

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject lambdacd "0.7.1-SNAPSHOT"
+(defproject lambdacd "0.7.1"
   :description "a library to create a continous delivery pipeline in code"
   :url "http://github.com/flosell/lambdacd"
   :license {:name "Apache License, version 2.0"


Version 0.3.1-SNAPSHOT

Version 0.3.1-SNAPSHOT

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject lein-droid/lein-droid "0.3.0"
+(defproject lein-droid/lein-droid "0.3.1-SNAPSHOT"
   :description "Plugin for easy Clojure/Android development and deployment"
   :url "https://github.com/clojure-android/lein-droid"
   :license {:name "Eclipse Public License"


Bump to 0.4.0-SNAPSHOT for forward development.

[ci skip]

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject me.frmr.tools/dstt "0.3.0"
+(defproject me.frmr.tools/dstt "0.4.0-SNAPSHOT"
   :description "Damn Simple Test Tool, a simple and rudamentary load testing library."
   :url "https://github.com/farmdawgnation/dstt"
   :license {:name "Apache License 2.0"


Tweaked a bit

Tweaked a bit

--- project.clj
+++ project.clj
@@ -4,7 +4,7 @@
   :license {:name "Eclipse Public License"
             :url  "http://www.eclipse.org/legal/epl-v10.html"}

-  :dependencies [[org.clojure/clojure "1.8.0"]
+  :dependencies [[org.clojure/clojure "1.8.0"]
                  [org.clojure/clojurescript "1.7.228"]
                  [cljsjs/material "1.1.1-0"]
                  [com.taoensso/timbre "4.2.1"]
@@ -33,7 +33,7 @@
                    {"resources/public/css/site.min.css" "resources/public/css/site.css"}}

   :cljsbuild {:builds
-              {:app {:source-paths ["src/cljs" "env/prod/cljs"]
+              {:app {:source-paths ["src/cljs"]
                      :compiler     {:output-to     "target/cljsbuild/public/js/app.js"
                                     :output-dir    "target/cljsbuild/public/js/out"
                                     :asset-path    "js/out"
@@ -66,15 +66,27 @@
                                     :compiler     {:output-to     "target/test.js"
                                                    :main          cljs-webrepl.doo-runner
                                                    :optimizations :whitespace
-                                                   :pretty-print  true}}}}
+                                                   :pretty-print  true}}}}}

-              :uberjar   {:hooks       [minify-assets.plugin/hooks]
-                          :prep-tasks  ["cljsbuild" "once"]
-                          :env         {:production true}
-                          :omit-source true
-                          :cljsbuild
-                          {:jar    true
-                           :builds {:app
-                                    {:compiler
-                                     {:optimizations :whitespace
-                                      :pretty-print  false}}}}}}})
+             :prod    {:hooks       [minify-assets.plugin/hooks]
+                       :prep-tasks  ["cljsbuild" "once"]
+                       :env         {:production true}
+                       :omit-source true
+                       :cljsbuild
+                       {:builds {:app
+                                 {:source-paths ["src/cljs" "env/prod/cljs"]
+                                  :compiler
+                                  {:optimizations :whitespace
+                                   :pretty-print  false}}}}}
+
+             :uberjar {:hooks       [minify-assets.plugin/hooks]
+                       :prep-tasks  ["cljsbuild" "once"]
+                       :env         {:production true}
+                       :omit-source true
+                       :cljsbuild
+                       {:jar    true
+                        :builds {:app
+                                 {:source-paths ["src/cljs" "env/prod/cljs"]
+                                  :compiler
+                                  {:optimizations :whitespace
+                                   :pretty-print  false}}}}}})


bump datomic version

bump datomic version

--- project.clj
+++ project.clj
@@ -1,11 +1,11 @@
 (defproject learndatalogtoday "0.1.0-SNAPSHOT"
   :description "Interactive Datalog Tutorial"
   :url "http://learndatalogtoday.org"
-  :dependencies [[org.clojure/clojure "1.7.0"]
+  :dependencies [[org.clojure/clojure "1.8.0"]
                  [org.clojure/clojurescript "1.8.51"]
                  [compojure "1.1.5"]
                  [ring/ring-jetty-adapter "1.2.0"]
-                 [com.datomic/datomic-free "0.8.4122"]
+                 [com.datomic/datomic-free "0.9.5394"]
                  [datomic-query-helpers "0.1.1"]
                  [hiccup "1.0.4"]
                  [markdown-clj "0.9.29"]


Remove `-Djava.net.preferIPv4Stack=true`

The build passes without it, and it was preventing a repl from being successfully launched in my environment.

--- project.clj
+++ project.clj
@@ -77,6 +77,6 @@
              :clj-kondo [:test
                          {:dependencies [[clj-kondo "2021.06.18"]]}]}

-  :jvm-opts ~(cond-> ["-Djava.net.preferIPv4Stack=true"]
+  :jvm-opts ~(cond-> []
                (System/getenv "CI")
                (conj "-Drefactor-nrepl.internal.log-exceptions=true")))


lein-release plugin: bumped version from 0.1.0 to 0.1.1-SNAPSHOT for next development cycle

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject org.clojars.mhuebert/re-view-routing "0.1.0"
+(defproject org.clojars.mhuebert/re-view-routing "0.1.1-SNAPSHOT"

   :description "ClojureScript routing tools"

@@ -18,6 +18,8 @@
                                    [cljsjs/react-dom "15.5.0-0"]
                                    [cljsjs/react "15.5.0-0"]]}}

+  :lein-release {:deploy-via :clojars}
+
   :cljsbuild {:builds [{:id           "test"
                         :source-paths ["src" "test"]
                         :compiler     {:output-to     "resources/public/js/test.js"


Added a doc-string to document one of the atoms.

--- src/main/clojure/plugboard/core.clj
+++ src/main/clojure/plugboard/core.clj
@@ -1,5 +1,8 @@
 (ns plugboard.core)

-(def path (atom :path))
-
-
+(def
+ ^{:doc "The relative path of the web resource. Web resources are identified
+ by URIs. Web applications are usually responsible for a number of web
+ resources, so the path given by the client must often be decoded from the
+ URI."}
+ path (atom :path))


respect rmq-settings

respect rmq-settings

--- src/brainbot/nozzle/manage.clj
+++ src/brainbot/nozzle/manage.clj
@@ -56,8 +56,8 @@

 (defn start-synchronization
-  [id filesystem]
-  (let [conn (rmq/connect)
+  [rmq-settings id filesystem]
+  (let [conn (rmq/connect rmq-settings)
         ch (lch/open conn)]
     (mqhelper/initialize-rabbitmq-structures
      ch "listdir" id filesystem)
@@ -69,7 +69,7 @@

 (defn manage-filesystem*
-  [id {:keys [fsid sleep-between-sync]}]
+  [rmq-settings id {:keys [fsid sleep-between-sync]}]
   (let [qname (rk/routing-key-string-from-map {:id id :filesystem fsid :command "*"})
         get-num-messages (fn []
                            (num-messages-from-queue-state
@@ -82,24 +82,24 @@
     (wait-idle)
     (while true
       (logging/info "starting synchronization of" qname)
-      (start-synchronization id fsid)
+      (start-synchronization rmq-settings id fsid)
       (Thread/sleep 10000)
       (wait-idle)
       (logging/info "synchronization of" qname "finished. restarting in" sleep-between-sync "seconds")
       (Thread/sleep (* sleep-between-sync 1000)))))

 (defn manage-filesystem
-  [id fsextra]
+  [rmq-settings id fsextra]
   (try-try-again {:sleep (* 60 1000)
                   :tries :unlimited
                   :error-hook (fn [e] (logging/error "error in manage-filesystem" (:fsid fsextra) e))}
-                 #(manage-filesystem* id fsextra)))
+                 #(manage-filesystem* rmq-settings id fsextra)))

 (defrecord ManageService [rmq-settings rmq-prefix filesystems]
   worker/Service
   (start [this]
     (doseq [fs filesystems]
-      (future (manage-filesystem rmq-prefix fs)))))
+      (future (manage-filesystem rmq-settings rmq-prefix fs)))))

 (defn http-connect!
   [{:keys [api-endpoint username password]}]


simpler approach, also gives random velocities. Not _pure_ from a physics perspective

--- src-cljs/hello.cljs
+++ src-cljs/hello.cljs
@@ -17,10 +17,8 @@
     :rockets []))

 (defn random-angle-vector []
-  (let [angle (+ 67.5 (rand-int 45))
-        radians (/ (* 180 angle) Math/PI)]
-    {:x (Math/cos radians)
-     :y (Math/sin radians)}))
+  {:x (- .5 (rand))
+   :y (+ .5 (rand))})

 (defn spawn-random-rocket [game-world]
   (let [rockets (aget game-world :rockets)


Better coercion for graph parameter on add-statement

--- src/rdf-repository/grafter/rdf/repository.clj
+++ src/rdf-repository/grafter/rdf/repository.clj
@@ -46,7 +46,7 @@
     ([this statement]
        {:pre [(instance? IStatement statement)]}
        (let [^Statement sesame-statement (IStatement->sesame-statement statement)
-             resources (if-let [graph (pr/context statement)] (resource-array (URIImpl. graph)) (resource-array))]
+             resources (if-let [graph (pr/context statement)] (resource-array (->sesame-uri graph)) (resource-array))]
          (doto this (.add sesame-statement resources))))

     ([this graph statement]


Add a work around for Clojure compiler bug to do with macros & class imports.

http://dev.clojure.org/jira/browse/CLJ-1232

--- src/rdf-repository/grafter/rdf/repository.clj
+++ src/rdf-repository/grafter/rdf/repository.clj
@@ -313,7 +313,17 @@

 (defn ->connection
   "Given a sesame repository return a connection to it."
-  ^RepositoryConnection
+  ;; NOTE: that the return type hint here is intentionally fully qualified
+  ;; as a workaround for the clojure compiler bug:
+  ;;
+  ;; http://dev.clojure.org/jira/browse/CLJ-1232
+  ;;
+  ;; Basically ->connection is designed to be used with the macro with-open and
+  ;; which will cause a compile error unless the user also imports the class
+  ;; RepositoryConnection into their namespace.
+  ;;
+  ;; This is scheduled to be fixed in Clojure 1.8.
+  ^org.openrdf.repository.RepositoryConnection
   [^Repository repo]
   (if (instance? RepositoryConnection repo)
     repo


Send seen with pubkey

Send seen with pubkey

Signed-off-by: yenda <96f164ad4d9b2b0dacf8ebee2bb1eeb3aa69adf1@status.im>

--- src/status_im/transport/message/protocol.cljs
+++ src/status_im/transport/message/protocol.cljs
@@ -130,8 +130,8 @@
                            chat-id
                            nil
                            this)
-      (send-with-sym-key cofx {:chat-id chat-id
-                               :payload this})))
+      (send-with-pubkey cofx {:chat-id chat-id
+                              :payload this})))
   (receive [this chat-id signature _ cofx]
     (chat/receive-seen cofx chat-id signature this))
   (validate [this]


Only interpret extension universal links if flag is enabled

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

--- src/status_im/utils/universal_links/core.cljs
+++ src/status_im/utils/universal_links/core.cljs
@@ -78,7 +78,7 @@
     (match-url url browse-regex)
     (handle-browse url cofx)

-    (match-url url extension-regex)
+    (and config/extensions-enabled? (match-url url extension-regex))
     (handle-extension url cofx)

     :else (handle-not-found url)))


Commenting out core.cljs for now

Commenting out core.cljs for now

--- src/cljs/dato/client/core.cljs
+++ src/cljs/dato/client/core.cljs
@@ -2,7 +2,7 @@
     (:require [cljs.core.async :as async :refer [put! chan <!]]
               [datascript :as d]
               [devtools.core :as devtools]
-              [figwheel.client :as figwheel :include-macros true]
+              ;;[figwheel.client :as figwheel :include-macros true]
               [dato.client.components.root :as com-root]
               [dato.client.utils :as utils :refer [sel1]]
               [dato.lib.core :as dato]
@@ -10,62 +10,64 @@
               [om.core :as om :include-macros true]
               [om-i.core :as om-i]
               [om-i.hacks :as om-i-hacks]
-              [weasel.repl :as weasel])
+              ;;[weasel.repl :as weasel]
+              )
     (:require-macros [cljs.core.async.macros :as async :refer [go]]))

-(enable-console-print!)
+;; (enable-console-print!)

-(defonce setup-misc
-  (do
-    (om-i-hacks/insert-styles)
-    (om-i/setup-component-stats!)
-    ;; Enable https://github.com/binaryage/cljs-devtools
-    (devtools/install!)))
+;; (defonce setup-misc
+;;   (do
+;;     (om-i-hacks/insert-styles)
+;;     (om-i/setup-component-stats!)
+;;     ;; Enable https://github.com/binaryage/cljs-devtools
+;;     (devtools/install!)))

-;; Put this here so it's easy to query in the repl
-(defonce db
-  (d/create-conn))
+;; ;; Put this here so it's easy to query in the repl
+;; (defonce db
+;;   (d/create-conn))

-(defn -main [root-node state]
-  (let [container (sel1 root-node "div.app-instance")
-        dato      (:dato @state)
-        dato-ch   (get-in dato [:comms :dato])
-        conn      (get-in dato [:db])]
-    (om/root com-root/root-com state
-             {:target     container
-              :shared     {:dato dato}
-              :instrument (fn [f cursor m]
-                            (om/build* f cursor
-                                       (if (:descriptor m)
-                                         m
-                                         (assoc m :descriptor om-i/instrumentation-methods))))})
-    (when-not (dato/bootstrapped? @conn)
-      ;; Grab the DataScript Schema (and enums), and the session ID to
-      ;; start.
-      (dato/bootstrap! dato)
-      (go
-        ;; Wait until we have the schema and session-id
-        (let [[bootstrap-success? session-id] (<! dato-ch)]
-          ;; Retrieve all remote entities that have a :task/title
-          ;; attr. The result of this will be handled in the root
-          ;; component multimethod with a name of :server/find-tasks-succeeded
-          (dato/r-qes-by dato {:name :find-tasks
-                               :a    :task/title})
-          (dato/start-loop! dato))))))
+;; (defn -main [root-node state]
+;;   (let [container (sel1 root-node "div.app-instance")
+;;         dato      (:dato @state)
+;;         dato-ch   (get-in dato [:comms :dato])
+;;         conn      (get-in dato [:db])]
+;;     (om/root com-root/root-com state
+;;              {:target     container
+;;               :shared     {:dato dato}
+;;               :instrument (fn [f cursor m]
+;;                             (om/build* f cursor
+;;                                        (if (:descriptor m)
+;;                                          m
+;;                                          (assoc m :descriptor om-i/instrumentation-methods))))})
+;;     (when-not (dato/bootstrapped? @conn)
+;;       ;; Grab the DataScript Schema (and enums), and the session ID to
+;;       ;; start.
+;;       (dato/bootstrap! dato)
+;;       (go
+;;         ;; Wait until we have the schema and session-id
+;;         (let [[bootstrap-success? session-id] (<! dato-ch)]
+;;           ;; Retrieve all remote entities that have a :task/title
+;;           ;; attr. The result of this will be handled in the root
+;;           ;; component multimethod with a name of :server/find-tasks-succeeded
+;;           (dato/r-qes-by dato {:name :find-tasks
+;;                                :a    :task/title})
+;;           (dato/start-loop! dato))))))

-(defonce app-state
-  (let [ws-host (str js/window.location.hostname ":" "8080")
-        ws-path "/ws/index.html"
-        app-dato (dato/new-dato ws-host ws-path db db/cs-schema)]
-    (atom {:dato app-dato})))
+;; (defonce app-state
+;;   (let [ws-host (str js/window.location.hostname ":" "8080")
+;;         ws-path "/ws/index.html"
+;;         app-dato (dato/new-dato ws-host ws-path db db/cs-schema)]
+;;     (atom {:dato app-dato})))

-(-main (js/document.getElementById "dato-app") app-state)
+;; (-main (js/document.getElementById "dato-app") app-state)

-(defonce connected?
-  (do
-    (figwheel/watch-and-reload
-     :websocket-url "ws://localhost:3449/figwheel-ws"
-     :jsload-callback (fn []
-                        (js/console.log "Reloading from figwheel..")))
-    (weasel/connect "ws://localhost:9001" :verbose true :print #{:repl :console})
-    true))
+;; (defonce connected?
+;;   true
+;;   #_(do
+;;     (figwheel/watch-and-reload
+;;      :websocket-url "ws://localhost:3449/figwheel-ws"
+;;      :jsload-callback (fn []
+;;                         (js/console.log "Reloading from figwheel..")))
+;;     (weasel/connect "ws://localhost:9001" :verbose true :print #{:repl :console})
+;;     true))


Fix for rebinding style properties.

Fix for rebinding style properties.

--- src/clojure/freactive/dom.cljs
+++ src/clojure/freactive/dom.cljs
@@ -246,11 +246,14 @@
   (.removeAttribute elem attr-name))

 (defn- set-style-prop! [elem prop-name prop-value]
-  (aset (.-style elem)
-        prop-name
-        (if (.-substring prop-value)
-          prop-value
-          (.toString prop-value))))
+  ;(println "set-style-prop!" elem prop-name prop-value)
+  (if prop-value
+    (aset (.-style elem)
+          prop-name
+          (if (.-substring prop-value)
+            prop-value
+            (.toString prop-value)))
+    (js-delete (.-style elem) prop-name)))

 (defn- remove-style-prop! [elem prop-name]
   (js-delete (.-style elem) prop-name))
@@ -278,7 +281,8 @@
   (set-fn @ref))

 (defn- bind-style-prop! [element attr-name attr-value node-state]
-  (let [setter (fn [v]
+  (let [attr-name (name attr-name)
+        setter (fn [v]
                  (set-style-prop! element attr-name v))]
     (if (satisfies? cljs.core/IDeref attr-value)
       (bind-attr* setter element "style" attr-name attr-value node-state)
@@ -331,7 +335,7 @@

 (defn- bind-style! [element styles node-state]
   (doseq [[p v] styles]
-    (bind-style-prop! element (name p) v node-state)))
+    (bind-style-prop! element p v node-state)))

 (defn- get-attr-setter [element attr-name]
   (cond
@@ -406,7 +410,7 @@

 (defn- rebind-style! [element styles node-state]
   (doseq [[p v] styles]
-    (rebind-style-prop! element (name p) v node-state)))
+    (rebind-style-prop! element p v node-state)))

 (defn- rebind-event! [element event-name handler node-state]
   (unbind-attr!* node-state "event" event-name)
@@ -439,12 +443,14 @@
 (defn- replace-attrs!* [node node-state old-attrs new-attrs rebinder]
   (let [hit #js {}]
     (doseq [[attr-name new-val] new-attrs]
+      ;(println "rebinding" attr-name new-val)
       (rebinder node attr-name new-val node-state)
       (when (get old-attrs attr-name)
           (aset hit (str attr-name) true)))
     (doseq [[attr-name _] old-attrs]
       (let [attr-str (str attr-name)]
         (when-not (aget hit attr-str)
+          ;(println "unbinding" attr-name)
           (rebinder node attr-name nil node-state))))))

 ;(defn- replace-attrs!* [node node-state old-attrs new-attrs rebinder]
@@ -566,7 +572,7 @@
     new-elem))

 (declare replace-child)
-
+(declare append-child!)
 (declare append-children!)

 (defn- try-diff-subseq [parent cur-child new-children]


Refactored text renderer

Refactored text renderer

--- src/clouseau/text_renderer.clj
+++ src/clouseau/text_renderer.clj
@@ -38,15 +38,17 @@

 (ns clouseau.text-renderer)

+(defn render-package-descriptions
+    [package-descriptions]
+    (for [p package-descriptions]
+        (str "[" (key p) "]\n"
+                 (val p) "\n\n")))
+
 (defn render-front-page
     [products package package-descriptions ccs-description products-per-descriptions products-without-descriptions new-description user-name]
     (str
         "[Package]\n" package
         "\n\n[CCS Description]\n" ccs-description
         "\n\n"
-        (apply str
-            (for [p package-descriptions]
-                (str "[" (key p) "]\n"
-                         (val p) "\n\n")
-            ))))
+        (apply str (render-package-descriptions package-descriptions))))


CMR-676: Added function to check echo-rest availability.

--- src/cmr/transmit/echo/rest.clj
+++ src/cmr/transmit/echo/rest.clj
@@ -74,4 +74,12 @@
   [status body]
   (errors/internal-error!
     (format "Unexpected status %d from response. body: %s"
-            status (pr-str body))))+            status (pr-str body))))
+
+(defn health
+  "Returns the availability status of echo-rest by calling its availability endpoint"
+  [context]
+  (let [conn (config/context->app-connection context :echo-rest)
+        url (format "%s%s" (conn/root-url conn) "/availability")
+        response (client/get url {:throw-exceptions false})]
+    (if (= 200 (:status response)) "ok" "down")))


Undo some value parsing

Undo some value parsing

--- src/eulalie/sqs.clj
+++ src/eulalie/sqs.clj
@@ -124,20 +124,6 @@
     (for [attr (x/children message :message-attribute)]
       (message-attr->kv attr))))

-(def parse-long #(when % (Long/parseLong %)))
-
-(def meta-attr->parser
-  {:approximate-first-receive-timestamp parse-long
-   :sent-timestamp parse-long
-   :approximate-receive-count parse-long})
-
-(defn meta-attributes->map [message]
-  (into {}
-    (for [[k v] (attributes->map message)]
-      [k (if-let [parser (meta-attr->parser k)]
-           (parser v)
-           v)])))
-
 (defn restructure-message [message]
   (-> message
       (conj (x/child-content->map
@@ -145,7 +131,7 @@
              {:body :body :md-5-of-body :body-md5 :message-id :id
               :receipt-handle :receipt-handle}))
       (assoc :attrs (message-attrs->map message)
-             :meta  (meta-attributes->map message))
+             :meta  (attributes->map message))
       (dissoc :message)))

 (defmethod restructure-response :receive-message [_ body]


[#3083] Fix undo with data-groups

[#3083] Fix undo with data-groups

Found bug if we execute an update with trasnformations then undo

--- backend/src/akvo/lumen/lib/transformation/engine.clj
+++ backend/src/akvo/lumen/lib/transformation/engine.clj
@@ -353,24 +353,27 @@
                                                                                :transformation transformation})))))))))

 (defn copy-tables-2 [tenant-conn data-groups]
-  (doall (map (fn [data-group]
-          (let [imported-table-name (:imported-table-name data-group)
-                table-name (util/gen-table-name "ds")]
-            (db.transformation/copy-table tenant-conn
-                                          {:source-table imported-table-name
-                                           :dest-table   table-name}
-                                          {}
-                                          {:transaction? false})
-
-            (assoc data-group :table-name table-name :previous-table-name (:table-name data-group)))
-          ) data-groups)))
+  (reduce (fn [c data-group]
+         (let [imported-table-name (:imported-table-name data-group)
+               table-name (util/gen-table-name "ds")]
+           (db.transformation/copy-table tenant-conn
+                                         {:source-table imported-table-name
+                                          :dest-table   table-name}
+                                         {}
+                                         {:transaction? false})
+
+           (assoc c (:group-id data-group) {:table-name table-name :previous-table-name (:table-name data-group)
+                                            :imported-table-name (:imported-table-name data-group)}))
+         ) {} data-groups))

 (defn- apply-undo-2 [{:keys [tenant-conn claims] :as deps} dataset-id job-execution-id current-dataset-version]
-  (let [initial-dataset-version (db.transformation/initial-dataset-version-2-to-update-by-dataset-id
+  (let [tables-dict     (->> (db.data-group/list-data-groups-by-dataset-version-id tenant-conn {:dataset-version-id (:id current-dataset-version)})
+                             (copy-tables-2 tenant-conn))
+        initial-dataset-version (db.transformation/initial-dataset-version-2-to-update-by-dataset-id
                                  tenant-conn
                                  {:dataset-id dataset-id})
         initial-data-groups     (->> (db.data-group/list-data-groups-by-dataset-version-id tenant-conn {:dataset-version-id (:id initial-dataset-version)})
-                                     (copy-tables-2 tenant-conn ))]
+                                     (map (fn [dg] (merge dg (get tables-dict (:group-id dg))))))]
     (loop [data-groups     initial-data-groups
            transformations (butlast (:transformations current-dataset-version))
            tx-index        0]


Add consistency check for exploration with incomplete counterexamples

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

--- src/conexp/fca/exploration.clj
+++ src/conexp/fca/exploration.clj
@@ -245,66 +245,78 @@
   [possible-ctx certain-ctx background-knowledge handler]
   (loop [implications background-knowledge,
          last         (close-under-implications implications #{}),
-         possible-ctx possible-ctx
+         possible-ctx possible-ctx,
          certain-ctx  certain-ctx]
-    (if (not last)
-      {:implications     (difference implications background-knowledge),
-       :possible-context possible-ctx
-       :certain-context  certain-ctx}
-      (let [conclusion-from-last (oprime possible-ctx (aprime certain-ctx last))] ; ?
-        (if (= last conclusion-from-last)
-          (recur implications
-                 (next-closed-set (attributes possible-ctx)
-                                  (clop-by-implications implications)
-                                  last)
-                 possible-ctx
-                 certain-ctx)
-          (let [new-impl        (make-implication last conclusion-from-last),
-                counterexamples (handler possible-ctx certain-ctx implications new-impl)]
-            (cond
-             (= counterexamples :abort) ; abort exploration
-             (recur implications nil possible-ctx certain-ctx)
-             ;;
-             counterexamples            ; add counterexample
-             (let [new-objs (map first counterexamples)]
-               ;; check that new names are not there already
-               (when (exists [g new-objs] (contains? (objects possible-ctx) g))
-                 (illegal-argument "Got objects as «new objects» in exploration "
-                                   "which are already present."))
-               (recur implications
-                      last
-                      ;; possible incidence, i.e. the one not excluded by the expert
-                      (make-context (into (objects possible-ctx) new-objs)
-                                    (attributes possible-ctx)
-                                    (union (incidence possible-ctx)
-                                           (set-of [g m] [[g _ neg] counterexamples,
-                                                          m (difference (attributes possible-ctx)
-                                                                        (set neg))])))
-                      ;; certain incidence, i.e. the one given by the expert
-                      (make-context (into (objects certain-ctx) new-objs)
-                                    (attributes certain-ctx)
-                                    (union (incidence certain-ctx)
-                                           (set-of [g m] [[g pos _] counterexamples,
-                                                          m pos])))))
-             ;;
-             true                       ; add implication
-             (let [new-implications (conj implications new-impl),
-                   new-clop         (clop-by-implications new-implications),
-                   new-certain-ctx  (make-context (objects certain-ctx)
-                                                  (attributes certain-ctx)
-                                                  (set-of [g m] [g (objects certain-ctx),
-                                                                 m (new-clop (oprime certain-ctx #{g}))])),
-                   new-possible-ctx (make-context (objects possible-ctx)
-                                                  (attributes possible-ctx)
-                                                  (filter (fn [[g m]]
-                                                            (let [certain-atts (oprime new-certain-ctx #{g})]
-                                                              (subset? (new-clop (conj certain-atts m))
-                                                                       (oprime possible-ctx #{g}))))
-                                                          (incidence possible-ctx)))]
-               (recur new-implications
-                      (next-closed-set (attributes possible-ctx) new-clop last)
-                      new-possible-ctx
-                      new-certain-ctx)))))))))
+    (cond
+     ;; consistency check
+     (not (subset? (incidence certain-ctx)
+                   (incidence possible-ctx)))
+     (do
+       (println "Inconsistent state reached: certain incidence is not a subset of the possible incidence")
+       {:implications     (difference implications background-knowledge),
+        :possible-context possible-ctx
+        :certain-context  certain-ctx})
+     ;; exploration finished
+     (not last)
+     {:implications     (difference implications background-knowledge),
+      :possible-context possible-ctx
+      :certain-context  certain-ctx}
+     ;; exploration continues
+     true
+     (let [conclusion-from-last (oprime possible-ctx (aprime certain-ctx last))] ; ?
+       (if (= last conclusion-from-last)
+         (recur implications
+                (next-closed-set (attributes possible-ctx)
+                                 (clop-by-implications implications)
+                                 last)
+                possible-ctx
+                certain-ctx)
+         (let [new-impl        (make-implication last conclusion-from-last),
+               counterexamples (handler possible-ctx certain-ctx implications new-impl)]
+           (cond
+            (= counterexamples :abort)  ; abort exploration
+            (recur implications nil possible-ctx certain-ctx)
+            ;;
+            counterexamples             ; add counterexample
+            (let [new-objs (map first counterexamples)]
+              ;; check that new names are not there already
+              (when (exists [g new-objs] (contains? (objects possible-ctx) g))
+                (illegal-argument "Got objects as «new objects» in exploration "
+                                  "which are already present."))
+              (recur implications
+                     last
+                     ;; possible incidence, i.e. the one not excluded by the expert
+                     (make-context (into (objects possible-ctx) new-objs)
+                                   (attributes possible-ctx)
+                                   (union (incidence possible-ctx)
+                                          (set-of [g m] [[g _ neg] counterexamples,
+                                                         m (difference (attributes possible-ctx)
+                                                                       (set neg))])))
+                     ;; certain incidence, i.e. the one given by the expert
+                     (make-context (into (objects certain-ctx) new-objs)
+                                   (attributes certain-ctx)
+                                   (union (incidence certain-ctx)
+                                          (set-of [g m] [[g pos _] counterexamples,
+                                                         m pos])))))
+            ;;
+            true                        ; add implication
+            (let [new-implications (conj implications new-impl),
+                  new-clop         (clop-by-implications new-implications),
+                  new-certain-ctx  (make-context (objects certain-ctx)
+                                                 (attributes certain-ctx)
+                                                 (set-of [g m] [g (objects certain-ctx),
+                                                                m (new-clop (oprime certain-ctx #{g}))])),
+                  new-possible-ctx (make-context (objects possible-ctx)
+                                                 (attributes possible-ctx)
+                                                 (filter (fn [[g m]]
+                                                           (let [certain-atts (oprime new-certain-ctx #{g})]
+                                                             (subset? (new-clop (conj certain-atts m))
+                                                                      (oprime possible-ctx #{g}))))
+                                                         (incidence possible-ctx)))]
+              (recur new-implications
+                     (next-closed-set (attributes possible-ctx) new-clop last)
+                     new-possible-ctx
+                     new-certain-ctx)))))))))

 ;;;


content accepted

content accepted

--- src/crawler/rich_extractor.clj
+++ src/crawler/rich_extractor.clj
@@ -130,47 +130,73 @@

 (defn extract-above-average-richest
   "Extract above-average richness XPaths"
-  ([page-src url]
-     (extract-above-average-richest page-src url (set [])))
-
-  ([page-src url blacklist]
-     (let [in-host-xpaths-hrefs (state-action page-src url blacklist)
+  ([page-src url-ds]
+     (extract-above-average-richest page-src url-ds (set [])))
+
+  ([page-src url-ds blacklist]
+     (let [url        (:url url-ds)
+           paginated? (-> url-ds :pagination?)
+           in-host-xpaths-hrefs (state-action page-src url blacklist)
            xpaths-tokenized     (tokenize-actions in-host-xpaths-hrefs)
-           xpaths-scored        (score-actions xpaths-tokenized)
-           mean-richness        (/ (apply + (map second xpaths-scored))
-                                   (count xpaths-scored))
-
-           ; return xpaths and scores of items who clocked above the
-           ; mean richness of the webpage
-
-           decision             (filter
-                                 (fn [[xpath score]]
-                                   (>= score mean-richness))
-                                 (reverse
-                                  (sort-by second xpaths-scored)))
-
-           ; links at the chosen XPaths
-           decision-links       (flatten
-                                 (map
-                                  (fn [[a-decision score]]
-                                    (map
-                                     #(-> % :href)
-                                     (in-host-xpaths-hrefs a-decision)))
-                                  decision))
-
-           ; this guy is computing the score products of the decisions alone
-           decision-scores      (/ (reduce
-                                    (fn [acc [a-decision score]]
-                                      (+ acc score))
-                                    0
-                                    decision)
-                                   (count decision))]
-       (do
-         (println :url url)
-         (println :decision decision)
-         {:links decision-links
-          :action-score decision-scores
-          :xpaths (map first decision)}))))
+           xpaths-scored        (score-actions xpaths-tokenized)]
+
+       (if-not paginated?
+         (let [mean-richness        (/ (apply + (map second xpaths-scored))
+                                       (count xpaths-scored))
+
+                                        ; return xpaths and scores of items who clocked above the
+                                        ; mean richness of the webpage
+
+               decision             (filter
+                                     (fn [[xpath score]]
+                                       (>= score mean-richness))
+                                     (reverse
+                                      (sort-by second xpaths-scored)))
+
+                                        ; links at the chosen XPaths
+               decision-links       (flatten
+                                     (map
+                                      (fn [[a-decision score]]
+                                        (map
+                                         #(-> % :href)
+                                         (in-host-xpaths-hrefs a-decision)))
+                                      decision))
+
+                                        ; this guy is computing the score products of the decisions alone
+               decision-scores      (/ (reduce
+                                        (fn [acc [a-decision score]]
+                                          (+ acc score))
+                                        0
+                                        decision)
+                                       (count decision))]
+          (do
+            (println :url url)
+            (println :decision decision)
+            {:links decision-links
+             :action-score decision-scores
+             :xpaths (map first decision)}))
+
+         (let [decision (-> url-ds :content-xpaths)
+               decision-links (flatten
+                               (map
+                                (fn [a-decision]
+                                  (map
+                                   #(-> % :href)
+                                   (in-host-xpaths-hrefs a-decision)))
+                                decision))
+               decision-scores (/ (reduce
+                                   (fn [acc a-decision]
+                                     (+ acc (xpaths-scored a-decision)))
+                                   0
+                                   decision)
+                                  (count decision))]
+           (do
+             (println :url url)
+             (println :decision decision)
+             (println "PAGINATED")
+             {:links decision-links
+              :action-score decision-scores
+              :xpaths decision}))))))

 (defn pagination?
   "Args:


Show missing dates simply as empty strings.

--- test/ahnentafel/server/pages/search_test.clj
+++ test/ahnentafel/server/pages/search_test.clj
@@ -58,4 +58,10 @@
     (let [page (get-page search "/Doe")]
       (are-on-page "John /Doe (a.k.a. John J. /Doe)"))))

-(deftest with-missing-dates)
+(deftest with-missing-dates
+  (with-redefs [query/search
+                (fn [data query]
+                  [{:xref "@I1@"
+                    :name ["John /Doe"]}])]
+    (let [page (get-page search "/Doe")]
+      (are-on-page "( - )"))))


Fix test_helper

Fix test_helper

--- test/clojurewerkz/cassaforte/test_helper.clj
+++ test/clojurewerkz/cassaforte/test_helper.clj
@@ -1,6 +1,5 @@
 (ns clojurewerkz.cassaforte.test-helper
-  (:require [clojurewerkz.cassaforte.embedded :as e]
-            [clojurewerkz.cassaforte.cluster.metrics :as metrics])
+  (:require [clojurewerkz.cassaforte.embedded :as e])
   (:use clojurewerkz.cassaforte.cql
         clojurewerkz.cassaforte.query))

@@ -32,10 +31,10 @@
   [f]
   (e/start-server!)
   (when (not (bound? (var cluster-client)))
-    (def cluster-client (connect! ["127.0.0.1"]))
-    (metrics/csv-reporter cluster-client))
-  ;; (when (not (bound? (var cluster-client)))
-  ;;   (def cluster-client (connect ["192.168.60.15"])))
+    ;; (def cluster-client (connect! ["192.168.60.10" "192.168.60.11" "192.168.60.12"]))
+    ;; (.getAllHosts (.getMetadata (.getCluster cluster-client)))
+    (def cluster-client (connect! ["127.0.0.1"])))
+
   (with-client cluster-client
     (run! f)))


Stop datepicker from jumping around

Stop datepicker from jumping around

--- mtg-pairings-server/src/cljs/mtg_pairings_server/components/filter.cljs
+++ mtg-pairings-server/src/cljs/mtg_pairings_server/components/filter.cljs
@@ -39,16 +39,17 @@
         v (when value (js/Date. (coerce/to-long value)))]
     [:div.date-picker
      [ui/date-picker
-      {:hint-text        hint-text
-       :container        :inline
-       :auto-ok          true
-       :locale           "fi-FI"
-       :DateTimeFormat   (oget js/Intl "DateTimeFormat")
-       :style            {:display :inline-block}
-       :text-field-style {:width "128px"}
-       :on-change        handler
-       :value            v
-       :cancel-label     "Peruuta"}]
+      {:hint-text              hint-text
+       :container              :inline
+       :dialog-container-style {:left "-9999px"}
+       :auto-ok                true
+       :locale                 "fi-FI"
+       :DateTimeFormat         (oget js/Intl "DateTimeFormat")
+       :style                  {:display :inline-block}
+       :text-field-style       {:width "128px"}
+       :on-change              handler
+       :value                  v
+       :cancel-label           "Peruuta"}]
      (when v
        [ui/icon-button
         {:on-click on-clear


simplify

simplify

--- src/io/exo/jobs.clj
+++ src/io/exo/jobs.clj
@@ -2,7 +2,6 @@
   "Simplistic JSON API for a Job board"
   (:require [org.httpkit.server   :as server]
             [ring.middleware.json :as json]
-            [compojure.handler    :as handler]
             [compojure.route      :as route]
             [compojure.core       :refer [defroutes GET POST DELETE]]
             [ring.util.response   :refer [response redirect]])
@@ -21,21 +20,13 @@
   [id]
   (swap! db dissoc id))

-(defn mksite
-  "Build a handler for our API routes."
-  [routes]
-  (-> routes
-      (handler/api)
-      (json/wrap-json-body {:keywords? true})
-      (json/wrap-json-response)))
+(defroutes api-routes
+  "Main router: 3 REST routes and resource handlers."

-(defroutes job-api
-  "Main router: 3 REST routes and resource handlers."
-
   (GET  "/jobs" []         (response @db))
   (POST "/jobs" req        (response (create! (:body req))))
   (DELETE "/jobs/:id" [id] (response (delete! id)))
-
+
   (GET  "/" []             (redirect "/index.html"))
   (route/resources         "/")
   (route/not-found         "
404
"))
@@ -43,5 +34,7 @@
 (defn -main
   "Start the API"
   [& args]
-  (server/run-server (mksite job-api) {:port 8080})
-  nil)
+  (let [api (-> api-routes (json/wrap-json-body) (json/wrap-json-response))
+        cfg {:port 8080}]
+    (server/run-server api cfg)
+    (println "Job board API up and running on http://localhost:8080")))


Don't manually construct loaded block.

Don't manually construct loaded block.

--- src/blocks/core.clj
+++ src/blocks/core.clj
@@ -124,16 +124,11 @@

   The returned block will have the same extra attributes and metadata as the one
   given."
-  [^Block block]
+  [block]
   (if (lazy? block)
-    (let [content (with-open [stream (open block)]
-                    (bytes/to-byte-array stream))]
-      (Block. (:id block)
-              (count content)
-              (PersistentBytes/wrap content)
-              (._attrs block)
-              (meta block)))
-    ; Block is already loaded.
+    (-> (data/load-block (:id block) (open block))
+        (into (remove (comp #{:id :size} key)) block)
+        (with-meta (meta block)))
     block))


Corrected field lengths and added tag migrations

--- src/portal_clj/models/migration.clj
+++ src/portal_clj/models/migration.clj
@@ -10,7 +10,7 @@
                    lastname VARCHAR(128),
                    username VARCHAR(64) NOT NULL,
                    email VARCHAR(512) NOT NULL,
-                   password VARBINARY(255),
+                   password VARBINARY(256),
                    admin BOOLEAN NOT NULL DEFAULT 0,
                    comments BOOLEAN NOT NULL,
                    signup_time TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
@@ -21,11 +21,11 @@
   (sql/execute! db/spec
                 ["CREATE TABLE IF NOT EXISTS pages (
                    id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                   title VARCHAR(255) NOT NULL,
+                   title VARCHAR(256) NOT NULL,
                    body TEXT,
                    user_id INT(11) NOT NULL,
                    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-                   slug VARCHAR(255) NOT NULL,
+                   slug VARCHAR(256) NOT NULL,
                    active BOOLEAN NOT NULL DEFAULT 1,
                    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
                  )"]))
@@ -34,12 +34,12 @@
   (sql/execute! db/spec
                 ["CREATE TABLE IF NOT EXISTS posts (
                    id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
-                   title VARCHAR(255) NOT NULL,
+                   title VARCHAR(256) NOT NULL,
                    body TEXT,
                    user_id INT(11) NOT NULL,
                    commentable BOOLEAN NOT NULL DEFAULT 0,
                    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
-                   slug VARCHAR(255) NOT NULL,
+                   slug VARCHAR(256) NOT NULL,
                    active BOOLEAN NOT NULL DEFAULT 1,
                    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE
                  )"]))
@@ -66,6 +66,23 @@
                    created_at TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
                  )"]))

+(defn tag-migration []
+  (sql/execute! db/spec
+                ["CREATE TABLE IF NOT EXISTS tags (
+                   id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                   name VARCHAR(256),
+                 )"]))
+
+(defn post-tag-migration []
+  (sql/execute! db/spec
+                ["CREATE TABLE IF NOT EXISTS post_tags (
+                   id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
+                   post_id INT(11) NOT NULL,
+                   tag_id INT(11) NOT NULL,
+                   FOREIGN KEY (post_id) REFERENCES posts(id) ON DELETE CASCADE,
+                   FOREIGN KEY (tag_id) REFERENCES tags(id) ON DELETE CASCACDE
+                 )"]))
+
 (defn do-migrate []
   (do
     (println "Creating database scaffold... ")


(maint) Fix open reader leaks.

(maint) Fix open reader leaks.

As noted in its docstring, clojure.java.io/reader should always be used
inside `with-open`, since it opens a reader on its argument but leaves
it up to the caller to close the reader.

--- src/puppetlabs/kitchensink/core.clj
+++ src/puppetlabs/kitchensink/core.clj
@@ -150,10 +150,9 @@
 (defn lines
   "Returns a sequence of lines from the given filename"
   [filename]
-  (-> filename
-    (fs/file)
-    (reader)
-    (line-seq)))
+  (with-open [file-reader (reader (fs/file filename))]
+    ;; line seq is lazy and file-reader gets closed
+    (doall (line-seq file-reader))))

 (defn mkdirs!
   "Given a path (may be a File or a string), creates a directory (including any
@@ -765,12 +764,13 @@
           (every? keyword? (keys %))
           (every? map? (vals %))]}

-  (reduce (fn [acc [name section]]
-            (assoc acc
-              (keywordize name)
-              (create-section-map section)))
-          {}
-          (parse-ini (reader filename))))
+  (with-open [ini (reader filename)]
+    (reduce (fn [acc [name section]]
+              (assoc acc
+                     (keywordize name)
+                     (create-section-map section)))
+            {}
+            (parse-ini ini))))

 (defn inis-to-map
   "Takes a path and converts the pointed-at .ini files into a nested


Add latest utils changes from PuppetDB

Add latest utils changes from PuppetDB

--- src/puppetlabs/kitchensink/core.clj
+++ src/puppetlabs/kitchensink/core.clj
@@ -57,6 +57,11 @@
   {:pre [(string? s)
          (string? substring)]}
   (>= (.indexOf s substring) 0))
+
+(defn true-str?
+  "Return true if the string contains true"
+  [^String s]
+  (.equalsIgnoreCase "true" s))

 ;; ## I/O

@@ -609,6 +614,10 @@
                                  (split #"[\\._]")))]
     (compare (parse a) (parse b))))

+(def java-version
+  "Returns a string of the currently running java version"
+  (System/getProperty "java.version"))
+
 ;; control flow

 (defmacro cond-let


In fact, we only do English

In fact, we only do English

--- src/kale/common.clj
+++ src/kale/common.clj
@@ -23,13 +23,15 @@

 ;; Assume that the user's environment is setup for their preferred
 ;; language.
-(def my-language
+(def my-language-in-your-dreams
   "The two letter language code for this user's language."
   (atom
    (let [locale-key (keyword (.getLanguage (java.util.Locale/getDefault)))]
      (if (contains? languages locale-key)
        locale-key
        :en))))
+
+(def my-language (atom :en))

 (defn get-command-msg
   "Return the corresponding command message string based on the


Changed the replace-facts test to pass in the correct facts map

--- test/com/puppetlabs/puppetdb/test/command.clj
+++ test/com/puppetlabs/puppetdb/test/command.clj
@@ -562,7 +562,7 @@
       (with-redefs [scf-store/update-facts! (fn [certname facts timestamp]
                                               (.put hand-off-queue "got the lock")
                                               (.poll hand-off-queue 5 java.util.concurrent.TimeUnit/SECONDS)
-                                              (storage-replace-facts! certname (:values facts) timestamp))]
+                                              (storage-replace-facts! certname facts timestamp))]
         (let [first-message? (atom false)
               second-message? (atom false)
               fut (future


Use yada's new stop method

Use yada's new stop method

Thanks to @markmelling for pointing it out to me.
Fixes #6

--- src/edge/server.clj
+++ src/edge/server.clj
@@ -19,8 +19,8 @@
   (start [component]
     (assoc component :server (yada/server routes {:port port})))
   (stop [component]
-    (when-let [server (:server component)]
-      (.close server))
+    (when-let [close (get-in component [:server :close])]
+      (close))
     component))

 (defn new-http-server [options]


Adapt recent-colors component usage on colors options.

--- src/uxbox/ui/workspace/options.cljs
+++ src/uxbox/ui/workspace/options.cljs
@@ -156,7 +156,7 @@
           :value (:fill shape "")
           :on-change on-color-change}]]

-       (recent-colors shape)
+       (recent-colors shape #(change-fill {:fill %}))

        ;; SLIDEBAR FOR ROTATION AND OPACITY
        [:span "Opacity"]


Correct category empty string statement in where clause.

--- src/verbose_spoon/model/queries.clj
+++ src/verbose_spoon/model/queries.clj
@@ -179,7 +179,7 @@
         designation (if (= designation "") nil designation)
         major (if (= major "") nil major)
         year (if (= year "") nil year)
-        categories (if (empty? categories) nil categories)
+        categories (remove (partial = "") categories)
         itype (if (= itype "Both") nil itype)
         query-part (build-subtables conj-where-or-and designation major year categories itype)
         query-part (if designation (format (str query-part (conj-where-or-and "Main_View.Designation_name = '%s' ")) designation) query-part)


Fix `create`

Fix `create`

--- src/invadm/core.clj
+++ src/invadm/core.clj
@@ -146,9 +146,15 @@
     (not (:net options)) (exit 1 (error-msg ["-n NET is required"]))
     (not (get arguments 1)) (exit 1 (error-msg ["invoice id is required"])))
   (write-invoice (get arguments 1)
-                 (assoc options
-                        "id" (get arguments 1)
-                        "payments" [])))
+                 {"id" (get arguments 1)
+                  "to" (:to options)
+                  "from" (:from options)
+                  "amount" (:amount options)
+                  "currency" (:currency options)
+                  "issue-date" (:issue-date options)
+                  "filename" (:filename options)
+                  "net" (:net options)
+                  "payments" []}))

 (defn data [options]
   (println (json/write-str (map serialize-invoice


Adapt to new API.

Adapt to new API.

--- twitter-sample.clj
+++ twitter-sample.clj
@@ -1,6 +1,8 @@
 (ns twitter-sample
   (:require [http.async.client :as c]
             [org.danlarkin.json :as j]))
+
+;; Please consider using https://github.com/adamwynne/twitter-api

 (def u "username")
 (def p "password")
@@ -13,15 +15,17 @@

 ;; statuses/sample
 (defn statuses-sample []
-  (doseq [twit-str (c/string
-                    (c/stream-seq :get "http://stream.twitter.com/1/statuses/sample.json"
-                                  :auth {:user u :password p}))]
-    (print-user-and-text "sample" twit-str)))
+  (with-open [client (c/create-client)]
+    (doseq [twit-str (c/string
+                      (c/stream-seq client :get "http://stream.twitter.com/1/statuses/sample.json"
+                                    :auth {:user u :password p}))]
+      (print-user-and-text "sample" twit-str))))

 ;; statuses/filter
 (defn statuses-filter []
-  (doseq [twit-str (c/string
-                    (c/stream-seq :post "http://stream.twitter.com/1/statuses/filter.json"
-                                  :body {"track" "basketball,football,baseball,footy,soccer"}
-                                  :auth {:user u :password p}))]
-    (print-user-and-text "sports" twit-str)))
+  (with-open [client (c/create-client)]
+    (doseq [twit-str (c/string
+                      (c/stream-seq client :post "http://stream.twitter.com/1/statuses/filter.json"
+                                    :body {"track" "basketball,football,baseball,footy,soccer"}
+                                    :auth {:user u :password p}))]
+      (print-user-and-text "sports" twit-str))))


(PDB-3529) Fix latest-report test and add new test for old reports

Prior to this commit, the latest-report test was comparing
end_time instead of producer timestamp which was incorrect.

After this commit, the latest-report test compares producer timestamp
and has a new test that ensures a report with an older timestamp than
the current latest report will not overwrite the latest report.

--- test/puppetlabs/puppetdb/scf/storage_test.clj
+++ test/puppetlabs/puppetdb/scf/storage_test.clj
@@ -1754,17 +1754,26 @@
                  :environment_id env-id}])))))

   (deftest-db latest-report
-    (testing "should flag report as 'latest'"
-      (let [node        (:certname report)
-            report-hash (:hash (store-example-report! report timestamp))]
+    (let [node (:certname report)
+          report-hash (:hash (store-example-report! report timestamp))]
+      (testing "should flag report as 'latest'"
         (is (is-latest-report? node report-hash))
         (let [new-report-hash (:hash (store-example-report!
                                       (-> report
                                           (assoc :configuration_version "bar")
-                                          (assoc :end_time (now)))
+                                          (assoc :end_time (now))
+                                          (assoc :producer_timestamp (now)))
                                       timestamp))]
           (is (is-latest-report? node new-report-hash))
-          (is (not (is-latest-report? node report-hash)))))))
+          (is (not (is-latest-report? node report-hash)))))
+      (testing "should not update latest report with older report timestamp"
+        (let [old-report-hash (:hash (store-example-report!
+                                      (-> report
+                                          (assoc :configuration_version "bar")
+                                          (assoc :end_time (now))
+                                          (assoc :producer_timestamp (-> -1 days from-now)))
+                                      timestamp))]
+          (is (not (is-latest-report? node old-report-hash)))))))

   (deftest-db report-cleanup


Preparing tests for mv contexts

Preparing tests for mv contexts

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

--- src/conexp/tests/fca/many_valued_contexts.clj
+++ src/conexp/tests/fca/many_valued_contexts.clj
@@ -58,13 +58,20 @@
     (=> (= mv-ctx-1 mv-ctx-2)
         (= (hash mv-ctx-1) (hash mv-ctx-2)))))

-;; objects, attributes, incidence
+;; objects
+;; attributes
+;; incidence

 ;;;

-;; values-of-{attribute,object}
+;; values-of-attribute
+;; values-of-object

-;; {nominal,ordinal,interordinal,biordinal,dichotomic}-scale
+;; nominal-scale
+;; ordinal-scale
+;; interordinal-scale
+;; biordinal-scale
+;; dichotomic-scale

 ;;;


Add debug info

Add debug info

--- src/discuss/components/search/statements.cljs
+++ src/discuss/components/search/statements.cljs
@@ -62,6 +62,7 @@
         validate-statements (map valid-statement?)
         xform-statements (comp rename-position validate-statements)
         validated-statements (transduce xform-statements conj statements)]
+    (log/debug "Received" (count validated-statements) "search results from D-BAS instance")
     (om/transact! parser/reconciler `[(search/results {:value ~validated-statements})])))

 (defn remove-search-results!
@@ -93,6 +94,7 @@
         validate-statements (map valid-statement?)
         xform-statements (comp conform-statements validate-statements)
         validated-statements (transduce xform-statements conj statements)]
+    (log/debug "Received" (count validated-statements) "search results from EDEN instance")
     (om/transact! parser/reconciler `[(search/results {:value ~validated-statements})])))

 (defn- handle-eden-search-results
@@ -134,7 +136,7 @@
 (entrypoint)

 ;; -----------------------------------------------------------------------------
-
+@(om/app-state parser/reconciler)
 (defui Result
   Object
   (render [this]


goog.closure web worker

goog.closure web worker

--- worker/src/worker/core.cljs
+++ worker/src/worker/core.cljs
@@ -3,24 +3,40 @@

 (enable-console-print!)

+(def b (new js/Blob (clj->js ["
+var CLOSURE_BASE_PATH = 'http://localhost:3449/js/compiled/out/goog/';
+var CLOSURE_IMPORT_SCRIPT = (function(global) {
+  return function(src) {
+    //global['console'].log(src);
+    global['importScripts'](src);
+    return true;
+  };
+})(self);

-(def b (new js/Blob (clj->js ["self.addEventListener('message', function(e) {
-console.log('in worker');
-postMessage(e.data);
-} ,false);"])))
+self.onmessage = function(e) {
+  importScripts(
+    'http://localhost:3449/js/compiled/out/goog/base.js'
+    ,'http://localhost:3449/js/compiled/out/cljs_deps.js'
+  )
+  goog.require('cljs.core')
+
+  cljs.core.enable_console_print_BANG_.call(null);
+  cljs.core.println.call(null,e.data);
+  postMessage(e.data);
+};
+"])))

 (def w (new js/Worker (.createObjectURL js/URL b)))

-(.addEventListener w "message" (fn [e] (println (.-data e))))
+(defn worker-print [message]
+  (println message))

-(println (cljs/compile-str (cljs/empty-state) "(defn j[x y] (+ x y))" #(:value %)))
+(println (cljs/compile-str (cljs/empty-state) "(println \"test\")" #(:value %)))

-
-(.postMessage w "test")
+(.postMessage w "hello google closure worker")

 ;;(defonce app-state (atom {:text "Hello world!"}))
-

 (defn on-js-reload []
   ;; optionally touch your app-state to force rerendering depending on


Implement break function for newline/paragraph breaks

--- src/merkki/core.clj
+++ src/merkki/core.clj
@@ -1,12 +1,18 @@
 (ns merkki.core)
+
+(defn break
+  "Markdown standard allows hard-wrapping by not creating a new paragraph block automatically on new line.
+   In order to guarantee that a <br>/newline is produced, a line must end in two spaces followed by new line.
+   See: https://daringfireball.net/projects/markdown/syntax#p"
+  [s]
+  (str s "  \n"))

 (defn header
   "Given a number and a string, tags the string as that header level and adds a new line"
   [n s]
   (str (reduce str (take n (repeat "#")))
        " "
-       s
-       "  \n"))
+       (break s)))

 ;; Pre-provided curried versions of header for quicker use
 (def h1 (partial header 1))
@@ -19,8 +25,8 @@
 (defn u-header
   "Generates an underlined, multi-line setext style header, using the given underline character"
   [ch s]
-  (str s "  \n"
-       (reduce str (take (count s) (repeat ch))) "  \n"))
+  (str (break s)
+       (break (reduce str (take (count s) (repeat ch))))))

 ;; Pre-provided curried versions of u-header for h1 and h2
 (def uh1 (partial u-header "="))


CMR-969: More update.

CMR-969: More update.

--- ingest-app/src/cmr/ingest/services/validation.clj
+++ ingest-app/src/cmr/ingest/services/validation.clj
@@ -54,13 +54,13 @@
   (if-errors-throw (umm-validation/validate (mt/mime-type->format metadata-format) umm)))

 (defn- delete-time-validation
-  "Validates the concept delete-time is before the current time, otherwise throws exception."
+  "Validates the concept delete-time.
+  Returns error if the delete time exists and is before one minute from the current time."
   [_ concept]
-  (let [time-to-compare (t/plus (tk/now) (t/minutes 1))
-        delete-time (get-in concept [:extra-fields :delete-time])]
+  (let [delete-time (get-in concept [:extra-fields :delete-time])]
     (when (some-> delete-time
                   p/parse-datetime
-                  (t/before? time-to-compare))
+                  (t/before? (t/plus (tk/now) (t/minutes 1))))
       [(format "DeleteTime %s is before the current time." delete-time)])))

 (defn- concept-id-validation
@@ -79,6 +79,6 @@
    concept-id-validation])

 (defn validate-business-rules
-  "Validates the concept against CMR ingest rules. Short circuit on first error by throwing exception."
+  "Validates the concept against CMR ingest rules."
   [context concept]
   (if-errors-throw (mapcat #(% context concept) business-rule-validations)))


Bumps version to 1.38.2-SNAPSHOT

Bumps version to 1.38.2-SNAPSHOT

--- scheduler/project.clj
+++ scheduler/project.clj
@@ -13,7 +13,7 @@
 ;; See the License for the specific language governing permissions and
 ;; limitations under the License.
 ;;
-(defproject cook "1.38.1"
+(defproject cook "1.38.2-SNAPSHOT"
   :description "This launches jobs on a Mesos cluster with fair sharing and preemption"
   :license {:name "Apache License, Version 2.0"}
   :dependencies [[org.clojure/clojure "1.8.0"]


Better log for dismiss-all.

Better log for dismiss-all.

--- src/oc/storage/api/entries.clj
+++ src/oc/storage/api/entries.clj
@@ -215,7 +215,9 @@
            :dismiss-at dismiss-at})
         (do
           (timbre/warn "Failed dismiss-all for entries")
-          (map #(when-not (lib-schema/valid? common-res/Entry %) (timbre/info "Failed for" (:uuid %))) updated-entries)
+          (map #(when-not (lib-schema/valid? common-res/Entry %)
+                  (timbre/info "Failed for" (:uuid %)))
+           updated-entries)
           false)))

     (do
@@ -361,7 +363,7 @@
     (do (timbre/error "Failed updating entry:" entry-for) false)))

 (defn- update-user-visibility-dismiss-all [conn ctx entry-for]
-  (timbre/info "Dismiss all entries for:" entry-for ". Dismissing" (count (:updated-entries ctx)) "entries:" (map :uuid (:updated-entries ctx)))
+  (timbre/info "Dismiss all entries for:" entry-for ". Dismissing" (count (:updated-entries ctx)) "entries for user" (-> ctx :user :user-id))
   (if-let* [org (:existing-org ctx)
             user (:user ctx)
             existing-entries (:existing-entries ctx)


Wip: Read from the log.

Wip: Read from the log.

--- src/onyx/coordinator/async.clj
+++ src/onyx/coordinator/async.clj
@@ -133,7 +133,7 @@

 (defn born-peer-ch-loop [sync sync-ch born-tail offer-head dead-head]
   (loop []
-    (when-let [_ (<!! born-tail)]
+    (when (<!! born-tail)
       (let [offset (extensions/next-offset sync :born-log)
             peer (extensions/log-entry-at sync :born-log offset)]
         (when (mark-peer-birth sync sync-ch peer (fn [_] (>!! dead-head peer)))
@@ -142,13 +142,19 @@
           (>!! offer-head true))
         (recur)))))

+;;; todo - create log entry to lead into this loop
 (defn dead-peer-ch-loop [sync sync-ch dead-tail evict-head offer-head]
   (loop []
-    (when-let [peer-node (<!! dead-tail)]
-      (when (mark-peer-death sync sync-ch peer-node)
-        (>!! evict-head peer-node)
-        (>!! offer-head peer-node))
-      (recur))))
+    (when (<!! dead-tail)
+      (let [offset (extensions/next-offset sync :death-log)
+            peer-node (extensions/log-entry-at sync :death-log offset)]
+        (when (mark-peer-death sync sync-ch peer-node)
+          (extensions/create sync :evict-log peer-node)
+          (extensions/create sync :offer-log peer-node)
+          (extensions/checkpoint sync :death-log offset)
+          (>!! evict-head peer-node)
+          (>!! offer-head peer-node))
+        (recur)))))

 (defn planning-ch-loop [sync queue planning-tail offer-head]
   (loop []
@@ -166,29 +172,39 @@

 (defn evict-ch-loop [sync sync-ch evict-tail offer-head shutdown-head]
   (loop []
-    (when-let [node (<!! evict-tail)]
-      (evict-peer sync sync-ch node)
-      (>!! shutdown-head node)
-      (>!! offer-head node)
-      (recur))))
+    (when (<!! evict-tail)
+      (let [offset (extensions/next-offset sync :evict-log)
+            node (extensions/log-entry-at sync :evict-log offset)]
+        (evict-peer sync sync-ch node)
+        (extensions/create sync :shutdown-log node)
+        (extensions/create sync :offer-log node)
+        (extensions/checkpoint sync :evict-log offset)
+        (>!! shutdown-head node)
+        (>!! offer-head node)
+        (recur)))))

 (defn offer-ch-loop
   [sync sync-ch revoke-delay offer-tail ack-head exhaust-head complete-head revoke-head]
   (loop []
-    (when-let [event (<!! offer-tail)]
-      (offer-task sync sync-ch
-                  #(>!! ack-head %)
-                  #(>!! exhaust-head %)
-                  #(>!! complete-head %)
-                  #(thread (<!! (timeout revoke-delay))
-                           (>!! revoke-head %)))
-      (recur))))
+    (when (<!! offer-tail)
+      (let [offset (extensions/next-offset sync :offer-log)]
+        (offer-task sync sync-ch
+                    #(>!! ack-head %)
+                    #(>!! exhaust-head %)
+                    #(>!! complete-head %)
+                    #(thread (<!! (timeout revoke-delay))
+                             (>!! revoke-head %)))
+        (extensions/checkpoint sync :offer-log offset)
+        (recur)))))

 (defn offer-revoke-ch-loop [sync sync-ch offer-revoke-tail evict-head]
   (loop []
-    (when-let [{:keys [peer-node ack-node]} (<!! offer-revoke-tail)]
-      (revoke-offer sync sync-ch peer-node ack-node #(>!! evict-head %))
-      (recur))))
+    (when (<!! offer-revoke-tail)
+      (let [offset (extensions/next-offset sync :revoke-log)
+            {:keys [peer-node ack-node]} (extensions/log-entry-at sync :revoke-log offset)]
+        (revoke-offer sync sync-ch peer-node ack-node #(>!! evict-head %))
+        (extensions/checkpoint sync :revoke-log offset)
+        (recur)))))

 (defn exhaust-queue-loop [sync sync-ch exhaust-tail seal-head]
   (loop []
@@ -199,12 +215,15 @@

 (defn seal-resource-loop [sync seal-tail exhaust-head]
   (loop []
-    (when-let [result (<!! seal-tail)]
-      (seal-resource
-       sync
-       (:seal? result) (:seal-node result)
-       (:exhaust-node result) exhaust-head)
-      (recur))))
+    (when (<!! seal-tail)
+      (let [offset (extensions/next-offset sync :seal-log)
+            result (extensions/log-entry-at sync :seal-log offset)]
+        (seal-resource
+         sync
+         (:seal? result) (:seal-node result)
+         (:exhaust-node result) exhaust-head)
+        (extensions/checkpoint sync :seal-log offset)
+        (recur)))))

 (defn completion-ch-loop
   [sync sync-ch complete-tail offer-head complete-head]


tempo is a better fn name than speed-up.

--- src/overtunes/songs/at_all.clj
+++ src/overtunes/songs/at_all.clj
@@ -10,7 +10,7 @@
     #(+ start (* ms-per-beat %))))

 (defn from [timing offset] #(timing (+ offset %)))
-(defn speed-up [timing factor] #(timing (/ % factor)))
+(defn tempo [timing factor] #(timing (/ % factor)))

 (def scale 60)
 (defn ground [note] (+ scale note))
@@ -69,7 +69,7 @@
 (defn first-bit# [timing]
   (-> timing
     (from -1)
-    (speed-up 2)
+    (tempo 2)
     (even-melody# (map ionian [2 4 5 4 4 2 4]))
     (from 9)
     (even-melody# (map ionian [-2 1 2 1 1 -2 1]))
@@ -81,7 +81,7 @@

 (defn variation# [timing]
   (-> timing
-    (speed-up 2)
+    (tempo 2)
     (from 9)
     (even-melody# (map ionian [11 11 12 9 7]))
     (from 11)
@@ -95,7 +95,7 @@
 (defn final-chord# [timing]
   (-> timing
     (from -1)
-    (speed-up 2)
+    (tempo 2)
     (even-melody# (map ionian [11 13 14])))
   (at (timing 0)
       (chord# (update-in I [:i] raise))))


Truncate should happen even if value of unit is 0

--- src/metabase/driver/druid/query_processor.clj
+++ src/metabase/driver/druid/query_processor.clj
@@ -44,9 +44,7 @@
   DateTimeField         (->rvalue [this] (->rvalue (:field this)))
   Value                 (->rvalue [this] (:value this))
   DateTimeValue         (->rvalue [{{unit :unit} :field, value :value}] (u/date->iso-8601 (u/date-trunc-or-extract unit value)))
-  RelativeDateTimeValue (->rvalue [{:keys [unit amount]}] (if (zero? amount)
-                                                            (u/date->iso-8601)
-                                                            (u/date->iso-8601 (u/date-trunc-or-extract unit (u/relative-date unit amount))))))
+  RelativeDateTimeValue (->rvalue [{:keys [unit amount]}] (u/date->iso-8601 (u/date-trunc-or-extract unit (u/relative-date unit amount)))))

 (defprotocol ^:private IDimensionOrMetric
   (^:private dimension-or-metric? [this]


Round the value returned for distinct count by druid

--- src/metabase/driver/druid/query_processor.clj
+++ src/metabase/driver/druid/query_processor.clj
@@ -41,7 +41,7 @@
   Object                (->rvalue [this] this)
   AgFieldRef            (->rvalue [_] (let [ag-type (or (get-in *query* [:aggregation :aggregation-type])
                                                         (throw (Exception. "Unknown aggregation type!")))]
-                                        (if (= ag-type :distinct) :count
+                                        (if (= ag-type :distinct) :distinct___count
                                             ag-type)))
   Field                 (->rvalue [this] (:field-name this))
   DateTimeField         (->rvalue [this] (->rvalue (:field this)))
@@ -150,7 +150,7 @@
                                                            {:type :fieldAccess, :fieldName :___count}]}]}

                [:distinct _] {:aggregations [{:type       :cardinality
-                                              :name       :count
+                                              :name       :distinct___count
                                               :fieldNames [(->rvalue ag-field)]}]}
                [:sum      _] {:aggregations [(ag:doubleSum ag-field :sum)]}
                [:min      _] {:aggregations [(ag:doubleMin ag-field)]}
@@ -403,7 +403,7 @@
   (let [field             (->rvalue field)
         breakout-field    (->rvalue breakout-field)
         sort-by-breakout? (= field breakout-field)
-        ag-field          (if (= ag-type :distinct) :count ag-type)]
+        ag-field          (if (= ag-type :distinct) :distinct___count ag-type)]
     (assoc druid-query :metric (match [sort-by-breakout? direction]
                                  [true  :ascending]  {:type :alphaNumeric}
                                  [true  :descending] {:type :inverted, :metric {:type :alphaNumeric}}
@@ -554,15 +554,17 @@
 (defn- columns->getter-fns
   "Given a sequence of COLUMNS keywords, return a sequence of appropriate getter functions to get values from a single result row. Normally,
    these are just the keyword column names themselves, but for `:timestamp___int`, we'll also parse the result as an integer (for further
-   explanation, see the docstring for `units-that-need-post-processing-int-parsing`)."
+   explanation, see the docstring for `units-that-need-post-processing-int-parsing`). We also round `:distinct___count` in order to return an
+   integer since Druid returns the approximate floating point value for cardinality queries (See Druid documentation regarding cardinality and HLL)."
   [columns]
   (vec (for [k columns]
-         (if (not= k :timestamp___int)
-           k
-           (comp (fn [^String s]
-                   (when (seq s)
-                     (Integer/parseInt s)))
-                 k)))))
+         (case k
+            :distinct___count (comp #(Math/round %) k)
+            :timestamp___int  (comp (fn [^String s]
+                                      (when (seq s)
+                                        (Integer/parseInt s)))
+                                    k)
+            k))))

 (defn execute-query
   "Execute a query for a Druid DB."
@@ -579,7 +581,8 @@
         columns    (keys (first results))
         getters    (columns->getter-fns columns)]
     ;; rename any occurances of `:timestamp___int` to `:timestamp` in the results so the user doesn't know about our behind-the-scenes conversion
-    {:columns   (vec (replace {:timestamp___int :timestamp} columns))
+    ;; and apply any other post-processing on the value such as parsing some units to int and rounding up approximate cardinality values.
+    {:columns   (vec (replace {:timestamp___int :timestamp :distinct___count :count} columns))
      :rows      (for [row results]
                   (for [getter getters]
                     (getter row)))


Simplify template.cljs a little

Simplify template.cljs a little

--- src/reagent/impl/template.cljs
+++ src/reagent/impl/template.cljs
@@ -39,13 +39,13 @@
                          :for "htmlFor"
                          :charset "charSet"})

-(defn obj-get [o k]
+(defn cache-get [o k]
   (when ^boolean (.hasOwnProperty o k)
     (aget o k)))

 (defn cached-prop-name [k]
   (if (named? k)
-    (if-some [k' (obj-get prop-name-cache (name k))]
+    (if-some [k' (cache-get prop-name-cache (name k))]
       k'
       (aset prop-name-cache (name k)
             (util/dash-to-camel k)))
@@ -68,30 +68,32 @@
         (coll? x) (clj->js x)
         (ifn? x) (fn [& args]
                    (apply x args))
-        true (clj->js x)))
-
-(defn set-id-class [props id class]
-  (let [p (if (nil? props) #js{} props)]
-    (when (and (some? id)
-               (nil? (.' p :id)))
-      (.! p :id id))
-    (when (some? class)
-      (let [old (.' p :className)]
-        (.! p :className (if (some? old)
-                           (str class " " old)
-                           class))))
-    p))
+        :else (clj->js x)))
+
+(defn oset [o k v]
+  (doto (if (nil? o) #js{} o)
+    (aset k v)))
+
+(defn oget [o k]
+  (if (nil? o) nil (aget o k)))
+
+(defn set-id-class [p id-class]
+  (let [id (.' id-class :id)
+        p (if (and (some? id)
+                   (nil? (oget p "id")))
+            (oset p "id" id)
+            p)]
+    (if-some [class (.' id-class :className)]
+      (let [old (oget p "className")]
+        (oset p "className" (if (nil? old)
+                              class
+                              (str class " " old))))
+      p)))

 (defn convert-props [props id-class]
-  (let [id (.' id-class :id)
-        class (.' id-class :className)
-        no-id-class (and (nil? id) (nil? class))]
-    (if (and no-id-class (empty? props))
-      nil
-      (let [objprops (convert-prop-value props)]
-        (if no-id-class
-          objprops
-          (set-id-class objprops id class))))))
+  (-> props
+      convert-prop-value
+      (set-id-class id-class)))

 ;;; Specialization for input components
@@ -215,22 +217,26 @@
         :id id
         :className class}))

+(defn try-get-key [x]
+  ;; try catch to avoid clojurescript peculiarity with
+  ;; sorted-maps with keys that are numbers
+  (try (get x :key)
+       (catch :default e)))
+
 (defn get-key [x]
   (when (map? x)
-    ;; try catch to avoid clojurescript peculiarity with
-    ;; sorted-maps with keys that are numbers
-    (try (get x :key)
-         (catch :default e))))
+    (try-get-key x)))

 (defn key-from-vec [v]
-  (if-some [k (some-> (meta v) get-key)]
+  (if-some [k (-> (meta v) get-key)]
     k
     (-> v (nth 1 nil) get-key)))

 (defn reag-element [tag v]
   (let [c (comp/as-class tag)
         jsprops #js{:argv v}]
-    (some->> v key-from-vec (.! jsprops :key))
+    (when-some [key (key-from-vec v)]
+      (.! jsprops :key key))
     (.' util/react createElement c jsprops)))

 (defn adapt-react-class [c]
@@ -242,7 +248,7 @@
 (def tag-name-cache #js{})

 (defn cached-parse [x]
-  (if-some [s (obj-get tag-name-cache x)]
+  (if-some [s (cache-get tag-name-cache x)]
     s
     (aset tag-name-cache x (parse-tag x))))

@@ -258,11 +264,10 @@
         (-> [(reagent-input) argv comp jsprops first-child]
             (with-meta (meta argv))
             as-element)
-        (let [key (some-> (meta argv) get-key)
+        (let [key (-> (meta argv) get-key)
               p (if (nil? key)
                   jsprops
-                  (doto (if (nil? jsprops) #js{} jsprops)
-                    (.! :key key)))]
+                  (oset jsprops "key" key))]
           (make-element argv comp p first-child))))))

 (defn str-coll [coll]
@@ -279,7 +284,7 @@

 (defn vec-to-elem [v]
   (assert (pos? (count v)) (hiccup-err v "Hiccup form should not be empty"))
-  (let [tag (nth v 0)]
+  (let [tag (nth v 0 nil)]
     (assert (valid-tag? tag) (hiccup-err v "Invalid Hiccup form"))
     (cond
       (hiccup-tag? tag)
@@ -287,7 +292,7 @@
             pos (.indexOf n ">")]
         (case pos
           -1 (native-element (cached-parse n) v 1)
-          0 (let [comp (nth v 1)]
+          0 (let [comp (nth v 1 nil)]
               ;; Support [:> comp ...]
               (assert (= ">" n) (hiccup-err v "Invalid Hiccup tag"))
               (assert (or (string? comp) (fn? comp))
@@ -372,7 +377,7 @@
     0 (.' util/react createElement comp jsprops)

     1 (.' util/react createElement comp jsprops
-          (as-element (nth argv first-child)))
+          (as-element (nth argv first-child nil)))

     (.apply (.' util/react :createElement) nil
             (reduce-kv (fn [a k v]


Cleanup in the interests of information hiding: Roll private function into let binding.

--- src/rdf-repository/grafter/rdf/repository.clj
+++ src/rdf-repository/grafter/rdf/repository.clj
@@ -379,31 +379,30 @@
                                          sparql-string)]
       (.execute prepared-query))))

-(defn- ->uri [graph]
-  (if (instance? URI graph)
-    graph
-    (URIImpl. graph)))
-
 (defn make-restricted-dataset
   "Build a dataset to act as a graph restriction.  You can specify for
   both `:default-graph` and `:named-graphs`.  Both of which take sequences
   of URI strings."
   [& {:as options}]
-  (when options
-    (let [{:keys [default-graph named-graphs]
-           :or {default-graph [] named-graphs []}} options
-           private-graph "urn:private-graph-to-force-restrictions-when-no-graphs-are-listed"
-           dataset (DatasetImpl.)]
-      (if (string? default-graph)
-        (.addDefaultGraph dataset (->uri default-graph))
-
-        (doseq [graph (conj default-graph private-graph)]
-          (.addDefaultGraph dataset (->uri graph))))
-      (if (string? named-graphs)
-        (.addNamedGraph dataset (->uri named-graphs))
-        (doseq [graph named-graphs]
-          (.addNamedGraph dataset (->uri graph))))
-      dataset)))
+  (let [->uri (fn [graph]
+                (if (instance? URI graph)
+                  graph
+                  (URIImpl. graph)))]
+    (when options
+      (let [{:keys [default-graph named-graphs]
+             :or   {default-graph [] named-graphs []}} options
+            private-graph "urn:private-graph-to-force-restrictions-when-no-graphs-are-listed"
+            dataset (DatasetImpl.)]
+        (if (string? default-graph)
+          (.addDefaultGraph dataset (->uri default-graph))
+
+          (doseq [graph (conj default-graph private-graph)]
+            (.addDefaultGraph dataset (->uri graph))))
+        (if (string? named-graphs)
+          (.addNamedGraph dataset (->uri named-graphs))
+          (doseq [graph named-graphs]
+            (.addNamedGraph dataset (->uri graph))))
+        dataset))))

 (defn- mapply [f & args]
   (apply f (apply concat (butlast args) (last args))))


main-html now takes the posts atom as a parameter

--- src/saved_for_reddit/core.cljs
+++ src/saved_for_reddit/core.cljs
@@ -55,11 +55,11 @@
     [:small "submitted by " [:a {:href (str "https://www.reddit.com/user/" (:author p))} [:small (:author p)]]
      " on " (timef/unparse time-formatter (timec/from-long (* 1000 (+ (:created_utc p) (* 3600 (.getTimezoneOffset (js/Date.))) ))))]]])

-(defn main-html []
+(defn main-html [posts]
   [:div {:class "col-md-12"}
    [:h4 "Saved Posts"]
    [:div {:class "list-group"}
-    (for [p @saved-posts]
+    (for [p @posts]
       [post-html p])]
    [:div {:class "row"}
     [:div {:class "col-md-12"}
@@ -145,7 +145,7 @@
       (if (and (nil? code) (clojure.string/blank? (:token @app-state))) ;; code query param is not present or the token is blank in HTML5 localStorage
         (set! (.-location js/window) (gen-reddit-auth-url client-id redirect-uri "abcdef")) ;; redirect to reddit for requesting authorization
         (do
-          (r/render-component [main-html] (dommy/sel1 :#app))
+          (r/render-component [main-html saved-posts] (dommy/sel1 :#app))
           (if (not (clojure.string/blank? (:token @app-state)))
             (do
               (process-after-token-acquire))


adding missing image-type

adding missing image-type

--- test/vignette/storage/core_test.clj
+++ test/vignette/storage/core_test.clj
@@ -10,6 +10,7 @@
 (def local-path "/tmp/vignette-local-storage")

 (def sample-media-hash {:wikia "lotr"
+                        :image-type "images"
                         :top-dir "3"
                         :middle-dir "35"
                         :request-type :original


Avoid serialization error seeding a map and remove manager waiting now that we depend on it, dammit

--- modules/cache/src/main/clojure/immutant/cache.clj
+++ modules/cache/src/main/clojure/immutant/cache.clj
@@ -20,23 +20,11 @@
   (:require [clojure.core.cache]
             [immutant.registry :as lookup])
   (:import [clojure.core.cache CacheProtocol]
-           [org.jboss.msc.service ServiceName]
-           [org.projectodd.polyglot.core.util ClusterUtil]
            [org.infinispan.config Configuration$CacheMode]
            [org.infinispan.manager DefaultCacheManager]))

 (def local-manager (DefaultCacheManager.))
-
-(defn wait-for-clustered-manager []
-  (if (and lookup/msc-registry (ClusterUtil/isClustered lookup/msc-registry))
-    (loop [attempts 30]
-      (let [svc (.append ServiceName/JBOSS (into-array ["infinispan" "web"]))]
-        (or (lookup/fetch svc)
-            (when (> attempts 0)
-              (Thread/sleep 1000)
-              (recur (dec attempts))))))))
-
-(def clustered-manager (wait-for-clustered-manager))
+(def clustered-manager (lookup/fetch "jboss.infinispan.web"))

 (defcache InfinispanCache [cache]
   CacheProtocol
@@ -108,8 +96,8 @@

 (defn cache
   "The entry point to determine whether clustered or local"
-  ([name] (cache name nil {}))
-  ([name v] (if (keyword? v) (cache name v {}) (cache name nil v)))
+  ([name] (cache name nil nil))
+  ([name v] (if (keyword? v) (cache name v nil) (cache name nil v)))
   ([name mode seed]
      (if clustered-manager
        (clustered-cache name :mode (or mode :invalidated) :base seed)


use pmap for aliases as well

use pmap for aliases as well

--- src/skream/core.clj
+++ src/skream/core.clj
@@ -114,17 +114,14 @@
 (defn add-num
   ([sk] sk)
   ([sk x]
-    (let [added-sk (apply merge (pmap (fn [add-fn] (add-fn sk x)) (vals (:add-fn-map (meta sk)))))
+    (let [added-sk (apply merge-with-meta (pmap (fn [add-fn] (add-fn sk x))
+                                      (vals (:add-fn-map (meta sk)))))
           alias-map (:alias-map (meta sk))
-          aliased-sk (loop [current-alias-keys (keys alias-map)
-                            current-alias-map-results {}]
-                       (if (empty? current-alias-keys) current-alias-map-results
-                         (let [alias-target (first current-alias-keys)
-                               alias-src (get alias-map alias-target)
-                               alias-src-val (get added-sk alias-src)]
-                           (recur
-                             (rest current-alias-keys)
-                             (merge current-alias-map-results { alias-target (get added-sk alias-src) })))))]
+          aliased-sk (apply merge (pmap (fn [alias-target]
+                                          (let [alias-src (get alias-map alias-target)
+                                                alias-src-val (get added-sk alias-src)]
+                                            { alias-target alias-src-val }))
+                                        (keys alias-map)))]
       (merge (merge-with-meta sk added-sk) aliased-sk)))
   ([sk x & xs]
     (loop [current-xs xs


Bump cljs version

Bump cljs version

--- build.boot
+++ build.boot
@@ -1,7 +1,7 @@
 (set-env!
   :resource-paths #{"src/cljc" "src/js/foreign"}
   :dependencies   '[[org.clojure/clojure         "1.9.0-alpha16"]
-                    [org.clojure/clojurescript   "1.9.521"]
+                    [org.clojure/clojurescript   "1.9.522"]

                     [adzerk/boot-test            "1.2.0"     :scope "test"]
                     [pandeiro/boot-http          "0.7.6"     :scope "test"]
@@ -18,6 +18,8 @@
                     [org.clojure/tools.nrepl     "0.2.12"    :scope "test"]
                     [viebel/codox-klipse-theme   "0.0.4"     :scope "test"]
                     [nodisassemble               "0.1.3"     :scope "test"]])
+
+(load-data-readers!)

 (require '[clojure.java.io :as io]
          '[clojure.pprint :as pprint]


Add boot task called cljs-api for generating cljs-repl-web.cljs-api

--- build.boot
+++ build.boot
@@ -26,8 +26,6 @@
                  [cljsjs/highlight            "8.4-0"]
                  [re-com                      "0.7.0-alpha2"]
                  [cljs-ajax                   "0.5.1"]
-                 [endophile                   "0.1.2"]
-                 [markdown-clj                "0.9.78"]
                  [hickory                     "0.5.4"]
                  [cljsjs/showdown             "0.4.0-1"]
                  [org.clojure/tools.reader    "1.0.0-alpha3"]
@@ -38,12 +36,18 @@
                  [day8/re-frame-tracer        "0.1.0-SNAPSHOT"]
                  [cljsjs/codemirror           "5.10.0-0"]])

-(require '[adzerk.boot-cljs             :refer [cljs]]
-         '[adzerk.boot-reload           :refer [reload]]
-         '[pandeiro.boot-http           :refer [serve]]
-         '[crisptrutski.boot-cljs-test  :refer [test-cljs]]
-         '[adzerk.boot-cljs-repl        :refer [cljs-repl start-repl]]
-         '[boot-semver.core :refer :all])
+(def generator-deps '[[org.clojure/clojure         "1.7.0"]
+                      [org.clojure/tools.reader    "1.0.0-alpha3"]
+                      [endophile                   "0.1.2"]
+                      [markdown-clj                "0.9.78"]])
+
+(require '[adzerk.boot-cljs            :refer [cljs]]
+         '[adzerk.boot-reload          :refer [reload]]
+         '[pandeiro.boot-http          :refer [serve]]
+         '[crisptrutski.boot-cljs-test :refer [test-cljs]]
+         '[adzerk.boot-cljs-repl       :refer [cljs-repl start-repl]]
+         '[boot-semver.core            :refer :all]
+         '[boot.pod                    :as pod])

 (def +version+ (get-version))

@@ -74,6 +78,13 @@
 (defmulti options
   "Return the correct option map for the build, dispatching on identity"
   identity)
+
+(defmethod options :generator
+  [selection]
+  {:type :generator
+   :env {:source-paths #{"src/clj"}
+         :dependencies generator-deps
+         :resource-paths #{"dev-resources"}}})

 (defmethod options :dev
   [selection]
@@ -155,3 +166,25 @@
   (comp (watch)
         (if no-sounds identity (speak))
         (test :type :dev)))
+
+(deftask cljs-api
+  "The task generates the Clojurescript API and the cljs-repl-web.cljs-api
+  namespace. It does NOT add it to the fileset, but calls
+  cljs-api.generator/-main and dump in src/cljs."
+  []
+  (with-pass-thru fs
+    (boot.util/info "Generating...\n")
+    (let [custom-env (:env (options :generator))
+          source-paths (:source-paths custom-env)
+          resource-paths (:resource-paths custom-env)
+          pod-env (assoc-in (get-env) [:dependencies] (:dependencies custom-env))]
+      (let [pod (future (pod/make-pod pod-env))]
+        (pod/with-eval-in @pod
+          (boot.util/dbug "Directories %s\n" (with-out-str (clojure.pprint/pprint boot.pod/env)))
+          (doseq [src ~source-paths]
+            (boot.pod/add-classpath src))
+          (doseq [resource ~resource-paths]
+            (boot.pod/add-classpath resource))
+          (require 'cljs-api.generator)
+          (cljs-api.generator/-main))
+        (pod/destroy-pod @pod)))))


Rename boot task "solver" to "make-solver"

--- build.boot
+++ build.boot
@@ -101,7 +101,7 @@
     (reset! watcher (watch-dir fix-path (io/file ".")))
     fs))

-(deftask solver []
+(deftask make-solver []
   (comp
    (build)
    (target "target")))
@@ -113,7 +113,7 @@

 (deftask tests []
   (comp
-   (solver)
+   (make-solver)
    (testing)
    (test)))

@@ -140,7 +140,7 @@
 (deftask dev-clj []
   (comp
    (fix)
-   (solver)
+   (make-solver)
    (watch :verbose true)
    (testing)
    (test)))
@@ -160,7 +160,7 @@
 (deftask dev []
   (comp
    (fix)
-   (solver)
+   (make-solver)
    (environ :env {:http-port "3000"})
    (repl)
    (figwheel)
@@ -174,7 +174,8 @@
    (sass)
    (sift :move {#"herder/sass/(.*)" "resources/public/css/$1"})
    (target :no-clean true)
-   (system :sys #'dev-system :auto true :files ["lobos.clj" "handler.clj"])
+   (system :sys #'dev-system :auto true :files ["lobos.clj" "handler.clj" "solver.clj" "systems.clj"])
+   (make-solver)
    (testing)
    (test)
    (kill-pods)))


Clean up set-fn maps once empty.

Clean up set-fn maps once empty.

--- src/afterglow/show.clj
+++ src/afterglow/show.clj
@@ -295,8 +295,10 @@
   {:pre [(some? *show*) (fn? f)]}
   (swap! (:variables *show*) (fn [vars]
                                (let [key (keyword key)
-                                     entry (get-in vars ["set-fn" key])]
-                                 (assoc-in vars ["set-fn" key] (dissoc entry f)))))
+                                     entry (dissoc (get-in vars ["set-fn" key]) f)]
+                                 (if (empty? entry)
+                                   (assoc vars "set-fn" (dissoc (get vars "set-fn") key))
+                                   (assoc-in vars ["set-fn" key] entry)))))
   nil)

 (defn set-variable!


Add simpler middleware for auth

Add simpler middleware for auth

--- src/time_tracker/auth/core.clj
+++ src/time_tracker/auth/core.clj
@@ -43,3 +43,6 @@
     (if-let [user-information (auth-credentials client-ids request)]
       (handler (assoc request :credentials user-information))
       util/forbidden-response)))
+
+(def wrap-auth
+  #(wrap-google-authenticated % config/client-ids))