Chapter 3 is huge!

Chapter 3 is huge!

--- clojure-programming/src/clojure_programming/chp03.clj
+++ clojure-programming/src/clojure_programming/chp03.clj
@@ -443,12 +443,12 @@
   ;; => 10
   )

-"
+"
 since 'cons' and 'list*' don't force realization of a values in s 'seq' these
  functions are key to building lazy sequences.

-so build a sequence with concrete values 'consed' onto a lazy tail, that
-suspends it's computation.
+so build a sequence with concrete values 'consed' onto a lazy tail, that
+suspends it's computation.
 "
 "
 a simpler solution using composition of random-int and repeatedly:
@@ -498,7 +498,7 @@

 - 'assoc' creates new associations between keys and values in a collection.
 - 'dissoc' drops association for keys in the collection.
-- 'get' looks up a value in a collection.
+- 'get' looks up a value in a collection.
 - 'contains?' a predicate that returns whether a key is in the collection.

 The most used structure is the 'map'."
@@ -979,7 +979,7 @@
 "
 also not all collections can act as functions

-but if the keys are not keywords or symbols then the collection or
+but if the keys are not keywords or symbols then the collection or
 'get' or 'nth' must be used
 "

@@ -997,7 +997,7 @@
               {:name "Sara" :location "NYC"}])
   => '("David" "Suzanne" "Sara"))

-(facts "'some' searches for the first values in  a sequnce that
+(facts "'some' searches for the first values in  a sequnce that
          logically returns true"
   (fact
     (some #{1 3 7} [0  2 4 5 6])
@@ -1167,20 +1167,361 @@
   (map val m)
   => '(3 2 1))

-
-
-
-
+"
+Maps as ad-hoc structs
+
+Maps a very flexible and alow data modeling even before the design
+ is nailed down.
+"
+(def playlist
+  [{:title "Elephant", :artist "The White Stripes", :year 2003}
+   {:title "Helioself", :artist "Papas Fritas", :year 1997}
+   {:title "Stories from the City, Stories from the Sea",
+    :artist "PJ Harvey", :year 2000}
+   {:title "Buildings and Grounds", :artist "Papas Fritas", :year 2000}
+   {:title "Zen Rodeo", :artist "Mardi Gras BB", :year 2002}])
+
+"
+the (:slot data) idiom
+"
+(fact "querying data agregates"
+  (map :title playlist)
+  => '("Elephant" "Helioself" "Stories from the City, Stories from the Sea" "Buildings and Grounds" "Zen Rodeo"))
+
+"associative destructuring eliminates the more verbose
+ (:slot data) access"
+(defn summarize [{:keys [title artist year]}]
+  (str title " / " artist " / " year))
+
+(summarize playlist)
+
+"other use for maps
+Maps can be used as summaries, indexes or translation tables
+"
+"
+'group-by' is useful to partition a collection using a key function
+"
+(fact "group by 3's"
+  (group-by #(rem % 3) (range 10))
+  => {0 [0 3 6 9], 1 [1 4 7], 2 [2 5 8]})
+
+(fact "group by artist"
+  (group-by :artist playlist)
+  => {"The White Stripes" [{:artist "The White Stripes", :title "Elephant", :year 2003}],
+      "Papas Fritas" [{:artist "Papas Fritas", :title "Helioself", :year 1997}
+                      {:artist "Papas Fritas", :title "Buildings and Grounds", :year 2000}],
+      "PJ Harvey" [{:artist "PJ Harvey", :title "Stories from the City, Stories from the Sea", :year 2000}],
+      "Mardi Gras BB" [{:artist "Mardi Gras BB", :title "Zen Rodeo", :year 2002}]})
+
+"indexing by two columns: (group-by (juxt :col1 :col1) data)
+
+producing a summary:
+"
+(comment "key-fn summary are place holder functions"
+  (into {} (for [[k v] (group-by key-fn coll)]
+             [k (summarize v)]))
+  )
+
+
+(defn reduce-by
+  [key-fn f init coll]
+  (reduce (fn [summaries x]
+            (let [k (key-fn x)]
+              (assoc summaries k (f (summaries k init) x))))
+          {} coll))
+
+"
+a list of purchase orders to ACME Corp, represented using plain
+maps as “structs”:"
+(def orders
+  [{:product "Clock", :customer "Wile Coyote", :qty 6, :total 300}
+   {:product "Dynamite", :customer "Wile Coyote", :qty 20, :total 5000}
+   {:product "Shotgun", :customer "Elmer Fudd", :qty 2, :total 800}
+   {:product "Shells", :customer "Elmer Fudd", :qty 4, :total 100}
+   {:product "Hole", :customer "Wile Coyote", :qty 1, :total 1000}
+   {:product "Anvil", :customer "Elmer Fudd", :qty 2, :total 300}
+   {:product "Anvil", :customer "Wile Coyote", :qty 6, :total 900}])
+
+(fact "With reduce-by, we can easily compute order totals by customer:"
+  (reduce-by :customer #(+ %1 (:total %2)) 0 orders)
+  => {"Elmer Fudd" 1200, "Wile Coyote" 7200})
+
+(fact "get customers for each product"
+  (reduce-by :product #(conj %1 (:customer %2)) #{} orders)
+  => {"Anvil" #{"Elmer Fudd" "Wile Coyote"},
+      "Hole" #{"Wile Coyote"}
+      "Shells" #{"Elmer Fudd"},
+      "Shotgun" #{"Elmer Fudd"},
+      "Dynamite" #{"Wile Coyote"},
+      "Clock" #{"Wile Coyote"}})
+
+"
+functions to do two level breakup, all orders by customer then by product.
+"
+(fn [order]
+  [(:customer order) (:product order)])
+
+#(vector (:customer %) (:product %))
+
+(fn [{:keys [customer product]}]
+  [customer product])
+
+(juxt :customer :product)
+
+(fact "using 'juxt'"
+  (reduce-by (juxt :customer :product)
+             #(+ %1 (:total %2)) 0 orders)
+  => {["Wile Coyote" "Anvil"] 900,
+      ["Elmer Fudd" "Anvil"] 300,
+      ["Wile Coyote" "Hole"] 1000,
+      ["Elmer Fudd" "Shells"] 100,
+      ["Elmer Fudd" "Shotgun"] 800,
+      ["Wile Coyote" "Dynamite"] 5000,
+      ["Wile Coyote" "Clock"] 300})
+
+"reduce-by now works with nested maps by replacing calls to 'assoc' with
+ 'assoc-in' and 'get-in'"
+(defn reduce-by-in
+  [keys-fn f init coll]
+  (reduce (fn [summaries x]
+            (let [ks (keys-fn x)]
+              (assoc-in summaries ks
+                        (f (get-in summaries ks init) x))))
+          {} coll))
+(fact "now we get two level breakup"
+  (reduce-by-in (juxt :customer :product)
+                #(+ %1 (:total %2)) 0 orders)
+  => {"Elmer Fudd" {"Anvil" 300, "Shells" 100, "Shotgun" 800},
+      "Wile Coyote" {"Anvil" 900, "Hole" 1000, "Dynamite" 5000, "Clock" 300}}
+  )
+
+"
+or we can break transform our output: "
+(def flat-breakup
+  {["Wile Coyote" "Anvil"] 900,
+   ["Elmer Fudd" "Anvil"] 300,
+   ["Wile Coyote" "Hole"] 1000,
+   ["Elmer Fudd" "Shells"] 100,
+   ["Elmer Fudd" "Shotgun"] 800,
+   ["Wile Coyote" "Dynamite"] 5000,
+   ["Wile Coyote" "Clock"] 300})
+
+(fact "... using 'assoc-in:"
+  (reduce #(apply assoc-in %1 %2) {} flat-breakup)
+  => {"Wile Coyote" {"Anvil" 900, "Hole" 1000, "Dynamite" 5000, "Clock" 300},
+      "Elmer Fudd" {"Anvil" 300, "Shotgun" 800, "Shells" 100}})

 [[:section {:title "Immutability and Persistence --  page: 122"}]]

+(def v (vec (range 1e6))) ;; a vector containing a million values
+
+(fact
+  (count v)
+  => 1000000 )
+
+(def v2 (conj v 1e6)) ; 'conj' a value to 'v'
+
+(fact "Clojures data structures are immuatable"
+  (count v)
+  => 1000000
+  (count v2)
+  => 1000001)
+
+" How does Clojure do this efficiently? "
+
 [[:subsection {:title "Persistence and Structural Sharing --  page: 123"}]]

+"
+Persistence is the reuse of internal datastructures in derived data.
+"
+(def a (list 1 2 3)) ; given a list
+(fact a => '(1 2 3))
+"
+'conj'ing to a list is a constant time operation.
+It: copies no data, original list is not modified, old list
+and new list share the old's structure.
+"
+(def b (conj a 0))
+(fact b => '(0 1 2 3))
+
+"
+poping the head of a list is also a constant time operation
+(it just move a pointer):
+"
+(def c (rest a))
+(fact c => '(2 3))
+
+"
+Can maps and vectors and sets be as effiecient?
+"
+
+;; an example:
+(def a1 {:a 5 :b 6 :c 7 :d 8})
+
+(fact "Let's update our map"
+  (def b1 (assoc a1 :c 0))
+
+  b1 => '{:c 0, :b 6, :d 8, :a 5}
+
+  )
+
+(fact "removing a value share structure too "
+  (def c1 (dissoc a1 :d))
+  c1 => '{:c 7, :b 6, :a 5})
+
+"
+Tangible benefits:
+
+Enabling concurrency.
+
+Free versioning.
+"
+
+(def version1 {:name "Chas" :info {:age 31}})
+
+(def version2 (update-in version1 [:info :age] + 3))
+
+(fact "versioning"
+  version1
+  => {:info {:age 31}, :name "Chas"}
+  version2
+  => {:info {:age 34}, :name "Chas"})
+"
+'update-in' updates the value identified by the vector arguement located
+in the nested structure by applying the given function and producing
+a new structure.
+"
+
 [[:subsection {:title "Transients --  page: 130"}]]
+"
+transient data structures are the opposite of pesistent.
+based on the notion if noone notices if a data structure is mutated, does
+that mutation hurt anyone?
+"
+(def x (transient []))  ; a transient vector using a persistent
+                        ; vector as a base
+(def y (conj! x 1))     ; a single value is destructively added to vector
+
+(facts
+  (fact "new vector"
+    (count y)
+    => 1)
+  (fact "old vector modified!"
+    (count x)
+    => 1))
+
+"
+this is useful for implementing efficient functions that use datastructures.
+
+"
+(fact "example 'into'"
+  (into #{} (range 5))
+  => #{0 1 4 3 2})
+
+(defn naive-into
+  [coll source]
+  (reduce conj coll source))
+
+(fact "same results"
+  (= (into #{} (range 500))
+     (naive-into #{} (range 500)))
+  => true)
+
+(time (do (into #{} (range 1e6))
+          nil))
+;;=> "Elapsed time: 5558.42672 msecs"
+
+(time (do (naive-into #{} (range 1e6))
+          nil))
+;;=> "Elapsed time: 21497.8682 msecs"
+
+(defn faster-into
+  [coll source]
+  (persistent! (reduce conj! (transient coll) source)))
+
+(time (do (faster-into #{} (range 1e6))
+          nil))
+;;=> "Elapsed time: 7073.91604 msecs"
+
+;; check if collection has transients:
+(defn transient-capable?
+  "Returns true if a transient can be obtained for the given collection.
+  i.e. tests if `(transient coll)` will succeed."
+  [coll]
+  (instance? clojure.lang.IEditableCollection coll))
+
+(fact
+  (transient-capable? '(1 2 3)) => false
+  (transient-capable? #{1 2 3}) => true
+  (transient-capable? {:a 1 :b 2}) => true
+  (transient-capable? [1 2 3]) => true)
+
+"
+a persistent collection used as a transient is unaffected
+"
+(def v [1 2])
+;;= #'user/v
+
+(def tv (transient v))
+;;= #'user/tv
+(fact
+  (conj v 3)
+  => [1 2 3])
+
+;;(persistent! tv)
+;;= [1 2]
+;;(get tv 0)
+;; TODO: work on transients later.

 [[:section {:title "Metadata --  page: 134"}]]
+(def a ^{:created (System/currentTimeMillis)}
+  [1 2 3])
+
+(meta a)
+;;> {:created 1427329661290}
+
+"
+meta data that contains only slots that are keywords and whose values
+are 'true' can be provided in short form and can be stack with other
+values:
+"
+(fact
+  (meta ^:private [1 2 3])
+  => {:private true}
+  (meta ^:private ^:dynamic [1 2 3])
+  => {:private true, :dynamic true})
+
+"
+'with-meta' and 'vary-meta' functions will update metadata
+"
+
+(def b (with-meta a (assoc (meta a)
+                           :modified (System/currentTimeMillis))))
+
+(meta b)
+;;=> {:modified 1427330784023, :created 1427330767808}
+
+(def b (vary-meta a assoc :modified (System/currentTimeMillis)))
+(meta b)
+;;=> {:modified 1427330819791, :created 1427330767808}
+
+(fact "meta data doesn't change values:"
+  (= a b)
+  => true
+  a => [1 2 3]
+  b => [1 2 3])
+
+(fact
+  (= ^{:a 5} 'any-value
+     ^{:b 5} 'any-value)
+  => true)
+
+(meta (conj a 500)) ;; 'modified' data keeps it's metadata
+;;=> {:created 1427331681601}

 [[:section {:title "Putting Clojure’s Collections to Work --  page: 136"}]]
+
+

 [[:subsection {:title "Identifiers and Cycles --  page: 137"}]]


Adding simple test case for exploration with incomplete counterexamples

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

--- src/conexp/tests/fca/exploration.clj
+++ src/conexp/tests/fca/exploration.clj
@@ -80,6 +80,13 @@
            #{(impl 3 ==> 1 2) (impl 1 2 ==> 3)}))
     (is (= 2 (count (objects (:context result)))))))

+(deftest test-explore-attributes-with-incomplete-counterexamples
+  (let [result (explore-attributes :context (make-context [] '[black blue green] [])
+                                   :incomplete-counterexamples true
+                                   :handler (fn [_ _ _ impl]
+                                              [[(gensym) (premise impl) (conclusion impl)]]))]
+    (is (empty? (:implications result)))))
+
 ;;;

 nil


cleaned up Leiningen project

cleaned up Leiningen project

--- cljx/plongeur-vdom/project.clj
+++ cljx/plongeur-vdom/project.clj
@@ -1,8 +1,6 @@
 (defproject plongeur-vdom "0.1.0-SNAPSHOT"
-  :description "FIXME: write this!"
-  :url "http://example.com/FIXME"
-  :license {:name "Eclipse Public License"
-            :url "http://www.eclipse.org/legal/epl-v10.html"}
+
+  :description "Plongeur reactive frontend."

   :min-lein-version "2.5.3"

@@ -11,71 +9,57 @@
                  [org.clojure/core.async "0.2.374" :exclusions [org.clojure/tools.reader]]

                  [com.2tothe8th/dominator "0.4.0"]
-                 [jamesmacaulay/zelkova "0.4.0"]
-                 [stch-library/html "0.1.2"]
-                 [org.clojure/core.match "0.2.2"]
+                 [jamesmacaulay/zelkova   "0.4.0"]
+                 [stch-library/html       "0.1.2"]
+                 [org.clojure/core.match  "0.2.2"]

-                 [cljsjs/virtual-dom "2.1.1-0"]               ;; figure this out!
+                 ;[cljsjs/virtual-dom      "2.1.1-0"]
                  ]
-
+
   :plugins [[lein-figwheel "0.5.1"]
-            [lein-cljsbuild "1.1.2" :exclusions [[org.clojure/clojure]]]]
+            [lein-cljsbuild "1.1.3" :exclusions [[org.clojure/clojure]]]]

-  :source-paths ["src"]
+  :source-paths ["src" "script"]

-  :clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
+  :clean-targets ^{:protect false} ["resources/public/js/compiled"
+                                    "resources/private/js/compiled"
+                                    "target"]

-  :cljsbuild {:builds [{:id "dev"
-                        :source-paths ["src"]
+  :cljsbuild {:builds {:dev {:source-paths ["src"]

-                        ;; If no code is to be run, set :figwheel true for continued automagical reloading
-                        :figwheel {:on-jsload "plongeur-vdom.core/on-js-reload"}
+                             ;; If no code is to be run, set :figwheel true for continued automagical reloading
+                             :figwheel {:on-jsload "plongeur-vdom.core/on-js-reload"}

-                        :compiler {:main plongeur-vdom.core
-                                   :externs ["externs/dominator.js"]
-                                   :asset-path "js/compiled/out"
-                                   :output-to "resources/public/js/compiled/plongeur_vdom.js"
-                                   :output-dir "resources/public/js/compiled/out"
-                                   :source-map-timestamp true}}
+                             :compiler {:main plongeur-vdom.core
+                                        :externs ["externs/dominator.js"]
+                                        :asset-path "js/compiled/out"
+                                        :output-to "resources/public/js/compiled/plongeur_vdom.js"
+                                        :output-dir "resources/public/js/compiled/out"
+                                        :source-map-timestamp true}}

-                       ;; This next build is an compressed minified build for
-                       ;; production. You can build this with:
-                       ;; lein cljsbuild once min
-                       {:id "min"
-                        :source-paths ["src"]
-                        :compiler {:output-to "resources/public/js/compiled/plongeur_vdom.js"
-                                   :main plongeur-vdom.core
-                                   :externs ["externs/dominator.js"]
-                                   :optimizations :advanced
-                                   :pretty-print false}}]}
+                       ;; compressed minified build for production: `lein cljsbuild once min`
+                       :min {:source-paths ["src"]
+                             :compiler {:output-to "resources/public/js/compiled/plongeur_vdom.js"
+                                        :main plongeur-vdom.core
+                                        :externs ["externs/dominator.js"]
+                                        :optimizations :advanced
+                                        :pretty-print false}}

-  :figwheel {;; :http-server-root "public" ;; default and assumes "resources"
-             ;; :server-port 3449 ;; default
-             ;; :server-ip "127.0.0.1"
+                       :test {:source-paths ["src" "test"]
+                              :compiler {;:externs ["externs/dominator.js"]
+                                         :output-to "resources/private/js/compiled/unit-test.js"
+                                         :optimizations :whitespace
+                                         :preamble ["public/js/vdom.js"]
+                                         :pretty-print true}}}

-             :css-dirs ["resources/public/css"] ;; watch and update CSS
+              :test-commands {"unit" ["phantomjs"
+                                      "resources/private/js/compiled/unit-test.js"]}}

-             ;; Start an nREPL server into the running figwheel process
-             ;; :nrepl-port 7888
+  :profiles {:dev {:dependencies [[com.cemerick/piggieback "0.2.1"]
+                                  [org.clojure/tools.nrepl "0.2.10"]
+                                  [figwheel-sidecar        "0.5.1"]]
+                   :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}}

-             ;; Server Ring Handler (optional)
-             ;; if you want to embed a ring handler into the figwheel http-kit
-             ;; server, this is for simple ring servers, if this
-             ;; doesn't work for you just run your own server :)
-             ;; :ring-handler hello_world.server/handler
-
-             ;; To be able to open files in your editor from the heads up display
-             ;; you will need to put a script on your path.
-             ;; that script will have to take a file path and a line number
-             ;; ie. in  ~/bin/myfile-opener
-             ;; #! /bin/sh
-             ;; emacsclient -n +$2 $1
-             ;;
-             ;; :open-file-command "myfile-opener"
-
-             ;; if you want to disable the REPL
-             ;; :repl false
-
-             ;; to configure a different figwheel logfile path
-             ;; :server-logfile "tmp/logs/figwheel-logfile.log"
-             })
+  :figwheel {:css-dirs ["resources/public/css"] ;; watch and update CSS
+             :nrepl-port 7888} ;; Start an nREPL server into the running figwheel process
+  )


Better names for the example

Better names for the example

--- src/themis/core.clj
+++ src/themis/core.clj
@@ -55,15 +55,15 @@
          {}))

   (def valid-paul [[[:name :first] [(fn [t-map data-point opt-map] (and (= data-point "Paul")
-                                                                       {:a 1 :b 2}))]]
+                                                                        {:a 1 :b 2}))]]
                    [[:pets 0 0] [::w-pets {:pet-name-starts ""}]]
                    ;[[:*] ['degrandis-pets]] ;This is valid, but we can also just write:
                    [:* 'degrandis-pets]])

-  (def normal-paul (query/normalize valid-paul))
-  (validation-seq paul normal-paul)
-  (validation paul normal-paul)
-  (validation paul normal-paul identity)
+  (def paul-rules (query/normalize valid-paul))
+  (validation-seq paul paul-rules)
+  (validation paul paul-rules)
+  (validation paul paul-rules identity)

 )


p150 solved but timing out

p150 solved but timing out


Extract original spec and value from explain-data using CLJ-2085

--- src/spectrace/trace.cljc
+++ src/spectrace/trace.cljc
@@ -220,8 +220,5 @@
     (let [state (normalize {:spec spec :path path :val value :in in})]
       (trampoline rec state (constantly nil) [state]))))

-(defn traces
-  ([ed] (traces ed nil))
-  ([ed value]
-   (mapv #(trace % (first (:via %)) value)
-         (::s/problems ed))))
+(defn traces [{:keys [::s/spec ::s/value] :as ed}]
+  (mapv #(trace % (s/form spec) value) (::s/problems ed)))


Docstring

Docstring

--- src/tenor/constructs.clj
+++ src/tenor/constructs.clj
@@ -195,5 +195,6 @@
 ;; --- Multiple voices --- ;;

 (defn generate-parallel-voices [& body]
+  "Run multiple pieces concurrently using pmap."
   (pmap #(eval %) `(list ~@body)))


Pass pivot time as parameter to play-measure

--- src/tenor/constructs.clj
+++ src/tenor/constructs.clj
@@ -95,15 +95,16 @@
   and return overtone code that plays the note."
   `(list 'at ~time (list ~player ~entity)))

-(defmacro construct-measure [measure-maps base-time player]
+(defmacro construct-measure [measure-maps base-time player pivot-time]
   "Take a measure map and run construct-note on each
   note, creating a list of overtone playback code components."
-  `(map #(construct-note (+ (now) (* (:pos %) ~base-time))
+  `(map #(construct-note (+ ~pivot-time (* (:pos %) ~base-time))
                          ~player (:note %))
         ~measure-maps))

-(defn play-measure [measure-maps base-time player]
+(defn play-measure [measure-maps base-time player
+                    & {:keys [pivot-time] :or {pivot-time (now)}}]
   "Play the constructed measure with current time as start time."
-  `(let [time# (now)]
-     ~@(construct-measure measure-maps base-time player)))
+  `(let [time# ~pivot-time]
+     ~@(construct-measure measure-maps base-time player pivot-time)))


[#2620] Adapt merge dataset tx

[#2620] Adapt merge dataset tx

--- backend/src/akvo/lumen/lib/transformation/merge_datasets.clj
+++ backend/src/akvo/lumen/lib/transformation/merge_datasets.clj
@@ -101,7 +101,8 @@
                                      "geoshape" "geometry(GEOMETRY, 4326)"
                                      "number" "double precision"
                                      "multiple" "text"
-                                     "text" "text")})))
+                                     "text" "text"
+                                     "option" "text")})))

 (defn insert-merged-data
   "Insert the merged values into the target dataset"


Update close-ch logic

Update close-ch logic

--- src/zirconia/socket.cljs
+++ src/zirconia/socket.cljs
@@ -85,8 +85,7 @@

        (.on socket "connect"
             (fn []
-              (.log js/console (str "Connected to MPD: " host ":" port))
-              (close! open-ch)))
+              (.log js/console (str "Connected to MPD: " host ":" port))))

        (.on socket "error"
             (fn [error]
@@ -106,6 +105,7 @@
              #"^OK MPD.*"
              (do
                (.log js/console data)
+               (close! open-ch)
                (>! read-ch {:command :ok-mpd
                             :args []
                             :response data})


[WR] add incorrectly formatted value to errors

The incorrect value will make its way to the front-end as well!

--- src/vip/data_processor/validation/data_spec.clj
+++ src/vip/data_processor/validation/data_spec.clj
@@ -413,7 +413,7 @@
           (assoc-in ctx [:errors scope id name] ["Is not valid UTF-8."])

           (not (test-fn val))
-          (assoc-in ctx [:errors scope id name] [message])
+          (assoc-in ctx [:errors scope id name] [(str message ": " val)])

           :else ctx)))))


Change index lookup order to avoid double adds

--- src/aurora/language.cljs
+++ src/aurora/language.cljs
@@ -584,8 +584,10 @@
         val-ixes-a (ixes-of (concat vars-a vars-b) val-vars)
         val-ixes-b (ixes-of (concat vars-b vars-a) val-vars)
         [plan index-a] (add-flow plan (->Index nodes-a index-ixes-a))
-        [plan index-b] (add-flow plan (->Index nodes-b index-ixes-b))
+        index-b (inc (count (:node->flow plan))) ;; gross :(
         [plan lookup-a] (add-flow plan (->Lookup [index-a] index-b lookup-ixes-a val-ixes-a))
+        [plan index-b'] (add-flow plan (->Index nodes-b index-ixes-b))
+        _ (assert (= index-b index-b'))
         [plan lookup-b] (add-flow plan (->Lookup [index-b] index-a lookup-ixes-b val-ixes-b))]
     [plan [lookup-a lookup-b] (vec (distinct (concat vars-a vars-b)))]))


Reduce multi-level gets and assocs

Reduce multi-level gets and assocs

--- src/onyx/messaging/acking_daemon.clj
+++ src/onyx/messaging/acking_daemon.clj
@@ -22,22 +22,20 @@
 (defn acking-daemon [config]
   (map->AckingDaemon {:opts config}))

-;; TODO, performance
-;; Should ack multiple messages at a time so only a single swap!
-;; is required
 (defn ack-message [daemon message-id completion-id ack-val]
   (let [rets
         (swap!
           (:ack-state daemon)
           (fn [state]
-            (let [updated-ack-val (if-let [current-ack-val (get-in state [message-id :ack-val])]
+            (let [ack (get state message-id)
+                  updated-ack-val (if-let [current-ack-val (:ack-val ack)]
                                     (bit-xor current-ack-val ack-val))]
               (cond (nil? updated-ack-val)
                     (assoc state message-id (->Ack nil completion-id ack-val))
                     (zero? updated-ack-val)
                     (dissoc state message-id)
                     :else
-                    (assoc-in state [message-id :ack-val] updated-ack-val)))))]
+                    (assoc state message-id (assoc ack :ack-val updated-ack-val))))))]
     (when-not (get rets message-id)
       (>!! (:completions-ch daemon) {:id message-id :peer-id completion-id}))))


altcrawl.clj: use convert-jruby

altcrawl.clj: use convert-jruby

--- src/org/altlaw/jobs/pre/altcrawl.clj
+++ src/org/altlaw/jobs/pre/altcrawl.clj
@@ -59,33 +59,24 @@
 ;; Step 3 (for HTML): Run scrapers

 (defn get-primary-url [record]
-  (when-let [links (get record "links")]
+  (when-let [links (get record :links)]
     (get links "application/pdf")))

 (defn get-all-urls [record]
-  (when-let [links (get record "links")]
+  (when-let [links (get record :links)]
     (vals links)))

-(defn rubyhash-to-map [hash]
-  (reduce (fn [m [k v]]
-            (assoc m (keyword k)
-                   (if (instance? java.util.Map v)
-                     (into {} v)  ;; don't keywordize MIME types
-                     (str v))))
-          {} hash))
-
 (defn handle-scraper-record [record]
-  (let [data (into {} record)]
-    (if (contains? data "exception")
-      (do (h/counter "Scraper errors")
-          [:scraper-error (rubyhash-to-map data)])
-      (if-let [url (get-primary-url data)]
-        (if-let [docid (ids/get-docid "altcrawl" url)]
-          [docid (rubyhash-to-map data)]
-          [:docid-request (ids/make-docid-request "altcrawl" (get-all-urls data))])
-        (do (h/counter "No primary URL")
-            (log/warn "No primary URL among " (pr-str (get-all-urls data)))
-            nil)))))
+  (h/counter "Scraper output records" "Total")
+  (let [data (ruby/convert-jruby record)]
+    (if (contains? data :exception)
+      (do (h/counter "Scraper output records" "Errors")
+          [:scraper-error data])
+      (if-let [docid (some #(ids/get-docid "altcrawl" %) (get-all-urls data))]
+        (do (h/counter "Scraper output records" "With docid")
+            [docid data])
+        (do (h/counter "Scraper output records" "Docid requested")
+            [:docid-request (ids/make-docid-request "altcrawl" (get-all-urls data))])))))

 (defn run-scrapers [download]
   (filter identity


reading the token-secret via the environment variable

--- src/bitfondue/config.clj
+++ src/bitfondue/config.clj
@@ -3,3 +3,7 @@

 (def database
   (env :database-url))
+
+;; Authentication & Authorization
+(def token-secret
+  (env :token-secret))


[fix #] pass network-status to account app-db

when login offline the offline gray box was not shown in chat-list
and the fix in #2314 would not work in that case

--- src/status_im/ui/screens/events.cljs
+++ src/status_im/ui/screens/events.cljs
@@ -245,13 +245,13 @@
 (register-handler-db
   :initialize-account-db
   (fn [{:keys [accounts/accounts contacts/contacts networks/networks
-               network view-id navigation-stack chats
+               network network-status view-id navigation-stack chats
                access-scope->commands-responses layout-height
                status-module-initialized? status-node-started?]
         :or [network (get app-db :network)]
         :as db} [_ address]]
     (let [console-contact (get contacts console-chat-id)]
-      (cond-> (assoc app-db
+      (cond-> (assoc app-db
                      :access-scope->commands-responses access-scope->commands-responses
                      :accounts/current-account-id address
                      :layout-height layout-height
@@ -266,6 +266,7 @@
                      :accounts/accounts accounts
                      :accounts/creating-account? false
                      :networks/networks networks
+                     :network-status network-status
                      :network network)
         console-contact
         (assoc :contacts/contacts {console-chat-id console-contact})))))
@@ -279,7 +280,7 @@
                           [:initialize-sync-listener]
                           [:initialize-chats]
                           [:load-contacts]
-                          [:load-contact-groups]
+                          [:load-contact-groups]
                           [:init-discoveries]
                           [:initialize-debugging {:address address}]
                           [:send-account-update-if-needed]


[#130] Fix fragile `make-new-connection` destructuring (@chairmanwow, @mavbozo)

--- src/taoensso/carmine/connections.clj
+++ src/taoensso/carmine/connections.clj
@@ -54,10 +54,15 @@

 (defn make-new-connection
   [{:keys [host port password db conn-setup-fn
-           conn-timeout-ms read-timeout-ms timeout-ms] :as spec
-    :or   {conn-timeout-ms (or timeout-ms 4000)
-           read-timeout-ms timeout-ms}}]
-  (let [socket-address (InetSocketAddress. ^String host ^Integer port)
+           conn-timeout-ms read-timeout-ms timeout-ms] :as spec}]
+  (let [;; :timeout-ms controls both :conn-timeout-ms and :read-timeout-ms
+        ;; unless those are specified individually
+        ;; :or   {conn-timeout-ms (or timeout-ms 4000)
+        ;;        read-timeout-ms timeout-ms} ; Ref. http://goo.gl/XULHCd
+        conn-timeout-ms (get spec :conn-timeout-ms (or timeout-ms 4000))
+        read-timeout-ms (get spec :read-timeout-ms     timeout-ms)
+
+        socket-address (InetSocketAddress. ^String host ^Integer port)
         socket (encore/doto-cond [expr (Socket.)]
                  :always         (.setTcpNoDelay   true)
                  :always         (.setKeepAlive    true)


CLJS-802 Add :pseudo-names compiler option

This generates mangled, but readable names in advanced compilation.

--- src/clj/cljs/closure.clj
+++ src/clj/cljs/closure.clj
@@ -92,6 +92,9 @@
   [opts ^CompilerOptions compiler-options]
   (when (contains? opts :pretty-print)
     (set! (.prettyPrint compiler-options) (:pretty-print opts)))
+
+  (when (contains? opts :pseudo-names)
+    (set! (.generatePseudoNames compiler-options) (:pseudo-names opts)))

   (when (contains? opts :language-in)
     (case (:language-in opts)


Refresh on index

Refresh on index

--- src/clj/runbld/store.clj
+++ src/clj/runbld/store.clj
@@ -96,7 +96,8 @@
         t (name DocType)
         id (:id d)
         es-addr {:index idx :type t :id id}]
-    (doc/index conn (merge es-addr {:body d}))
+    (doc/index conn (merge es-addr {:body d
+                                    :query-params {:refresh true}}))
     {:url (format "%s://%s:%s/%s/%s/%s"
                   (-> opts :es :conn :settings :scheme name)
                   (-> opts :es :conn :settings :server-name)
@@ -122,7 +123,8 @@
           idx (-> opts :es :failure-index-write)
           t (name DocType)
           es-addr {:index idx :type t}]
-      (doc/index conn (merge es-addr {:body d})))))
+      (doc/index conn (merge es-addr {:body d
+                                      :query-params {:refresh true}})))))

 (s/defn save! :- {s/Keyword s/Any}
   ([opts        :- OptsFinal


[spec] instrument is-grid-group

[spec] instrument is-grid-group

--- src/clj_dstream/core.clj
+++ src/clj_dstream/core.clj
@@ -243,6 +243,7 @@
 (stest/instrument `update-char-vec-label)
 (stest/instrument `phase-space->cell-count)
 (stest/instrument `are-neighbors)
+(stest/instrument `is-grid-group)

 ;(clojure.pprint/pprint (one-dstream-iteration {::state test-state ::raw-data test-raw-data}))


Adds TODOs for new api endpoints.

Adds TODOs for new api endpoints.

--- src/clj_spotify/core.clj
+++ src/clj_spotify/core.clj
@@ -455,6 +455,8 @@
   Example: (change-a-playlists-details {:user_id \"elkalel\" :playlist_id \"6IIjEBw2BrRXbrSLerA7A6\" :name \"Fantastic playlist\" :public true} \"BQBw-JtC..._7GvA\")"
   (api-put "users/user_id/playlists/playlist_id"))

+;;TODO Upload a custom playlist cover
+
 ;Profiles
 (def get-a-users-profile
   " Takes two arguments, a map m with query parameters and an optional oauth-token t.
@@ -467,9 +469,34 @@
 ;TODO - what happens when map is not present or nil?
 (def get-current-users-profile
   " Takes an oauth-token t.
-
   Example: (get-current-users-profile {} \"BQBw-JtC..._7GvA\")"
   (api-get "me"))
+
+;;TODO Get current users recently played tracks.
+
+;;TODO Get a users available devices.
+
+;;TODO Get information about the users current playback.
+
+;;TODO Get the users currently playing track.
+
+;;TODO Transfer a users playback.
+
+;;TODO Start/Resume a users playback.
+
+;;TODO Pause a users playback.
+
+;;TODO Skip users playback to next track.
+
+;;TODO Skip users playback to previous track.
+
+;;TODO Seek to position in currently playing track.
+
+;;TODO Set repeat mode on user's playback.
+
+;;TODO Set volume for user's playback.
+
+;;TODO Toggle shuffle for users playback.

 ;Search
 (def search


Minor cleanup

Minor cleanup

--- src/cljs/go/compiler.clj
+++ src/cljs/go/compiler.clj
@@ -451,18 +451,11 @@
         (when-not (= export mname)
           (emitln "var "export  " = " mname))))))

-(defn emit-fn-params [params]
-  (doseq [param params]
-    (emit param)
-    ; Avoid extraneous comma (function greet(x, y, z,)
-    (when-not (= param (last params))
-      (emits ","))))
-
 (defn go-type [tag]
-  ('{number "float64" boolean "bool" string "string" array "[]interface{}"} tag '"interface{}"))
+  ('{number "float64" boolean "bool" string "string" array "[]interface{}"} tag "interface{}"))

 (defn go-short-type [tag]
-  ('{number "F" boolean "B" string "S" array "A"} tag '"I"))
+  ('{number "F" boolean "B" string "S" array "A"} tag "I"))

 (defn go-type-suffix [params ret-tag]
   (apply str (concat (map (comp go-short-type :tag) params) [(go-short-type ret-tag)])))
@@ -528,7 +521,7 @@
       (when loop-locals
         (when (= :return (:context env))
           (emits "return "))
-        (emitln "func (" (comma-sep (map munge loop-locals)) ") *AFnPrimitive {")
+        (emitln "func (" (comma-sep loop-locals) ") *AFnPrimitive {")
         (when-not (= :return (:context env))
           (emits "return ")))
       (let [name (or name (gensym))


Revert back to unmodified Om

Revert back to unmodified Om

--- ClojureScript/project.clj
+++ ClojureScript/project.clj
@@ -2,7 +2,7 @@
   :description "React Native tic-tac-toe in ClojureScript"
   :dependencies [[org.clojure/clojure "1.6.0"]
                  [org.clojure/clojurescript "0.0-3153"]
-                 [org.omcljs/om "0.9.0-SNAPSHOT"]
+                 [org.omcljs/om "0.8.8"]
                  [org.omcljs/ambly "0.1.0-SNAPSHOT"]]
   :plugins [[lein-cljsbuild "1.0.5"]]
   :source-paths ["src"]


set-properties! needs to provide all the properties, even the non changed ones, to the nodeService

--- lambdalf-lib/src/main/clojure/alfresco/nodes.clj
+++ lambdalf-lib/src/main/clojure/alfresco/nodes.clj
@@ -76,25 +76,26 @@

   (dir? [node] (= (m/qname "cm:folder" (.getType (node-service) (c/c2j node)))))

-  (create-child-assoc [node {:keys [assoc-type assoc props type]}]
-    (let [assoc-qname (if assoc-type
-                        (m/qname assoc-type)
-                        (m/qname "cm:contains"))
-          assoc-name (if assoc
-                       (m/qname assoc)
-                       (m/qname (str "cm:" (props ContentModel/PROP_NAME))))
-          ^ChildAssociationRef assoc-ref (.createNode (node-service)
-                                                      (c/c2j node)
-                                                      assoc-qname
-                                                      assoc-name
-                                                      type
-                                                      props)]
-
+  (create-child-assoc
+   [node {:keys [assoc-type assoc props type]}]
+   (let [assoc-qname (if assoc-type
+                       (m/qname assoc-type)
+                       (m/qname "cm:contains"))
+         assoc-name (if assoc
+                      (m/qname assoc)
+                      (m/qname (str "cm:" (props ContentModel/PROP_NAME))))
+         ^ChildAssociationRef assoc-ref (.createNode (node-service)
+                                                     (c/c2j node)
+                                                     assoc-qname
+                                                     assoc-name
+                                                     (m/qname type)
+                                                     props)]
+
       {:type assoc-qname
        :name assoc-name
        :parent (c/j2c node)
        :child (c/j2c (.getChildRef assoc-ref))}))
-
+
   (children
    [node]
    (into #{} (doall
@@ -131,9 +132,11 @@
   (set-properties!
    [node & prop-defs]
    {:pre [(or (nil? prop-defs) (even? (count prop-defs)))]}
-   (let [prop-map (defs2map prop-defs)
+   (let [current-props (properties node)
+         prop-map (merge current-props (defs2map prop-defs))
          qnamed-map (zipmap (map m/qname (keys prop-map))
                             (vals prop-map))]
+
      (.setProperties (node-service) (c/c2j node) qnamed-map)))

   (type-qname


Clean up test requires

Clean up test requires

Remove some confusion around aliases

--- test/aero/core_test.cljc
+++ test/aero/core_test.cljc
@@ -1,19 +1,21 @@
 ;; Copyright © 2015-2017, JUXT LTD.

 (ns aero.core-test
-  #?(:clj (:require [aero.core :refer :all]
-                    [clojure.edn :as edn]
-                    [clojure.test :refer :all]
-                    [clojure.java.io :as io]))
-  #?(:clj (:import [aero.core Deferred]))
-  #?(:cljs (:require [aero.core :refer [read-config reader Deferred] :refer-macros [deferred]]
-                     [cljs.tools.reader :as edn]
-                     [cljs.test :refer [deftest is testing are]]
-                     [goog.object :as gobj]
-                     [goog.string :as gstring]
-                     goog.string.format
-                     [cljs.tools.reader.reader-types
-                      :refer [source-logging-push-back-reader]])))
+  (:require
+   [aero.core :refer [read-config reader
+                      #?@(:clj [deferred resource-resolver root-resolver])
+                      #?(:cljs Deferred)]
+    #?@(:cljs [:refer-macros [deferred]])]
+   #?(:clj [clojure.edn :as edn]
+      :cljs [cljs.tools.reader :as edn])
+   [clojure.test :refer [deftest is testing are]]
+   #?@(:clj [[clojure.java.io :as io]]
+       :cljs [[goog.object :as gobj]
+              [goog.string :as gstring]
+              goog.string.format
+              [cljs.tools.reader.reader-types
+               :refer [source-logging-push-back-reader]]]))
+  #?(:clj (:import [aero.core Deferred])))

 (defn env [s]
   #?(:clj (System/getenv (str s)))


Remove defunct file

Remove defunct file

--- test/grafter/io_test.clj
+++ test/grafter/io_test.clj
@@ -1,135 +0,0 @@
-;; (ns grafter.rdf.io-test
-;;   (:require [clojure.test :refer :all]
-;;             [grafter.rdf.protocols :refer [->Quad]]
-;;             [grafter.rdf :refer [add statements]]
-;;             [grafter.rdf.templater :refer [graph]]
-;;             [grafter.rdf4j.io :refer :all]
-;;             [grafter.url :refer :all]
-;;             [grafter.rdf.protocols :as pr]
-;;             [grafter.rdf.formats :as fmt]
-;;             [clojure.java.io :as io])
-;;   (:import [org.eclipse.rdf4j.model.impl LiteralImpl URIImpl ContextStatementImpl]
-;;            [java.net URI]))
-
-;; ;; NOTE this function is deprecated in favour of the one in formats,
-;; ;; but unlike the variation in formats it raises an exception if the
-;; ;; supplied argument is nil.
-;; (deftest mimetype->rdf-format-test
-;;   (testing "mimetype->rdf-format"
-
-;;     (is (= fmt/rdf-ntriples
-;;            (fmt/mimetype->rdf-format "application/n-triples; charset=UTF-8"))
-;;         "works with charset parameters")
-
-;;     (is (= fmt/rdf-xml
-;;            (fmt/mimetype->rdf-format "application/rdf+xml"))
-;;         "works without charset parameters")
-
-;;     (is (thrown? IllegalArgumentException
-;;                  (fmt/mimetype->rdf-format nil))
-;;         "throws on nil mime type")))
-
-;; (deftest round-trip-numeric-types-test
-;;   (are [xsd type number]
-;;       (is (= number (pr/raw-value (->backend-type (->grafter-type (LiteralImpl. number (URIImpl. xsd)))))))
-
-;;     "http://www.w3.org/2001/XMLSchema#byte" Byte "10"
-;;     "http://www.w3.org/2001/XMLSchema#short" Short "10"
-;;     "http://www.w3.org/2001/XMLSchema#decimal" java.math.BigDecimal "10"
-;;     "http://www.w3.org/2001/XMLSchema#double" Double "10.7"
-;;     "http://www.w3.org/2001/XMLSchema#float" Float "10.6"
-;;     "http://www.w3.org/2001/XMLSchema#integer" BigInteger "10"
-;;     "http://www.w3.org/2001/XMLSchema#int" Integer "10"))
-
-;; (deftest literal-and-literal-datatype->type-test
-;;   (are [clj-val uri klass]
-;;       (let [ret-val (literal-datatype->type (literal clj-val uri))]
-;;         (is (= clj-val ret-val))
-;;         (is (= klass (class clj-val))))
-
-;;     true           "http://www.w3.org/2001/XMLSchema#boolean" Boolean
-;;     (byte 10)      "http://www.w3.org/2001/XMLSchema#byte" Byte
-;;     (short 12)     "http://www.w3.org/2001/XMLSchema#short" Short
-;;     (bigdec 9)     "http://www.w3.org/2001/XMLSchema#decimal" java.math.BigDecimal
-;;     (double 33.33) "http://www.w3.org/2001/XMLSchema#double" Double
-;;     (float 23.8)   "http://www.w3.org/2001/XMLSchema#float" Float
-;;     10             "http://www.w3.org/2001/XMLSchema#long" Long
-
-;;     ;; Yes this is correct according to the XSD spec. #integer is
-;;     ;; unbounded whereas #int is bounded
-;;     (bigint 3)     "http://www.w3.org/2001/XMLSchema#integer" clojure.lang.BigInt
-;;     (int 42)       "http://www.w3.org/2001/XMLSchema#int" Integer
-;;     "hello"        "http://www.w3.org/2001/XMLSchema#string" String))
-
-;; (deftest literal-test
-;;   (is (instance? LiteralImpl (->backend-type (literal "2014-01-01" (java.net.URI. "http://www.w3.org/2001/XMLSchema#date"))))))
-
-;; (deftest language-string-test
-;;   (let [bonsoir (language "Bonsoir Mademoiselle" :fr)]
-;;     (is (= bonsoir (literal-datatype->type bonsoir)))
-;;     (is (= bonsoir (->grafter-type (->backend-type bonsoir))))))
-
-;; (deftest round-trip-quad-test
-;;   (let [quad (->Quad (->java-uri "http://example.org/test/subject")
-;;                      (->java-uri "http://example.org/test/predicate")
-;;                      (->java-uri "http://example.org/test/object")
-;;                      (->java-uri "http://example.org/test/graph"))]
-;;     (is (= quad
-;;            (sesame-statement->IStatement (IStatement->sesame-statement quad)))))
-
-;;   (testing "with nil graph"
-;;     (let [quad (->Quad (->java-uri "http://example.org/test/subject")
-;;                        (->java-uri "http://example.org/test/predicate")
-;;                        (->java-uri "http://example.org/test/object")
-;;                        nil)]
-;;       (is (= quad
-;;              (sesame-statement->IStatement (IStatement->sesame-statement quad)))))))
-
-;; (deftest round-trip-quad-serialize-deserialize-test
-;;   (let [quad (graph (->java-uri "http://example.org/test/graph")
-;;                     [(->java-uri "http://test/subj") [(->java-uri "http://test/pred") (->java-uri "http://test/obj")]])
-;;         string-wtr (java.io.StringWriter.)
-;;         serializer (rdf-serializer string-wtr :format :nq)]
-;;     (add serializer quad)
-
-;;     (let [output-str (str string-wtr)]
-;;       (with-open [rdr (java.io.StringReader. output-str)]
-;;         (is (= quad
-;;                (statements rdr :format :nq)))))))
-
-
-;; (deftest IStatement->sesame-statement-test
-;;   (testing "IStatement->sesame-statement"
-;;     (is (= (IStatement->sesame-statement (->Quad (->java-uri "http://foo.com/") (->java-uri "http://bar.com/") "a string" (->java-uri "http://blah.com/")))
-;;            (ContextStatementImpl. (URIImpl. "http://foo.com/") (URIImpl. "http://bar.com/") (LiteralImpl. "a string") (URIImpl. "http://blah.com/"))))
-
-;;     (testing "Raising Exceptions"
-;;       (let [broken-quad (with-meta (->Quad nil "http://bar.com/" "http://baz.com/" "http://blah.com/") {:foo :bar})
-;;             ex (ex-data (is (thrown? clojure.lang.ExceptionInfo
-;;                                      (IStatement->sesame-statement broken-quad))))]
-
-;;         (is (= (->Quad
-;;                 nil
-;;                 "http://bar.com/"
-;;                 "http://baz.com/"
-;;                 "http://blah.com/") (:quad ex))
-;;             "Adds the statement itself to the exception data")
-
-;;         (is (= {:foo :bar} (:quad-meta ex))
-;;             "Metadata from quads is reported in exception data")))))
-
-;; (deftest to-grafter-url-protocol-test
-;;   (testing "extends RDF Model URI"
-;;     (let [uri (URIImpl. "http://www.tokyo-3.com:777/ayanami?geofront=retracted")
-;;           grafter-url (->grafter-url uri)]
-;;       (are [expected actual] (= expected actual)
-;;                              777 (port grafter-url)
-;;                              "www.tokyo-3.com" (host grafter-url)
-;;                              "http" (scheme grafter-url)
-;;                              ["ayanami"] (path-segments grafter-url)))))
-
-;; (deftest blank-nodes-load-test
-;;   (testing "Blank nodes are keywords"
-;;     (let [[[s1 p1 o1] [s2 p2 o2]] (statements (io/resource "grafter/rdf/bnodes.nt"))]
-;;       (is (keyword? o1))
-;;       (is (keyword? s2)))))


Remove unused require

Remove unused require

--- test/aero/core_test.cljc
+++ test/aero/core_test.cljc
@@ -6,8 +6,6 @@
                       #?@(:clj [deferred resource-resolver root-resolver])
                       #?(:cljs Deferred)]
     #?@(:cljs [:refer-macros [deferred]])]
-   #?(:clj [clojure.edn :as edn]
-      :cljs [cljs.tools.reader :as edn])
    [clojure.test :refer [deftest is testing are]]
    #?@(:clj [[clojure.java.io :as io]]
        :cljs [[goog.object :as gobj]


allow references for endpoints in sns

allow references for endpoints in sns

--- src/crucible/aws/sns.clj
+++ src/crucible/aws/sns.clj
@@ -8,12 +8,12 @@

 (s/def ::topic-name (spec-or-ref string?))

-(s/def ::endpoint string?)
+(s/def ::endpoint (spec-or-ref string?))

 (s/def ::protocol #{"http" "https" "email" "email-json" "sms" "sqs" "application" "lambda"})

-(s/def ::subscription (s/* (s/keys :req [::endpoint
-                                         ::protocol])))
+(s/def ::subscription (s/coll-of (s/keys :req [::endpoint
+                                               ::protocol])))

 (s/def ::topic (s/keys :opt [::display-name
                              ::topic-name


move {:first :head} to (def head-first)

move {:first :head} to (def head-first)

--- src/babel/english/grammar.cljc
+++ src/babel/english/grammar.cljc
@@ -44,7 +44,9 @@
      :comp {:english comp-english}
      :english {:a head-english
                :agr agr
-               :b comp-english}}))
+               :b comp-english}
+     :first :head}))
+
 (def head-last
   (let [agr (atom :top)
         head-english (atom {:agr agr})
@@ -92,7 +94,6 @@
    head-first
    {:comment "h00"
     :schema-symbol 'h00 ;; used by over-each-parent to know where to put children.
-    :first :head
     :comp {:synsem {:subcat '()}}
     :head {:synsem {:subcat '()}}}))

@@ -130,7 +131,7 @@
    head-first
    {:comment "h10"
     :schema-symbol 'h10 ;; used by over-each-parent to know where to put children.
-    :first :head}))
+    }))

 (def h21
   (unify-check
@@ -138,8 +139,7 @@
    head-principle
    head-first
    {:comment "h21"
-    :schema-symbol 'h21 ;; used by over-each-parent to know where to put children.
-    :first :head}))
+    :schema-symbol 'h21})) ;; used by over-each-parent to know where to put children.

 (def h22
   (unify-check
@@ -148,7 +148,7 @@
    head-first
    {:comment "h22"
     :schema-symbol 'h22 ;; used by over-each-parent to know where to put children.
-    :first :head}))
+    }))

 (def h32
   (unify-check
@@ -157,7 +157,7 @@
    head-first
    {:comment "h32"
     :schema-symbol 'h32 ;; used by over-each-parent to know where to put children.
-    :first :head}))
+    }))

 ;; </TODO: move to ug>
 ;; -- END SCHEMA DEFINITIONS


+scary/+monster/+creep

+scary/+monster/+creep

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -1150,6 +1150,12 @@
    "meet"  {:synsem {:cat :verb
                      :sem {:pred :incontrare}}
             :english {:past "met"}}
+
+   "monster" {:synsem {:cat :noun
+                       :sem {:it-came-from-outerspace true}}}
+   "creep" {:synsem {:cat :noun
+                     :sem {:it-came-from-outerspace true}}}
+
    "mother"
    (unify agreement-noun
           common-noun
@@ -1365,6 +1371,9 @@
    "say" {:english {:past "said"}
           :synsem {:cat :verb
                    :sem {:pred :say}}}
+
+   "scary" {:synsem {:cat :adjective
+                     :sem {:it-came-from-outerspace true}}}

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


remove (if-then) with no effect

remove (if-then) with no effect

--- src/babel/english/lexicon.cljc
+++ src/babel/english/lexicon.cljc
@@ -2644,13 +2644,6 @@
       (verb-pred-defaults encyc/verb-pred-defaults)

       ;; if a verb has an object,
-      ;; and the object is not {:reflexive true}
-      ;; then the object is {:reflexive false}
-      (if-then {:synsem {:cat :verb
-                         :subcat {:2 {:reflexive false}}}}
-               {:synsem {:subcat {:2 {:reflexive false}}}})
-
-      ;; if a verb has an object,
       ;; and the object is {:cat :noun},
       ;; then the object is {:synsem {:case :acc}}.
       (if-then {:synsem {:cat :verb


Add invite and settings buttons

Add invite and settings buttons

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -325,12 +325,26 @@
            [:i.fa.fa-plus-circle]
            [:span "Add Projects"]]

+          [:a.aside-item {:href "/invite-teammates",
+                          :data-placement "right"
+                          :data-trigger "hover"
+                          :title "Invite your teammates"}
+           [:i.fa.fa-user]
+           [:span "Invite your teammates"]]
+
           [:a.aside-item {:data-placement "right"
                           :data-trigger "hover"
                           :title "Changelog"
                           :href "/changelog"}
            [:i.fa.fa-bell]
            [:span "Changelog"]]
+
+          [:a.aside-item {:data-placement "right"
+                          :data-trigger "hover"
+                          :title "Settings"
+                          :href "/account"}
+           [:i.fa.fa-gear]
+           [:span "Settings"]]

           [:a.aside-item.push-to-bottom {:data-placement "right"
                                          :data-trigger "hover"


Update org sidebar nav links

Update org sidebar nav links

--- src-cljs/frontend/components/aside.cljs
+++ src-cljs/frontend/components/aside.cljs
@@ -270,11 +270,11 @@
      (if (pm/piggieback? plan org-name org-vcs-type)
        [{:type :subpage :href "#containers" :title "Add containers" :subpage :containers}]
        (concat
-         [{:type :subpage :title "Update plan" :href "#containers" :subpage :containers}]
+         [{:type :subpage :title "Plan" :href "#containers" :subpage :containers}]
          (when (pm/transferrable-or-piggiebackable-plan? plan)
-           [{:type :subpage :title "Organizations" :href "#organizations" :subpage :organizations}])
+           [{:type :subpage :title "Extra Organizations" :href "#organizations" :subpage :organizations}])
          (when (pm/stripe-customer? plan)
-           [{:type :subpage :title "Billing info" :href "#billing" :subpage :billing}]))))
+           [{:type :subpage :title "Billing Info" :href "#billing" :subpage :billing}]))))
    [{:type :heading :title "Organization"}
     {:type :subpage :href "#projects" :title "Projects" :subpage :projects}
     {:type :subpage :href "#users" :title "Users" :subpage :users}]))


Render countries, social, interests filters in this order

--- frontend/src/faceboard/views/boards/people.cljs
+++ frontend/src/faceboard/views/boards/people.cljs
@@ -248,8 +248,8 @@
     (dom/div {:class    "people-filters no-select"
               :on-click #(.stopPropagation %)}
       (om/build countries-filter-component data)
-      (om/build tags-filter-component data)
-      (om/build socials-filter-component data))))
+      (om/build socials-filter-component data)
+      (om/build tags-filter-component data))))

 (defn build-countries-filter-predicate [active-filters]
   (if-let [active-countries (:countries active-filters)]


Solve the invalid fop problem even more succinctly

--- src/clj/catalog/layout/fop.clj
+++ src/clj/catalog/layout/fop.clj
@@ -828,20 +828,16 @@
         (header :recto)
         (header :verso)

-        (let [subitems (or
-                        (-> items
+        (let [subitems (-> items
                             (get fmt)
                             (cond->
                                 (not (string/blank? editorial)) (assoc :editorial editorial)
-                                (not (string/blank? recommendations)) (assoc :recommendation recommendations)))
-                        ;; if there are no items and neither an editorial nor any recommendations
-                        ;; then default to an empty map. This will make sure at least the title of
-                        ;; the toc is printed and the fop will be valid.
-                        {})]
+                                (not (string/blank? recommendations)) (assoc :recommendation recommendations)))]
           [:fo:flow {:flow-name "xsl-region-body"}
-             (toc subitems [fmt] 2 {:heading? true})
-             (realize-lazy-seqs
-              (mapcat #(genre-sexp (get subitems %) fmt % 1 {}) (keys subitems)))])]
+           ;; if there are no items then at least the title of the toc is printed so the fop is valid.
+           (toc (or subitems {}) [fmt] 2 {:heading? true})
+           (realize-lazy-seqs
+            (mapcat #(genre-sexp (get subitems %) fmt % 1 {}) (keys subitems)))])]
        (coverpage-verso title issue fmt)])))

 (defmethod document-sexp :hörbuch


Add logged in user to context

Add logged in user to context

--- src/clj/salava/core/layout.clj
+++ src/clj/salava/core/layout.clj
@@ -4,7 +4,8 @@
             [clojure.java.io :as io]
             [clojure.data.json :as json]
             [salava.core.helper :refer [dump]]
-            [hiccup.page :refer [html5 include-css include-js]]))
+            [hiccup.page :refer [html5 include-css include-js]]
+            salava.core.restructure))

 (def asset-css
   ["/assets/bootstrap/css/bootstrap.min.css"
@@ -34,7 +35,7 @@

 (defn context-js [ctx]
-  (let [ctx-out {:plugins {:all (get-in ctx [:config :core :plugins])}}]
+  (let [ctx-out {:plugins {:all (get-in ctx [:config :core :plugins])} :user (:user ctx)}]
     (str "function salavaCoreCtx() { return " (json/write-str ctx-out) "; }")))

@@ -61,6 +62,7 @@
   (GET path []
          :no-doc true
          :summary "Main HTML layout"
-         (-> (main-view ctx)
+         :current-user current-user
+         (-> (main-view (assoc ctx :user current-user))
              (ok)
              (content-type "text/html; charset=\"UTF-8\""))))


Notify AI to start turn when player AI is toggled

--- src/clj/zetawar/events/ui.cljs
+++ src/clj/zetawar/events/ui.cljs
@@ -237,6 +237,7 @@

 ;; TODO: notify new AIs to start turn if they're plays as the current faction
 ;; TODO: find a way to make player swapping nicer (maybe put in router?)
+;; TODO: cleanup return value construction
 (defmethod router/handle-event ::toggle-faction-ai
   [{:as handler-ctx :keys [ev-chan conn db players]} [_ faction]]
   (let [{:as app :keys [ai-turn-stepping]} (app/root db)
@@ -247,7 +248,9 @@
         cur-player (color @players)
         new-player (if ai
                      (players/new-player handler-ctx ::players/human color)
-                     (players/new-player handler-ctx ::players/reference-ai color))]
+                     (players/new-player handler-ctx ::players/reference-ai color))
+        notify (when-not ai
+                 [[:zetawar.players/start-turn color]])]
     (players/stop cur-player)
     (players/start new-player)
     (swap! players assoc color new-player)
@@ -255,8 +258,10 @@
              (= (count other-factions)
                 (count (filter :faction/ai other-factions))))
       {:tx (conj tx [:db/add (e app) :app/ai-turn-stepping (not ai-turn-stepping)])
-       :dispatch [[::alert "AI enabled for all factions, enabling AI turn stepping."]]}
-      {:tx (conj tx [:db/add (e app) :app/ai-turn-stepping false])})))
+       :dispatch [[::alert "AI enabled for all factions, enabling AI turn stepping."]]
+       :notify notify}
+      {:tx (conj tx [:db/add (e app) :app/ai-turn-stepping false])
+       :notify notify})))

 (defmethod router/handle-event ::hide-win-dialog
   [{:as handler-ctx :keys [ev-chan db]} _]


Group related functions more close together

--- src/clj_gatling/simulation.clj
+++ src/clj_gatling/simulation.clj
@@ -104,6 +104,20 @@
         (recur (conj responses (response->result scenario (<!! response-chan))))
         responses))))

+(defn- print-scenario-info [scenario]
+  (let [concurrency        (:concurrency scenario)
+        number-of-requests (:number-of-requests scenario)]
+    (println "Running scenario" (:name scenario)
+             "with concurrency" concurrency
+             "and" (runner-info (:runner scenario)) ".")))
+
+(defn run-scenarios [timeout scenarios]
+  (let [results (doall (map (fn [scenario]
+                              (print-scenario-info scenario)
+                              (thread (run-scenario timeout scenario)))
+                        scenarios))]
+    (mapcat #(<!! %) results)))
+
 (defn- distinct-request-count [scenarios]
   (reduce + (map #(count (:requests %)) scenarios)))

@@ -120,20 +134,6 @@
           concurrencies
           requests)))

-(defn- print-scenario-info [scenario]
-  (let [concurrency        (:concurrency scenario)
-        number-of-requests (:number-of-requests scenario)]
-    (println "Running scenario" (:name scenario)
-             "with concurrency" concurrency
-             "and" (runner-info (:runner scenario)) ".")))
-
-(defn run-scenarios [timeout scenarios]
-  (let [results (doall (map (fn [scenario]
-                              (print-scenario-info scenario)
-                              (thread (run-scenario timeout scenario)))
-                        scenarios))]
-    (mapcat #(<!! %) results)))
-
 (defn run-simulation [scenarios users & [options]]
   (let [requests (or (:requests options) (* users (distinct-request-count scenarios)))
         duration (:duration options)


Add maps listener for data events

Add maps listener for data events

--- src/cljs/gtfve/utils/maps.cljs
+++ src/cljs/gtfve/utils/maps.cljs
@@ -13,6 +13,13 @@
                            :mapTypeId (:ROADMAP map-types)
                            :zoom 15})

+(defn data-listen
+  ([data type]
+   (data-listen data type (chan)))
+  ([data type c]
+   (.. data (addListener type (fn [e] (put! c (if e e (js/Date.))))))
+   c))
+
 (defn listen
   ([gmap type]
    (listen gmap type (chan)))


Remove console logs in gmaps integration

--- src/cljs/sloth/views/text.cljs
+++ src/cljs/sloth/views/text.cljs
@@ -148,8 +148,6 @@
         splitted-path (filter (complement empty?) (str/split path "/"))
         url-category (keyword (first splitted-path))]

-    (.log js/console "--- MAPA ---")
-    (.log js/console (str url-caterogy))
     (if (= url-category :maps)
       (let [embed-url (str "https://maps.googleapis.com/maps/api/staticmap?")
             additional-attrs (str "&zoom=15&size=600x300")
@@ -157,7 +155,6 @@
             coords-attr (str "center=" coords)
             mark-attr (str "&markers=color:red|label:A|" coords)
             maps-static-url (str embed-url coords-attr mark-attr additional-attrs)]
-        (.log js/console "--- DE VERDAD ---")
         (make-image-message maps-static-url))
       (make-external-link url))))


Added str to Fahrenheit conversion.

Added str to Fahrenheit conversion.

--- src/cljs/temperature/core.cljs
+++ src/cljs/temperature/core.cljs
@@ -17,7 +17,7 @@
     (if (or (str/blank? fahrenheit-str)
             (js/isNaN fahrenheit-float))
       ""
-      (-> fahrenheit-float (- 32) (* 5) (/ 9.0)))))
+      (-> fahrenheit-float (- 32) (* 5) (/ 9.0) str))))

 ;; Events


Revert "Switch "new" and "save" buttons"

This reverts commit d7d79e47f7a74baa0b77cce3b7eb522100851f67.

--- src/cljs/underground/core.cljs
+++ src/cljs/underground/core.cljs
@@ -81,7 +81,13 @@
      :on-mouse-move #(js/removeclasshoveritem)
      :style {:left (-> @menu-position :x (- 100))
              :top (-> @menu-position :y (- 80))}}
-    [:a [:li {:on-click #(let [my (.-clientY %)
+    [:a [:li {:on-click (fn [e]
+                          (network-save-state)
+                          (reset-menu-position)
+                          )
+              } "Save"]]
+    [:a [:li {:id :hoveritem
+              :on-click #(let [my (.-clientY %)
                                mx (.-clientX %)
                                {ox :x oy :y} @origin
                                x (- mx ox)
@@ -92,15 +98,9 @@
                                   (-> @gen-id str keyword)
                                   {:x x :y y :md "## placeholder" :html "
placeholder
"})
                            )
-              } "New"]]
-    [:a [:li {:id :hoveritem
-              :on-click (fn [e]
-                          (network-save-state)
-                          (reset-menu-position)
-                          )
               :on-mouse-leave #(js/removeclasshoveritem)
               :on-mouse-move #(js/removeclasshoveritem)
-              } "Save"]]
+              } "New"]]
     (if @clicked-note
       [:a [:li {:on-click (fn [e]
                             (swap! positions dissoc @clicked-note)


fix circular load in load-spec

fix circular load in load-spec

--- src/main/clojure/com/stuartsierra/lazytest.clj
+++ src/main/clojure/com/stuartsierra/lazytest.clj
@@ -435,7 +435,7 @@
   namespaces in the named directory."
   [x & options]
   (cond (symbol? x)
-        (do (apply require x options) (load-spec x))
+        (do (apply require x options) (load-spec (the-ns x)))

         (string? x)
         (load-spec (java.io.File. x))


Use 5% as accuracy for simulation test total count

--- test/clj_gatling/simulation_test.clj
+++ test/clj_gatling/simulation_test.clj
@@ -373,4 +373,4 @@
         count-requests (fn [name] (reduce + (map #(count (:requests %)) (get result name))))]
     (is (approximately== (count-requests "Main") 66 :accuracy 20))
     (is (approximately== (count-requests "Second") 33 :accuracy 20))
-    (is (approximately== 100 (+ (count-requests "Main") (count-requests "Second")) :accuracy 2))))
+    (is (approximately== 100 (+ (count-requests "Main") (count-requests "Second")) :accuracy 5))))


Remove test for copy-first-row-to-header.


Test partial movement

Test partial movement

--- test/obb_rules/actions/move_test.clj
+++ test/obb_rules/actions/move_test.clj
@@ -35,6 +35,23 @@
     (test-complete-move board [2 2] [3 1])
     (test-complete-move board [2 2] [3 2])
     (test-complete-move board [2 2] [3 3])))
+
+(deftest partial-movement
+
+  (testing "partial-movement"
+    (let [old-coord [2 2]
+          new-coord [1 2]
+          move (build-action [:move :p1 old-coord new-coord 4])
+          result (move board)
+          new-board (result-board result)
+          new-element (get-element new-board new-coord)
+          old-element (get-element new-board old-coord)]
+      (is (succeeded? result))
+      (is old-element)
+      (is new-element)
+      (is (= 2 (result-cost result)))
+      (is (= 4 (element-quantity new-element)))
+      (is (= 6 (element-quantity old-element))))))

 (deftest cost
   (testing "full move cost"


Print test names as they run

Print test names as they run

--- test/taoensso/faraday/tests/main.clj
+++ test/taoensso/faraday/tests/main.clj
@@ -12,6 +12,9 @@
    [com.amazonaws.services.dynamodbv2.model ConditionalCheckFailedException]
    [com.amazonaws AmazonServiceException]
    (java.util Date)))
+
+(defmethod clojure.test/report :begin-test-var [m]
+  (println "\u001B[32mTesting" (-> m :var meta :name) "\u001B[0m"))

 ;;;; Private var aliases


Added NamespaceOfFile Nail

Added NamespaceOfFile Nail

--- src/de/kotka/gorilla/nails.clj
+++ src/de/kotka/gorilla/nails.clj
@@ -76,6 +76,32 @@
                       classes)]
       (println path))))

+(defnail NamespaceOfFile
+  "Usage: ng de.kotka.gorilla.nails.NamespaceOfFile [options]"
+  [[file f "Read the named file. Use '-' for stdin." "-"]]
+  (let [in     (if (not= file "-")
+                 (-> file
+                   java.io.FileInputStream.
+                   java.io.InputStreamReader.
+                   LineNumberingPushbackReader.)
+                 *in*)
+        eof    (Object.)
+        of-interest '#{in-ns ns clojure.core/in-ns clojure.core/ns}
+        in-seq (repeatedly #(read in false eof))]
+    (let [candidate
+          (drop-while #(and (not= % eof)
+                            (or (not (instance? clojure.lang.ISeq %))
+                                (not (contains? of-interest (first %)))))
+                      in-seq)]
+      (when (not= candidate eof)
+        (let [candidate (first candidate)]
+          (cond
+            ('#{ns clojure.core/ns} (first candidate))
+            (println (second candidate))
+
+            ('#{in-ns clojure.core/in-ns} (first candidate))
+            (println (second (second candidate)))))))))
+
 (defnail NamespaceInfo
   "Usage: ng de.kotka.gorilla.nails.NamespaceInfo [--] namespace ..."
   [namespaces]


Change move-npcs to use map-reduce algorithm for xtra speeeed

--- src/dungeon_crusade/update.clj
+++ src/dungeon_crusade/update.clj
@@ -578,7 +578,7 @@
             (transfer-items-from-player-to-npc (npc :id) (partial = item))))
         state)))

-(defn move-npc
+(defn calc-npc-next-step
   "Move `npc` one space closer to the player's position if there is a path
    from the npc to the player. Returns the moved npc and not the updated state."
   [state npc]
@@ -618,19 +618,28 @@
                     (assoc-in [:pos :x] (first new-pos))
                     (assoc-in [:pos :y] (second new-pos)))
         _ (debug "new-npc" new-npc)]
-    new-npc))
+    [new-pos new-npc npc]))

 (defn move-npcs
   "Move all npcs in the current place using `move-npc`."
   [state]
-  (update-in state [:world :npcs]  (fn [npcs] (reduce (fn [result npc]
-                                                      (conj result
-                                                            (if (= (npc :place)
-                                                                   (-> state :world :current-place))
-                                                              (move-npc state npc)
-                                                              npc)))
-                                                    []
-                                                    npcs))))
+  (update-in state
+             [:world :npcs]
+             (fn [npcs]
+               (let [map-result (log-time "map-result" (map (fn [npc] (if (= (npc :place)
+                                                       (-> state :world :current-plce))
+                                                  (calc-npc-next-step state npc)
+                                                  [nil nil npc]))
+                                      npcs))]
+               (log-time "reduce" (reduce
+                 (fn [result [new-pos new-npc npc]]
+                   (conj result
+                         (if (or (nil? new-pos)
+                                 (empty? (npc-at-xy state (new-pos :x) (new-pos :y))))
+                           npc
+                           new-npc)))
+                 []
+                 map-result))))))

 (defn add-npcs
   "Randomly add rats to the current place's in floor cells."


Simplify conditional

Simplify conditional

--- src/graphql_clj/spec.clj
+++ src/graphql_clj/spec.clj
@@ -46,8 +46,9 @@
   ([n pred]
    (eval (list 'clojure.spec/def n pred)))
   ([schema-hash path pred]
-   (cond (keyword? (last path))                    (last path)
-         (or (string? path) (string? (last path))) (register-idempotent (named-spec schema-hash path) pred)))
+   (if (keyword? (last path))
+     (last path)
+     (register-idempotent (named-spec schema-hash path) pred)))
   ([schema-hash path pred required]
    (if required
      (register-idempotent schema-hash (append-pathlast path "!") pred)


fix failed test cases

fix failed test cases

--- src/graphql_clj/type.clj
+++ src/graphql_clj/type.clj
@@ -100,12 +100,12 @@
    "Boolean" {:name "Boolean"
               :kind :SCALAR}})

-;; (defn inject-introspection-root-query-fields [root-query-type]
-;;   (if root-query-type
-;;     (-> root-query-type
-;;         (assoc-in [:fields "__schema"] {:name "__schema" :type-field-type {:name "__Schema"
-;;                                                                            :required true}})
-;;         (assoc-in [:fields "__type"] {:name "__type" :type-field-type {:name "__Type"}}))))
+(defn inject-introspection-root-query-fields [root-query-type]
+  (if root-query-type
+    (-> root-query-type
+        (assoc-in [:fields "__schema"] {:name "__schema" :type-field-type {:name "__Schema"
+                                                                           :required true}})
+        (assoc-in [:fields "__type"] {:name "__type" :type-field-type {:name "__Type"}}))))

 (defn create-schema
   "Create schema definition from parsed & transformed type system definition."


code refactor - remove var binding

code refactor - remove var binding

--- src/hatti/ona/forms.cljs
+++ src/hatti/ona/forms.cljs
@@ -223,10 +223,8 @@
                           (or formatted answer))
     (select-all? field) (let [names (set (string/split answer #" "))
                               appearance-value (-> field :control :appearance)
-                              has-search-expression? (uses-search-expression?
-                                                      appearance-value)
                               multiple-select-values
-                              (if has-search-expression?
+                              (if (uses-search-expression? appearance-value)
                                 (map #(identity {:name %}) names)
                                 (filter
                                  #(contains?


service war kaputt, wegen der klammern, weisstschon

--- src/hello_world/core.clj
+++ src/hello_world/core.clj
@@ -24,9 +24,7 @@
 ;    (j/query mysql-db ["select * from konten"]))

 (def app
-  (-> (handler wrap-params)
-;     (sqlquery)
-      ))
+  (-> handler wrap-params))

 (require '[clojure.java.jdbc :as j])

@@ -39,12 +37,12 @@
            :subname (str "//" db-host ":" db-port "/" db-name)
            ; Any additional keys are passed to the driver
            ; as driver-specific properties.
-           :user ""
-           :password ""}))
+           :user "johorst"
+           :password "666jojojo"}))
 ;geht:
-;(j/insert! mysql-db :konten
-;           {:Kontonummer 9 :Kontostand 3}
-;           {:Kontonummer 10 :Kontostand 1})
+(j/insert! mysql-db :konten
+           {:Kontonummer 11 :Kontostand 31}
+           {:Kontonummer 12 :Kontostand 11})

 (run-jetty app {:port 8080})


Remove debug printout

Remove debug printout

--- src/hello_world/core.clj
+++ src/hello_world/core.clj
@@ -96,8 +96,7 @@
                                   (submit-button {:class "btn btn-default"} "Add task")
                                  ]
                                  )
-                        (str (#'select-all-tasks))
-                        ]
+                          ]
                        ]
                        (include-js "https://code.jquery.com/jquery.js")
                        (include-js "/js/bootstrap.min.js")


add google analytics

add google analytics

--- src/hashobject/views/index.clj
+++ src/hashobject/views/index.clj
@@ -2,6 +2,15 @@
   (:use [hiccup.core :only (html)]
         [hiccup.page :only (html5 include-css include-js)]))

+
+(defn ga[]
+  [:script "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
+  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
+  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
+  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
+
+  ga('create', 'UA-41533076-1', 'hashobject.com');
+  ga('send', 'pageview');"])

 (defn index []
@@ -14,5 +23,6 @@
       [:meta {:name "keywords" :itemprop "keywords" :content "HashObject, hashobject, #{hash:object}, HashObject Team, HashObject Ltd"}]
       [:meta {:name "description" :itemprop "description" :content "HashObject - software engineering, design and application development"}]
       [:title "HashObject: we love development"]
-      (include-css "/css/app.css")]
+      (include-css "/css/app.css")
+      (ga)]
     [:body "Our site will be here soon..."]     ))


docstring [ci skip]

docstring [ci skip]

--- frontend/components/common.cljs
+++ frontend/components/common.cljs
@@ -101,8 +101,11 @@
                                    [(str "<path class='" (name icon-name) "' fill='none'"
                                          " d='" (get-in icon-shapes [icon-name :path]) "'></path>")]))}}])

-;; XXX: add opts if we want to do something more interesting, e.g. different formatting
-(defn updating-duration [start owner opts]
+(defn updating-duration
+  "Takes a start time string and updates the component every second.
+   By default, uses datetime/as-duration, but can also take a custom :formatter
+   function in opts."
+  [start owner opts]
   (reify
     om/IInitState
     (init-state [_]


Fix a bug in the mem store

Fix a bug in the mem store

--- src/icecap/store/mem.clj
+++ src/icecap/store/mem.clj
@@ -12,7 +12,9 @@
         (swap! store assoc index blob)
         (a/to-chan []))
       (retrieve [_ index]
-        (a/to-chan [(@store index)]))
+        (let [v (@store index)
+              vs (if (nil? v) [] [v])]
+          (a/to-chan vs)))
       (delete! [_ index]
         (swap! store dissoc index)
         (a/to-chan [])))))


Clarify comment about "shameless hack" :computer:

--- src/metabase/driver/oracle.clj
+++ src/metabase/driver/oracle.clj
@@ -111,15 +111,16 @@
                                                       :milliseconds (hx// field-or-value (hsql/raw 1000))))))

 (defn- apply-offset-and-limit
-  "Append SQL like `OFFSET 20 FETCH FIRST 10 ROWS ONLY` to the query."
+  "Append SQL like `OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY` to the end of the query."
   [honeysql-query offset limit]
   (assoc honeysql-query
-    :offset (hsql/raw (format "%d ROWS FETCH NEXT %d ROWS ONLY" offset limit) )))
+    :offset (hsql/raw (format "%d ROWS FETCH NEXT %d ROWS ONLY" offset limit))))

 (defn- apply-limit [honeysql-query {value :limit}]
-  ;; Shameless hack! FETCH FIRST ... ROWS ONLY needs to go on the end of the query. Korma doesn't have any built-in
-  ;; way to do this but we can use `k/offset` and set it to 0.
-  ;; OFFSET 0 FETCH FIRST <value> ROWS ONLY
+  ;; HoneySQL doesn't support ANSI SQL "OFFSET <n> ROWS FETCH NEXT <n> ROWS ONLY"
+  ;; The semi-official workaround as suggested by yours truly is just to pass a raw string as the `:offset`
+  ;; which HoneySQL put in the appropriate place
+  ;; see my comment here: https://github.com/jkk/honeysql/issues/58#issuecomment-220450400
   (apply-offset-and-limit honeysql-query 0 value))

 (defn- apply-page [honeysql-query {{:keys [items page]} :page}]


Replace is used

Replace is used

--- src/midara/builder/builder.clj
+++ src/midara/builder/builder.clj
@@ -4,8 +4,9 @@
           clojure.java.io)
     (require [tentacles.repos :as repos]
              [clojure.data.json :as json]
-             [clojure.string :as string
-                :refer [replace join]]
+             [clojure.string
+                :as string
+                :refer [str-replace join]]
              [clojure.core.async
               :as a
               :refer [>! <! >!! <!! go chan buffer close! thread alts! alts!! timeout]]))
@@ -35,7 +36,7 @@
 (defn write-env
   ; write build result
   [owner repo env]
-  (let [-env  (replace env "\^M" "")]
+  (let [-env  (str-replace env "\^M" "")]
     (let [file (join "/" ["workspace" owner repo "env"])]
       (spit file -env))))


Write out hook data to file

Write out hook data to file


Support compiler warning

Support compiler warning

Signed-off-by: Gregory Haskins <640d9fe47775e6723f0355b7315e38f7d98d3539@gmail.com>

--- src/obcc/config/util.clj
+++ src/obcc/config/util.clj
@@ -15,6 +15,7 @@
 ;; specific language governing permissions and limitations
 ;; under the License.
 (ns obcc.config.util
+  (:refer-clojure :exclude [load])
   (:require [clojure.java.io :as io]
             [obcc.config.parser :as config]))


syntax fix

syntax fix

--- src/oc/email/content.clj
+++ src/oc/email/content.clj
@@ -258,7 +258,7 @@
              [:th {:class "small-6 large-6 columns header-right"}
                [:span.header-right-span
                  "Lead with clarity"]]]]
-         (vspacer 24 "header-table" "header-table")]]])
+         (vspacer 24 "header-table" "header-table")]]]))

 (declare reminder-notification-settings-footer)


Re-introduce support for :seq/checkpoint? option (#898)

Allows us to prevent checkpoints on seq plugin inputs, for example, when
using an infinite seq as input.

--- src/onyx/plugin/seq.cljc
+++ src/onyx/plugin/seq.cljc
@@ -4,7 +4,7 @@
             [onyx.plugin.protocols :as p]
             [taoensso.timbre :refer [fatal info debug] :as timbre]))

-(defrecord AbsSeqReader [event sequential rst completed? offset]
+(defrecord AbsSeqReader [event sequential rst completed? checkpoint? offset]
   p/Plugin

   (start [this event]
@@ -15,7 +15,7 @@

   p/Checkpointed
   (checkpoint [this]
-    @offset)
+    (when checkpoint? @offset))

   (recover! [this _ checkpoint]
     (vreset! completed? false)
@@ -46,11 +46,12 @@
       (do (vreset! completed? true)
           nil))))

-(defn input [event]
+(defn input [{:keys [onyx.core/task-map] :as event}]
   (map->AbsSeqReader {:event event
                       :sequential (:seq/seq event)
                       :rst (volatile! nil)
                       :completed? (volatile! false)
+                      :checkpoint? (not (false? (:seq/checkpoint? task-map)))
                       :offset (volatile! nil)}))

 (def reader-calls


Add a toggle for the HUD; closes #55

Add a toggle for the HUD; closes #55

--- src/adzerk/boot_reload.clj
+++ src/adzerk/boot_reload.clj
@@ -97,7 +97,8 @@
    j on-jsload SYM     sym "The callback to call when JS files are reloaded. (optional)"
    _ asset-host HOST   str "The asset-host where to load files from. Defaults to host of opened page. (optional)"
    a asset-path PATH   str "The asset-path. This is removed from the start of reloaded urls. (optional)"
-   o open-file COMMAND str "The command to run when warning or exception is clicked on HUD. Passed to format. (optional)"]
+   o open-file COMMAND str "The command to run when warning or exception is clicked on HUD. Passed to format. (optional)"
+   v disabled-hud      bool "Toggle to disable HUD. Defaults to false (visible)."]

   (let [pod  (make-pod)
         src  (tmp-dir!)
@@ -123,7 +124,7 @@
               fileset (try
                         (next-task fileset)
                         (catch Exception e
-                          (if (= :boot-cljs (:from (ex-data e)))
+                          (if (and (= :boot-cljs (:from (ex-data e))) (not disabled-hud))
                             (send-visual! @pod {:exception (merge {:message (.getMessage e)}
                                                                   (ex-data e))}))
                           (throw e)))]
@@ -133,7 +134,8 @@
                                   (map b/tmp-path)
                                   (map(fn [x] (clojure.string/replace x #"\.cljs\.edn$" ".js")))
                                   set)]
-            (send-visual! @pod {:warnings warnings})
+            (if-not disabled-hud
+              (send-visual! @pod {:warnings warnings}))
             ; Only send changed files when there are no warnings
             ; As prev is updated only when changes are sent, changes are queued untill they can be sent
             (when (empty? warnings)


goodbye repetetive datomic config

goodbye repetetive datomic config

--- server/project.clj
+++ server/project.clj
@@ -24,17 +24,13 @@
             [lein-environ "0.4.0"]
             [lein-datomic "0.2.0"]]

-  :datomic {:schemas ["resources/schema" ["schema.edn" "seed-data.edn"]]}
-
   :profiles {:dev
              {:dependencies [[midje "1.5.0"]]
               :env {:html-paths ["../html-app/app"
                                  "../html-app/.tmp"]
                     :datomic {:config "resources/datomic-transactor.properties"
                               :db-uri "datomic:free://localhost:4334/gp2"
-                              :test-uri "datomic:mem://gp2"}}
-              :datomic {:config "resources/datomic-transactor.properties"
-                        :db-uri "datomic:free://localhost:4334/gp2"}}
+                              :test-uri "datomic:mem://gp2"}}}

              ;;
              :production


bundel-run

bundel-run

--- src/pinkgorilla/notebook_ui/app_bundel/app.clj
+++ src/pinkgorilla/notebook_ui/app_bundel/app.clj
@@ -20,21 +20,19 @@
       (warn "goldly is disabed!"))))

 (defn notebook-bundel-run!
-  ([]
-   (notebook-bundel-run! nil "jetty"))
-  ([user-config]
-   (notebook-bundel-run! user-config "jetty"))
-  ([user-config profile]
-   (let [config (add-config "notebook-bundel.edn" user-config)]
-     (if (server? profile)
-       (do (load-config! config)
-           (run-goldly!)
-           (run-notebook-services!))
-       (warn "no server mode. not running explorer/goldly/nrepl"))
-     (webly-run! profile config))))
+  [{:keys [config profile] ; a map so it can be consumed by tools deps -X
+    :or {profile "jetty"
+         config {}}}]
+  (let [config (add-config "notebook-bundel.edn" config)]
+    (if (server? profile)
+      (do (load-config! config)
+          (run-goldly!)
+          (run-notebook-services!))
+      (warn "no server mode. not running explorer/goldly/nrepl"))
+    (webly-run! profile config)))

 (defn -main
   ([]
-   (notebook-bundel-run!))
+   (notebook-bundel-run! {}))
   ([profile]
-   (notebook-bundel-run! nil profile)))
+   (notebook-bundel-run! {:profile profile})))


Use 'empty-state/important' to emphasise words in empty states

Correct 'TestFlight' spelling

--- src-cljs/frontend/components/project_settings.cljs
+++ src-cljs/frontend/components/project_settings.cljs
@@ -1963,7 +1963,10 @@
                                                  (map (partial merge {:project-name project-name
                                                                       :vcs-type vcs-type})))})
              (empty-state/empty-state {:icon [:i.octicon.octicon-key]
-                                       :heading (str project-name " has no code signing identities yet")
+                                       :heading (html
+                                                  [:span (str project-name " has no ")
+                                                   (empty-state/important "code signing keys")
+                                                   " yet"])
                                        :subheading "Apple Code Signing requires a valid Code Signing Identity (p12) file."
                                        :action (button/button {:on-click #(om/set-state! owner :show-modal? true)
                                                                :kind :primary}
@@ -1996,7 +1999,7 @@
            [:hr.divider]
            [:div.info "The following provisioning profiles will be copied to the system location when your build
                       starts. This is to enable Xcode to sign your application. A provisioning profile should not
-                      usually be required for running tests, but will be required for ad-hoc, Tesflight, and
+                      usually be required for running tests, but will be required for ad-hoc, TestFlight, and
                       App Store builds. See our "
             [:a
              {:href "https://circleci.com/docs/ios-code-signing/"}
@@ -2007,7 +2010,10 @@
                                                               (map (partial merge {:project-name project-name
                                                                                :vcs-type vcs-type})))})
              (empty-state/empty-state {:icon [:i.octicon.octicon-key]
-                                       :heading (str project-name " has no provisioning profiles yet")
+                                       :heading (html
+                                                  [:span (str project-name " has no ")
+                                                   (empty-state/important "provisioning profiles")
+                                                   " yet"])
                                        :subheading "Apple Code Signing requires a valid provisioning profile (mobileprovision)."
                                        :action (button/button {:on-click #(om/set-state! owner :show-modal? true)
                                                                :kind :primary}