Create checkboxes for left and right axis

--- src-cljs/kixi/hecuba/web/chart.cljs
+++ src-cljs/kixi/hecuba/web/chart.cljs
@@ -69,30 +69,31 @@
   [device-details]
   (fn [cursor opts]
     (reify
-      om/IWillMount
-      (will-mount [this]
-        (.log js/console "I will mount")
-        (om/update! cursor update-in [:data] (fn [data] (get mock-data (:selected cursor)))))
       om/IRender
       (render [this]
-        (.log js/console "I render")
         (dom/div nil
-                 (dom/p nil (apply str (interpose "," (get-in cursor [:selected]))))
-                 (dom/form nil
-                           (for [device (get cursor :devices)]
-                             (let [device-id   (str (:hecuba/name device))
-                                   device-name (str (:name device))]
-                               (dom/input #js {:type "checkbox"
-                                               :value device-id
-                                               :ref device-name
-                                               :onChange (fn [e]
-                                                          (om/update! cursor update-in [:selected]
-                                                                      (if (.. e -target -checked) conj disj) device-id))}
-                                          device-name))))
-                 (dom/div #js {:id "chart"})))
+                 (dom/div #js {:id "chart" :width 500 :height 450})
+                 (dom/table #js {:id "form-table" :cellSpacing "10"}
+                            (let [cols ["Left axis plots" "Right axis plots"]]
+                               (dom/tr nil
+                                       (for [col cols]
+                                         (dom/td nil
+                                                 (dom/h4 nil (str col))
+                                                 (dom/form nil
+                                                           (for [device (get cursor :devices)]
+                                                             (let [device-id   (str (:hecuba/name device))
+                                                                   device-name (str (:name device))]
+                                                               (dom/div nil
+                                                                        (dom/input #js {:type "checkbox"
+                                                                                :ref device-id
+                                                                                :value device-id
+                                                                                :onChange (fn [e]
+                                                                                (om/update! cursor update-in [:selected]
+                                                                                (if (.. e -target -checked) conj disj) device-id))})
+                                                                        (dom/label #js {:htmlFor device-id} device-name)
+                                                                        (dom/br #js {}))))))))))))
       om/IDidUpdate
       (did-update [this prev-props prev-state root-node]
-        (.log js/console "I did update")
         (let [n (.getElementById js/document "chart")]
              (while (.hasChildNodes n)
                (.removeChild n (.-lastChild n))))
@@ -116,7 +117,7 @@
       (render [this]
         (dom/div nil
                  (dom/h3 nil (str "Metering data - " (get-in cursor [:property])))
-                 (dom/h4 nil "Select devices to be plotted on the chart:")
+                 (dom/p nil "Note: When you select something to plot on a given axis, you will only be able to plot other items of the same unit on that axis.")
                  (om/build chart-comp cursor))))))


solved Reverse Interleave

solved Reverse Interleave

--- src/4clojure/reverse_interleave.clj
+++ src/4clojure/reverse_interleave.clj
@@ -7,7 +7,7 @@

 (defn __ [coll n]
-  (partition-by #(mod % (inc n)) coll))
+  (vals (group-by #(mod % n) coll)))

 ;; (mod 5 3)

@@ -19,12 +19,31 @@

 ;; (repeat 2 [])

-(conj (nth %1
+;; (conj (nth %1

-(reduce #(conj (nth %1 (mod ) (repeat 2 []) [1 2 3 4 5 6])
+;; (reduce #(conj (nth %1 (mod ) (repeat 2 []) [1 2 3 4 5 6])

 (= (__ [1 2 3 4 5 6] 2) '((1 3 5) (2 4 6)))

 (= (__ (range 9) 3) '((0 3 6) (1 4 7) (2 5 8)))

 (= (__ (range 10) 5) '((0 5) (1 6) (2 7) (3 8) (4 9)))
+
+
+;; 4Clojure copy paste
+(fn [coll n]
+  (vals (group-by #(mod % n) coll)))
+
+
+;; _artem_uv's solution:
+(fn [s c]
+  (partition (/ (count s) c) (apply interleave (partition c s))))
+
+;; _pcl's solution:
+(fn [xs n] (apply map vector (partition n xs)))
+
+;; aceeca1's solution:
+#(apply (partial map list) (partition %2 %1))
+
+;; adereth's solution:
+#(apply (partial map vector) (partition %2 %1))


Typos! Who likes those.

Typos! Who likes those.

--- resources/fragments/onvim.clj
+++ resources/fragments/onvim.clj
@@ -3,13 +3,10 @@
  [:h2 "Complaints about VIM as I Struggle to Master It"]
  [:h3 "~ or ~"]
  [:h1 "Straw Horses & VIM"]
- [:h2 "How They Tell You Editing Sucks, VS How It Actually Sucks"]
- [:section   [:p [:span.newthought "I am typing this in "
-                  [:a {:href "http://spacemacs.org"} "Spacemacs"]
-                  ]
-              ", a version of Emacs that's been overhauled to operate like Vim."]
-
-  [:p "I've watched "[:a {:href "https://vimeo.com/53144573"} "Drew Neil's talk on Vim"] " and bought his book, which I'm still working throuh. I've run through the VimTutor more than once, in Vim and in Spacemacs, and I've used Spacemacs for real work (both client work and to build the static site generator that creates these pages)."
+ [:h2 "How They Tell You Editing Sucks, vs. How It Actually Sucks"]
+ [:section
+  [:p [:span.newthought "I am typing this in " [:a {:href "http://spacemacs.org"} "Spacemacs"]] ", a version of Emacs that's been overhauled to operate like Vim."]
+  [:p "I've watched "[:a {:href "https://vimeo.com/53144573"} "Drew Neil's talk on Vim"] " and bought his book, which I'm still working through. I've run through the VimTutor more than once, in Vim and in Spacemacs, and I've used Spacemacs for real work (both client work and to build the static site generator that creates these pages)."
    [:ul
     [:li "The mouse is BAD (not if you've played video games all your life, it's not; first-person shooters are ALL ABOUT hitting arbitrary tiny targets fast, and I've been doing that for a decade or more for fun; and these days the touchpad on laptops is always in the same place, vastly reducing time needed to find & use it). For example, Neil (around 33 minutes into his talk) talks about a notional touch interaction where you've to pick out the opening and closing brackets/tags/quotes of a section of text to highlight them. But who would suggest that?! There's already a great way of selecting the matching closing tag in a text using a mouse: double-click the opening (or closing) tag. IntelliJ does this, and I'm sure others do too. It works " [:emphasis "without"] " you having to even consider the type of tag and finding it's matching symbol on the keyboard. The v-a-t workflow Neil describes is " [:strong "great"] ", but made-up examples of poor alternatives don't sell it."]
     [:li "The cursor keys are BAD because... reasons?"]


Add pallet/alembic to Clojure profile

Add pallet/alembic to Clojure profile

--- clojure/profiles.clj
+++ clojure/profiles.clj
@@ -18,6 +18,8 @@
                   ;; Keep adding more stuff here
                   ]
         ;; Experimental
-        :dependencies [[pjstadig/humane-test-output "0.8.3"]]
+        :dependencies [[pjstadig/humane-test-output "0.8.3"]
+                       ;; See: https://github.com/pallet/alembic
+                       [alembic "0.3.2"]]
         :injections [(require 'pjstadig.humane-test-output)
                      (pjstadig.humane-test-output/activate!)]}}


adding todo

adding todo


CMR-5081: Change test slightly.

CMR-5081: Change test slightly.

Change test from looking for just concept-id to the granule search
option.

--- system-int-test/test/cmr/system_int_test/search/collection_concept_retrieval_test.clj
+++ system-int-test/test/cmr/system_int_test/search/collection_concept_retrieval_test.clj
@@ -181,16 +181,16 @@
         (is (search/mime-type-matches-response? response mt/umm-json))
         (is (= (:entry-title umm-coll) (:EntryTitle parsed-collection)))))))

-(defn- html-search-response-has-concept-id?
-  "Returns true if html contains concept-id."
+(defn- html-search-response-has-collection-granule-search?
+  "Returns true if html contains granule search option."
   [coll]
   (let [concept-id (:concept-id coll)
         response (search/retrieve-concept concept-id nil {:url-extension "html"})]
-    (.contains ^String (:body response) concept-id)))
-
-(deftest html-concept-id-retrieval-test
-  "Test html concept-id retrieval for collections with and without granules."
-  (testing "html response for collection with and without granules"
+    (.contains ^String (:body response) (str "https://search.earthdata.nasa.gov/search/granules?p=" concept-id))))
+
+(deftest html-collection-granule-search-test
+  "Test html search for collections with and without granules."
+  (testing "html response for collections with and without granules"
     (e/grant-all (s/context) (e/coll-catalog-item-id "PROV1"))
     (e/grant-all (s/context) (e/gran-catalog-item-id "PROV1"))
     (let [coll-with-granules (d/ingest "PROV1" (dc/collection {:short-name "With granules"
@@ -201,8 +201,8 @@
                                                                   :version-id "V2"}))]
       (d/ingest "PROV1" (dg/granule coll-with-granules))
       (index/wait-until-indexed)
-      (is (html-search-response-has-concept-id? coll-with-granules))
-      (is (not (html-search-response-has-concept-id? coll-without-granules))))))
+      (is (html-search-response-has-collection-granule-search? coll-with-granules))
+      (is (not (html-search-response-has-collection-granule-search? coll-without-granules))))))

 (defn- expected-umm-json
   "Returns the expected umm json in the expected-version for the given metadata whose umm


adding cleanup

adding cleanup

--- src/celestial/puppet_standalone.clj
+++ src/celestial/puppet_standalone.clj
@@ -21,17 +21,16 @@
     [taoensso.timbre :only (debug info error warn)]
     ))

-
 (defn copy-module [remote {:keys [src name]}]
   {:pre [(remote :host) src name]}
   "Copy a opsk module into server"
-  (copy src "/tmp" remote ))
+  (copy src "/tmp" remote))

 (defn copy-yml-type [{:keys [type hostname puppet-std] :as _type} remote]
   (let [path (<< "/tmp/~{hostname}.yml") f (file path)
         name (get-in puppet-std [:module :name])]
     (spit f (yaml/generate-string (select-keys _type [:classes])))
-    (copy path (<< "/tmp/~{name}/") remote )
+    (copy path (<< "/tmp/~{name}/") remote)
     (.delete f)))

 (defn as-root [remote cmd]
@@ -48,7 +47,7 @@
       (copy-yml-type type remote)
       (execute (str (<< "cd /tmp/~(:name module)") " && " (as-root remote "./scripts/run.sh")) remote)
       (finally
-        #_(execute remote (step :cleanup "cd /tmp" (<< "rm -rf ~(:name module)*"))))))))
+        (execute (<< "rm -rf /tmp/~(:name module)*") remote))))))

 (defmethod pconstruct :puppet-std [type {:keys [machine] :as spec}]


cleanup

cleanup

--- src/clj/rksm/websocket_test/com.clj
+++ src/clj/rksm/websocket_test/com.clj
@@ -1,49 +1,34 @@
 (ns rksm.websocket-test.com
-  (:require [clojure.core.async :as async])
   (:import (java.util UUID)))

 ; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

 (defn send-msg
-  [{:keys [id] :as sender} msg]
-  (merge {:sender id, :id (str (UUID/randomUUID))} msg))
+  [{:keys [id] :as sender} msg expect-more-responses]
+  (merge {:sender id,
+          :id (str (UUID/randomUUID)),
+          :expect-more-responses expect-more-responses}
+         msg))

 (defn answer-msg
-  [responder {:keys [id action sender] :as msg} data]
+  [responder {:keys [id action sender] :as msg} data expect-more-responses]
   (send-msg responder {:in-response-to id
                        :target sender
                        :action (str action "-response")
-                       :data data}))
-
-(defn stringify-for-send
-  [{:keys [id] :as sender} msg]
-  (let [msg (merge {:sender id, :id (str (UUID/randomUUID))} msg)
-        stringified (json/write-str msg)]
-    stringified))
-
-(defn stringify-for-answer
-  [responder {:keys [id action sender] :as msg} data]
-  (stringify-for-send responder {:in-response-to id
-                                 :target sender
-                                 :action (str action "-response")
-                                 :data data}))
-
-(defn relay-answers
-  [id channel]
-  (async/>!! channel ))
+                       :data data}
+            expect-more-responses))

 ; -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

 (defn send!
-  [send-fn {id :id, :as sender} msg]
-  (let [msg (send-msg sender msg)]
-    (send-fn msg)
-    ; (relay-answers id c)
-    msg
-    ))
+  [send-fn {id :id, :as sender} msg
+   & {:keys [expect-more-responses], :or {expect-more-responses false}}]
+  (let [msg (send-msg sender msg expect-more-responses)]
+    (send-fn msg) msg))

 (defn answer!
-  [send-fn responder msg data]
-  (let [msg (answer-msg responder msg data)]
+  [send-fn responder msg data
+   & {:keys [expect-more-responses], :or {expect-more-responses false}}]
+  (let [msg (answer-msg responder msg data expect-more-responses)]
     (send-fn msg)
     msg))


Don't make an api call on every filter change

--- src/cljs/comic_reader/handlers.cljs
+++ src/cljs/comic_reader/handlers.cljs
@@ -41,7 +41,8 @@
   (rf/register-handler
    :comics
    (fn [db [page site filter]]
-     (api/get-comics site)
+     (if-not (= (:site db) site)
+       (api/get-comics site))
      (-> db
          (assoc :page page
                 :site site
@@ -57,10 +58,10 @@
        (do
          (api/get-comic-pages site location)
          (assoc db
-               :page page
-               :site site
-               :location location
-               :comic-imgs [])))))
+                :page page
+                :site site
+                :location location
+                :comic-imgs [])))))

   (rf/register-handler
    :site-list


remove extra logs

remove extra logs

--- src/cljs/lisp_interpreter/core.cljs
+++ src/cljs/lisp_interpreter/core.cljs
@@ -73,7 +73,6 @@
   ;[var]
   ;(lookup-variable var global-env)
   [var env]
-  (js/console.log "the var is " var)
   (let [new-var (keyword var)]
     (or (new-var (:frames @env))
         (new-var @env))))
@@ -137,7 +136,6 @@
   (list? exp))

 (defn operator [exp]
-  (js/console.log "the first of exp is" (first exp))
   (first exp))

 (defn operands [exp]
@@ -164,7 +162,6 @@
         (variable? exp) (lookup-variable exp env)
         (lookup? exp) (eval-lookup exp env)
         (lambda? exp) (do
-                        (js/console.log "hello ")
                         (make-proc (lambda-params exp) (lambda-body exp) env))
         (application? exp) (my-apply (my-eval (operator exp) env)
                                      (eval-sub-exps (operands exp) env))


deck edit textarea update when editing a deck

--- src/cljs/netrunner/deckbuilder.cljs
+++ src/cljs/netrunner/deckbuilder.cljs
@@ -16,8 +16,12 @@
                 (not (#{"Special" "Alternates"} (:setname %)))
                 (= (:type %) "Identity")) (:cards @cb/app-state)))

+(defn deck->str [cards]
+  (reduce #(str %1 (:qty %2) " " (get-in %2 [:card :title]) "\n") "" cards))
+
 (defn edit-deck [owner]
   (om/set-state! owner :edit true)
+  (om/set-state! owner :deck-edit (deck->str (om/get-state owner [:deck :cards])))
   (-> owner (om/get-node "viewport") js/$ (.css "left" -500)))

 (defn new-deck [side owner]
@@ -39,8 +43,9 @@
     (go (let [response (<! (POST "/data/decks/" data :json))]))))

 (defn handle-edit [event owner]
-  (let [deck (-> owner (om/get-node "deck-edit") .-value)]
-    (om/set-state! owner [:deck :cards] (parse-deck deck))))
+  (let [text (-> owner (om/get-node "deck-edit") .-value)]
+    (om/set-state! owner :deck-edit text)
+    (om/set-state! owner [:deck :cards] (parse-deck text))))

 (defn decklist-view [{:keys [name identity cards]} owner]
   (om/component
@@ -62,6 +67,7 @@
       {:edit false
        :card-search ""
        :quantity 1
+       :deck-edit ""
        :deck {}})

     om/IRenderState
@@ -106,7 +112,8 @@
              [:input.lookup {:type "text" :placeholder "Card" :value (:card-search state)}] " x "
              [:input.qty {:type "text" :value (:quantity state)}]
              [:button {:on-click #()} "Add"]]
-            [:textarea {:ref "deck-edit" :on-change #(handle-edit % owner)}]]]]]]))))
+            [:textarea {:ref "deck-edit" :value (:deck-edit state)
+                        :on-change #(handle-edit % owner)}]]]]]]))))

 (om/root deck-builder app-state {:target (. js/document (getElementById "deckbuilder"))})

@@ -116,6 +123,3 @@
                     (let [cards (map #(str (:qty %) " " (:card %)) (:cards deck))]
                       (assoc deck :cards (parse-deck (join "\n" cards)))))]
         (swap! app-state assoc :decks decks))))
-
-
-(println (:decks @app-state))


allow to refine keys

allow to refine keys

--- src/clojure/nightcode/shortcuts.clj
+++ src/clojure/nightcode/shortcuts.clj
@@ -12,7 +12,8 @@

 (def down? (atom false))
 (def ^:dynamic *hint-container* nil)
-(def ^:const mappings {:new-project "P"
+
+(def ^:const mappings (merge {:new-project "P"
                        :rename "M"
                        :import "O"
                        :remove "G"
@@ -45,7 +46,8 @@
                        :edit "shift M"
                        :open-in-browser "shift F"
                        :cancel "shift C"
-                       :build-console "shift A"})
+                       :build-console "shift A"}
+                      (try (read-string (slurp "keys.clj")) (catch Exception e {}))))

 (defn create-mapping!
   "Maps `func` to the key combo associated with `id`."


start app with autoeval on

start app with autoeval on

--- src-app/swirl/app/ui.cljs
+++ src-app/swirl/app/ui.cljs
@@ -124,6 +124,7 @@
 (defn start
   [context]
   (let [stop-render (start-render context)]
+    (start-watch context)
     (fn stop
       []
       (stop-render)
@@ -138,7 +139,7 @@
                  :history* history*
                  :text-ch text-ch
                  :textarea-id textarea-id
-                 :control-state (reagent/atom {:autoeval false
+                 :control-state (reagent/atom {:autoeval true
                                                :expand-output false
                                                :width 500})
                  :mount-pt mount-pt}


nth important

nth important

--- src/Miscellaneous/warehouse.clj
+++ src/Miscellaneous/warehouse.clj
@@ -7,16 +7,19 @@
             [monger.core :as mg];the following 4 is for mongo use
             [monger.collection :as mc]
             [monger.operators :refer :all]
-            [monger.query :refer :all]
-            [Miscellaneous.purui :as purui])
+            [monger.query :refer :all])
   (:import [com.mongodb MongoOptions ServerAddress WriteConcern];the following two is for mongo use
            org.bson.types.ObjectId))

-(mg/connect! {:host "192.168.3.53" :port 7017})
+#_(mg/connect! {:host "192.168.3.53" :port 7017})

-(mg/set-db! (mg/get-db "test"))
+(mg/connect!)

-(declare extract-text extract-tieba)
+#_(mg/set-db! (mg/get-db "test"))
+
+(mg/set-db! (mg/get-db "star"))
+
+(declare extract-text extract-tieba extract-tianya extract-weibo extract-douban extract-youku)

 (defn integrate-text
   [& {:as source}]
@@ -25,13 +28,13 @@
         job (filter s m)]
     (mapcat #(extract-text % (get source %)) job)))

-(integrate-text :tianya 3 :douban 2 :tieba "star_baidutieba_contents")
+(mc/insert-batch "xuetest" (integrate-text :tianya "tianya" :douban 2 :tieba "tieba" :gada "haha" :weibo "weibo"))

 (defn extract-text
   [source-key source-address]
-  (cond (= source-key :tianya) (println "This is tianya")
+  (cond (= source-key :tianya) (extract-tianya source-address)
         (= source-key :tieba) (extract-tieba source-address)
-        (= source-key :weibo) (println "This is weibo")
+        (= source-key :weibo) (extract-weibo source-address)
         (= source-key :douban) (println "This is douban")
         (= source-key :youku) (println "This is youku")))

@@ -52,22 +55,48 @@
          (map j)
          flatten
          (remove #(= "" (:text %)))
-         (map #(assoc % :source "tianya"))
+         (map #(assoc % :source "tieba"))
          )))

-(mc/insert-batch "xuetest" (extract-tieba "star_baidutieba_contents"))
+(defn extract-tianya
+  [source-address]
+  (let [m (mc/find-maps source-address)
+        f #(select-keys % [:_id :content])
+        g #(assoc {} :mid (:_id %) :text (:content %) :level (Integer. 0) :source "tianya")]
+    (->> m
+         (map f)
+         (map g)
+         )))

-(extract-tieba "star_baidutieba_contents")
+(defn extract-weibo
+  [source-address]
+  (let [m (mc/find-maps source-address)
+        f #(select-keys % [:_id :text])
+        g #(assoc {} :mid (:_id %) :text (:text %) :level (Integer. 0) :source "weibo")]
+    (->> m
+         (map f)
+         (map g))))

-((comp :text :minireps) {:minireps {:text '3}})
+;(extract-weibo "weibo")

-(mc/find-maps "star_baidutieba_contents")
+
+
+
+
+(mc/insert-batch "xuetest" (extract-tieba "tieba"))
+
+;(extract-tieba "star_baidutieba_contents")
+
+
+
+
+

 #_(with-collection "star_baidunews_history"
   find{})

-
+;;;;;;;;;;;;;;;;;;;;;tips;;;;;;;;;;;;;;;;;;;;;;;;

 (flatten [[{:a 2} {:b 3}] [{:c 4} {:d 5}]])


Add separate devcards for view-dispatcher

--- src/devcards/discuss/molecules.cljs
+++ src/devcards/discuss/molecules.cljs
@@ -3,7 +3,8 @@
             [sablono.core :as html :refer-macros [html]]
             [discuss.parser :as parser]
             [discuss.views :as views]
-            [discuss.communication.lib :as comlib]))
+            [discuss.communication.lib :as comlib]
+            [om.next :as om]))

 (defcard sample-requests
   "Do some sample requests with `ajax-get`."
@@ -19,12 +20,22 @@

 (defcard-om-next discussion-elements
   views/DiscussionElements
-  parser/reconciler
-  {:inspect-data true :history true})
+  parser/reconciler)

-(defcard-om-next view-dispatcher
+(defcard-om-next view-dispatcher-default
   views/ViewDispatcher
-  parser/reconciler)
+  (om/reconciler {:state {:layout/view :default}
+                  :parser (om/parser {:read parser/read})}))
+
+(defcard-om-next view-dispatcher-login
+  views/ViewDispatcher
+  (om/reconciler {:state {:layout/view :login}
+                  :parser (om/parser {:read parser/read})}))
+
+(defcard-om-next view-dispatcher-options
+  views/ViewDispatcher
+  (om/reconciler {:state {:layout/view :options}
+                  :parser (om/parser {:read parser/read})}))

 (defcard-om-next main-content-view
   views/MainContentView


Make tooltip nil-safe

Make tooltip nil-safe

--- src/discuss/components/tooltip.cljs
+++ src/discuss/components/tooltip.cljs
@@ -87,10 +87,11 @@
 (defn track-user-selection
   "Listen to clicks on the websites' text to store it in the app-state."
   []
-  (let [clicks (listen (gdom/getElement "discuss-text") "click")]
-    (go (while true
-          (<! clicks)
-          (save-selected-text)))))
+  (when-let [discuss-text-dom (gdom/getElement (lib/prefix-name "text"))]
+    (let [clicks (listen discuss-text-dom "click")]
+      (go (while true
+            (<! clicks)
+            (save-selected-text))))))

 ;;;; Creating the view
 (defui Tooltip


Remove obsolete todo.

Remove obsolete todo.

--- src/fhofherr/simple/core/job_fn.clj
+++ src/fhofherr/simple/core/job_fn.clj
@@ -89,11 +89,6 @@
   (letfn [(job [ctx]
             (io!
              (->> ctx
-                  ;; TODO should the context be marked as executing here
-                  ;; instead of when transitioning the job execution?
-                  ;; This would require to mark the context successful after
-                  ;; all steps have complented. But only if none of them failed
-                  ;; the test.
                   (apply-step before false)
                   (apply-step test false)
                   (apply-step after true))))]


Remove grafter.rdf.ontologies.util namespace from docs, as users should use prefixer from grafter.rdf.

--- src/grafter/rdf/ontologies/util.clj
+++ src/grafter/rdf/ontologies/util.clj
@@ -1,6 +1,9 @@
-(ns grafter.rdf.ontologies.util
+(ns ^:no-doc grafter.rdf.ontologies.util
   "Some utility functions for ontology specification and management
-  within Clojure.")
+  within Clojure.
+
+  For internal use, mostly to prevent circular dependencies from the
+  ontology namespaces on grafter.rdf/prefixer")

 (defn prefixer
   "Takes the base prefix of a URI string and returns a function that


Add more core tests.

Add more core tests.

--- test/blocks/core_test.clj
+++ test/blocks/core_test.clj
@@ -86,23 +86,34 @@
 ;; ## Storage Function Tests

 (deftest list-wrapper
-  (let [store (reify block/BlockStore (enumerate [this opts] (vector :list opts)))]
-    (is (= [:list nil] (block/list store)))
-    (is (= [:list {:foo "bar" :baz 3}] (block/list store :foo "bar" :baz 3)))))
+  (let [store (reify block/BlockStore (-list [_ opts] opts))]
+    (is (nil? (block/list store)))
+    (is (= {:foo "bar"} (block/list store {:foo "bar"})))
+    (is (= {:foo "bar", :baz 3} (block/list store :foo "bar" :baz 3)))))

-(deftest checked-get
-  (let [content "foobarbaz"
-        block (block/read! content)
-        id (multihash/sha1 "bazbarfoo")
-        store (reify block/BlockStore (get* [this id] (assoc block :id id)))
-        block (block/get* store id)]
-    (is (= id (:id block)))
-    (is (bytes= content (:content block)))
-    (is (thrown? RuntimeException
-                 (block/get store (:id block))))))
+(deftest get-wrapper
+  (testing "non-multihash id"
+    (is (thrown? IllegalArgumentException (block/get {} "foo"))))
+  (testing "no block result"
+    (let [store (reify block/BlockStore (-get [_ id] nil))]
+      (is (nil? (block/get store (multihash/sha1 "foo bar"))))))
+  (testing "invalid block result"
+    (let [content "foobarbaz"
+          block (block/read! content)
+          store (reify block/BlockStore (-get [_ id] (assoc block :id id)))
+          other-id (multihash/sha1 "bazbarfoo")]
+      (is (thrown? RuntimeException (block/get store other-id))))))

+(deftest store-wrapper
+  (let [store (reify block/BlockStore (put! [_ block] block))
+        block (block/store! store "alphabet soup")]
+    (is (instance? blocks.core.Block block))
+    (is (nil? (block/validate! block)))))
+
+
+#_
 (deftest multihash-selection
   (let [a (multihash/create :sha1 "37b51d194a7513e45b56f6524f2d51f200000000")
         b (multihash/create :sha1 "73fcffa4b7f6bb68e44cf984c85f6e888843d7f9")


(SERVER-1721) Fix test macro

(SERVER-1721) Fix test macro

This macro was using the value of config-overrides at compile time
instead of runtime, so you could not give it a variable containing
the config overrides

--- test/integration/puppetlabs/puppetserver/bootstrap_testutils.clj
+++ test/integration/puppetlabs/puppetserver/bootstrap_testutils.clj
@@ -121,13 +121,13 @@

 (defmacro with-puppetserver-running
   [app config-overrides & body]
-  (let [config (load-dev-config-with-overrides config-overrides)]
-    `(let [services# (tk-bootstrap/parse-bootstrap-config! ~dev-bootstrap-file)]
-       (tk-testutils/with-app-with-config
-         ~app
-         services#
-         ~config
-         ~@body))))
+  `(let [config# (load-dev-config-with-overrides ~config-overrides)]
+     (let [services# (tk-bootstrap/parse-bootstrap-config! ~dev-bootstrap-file)]
+       (tk-testutils/with-app-with-config
+        ~app
+        services#
+        config#
+        ~@body))))

 (defmacro with-puppetserver-running-with-mock-jrubies
   "This macro should be used with caution; it makes tests run much more quickly,


Add test for an async operation not finishing in-time.

--- test/cli4clj/test/cli.clj
+++ test/cli4clj/test/cli.clj
@@ -206,6 +206,20 @@
     (is (= "Linking to foo hint test." (.get arr-lst 0)))
     (is (= "" (.get arr-lst 1)))))

+(deftest async-cmd-not-finished-test
+  (let [cli-opts {:cmds {:async-foo {:fn (fn []
+                                           (println "Starting...")
+                                           (doto
+                                             (Thread.
+                                               (fn []
+                                                 (sleep 60000)
+                                                 (println "Finished.")))
+                                             (.start))
+                                           "Started.")}}}
+        test-cmd-input ["async-foo"]
+        out-string (test-cli-stdout #(start-cli cli-opts) test-cmd-input)]
+    (is (= (expected-string ["Starting..." "\"Started.\""]) out-string))))
+

 (deftest simple-jline-input-stream-mock-test


Add doc string to `compare-images`.

Add doc string to `compare-images`.

--- test/clj/quil/snippet.clj
+++ test/clj/quil/snippet.clj
@@ -28,7 +28,15 @@
                "save"
                "time-and-date"} snippet-name))

-(defn- compare-images [expected actual difference]
+(defn- compare-images
+  "Compares images at file paths `expected` and `actual` and produces another
+  image at path `difference` which highlights any differences in the images.
+
+  Returns a number between `0` and `1` indicating a measure of the difference.
+  with `0` indicating the images are the same."
+  [expected actual difference]
+  ;; use imagemagick compare executable for comparison
+  ;; see https://imagemagick.org/script/compare.php
   (let [{:keys [err]} (sh/sh "compare" "-metric" "mae" expected actual difference)
         result        (second (re-find #"\((.*)\)" err))]
     (edn/read-string result)))


Simplify the test

Simplify the test

Don't need slack and email bits

--- test/runbld/main_test.clj
+++ test/runbld/main_test.clj
@@ -767,16 +767,9 @@
 (s/deftest java-home-in-path
   (let [logs (atom [])
         orig-save-logs store/save-logs!]
-    (with-redefs [email/send* (fn [& args]
-                                (swap! email concat args)
-                                ;; to satisfy schema
-                                {})
-                  slack/send fake-slack-send
-                  store/save-logs! (fn [opts docs]
+    (with-redefs [store/save-logs! (fn [opts docs]
                                      (reset! logs docs)
                                      (orig-save-logs opts docs))]
-      (reset! email [])
-      (reset! slack [])
       (git/with-tmp-repo [d "tmp/git/java-home-test"]
         (let [java-home (:home (java/jvm-facts))
               [opts res] (run


Add :implements in the gen-class of the defactivity macro

--- src/clojure/neko/activity.clj
+++ src/clojure/neko/activity.clj
@@ -59,7 +59,7 @@

   Available optional arguments:

-  :extends, :prefix - same as for `gen-class`.
+  :extends, :implements, :prefix - same as for `gen-class`.

   :features - window features to be requested for the activity.
   Relevant only if :create is used.
@@ -73,7 +73,7 @@

   :on-start, :on-restart, :on-resume, :on-pause, :on-stop, :on-destroy
   - same as :on-create but require a one-argument function."
-  [name & {:keys [extends prefix on-create on-create-options-menu
+  [name & {:keys [extends implements prefix on-create on-create-options-menu
                   on-options-item-selected on-activity-result
                   on-new-intent def state key features]
            :as options}]
@@ -92,6 +92,7 @@
         ~@(when state
             '(:init "init" :state "state"))
         :extends ~(or extends Activity)
+        :implements ~implements
         :exposes-methods {~'onCreate ~'superOnCreate
                           ~'onStart ~'superOnStart
                           ~'onRestart ~'superOnRestart


add waits in test case

add waits in test case

--- test/sledge/core_test.clj
+++ test/sledge/core_test.clj
@@ -13,22 +13,26 @@
     (let [input (tx/element "input#search-term")]
       (is (tx/displayed? input ) true)
       (tx/input-text input "queen"))
+
+    (tx/wait-until #(> (count (tx/elements "div.results div.track")) 1))
+
     (let [els (tx/elements "div.results div.track")
           choose-rows (map #(nth els %) [2 4 6 11])]
       (dorun (map #(tx/click (tx/find-element-under % {:tag :button}))
                   choose-rows)))
-    (is (= 5 (count (tx/elements "div.queue div.track")))
-        "4 tracks added to queue")
+
+    (tx/wait-until #(= 5 (count (tx/elements "div.queue div.track"))))
+
     (let [audio-url (tx/attribute "audio" :src)]
       (is (.startsWith audio-url "http://localhost:53281/bits/"))
       (let [del (nth (tx/elements "div.queue div.track") 2)]
         (tx/click (tx/find-element-under del {:tag :button}))
-        (is (= 4 (count (tx/elements "div.queue div.track"))))
+        (tx/wait-until #(= 4 (count (tx/elements "div.queue div.track"))))
         (is (= (tx/attribute "audio" :src) audio-url)
             "deleting 2nd track doesn't interrupt playback"))
       (let [del (nth (tx/elements "div.queue div.track") 1)]
         (tx/click (tx/find-element-under del {:tag :button}))
-        (is (= 3 (count (tx/elements "div.queue div.track"))))
+        (tx/wait-until #(= 3 (count (tx/elements "div.queue div.track"))))
         (is (not (= (tx/attribute "audio" :src) audio-url))
             "deleting 1st track moves player onto second"))
       )))


Refactored start up code

Refactored start up code

- Not hooking up to events until we're done with the initial import
- Setting the active window before reacting to the initial idle state,
  since that could have an effect on the saved value of the active tab

Cleaned up old unused values

--- src/app/booklet/background.cljs
+++ src/app/booklet/background.cljs
@@ -15,22 +15,24 @@

+;;;;-------------------------------------
+;;;; Settings
+;;;;-------------------------------------
+
+
+(def window-alarm "window-alarm")
+
+(defn now [] (.now js/Date))
+
+
+(def relevant-tab-keys [:windowId :id :active :url :selected :start-time :title :favIconUrl])
+
+(def select-tab-keys #(select-keys % relevant-tab-keys))
+(def url-time-path [:data :url-times])

 ;;;;-------------------------------------
 ;;;; Functions
 ;;;;-------------------------------------
-
-(def window-alarm "window-alarm")
-
-(defn now [] (.now js/Date))
-
-
-(def relevant-tab-keys [:windowId :id :active :url :selected :start-time :title :favIconUrl])
-
-(def select-tab-keys #(select-keys % relevant-tab-keys))
-(def add-tab-times #(assoc % :start-time (if (:active %) (now) 0)))
-
-(def url-time-path [:data :url-times])

 (defn check-window-status
@@ -44,32 +46,21 @@
                  (not= (:id last-focused) (:windowId tab)))
         (dispatch [::window-focus {:windowId (:id last-focused)}])))))

-(defn process-tab
-  "Filters a tab down to the relevant keys, and adds a start time which is
-  now if the tab is active, or 0 otherwise.
-
-  Keeping the time on the tab itself, since we may end up with multiple tabs
-  open to the same URL. Might make sense to track it all in one, using always
-  the last one... but for now I'm assuming that if you have it active in two
-  tabs, it's doubly important (you found it twice and forgot about it)."
-  [tab]
-  (->
-    tab
-    select-tab-keys
-    add-tab-times))
-
-
-(defn tab-list-to-map
-  [tabs]
-  (reduce #(assoc % (:id %2) %2) {} tabs))
-
-(defn process-tabs
-  "Take the tabs we have, filter them down and return them grouped by id."
-  [tabs]
-  (->>
-    tabs
-    (map process-tab)
-    tab-list-to-map))
+
+(defn hook-to-channels
+  "Hooks up to the various events we'll need to set up to.
+  We won't call it until after the initial import is done, so that we
+  don't end up receiving events when we don't yet have the environment
+  set up to handle them."
+  []
+  (on-channel alarms/on-alarm dispatch-sync ::on-alarm)
+  (on-channel runtime/on-suspend dispatch-sync :suspend)
+  (on-channel runtime/on-suspend-canceled dispatch-sync :log-content)
+  (on-channel tabs/on-activated dispatch ::tab-activated)
+  (on-channel tabs/on-updated dispatch ::tab-updated)
+  (on-channel windows/on-focus-changed dispatch ::window-focus)
+  (idle/set-detection-interval 60)
+  (on-channel idle/on-state-changed dispatch :idle-state-change))

 ;;;;-------------------------------------
@@ -80,8 +71,12 @@
 (register-handler
   ::initialize
   (fn [_]
-    (go (dispatch [:data-import (:data (<! (storage/get)))]))
-    {:app-state {}}))
+    (go
+      (dispatch [:data-import (:data (<! (storage/get))) true])
+      (dispatch [::window-focus {:windowId (:windowId (<! (windows/get-last-focused {:populate false})))}])
+      (dispatch [:idle-state-change {:newState (<! (idle/query-state 30))}]))
+    {:app-state    {}
+     :hookup-done? false}))

 ;; :data-import currently gets dispatched from both booklet.core
@@ -100,9 +95,13 @@
         (dispatch [:data-set key item]))
       ;; Once we've dispatched these, let's dispatch evaluate the state
       (dispatch [:data-import-done])
+      ;; We should only hook to the channels once.
+      (when (not (:hookup-done? app-state))
+        (hook-to-channels))
       (-> app-state
           (assoc-in [:ui-state :section] :time-track)
           (assoc-in [:app-state :import] nil)
+          (assoc :hookup-done? true)
           (assoc :data new-data))
       )))

@@ -116,11 +115,10 @@
           is-same?     (and (= (:id old-tab) (:id current-tab))
                             (= (:url old-tab) (:url current-tab))
                             (= (:windowId old-tab) (:windowId current-tab)))]
-      ;; De-activate every inactive tab
+      (console/trace "From suspend:" is-same? suspend-info)
       (if is-same?
         (dispatch [:handle-deactivation old-tab (:time suspend-info)])
         (dispatch [:handle-activation old-tab (:start-time old-tab)]))
-      (console/trace "From suspend:" is-same? suspend-info)
       (dispatch [:data-set :suspend-info] nil)
       app-state
       )
@@ -299,20 +297,8 @@

 (defn init-time-tracking []
-  (go (let [state  (<! (idle/query-state 30))
-            window (<! (windows/get-last-focused {:populate false}))]
-        (dispatch-sync [::initialize])
-        (dispatch-sync [::window-focus {:windowId (:id window)}])
-        (dispatch-sync [:idle-state-change {:newState state}])
-        ))
-  (on-channel runtime/on-suspend dispatch-sync :suspend)
-  (on-channel runtime/on-suspend-canceled dispatch-sync :log-content)
-  (on-channel tabs/on-activated dispatch ::tab-activated)
-  (on-channel tabs/on-updated dispatch ::tab-updated)
-  (on-channel windows/on-focus-changed dispatch ::window-focus)
-  (on-channel alarms/on-alarm dispatch-sync ::on-alarm)
-  (idle/set-detection-interval 60)
-  (on-channel idle/on-state-changed dispatch :idle-state-change))
+  (dispatch-sync [::initialize])
+  )

 (defn init []
   (init-time-tracking))


path finder

path finder

--- stuf/src/sandbox/4clojure.clj
+++ stuf/src/sandbox/4clojure.clj
@@ -826,3 +826,11 @@
         y (range (count board))
        :when (= \M (get-in board [y x]))]
     [x y]))
+
+(defn find-c [board pos]
+  (let [val (get-in board pos)]
+    (cond
+      (= val nil) false
+      (= val \C) true
+      :else (some #(find-c board %) (map #(map + pos %2) [[-1 0] [0 -1] [0 1] [1 0]])))))
+


Index page renderer + proper include of all .css and .js

--- src/arachnida/html_renderer.clj
+++ src/arachnida/html_renderer.clj
@@ -12,13 +12,14 @@
         [:meta {:name "Author"    :content "Pavel Tisnovsky"}]
         [:meta {:name "Generator" :content "Clojure"}]
         [:meta {:http-equiv "Content-type" :content "text/html; charset=utf-8"}]
-        ;(page/include-css "http://torment.usersys.redhat.com/openjdk/style.css")]
         (page/include-css "http://10.34.3.139/bootstrap.min.css")
+        (page/include-css "http://10.34.3.139/bootstrap.min.css")
+        (page/include-css "http://10.34.3.139/arachnida.css")
         (page/include-js  "http://10.34.3.139/bootstrap.min.js")
-        [:script {:type "text/javascript" :src "http://10.34.3.139/flotr/lib/prototype-1.6.0.2.js"}]
-        [:script {:type "text/javascript" :src "http://10.34.3.139/flotr/lib/canvas2image.js"}]
-        [:script {:type "text/javascript" :src "http://10.34.3.139/flotr/lib/canvastext.js"}]
-        [:script {:type "text/javascript" :src "http://10.34.3.139/flotr/flotr.debug-0.2.0-alpha.js"}]
+        (page/include-js  "http://10.34.3.139/flotr/lib/prototype-1.6.0.2.js")
+        (page/include-js  "http://10.34.3.139/flotr/lib/canvas2image.js")
+        (page/include-js  "http://10.34.3.139/flotr/lib/canvastext.js")
+        (page/include-js  "http://10.34.3.139/flotr/flotr.debug-0.2.0-alpha.js")
     ] ; head
 )

@@ -28,3 +29,47 @@
     [:div (str "

Author: Pavel Tisnovsky <ptisnovs@redhat.com>   "
           "
")])

+(defn render-navigation-bar-section
+    "Renders whole navigation bar."
+    []
+    [:nav {:class "navbar navbar-inverse navbar-fixed-top" :role "navigation"}
+        [:div {:class "container-fluid"}
+            [:div {:class "row"}
+                [:div {:class "col-md-4"}
+                    [:div {:class "navbar-header"}
+                        [:a {:href "/" :class "navbar-brand"} "Arachnida"]
+                    ] ; ./navbar-header
+                ] ; col ends
+                [:div {:class "col-md-4"}
+                    [:div {:class "navbar-header"}
+                        [:div {:class "navbar-brand"}
+                            ""
+                        ]
+                    ]
+                ] ; col ends
+                [:div {:class "col-md-4"}
+                    ""
+                ] ; col ends
+            ] ; row ends
+        ] ; /.container-fluid
+]);
+
+(defn render-index-page
+    []
+    (page/xhtml
+        (render-html-header)
+        [:body
+            [:div {:class "container"}
+                (render-navigation-bar-section)
+                [:h1 "Products"]
+                [:table {:class "table table-condensed table-hover table-bordered" :rules "all"}
+                ]
+                [:h1 "Writers"]
+                [:table {:class "table table-condensed table-hover table-bordered" :rules "all"}
+                ]
+                [:br][:br][:br][:br]
+                (render-html-footer)
+            ] ;

+        ] ;
+    ))
+


cleanup

cleanup

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -882,25 +882,6 @@
     (unify spec {:synsem {:sem {:reflexive true}}})
     true spec))

-(defn generation-implications
-  ([spec model]
-   (generation-implications spec reflexive-constraints model))
-  ([spec reflexive-constraints model]
-   (if (not (empty? reflexive-constraints))
-     (let [gen-impl (first reflexive-constraints)
-           spec (roots-to-sem spec (:lexicon model))]
-       (if ((:if gen-impl) spec)
-         (generation-implications (reduce unify
-                                          [spec
-                                           (:then gen-impl)
-                                           comp-clampdown
-                                           modified-false
-                                           ])
-                                  (rest reflexive-constraints)
-                                  model)
-         (generation-implications spec (rest reflexive-constraints) model)))
-     spec)))
-
 (def tense-specs [{:synsem {:cat :verb
                             :sem {:tense :present
                                   :aspect :perfect}
@@ -977,12 +958,6 @@
               (get rule-matcher key-in-rule-matcher))))
         (keys rule-matcher))))

-(defn spec-to-grammar
-  "return the minimal grammar subset needed to generate the given spec."
-  [spec]
-  (let []
-    {:foo 42}))
-
 (def index-paths
   [[:italiano :italiano]
    [:synsem :aux]
@@ -990,11 +965,3 @@
    [:synsem :essere]
    [:synsem :infl]
    [:synsem :sem :pred]])
-
-
-
-
-
-
-
-


fix bracketing

fix bracketing

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -575,7 +575,7 @@
                                    :essere essere
                                    :sem sem
                                    :subcat []}}
-                   :rule "s-modified-modifier-last"}))))
+                   :rule "s-modified-modifier-last"}))])

 (defn aux-is-head-feature [phrase]
   (cond (= :verb (get-in phrase [:synsem :cat]))


more rule cleanup

more rule cleanup

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -345,9 +345,8 @@
                            {:head {:phrasal true ;; only a vp-aux may be the head child, not simply a lexical auxiliary verb.
                                    :synsem {:aux true}}
                             :rule "s-aux"
-                            :synsem {:cat :verb
-                                     :sem {:aspect :top
-                                           :tense :past}}})
+                            :synsem {:cat :verb}})
+
                    (unify c10
                            root-is-head-root
                            {:rule "s-future-phrasal"


add support for sentential modifiers

add support for sentential modifiers

--- src/babel/italiano/grammar.cljc
+++ src/babel/italiano/grammar.cljc
@@ -467,36 +467,34 @@
                             :rule "s-modifier"})

                    (unify-check c00
+                                comp-modifies-head
                                 modified
-                                (let [head-sem (atom :top)]
-                                  {:modified true
-                                   :synsem {:subcat '()
-                                            :sem head-sem
-                                            :cat :verb}
+                                (let [sem (atom :top)]
+                                  {:synsem {:subcat '()
+                                            :cat :verb
+                                            :sem sem}
                                    :comp {:synsem {:cat :prep
-                                                   :subcat '()
-                                                   :sem head-sem}}
+                                                   :subcat '()}}
                                    :head {:modified false
                                           :synsem {:cat :verb
-                                                   :subcat '()
-                                                   :sem head-sem}}
+                                                   :sem sem
+                                                   :subcat '()}}
                                    :rule "s-modified-with-adjunct-first"}))

                    (unify-check h00
+                                comp-modifies-head
                                 modified
-                                (let [head-sem (atom :top)]
-                                 {:synsem {:subcat '()
-                                           :sem head-sem
-                                           :cat :verb}
-                                  :comp {:synsem {:cat :prep
-                                                  :subcat '()
-                                                  :sem head-sem}}
-                                  :head {:modified false
-                                         :synsem {:cat :verb
-                                                  :subcat '()
-                                                  :sem head-sem}}
-                                  :rule "s-modified-with-adjunct-last"}))
-                   ))
+                                (let [sem (atom :top)]
+                                  {:synsem {:subcat '()
+                                            :cat :verb
+                                            :sem sem}
+                                   :comp {:synsem {:cat :prep
+                                                   :subcat '()}}
+                                   :head {:modified false
+                                          :synsem {:cat :verb
+                                                   :sem sem
+                                                   :subcat '()}}
+                                   :rule "s-modified-with-adjunct-last"}))))

 (defn aux-is-head-feature [phrase]
   (cond (= :verb (get-in phrase '(:synsem :cat)))


add "l'" (L-apostrophe) entries for "lo" and "la"

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1395,6 +1395,59 @@
                           :consumable false
                           :artifact true}}})

+   ;; TODO: parser should turn 'l' into 'lo' and 'la'.
+   "l"
+   [{:synsem {:cat :noun
+              :pronoun true
+              :case pronoun-acc
+              :agr {:gender :masc
+                    :person :3rd
+                    :number :sing}
+              :sem {:human true
+                    :pred :lui}
+              :subcat '()}}
+
+    {:synsem {:cat :noun
+              :pronoun true
+              :case pronoun-acc
+              :agr {:gender :masc
+                    :person :3rd
+                    :number :sing}
+              :sem {:human false
+                    :place false
+                    :pred :lui}
+              :subcat '()}
+       :italiano {:initial true
+                  :pronoun true
+                  :cat :noun
+                  :case pronoun-acc}}
+
+    {:synsem {:cat :noun
+              :pronoun true
+              :case pronoun-acc
+              :agr {:gender :fem
+                    :person :3rd
+                    :number :sing}
+              :sem {:human true
+                    :pred :lei}
+              :subcat '()}}
+
+    {:synsem {:cat :noun
+              :pronoun true
+              :case pronoun-acc
+              :agr {:gender :fem
+                    :person :3rd
+                    :number :sing}
+              :sem {:human false
+                    :place false
+                    :pred :lei}
+              :subcat '()}
+     :italiano {:initial true
+                :pronoun true
+                :cat :noun
+                :case pronoun-acc}}
+    ]
+
    "lo"
    [{:synsem {:cat :noun
               :pronoun true


"casa" : propernoun=false

"casa" : propernoun=false

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -576,6 +576,7 @@
     ;; in the sense of "a casa": no article needed.
     {:synsem {:case :acc
               :cat :noun
+              :propernoun false
               :sem {:city false
                     :spec {:def :none} ;; "a casa", not "a mia casa", etc
                     :place true


remove (atom )s from "fare (3)"

remove (atom )s from "fare (3)"

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -1107,23 +1107,11 @@
        :synsem {:sem {:pred :do}}}
       {:unify [shared-part-of-fare]
        :synsem {:sem {:pred :make}}}
-      (let [subject-semantics (atom {:human true})
-            subject-agr (atom :top)]
-        {:unify [shared-part-of-fare]
-         :synsem {:cat :verb
-                  :essere true
-                  :sem {:pred :hurt-oneself
-                        :reflexive true
-                        :subj subject-semantics
-                        :obj subject-semantics}
-                  :subcat {:1 {:agr subject-agr
-                               :sem subject-semantics}
-                           :2 {:agr subject-agr
-                               :pronoun true
-                               :reflexive true
-                               :sem subject-semantics}
-                           :3 {:cat :adverb
-                               :sem {:pred :bad}}}}})])
+      {:unify [shared-part-of-fare reflexive]
+       :synsem {:cat :verb
+                :sem {:pred :hurt-oneself}
+                :subcat {:3 {:cat :adverb
+                             :sem {:pred :bad}}}}}])

    "finestre" {:synsem {:agr {:gender :fem}
                         :cat :noun


Minor fix

Minor fix

--- src/org/spootnik/cyanite/carbon.clj
+++ src/org/spootnik/cyanite/carbon.clj
@@ -114,4 +114,5 @@
 (defn stop
   "Stop a tcp carbon listener"
   [carbon-handle]
-  (tc/stop-tcp-server carbon-handle))
+  (when carbon-handle
+    (tc/stop-tcp-server carbon-handle)))


- (lookup)

- (lookup)

--- src/babel/italiano/workbook.clj
+++ src/babel/italiano/workbook.clj
@@ -65,37 +65,24 @@

 (def rules (:grammar-map medium))

-;; TODO: do morphological analysis
-;; do find non-infinitives (e.g. find 'parler' given 'parle')
-;; and then apply conjugated parts to lexeme
-;; i.e. if input is 'parle', return
-;; list of lexemes; for each, [:synsem :agr :person] will be
-;; 1st, 2nd, or 3rd, and for all, number will be singular.
-(defn lookup
-  ([string]
-   ((:lookup medium) string))
-  ([string model]
-   ((:lookup model) string)))
-
-;; TODO: deprecate lookup; use analyze instead.
 (defn analyze
   ([surface-form]
-   (morph/analyze surface-form (:lexicon medium)))
+   (morph/analyze surface-form (:lookup medium)))
   ([surface-form model]
-   (morph/analyze surface-form (:lexicon model))))
+   (morph/analyze surface-form (:lookup medium))))

 (defn over
   ([arg1]
-   (over/over (vals (:grammar-map medium)) (lookup arg1)))
+   (over/over (vals (:grammar-map medium)) (analyze arg1 medium)))
   ([grammar arg1]
-   (over/over grammar (lookup arg1)))
+   (over/over grammar (analyze arg1)))
   ([grammar arg1 arg2]
    (cond (string? arg1)
-         (over grammar (lookup arg1)
+         (over grammar (analyze arg1)
                arg2)

          (string? arg2)
-         (over grammar arg1 (lookup arg2))
+         (over grammar arg1 (analyze arg2))

          true
          (over/over grammar arg1 arg2))))


add user and java attributes to sysinfo utility fn

--- src/bract/core/util/runtime.clj
+++ src/bract/core/util/runtime.clj
@@ -50,6 +50,15 @@
           :os-arch               (.getArch os-bean)
           :os-version            (.getVersion os-bean)
           :system-load-avg       (.getSystemLoadAverage os-bean)
+          ;; user
+          :user-dir              (System/getProperty "user.dir")
+          :user-home             (System/getProperty "user.home")
+          :user-name             (System/getProperty "user.name")
+          ;; java
+          :java-class-path       (System/getProperty "java.class.path")
+          :java-home             (System/getProperty "java.home")
+          :java-vendor           (System/getProperty "java.vendor")
+          :java-version          (System/getProperty "java.version")
           ;; startup
           :jvm-launch-args       (vec (.getInputArguments rt-bean))
           ;; uptime


fix registering via oauth

fix registering via oauth

--- src/braid/server/routes/api.clj
+++ src/braid/server/routes/api.clj
@@ -231,12 +231,12 @@
                       :session (assoc (req :session) :user-id (user :id))}

                 (:braid.server.api/register? resp)
-                (let [user (register-user email (:braid.server.api/group-id resp))]
+                (let [user-id (register-user email (:braid.server.api/group-id resp))]
                   {:status 302
                    ; TODO: when we have mobile, redirect to correct site
                    ; (maybe part of state?)
                    :headers {"Location" (config :site-url)}
-                   :session (assoc (req :session) :user-id (user :id))})
+                   :session (assoc (req :session) :user-id user-id)})

                 :else
                 {:status 401


new-message sends message to server

new-message sends message to server

--- src/chat/client/dispatcher.cljs
+++ src/chat/client/dispatcher.cljs
@@ -8,12 +8,15 @@
 (defmulti dispatch! (fn [event data] event))

 (defmethod dispatch! :new-message [_ data]
-  (store/transact! [:messages] #(let [id (guid)]
-                            (assoc % id {:id id
-                                         :content (data :content)
-                                         :thread-id (or (data :thread-id) (guid))
-                                         :user-id (get-in @store/app-state [:session :user-id])
-                                         :created-at (js/Date.)}))))
+  (let [message (let [id (guid)]
+                  {:id id
+                   :content (data :content)
+                   :thread-id (or (data :thread-id) (guid))
+                   :user-id (get-in @store/app-state [:session :user-id])
+                   :created-at (js/Date.)})]
+
+    (store/transact! [:messages] #(assoc % (message :id) message))
+    (sync/chsk-send! [:chat/new-message message])))

 (defmethod dispatch! :hide-thread [_ data]
   (store/transact! [:users (get-in @store/app-state [:session :user-id]) :hidden-thread-ids] #(conj % (data :thread-id))))


Fix when code doesn't exist

Fix when code doesn't exist

--- src/clj/avalon/rules/people.clj
+++ src/clj/avalon/rules/people.clj
@@ -9,7 +9,8 @@
                  (if (= method :post)
                    (= (count (games/people-named game name)) 0)
                    true))]
-    {:name [v/required
+    {:id [[(fn [_] (some? game)) :message "Game with that code does not exist"]]
+     :name [v/required
             [taken? :message "There is already a player with that name"]]}))


delete user badge metabadge func

delete user badge metabadge func

--- src/clj/salava/metabadge/db.clj
+++ src/clj/salava/metabadge/db.clj
@@ -18,6 +18,9 @@
 (defn user-badge-by-assertion
   [ctx assertion_url]
   (some-> (select-user-badge-by-assertion-url {:assertion_url assertion_url} (u/get-db ctx))))
+
+(defn clear-user-metabadge! [ctx user_badge_id]
+  (delete-user-badge-metabadge! {:user_badge_id user_badge_id} (u/get-db ctx)))

 (defn metabadge?!
   "checks if badge is a metabadge, db is updated with information"


Further simplify eager-fetch using assoc instead of conj.

--- src/clj_record/associations.clj
+++ src/clj_record/associations.clj
@@ -4,12 +4,13 @@
                         [core :as core])))

 (defn eager-fetch [model-name foreign-key attribute-name records]
-  (let [fetched-records (core/find-records model-name
-                                           {foreign-key (apply q/in (map :id records))})]
-    (map (fn [record]
-           (conj {attribute-name (filter (fn [fetched]
-                                           (= (:id record) (foreign-key fetched))) fetched-records)}
-                 record))
+  (let [parent-ids (map :id records)
+        child-records (core/find-records model-name
+                                         {foreign-key (apply q/in parent-ids)})]
+    (map (fn [parent-record]
+           (assoc parent-record
+                  attribute-name
+                  (filter #(= (foreign-key %) (:id parent-record)) child-records)))
          records)))

 (defn expand-init-option


Improve on looks

Improve on looks

--- src/cljs/hacker_agent/core.cljs
+++ src/cljs/hacker_agent/core.cljs
@@ -23,18 +23,20 @@
     (fn [data]
       (let [{:keys [id by kids parent text type time score deleted]} data]
         (when (and id (not deleted))
-          [:ul
-           [:li "ID: " [:a {:href (str "/#/items/" id)} id]]
-           [:li "Parent: " [:a {:href (str "/#/items/" parent)} parent]]
-           [:li "By: " by]
-           [:li {:dangerouslySetInnerHTML {:__html (str "Text: </br>" text)}}]
-           [:li "Time: " time]
+          [:ul {:on-click #(do
+                             (swap! local update-in [:collapse-comments?] not)
+                             (.stopPropagation %))
+                :style {:cursor "pointer"}}
+           [:li
+            [:p
+             (str by " " time " | ")
+             [:a {:href (str "/#/items/" id)} "link"]
+             [:p {:dangerouslySetInnerHTML {:__html text}}]]]
            (when kids
-             [:li [:span {:on-click #(swap! local update-in [:collapse-comments?] not)}
-                   "Comments: "]
-              (when-not (:collapse-comments? @local)
-                (for [[id sub-data] (vec kids)]
-                  ^{:key id} [comment sub-data]))])])))))
+             (if (:collapse-comments? @local)
+               [:p [:b "..."]]
+               (for [[id sub-data] (vec kids)]
+                 ^{:key id} [comment sub-data])))])))))

 (defn story [data]
   (let [local (atom {:collapse? false
@@ -59,25 +61,30 @@
                     ^{:key id} [comment sub-data]))])]))))))

 (defn story-list-item [story]
-  (let [{:keys [by id title score]} story]
+  (let [{:keys [by id title score url kids]} story]
     (when (every? identity [by title score])
       [:div
-       [:p [:a {:href (str "/#/items/" id)} title]]
-       [:p (str score " points by " by)
+       [:p [:a {:href url} title]]
+       [:p
+        (str score " points by " by)
+        " | "
+        [:a {:href (str "/#/items/" id)}
+         (str (count kids) " comments")]
+        " | "
         [:span {:on-click #(reset-item-sync! id app-state [:current-item])
                 :style {:cursor :pointer}}
-         [:i " Preview "]]]])))
+         [:i "Preview"]]]])))

 (defn top-stories [state]
   (let [{top-stories :top-stories} state
         selected-story (get-in state [:current-item :item])]
-    [:ul
+    [:ol
      (for [[index entry] (into (sorted-map) top-stories)]
        (let [id (entry :id)]
          (if (= id (:id selected-story))
            ^{:key index} [:li
-                       [story-list-item entry]
-                       [story selected-story]]
+                          [story-list-item entry]
+                          [story selected-story]]
            ^{:key index} [:li [story-list-item entry]])))]))

 ;; -------------------------


Change js-obj for macro

Change js-obj for macro

--- src/cljs/openslack/browser.cljs
+++ src/cljs/openslack/browser.cljs
@@ -12,4 +12,4 @@

 (defn notify
   [title body icon]
-  (js/Notification. title (js-obj :body body :icon icon)))
+  (js/Notification. title #js {:body body :icon icon}))


Don't prevent default on drag click. This lets you move the cursor by clicking on a note you're editting. Still a little off.

--- src/cljs/retroboard/client.cljs
+++ src/cljs/retroboard/client.cljs
@@ -295,10 +295,7 @@
       (let [comp (om/get-node owner)
             dragger (om/get-state owner :dragger)]
         (set! (.-onmousedown comp) (fn [ev]
-                                     (.preventDefault ev)
-                                     (drag-start dragger ev)))
-        (set! (.-onmouseup comp) (fn [ev]
-                                   (drag-end dragger ev)))))
+                                     (drag-start dragger ev)))))
     om/IRenderState
     (render-state [this s]
       (let [is-dragging (= (:state s) :dragging)]


fix: cosmetic refactor

fix: cosmetic refactor

--- src/bulk_trader/core.cljs
+++ src/bulk_trader/core.cljs
@@ -12,7 +12,7 @@

 ;; find "index" (from g/traders) of selected trader
 (defn find-selected-trader [e]
-  (let [children (.-children (aget (.-children (.-form (.-target e))) 1))]
+  (let [children (.-children (aget (.. e -target -form -children) 1))]
     ;; this "loop" is needed coz children is HTMLElements which is *not* iterable
     (loop [i (dec (.-length children))]
       (if (= -1 i)
@@ -76,7 +76,7 @@
   (.log js/console "inside e-trade"))

 (defn e-edit-data-save [e]
-  (let [data (.-value (.-firstChild (.-parentNode (.-parentNode (.-parentNode (.-target e))))))]
+  (let [data (.. e -target -parentNode -parentNode -parentNode -firstChild -value)]
     (save-data data e)))

 (defn e-edit-data-cancel [e]
@@ -90,12 +90,12 @@

 (defn e-upload-data [e]
   (.preventDefault e)
-  (let [file (aget (.-files (.-firstChild (.-parentNode (.-target e)))) 0)
+  (let [file (aget (.. e -target -parentNode -firstChild -files) 0)
         reader (js/FileReader.)]
     ;; set "onload" event handler for reader
     (set! (.-onload reader)
           (fn [event]
-            (save-data (.-result (.-target event)) event)))
+            (save-data (.. event -target -result) event)))
     ;; fire "read" event
     (.readAsText reader file)))

@@ -191,7 +191,6 @@
          g/overlay-state
          {:target (. js/document (getElementById "overlay"))})

-;; init "root" is inside defn, coz need to call it below and on-js-reload
 (om/root c-app
          g/app-state
          {:target (. js/document (getElementById "main"))})


Update writer.cljc

Update writer.cljc

--- src/cats/labs/writer.cljc
+++ src/cats/labs/writer.cljc
@@ -76,9 +76,9 @@
   "The Writer type constructor.

   The purpose of Writer type is wrap a simple
-  function that fullfills the writer signature.
-
-  It exists just to avoid extending the clojure
+  function that fullfills the Writer signature.
+
+  It exists to avoid extending the Clojure
   function type (it is already very generic) ."
   [f]
   (Writer. f))


Fix: accepted_repositories

Fix: accepted_repositories

Do neither automatically downcase traits or accepted_repositories.

--- src/cider_ci/ex/utils.clj
+++ src/cider_ci/ex/utils.clj
@@ -21,7 +21,6 @@
       (if (.exists (io/as-file filename))
         (recur (try (let [add-on-string (slurp filename)]
                       (-> add-on-string
-                          lower-case
                           (split #",")
                           (#(map trim %))
                           (#(remove blank? %))


* src/clj/cljs/compiler.clj: always warn on dynamic binding of vars not delcared dynamic. possible now that analysis follows :requires & :uses

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -186,9 +186,6 @@
     (let [env (merge env {:ns (@namespaces *cljs-ns*)})
           ev (resolve-existing-var env name)]
       (when (and *cljs-warn-on-dynamic*
-                 ;; don't warn on vars from other namespaces because
-                 ;; dependency ordering happens *after* compilation
-                 (= (:ns ev) *cljs-ns*)
                  ev (not (-> ev :dynamic)))
         (warning env
           (str "WARNING: " (:name-sym ev) " not declared ^:dynamic"))))))


Use names from runtime.

Use names from runtime.

--- src/clj/minijava/tree.clj
+++ src/clj/minijava/tree.clj
@@ -139,11 +139,11 @@

 (deftree minijava.ast.NewArray
   [x frame]
-  (Call (Name (tm/label "newArray")) [(-> x .size (tree frame) unEx)]))
+  (Call (Name (tm/label "_mj_new_array")) [(-> x .size (tree frame) unEx)]))

 (deftree minijava.ast.NewObject
   [x frame]
-  (Call (Name (tm/label "newObject")) [(Name (tm/label (.typeName x)))]))
+  (Call (Name (tm/label "_mj_new_object")) [(Name (tm/label (.typeName x)))]))

 (deftree minijava.ast.Not
   [x frame]
@@ -163,7 +163,7 @@

 (deftree minijava.ast.Print
   [x frame]
-  (Call (Name (tm/label "print")) [(-> x .exp (tree frame) unEx)]))
+  (Call (Name (tm/label "_mj_println")) [(-> x .exp (tree frame) unEx)]))

 (deftree minijava.ast.Program
   [x frame]


Cleaned up macro/ns misc.cljc

Cleaned up macro/ns misc.cljc

--- src/cljc/tupelo/misc.cljc
+++ src/cljc/tupelo/misc.cljc
@@ -11,27 +11,27 @@
   #?(:cljs ; http://blog.fikesfarm.com/posts/2015-12-18-clojurescript-macro-tower-and-loop.html
      (:require-macros
        [tupelo.misc :refer [with-dots]]))
-  (:require
-    [clojure.string :as str]
-    [clojure.walk :as walk]
-    [schema.core :as s]
-    [tupelo.core :as t :refer [glue grab thru kw->str validate it-> spyx spyxx vals->map]]
-    [tupelo.schema :as tsk]
-    [tupelo.string :as ts]
-    #?(:clj [clj-uuid :as clj-uuid])
-    #?(:clj [clojure.java.shell :as shell])
-
-    #?(:cljs [goog.crypt :as crypt])
-    #?(:cljs [goog.crypt.Sha1])
-)
-
+  (:require [clojure.string :as str]
+            [clojure.walk :as walk]
+            [schema.core :as s]
+            [tupelo.core :as t :refer [glue grab thru kw->str validate it-> spyx spyxx vals->map]]
+            [tupelo.schema :as tsk]
+            [tupelo.string :as ts])
+  #?(:clj (:require
+            [clj-uuid :as clj-uuid]
+            [clojure.java.shell :as shell]))
   #?(:clj (:import
             [java.lang Byte Integer]
             [java.nio ByteBuffer]
             [java.nio.file Paths]
             [java.security MessageDigest]
             [java.util UUID]
-            )))
+            [java.security MessageDigest]
+            [java.nio.file Paths]))
+  #?(:cljs (:require
+             [goog.crypt :as crypt]
+             [goog.crypt.Sha1]))
+  )

 (s/defn factorial :- s/Int
   "Computes the factorial of N"


Show more info about each group.

Show more info about each group.

--- src/cljs/primes/core.cljs
+++ src/cljs/primes/core.cljs
@@ -93,7 +93,9 @@
     (render [this]
       (dom/li nil
               (dom/b nil (str/join ", " signature))
-              ": "
+              " [" (nums/vector-magnitude signature) "]"
+              (dom/br nil)
+              (count numbers) ": "
               (dom/small nil (dom/i nil (str/join ", " numbers)))))))


add missing dommy import

add missing dommy import

--- src/desdemona/ui/dom.cljs
+++ src/desdemona/ui/dom.cljs
@@ -1,6 +1,7 @@
 (ns desdemona.ui.dom
   (:require [reagent.core :as r]
-            [cljsjs.react-bootstrap]))
+            [cljsjs.react-bootstrap]
+            [dommy.core :as d]))

 (def button
   (r/adapt-react-class (aget js/ReactBootstrap "Button")))


Generate tag predicates in deftag

Generate tag predicates in deftag

--- src/detritus/variants.clj
+++ src/detritus/variants.clj
@@ -31,6 +31,13 @@
     `(do (defn ~vname ~?docstring ~?attr-map ~members
            ~?pre-map
            [~kw-tag (hash-map ~@(interleave kw-members members))])
+         (defn ~(symbol (str (name vname) "?"))
+           ([x#]
+            (and (vector? x#)
+                 (= 2 (count x#))
+                 (= ~kw-tag (first x#))
+                 (or (map? (second x#))
+                     (nil? (second x#))))))
          nil)))

 (defmacro defvariant


Fix crash when watching a directory on linux.


fix typo

fix typo

--- src/metabase/api/user.clj
+++ src/metabase/api/user.clj
@@ -4,6 +4,6 @@
 (defn current
   "Fetch the current user."
   [{:keys [current-user]}]
-  (with-or-404 current-user
+  (with-or-404 (current-user)
     {:status 200
      :body (current-user)}))


M for Merge

M for Merge

--- example/srcs/ui/core.cljs
+++ example/srcs/ui/core.cljs
@@ -51,7 +51,8 @@
                {:name "Tim"}
                {:name "Slava"}]
         form {:name :selects-form
-              :meta {:properties {:owner  {:validators {:not-blank true}}}}
+              :meta {:properties {:owner  {:validators {:not-blank true}}
+                                  :other-owner {:validators {:not-blank true}}}}
               :value {:owner {:name "Mike"}
                       :other-owner {:name "Marat"}}}]
     (form/init form)


filename fix

filename fix

--- src/plugins/Scripts/Funimage/Experimental/star_detector.clj
+++ src/plugins/Scripts/Funimage/Experimental/star_detector.clj
@@ -5,11 +5,9 @@
          '[funimage.segmentation.imp :as ij1seg]
          '[funimage.imp.statistics :as ij1stats])

-
 (when-not (ij.IJ/getInstance)
   (def filename "/Users/kharrington/Data/Harrington_Kyle/SanchezLab/ShapesOnPetriDish.tif")
   (def imp (ij1/open-imp filename)))
-

 (ij.IJ/run imp "8-bit" "")

@@ -323,4 +321,4 @@
   (let [imp-cc (ij1/autocontrast (ij1seg/color-code-rois imp rois (partial measure-fn imp)))]
     (ij.IJ/run imp-cc "Fire" "")
     (ij1/save-imp-as-tiff (ij1/show-imp (ij1/set-title imp-cc (name measure-name)))
-                          (str "/Users/kharrington/Data/Harrington_Kyle/SanchezLab/ShapesOnPetriDish_" (name measure-name) ".tif"))))
+                          (str (.substring img-filename 0 (- (.length img-filename) 4)) "_" (name measure-name) ".tif"))))


rewrite screenshot-test with clojure.test

--- src/test/clojure/com/xebia/visualreview/screenshot_test.clj
+++ src/test/clojure/com/xebia/visualreview/screenshot_test.clj
@@ -15,69 +15,53 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

 (ns com.xebia.visualreview.screenshot-test
-  (:require [midje.sweet :refer :all]
-            [taoensso.timbre :as timbre]
+  (:require [clojure.test :refer :all]
+            [slingshot.test]
             [clojure.java.io :as io]
             [com.xebia.visualreview.screenshot :as s]
             [com.xebia.visualreview.screenshot.persistence :as sp]
             [com.xebia.visualreview.persistence :as p]
             [com.xebia.visualreview.image :as i]
             [com.xebia.visualreview.service-util-test :as sutilt])
-  (:import (java.sql SQLException)
-           (clojure.lang IExceptionInfo)))
+  (:import [java.sql SQLException]))

-(timbre/set-level! :warn)
+(defmacro with-mock [bindings body]
+  (assert (even? (count bindings)) "with-mock requires an even number of arguments for its binding form")
+  (let [fns (take-nth 2 bindings)
+        rvals (map (fn [rval] `(fn [& _#] ~rval)) (take-nth 2 (rest bindings)))
+        pairs (interleave fns rvals)]
+    `(with-redefs [~@pairs]
+       ~body)))

-(facts "Screenshot service"
-       (facts "insert-screenshot!"
-              (fact "throws a service exception when given run-id does not exist"
-                    (let [image-file (io/as-file (io/resource "tapir_hat.png"))]
-                      (s/insert-screenshot! {} 999 "myScreenshot" {:browser "chrome" :os "windows"} {:version "4.0"} image-file)
-                      => (throws IExceptionInfo (sutilt/is-service-exception? "Could not store screenshot, run id 999 does not exist." ::s/screenshot-cannot-store-in-db-runid-does-not-exist))
-                      (provided (p/get-run anything 999) => nil)))
+(deftest insert-screenshot
+  (let [run-id 1
+        image-id 2
+        image-file (io/as-file (io/resource "tapir_hat.png"))
+        insert-screenshot-fn #(s/insert-screenshot! {} 999 "myScreenshot" {:browser "chrome" :os "windows"} {:version "4.0"} image-file)]
+    (is (thrown+-with-msg? sutilt/service-exception? #"Could not store screenshot, run id 999 does not exist."
+                           (with-mock [p/get-run nil]
+                             (insert-screenshot-fn))) "Throws a service exception when given run-id does not exist")
+    (is (thrown+-with-msg? sutilt/service-exception? #"Could not store screenshot in database: Database error"
+                           (with-mock [p/get-run {:id run-id}
+                                       i/insert-image! {:id image-id}
+                                       sp/save-screenshot! (throw (SQLException. "Database error"))]
+                             (insert-screenshot-fn))) "throws a service exception when screenshot could not be stored in the database")
+    (is (thrown+-with-msg? sutilt/service-exception? #"Could not store screenshot in database: screenshot with name and properties already exists"
+                           (with-mock [p/get-run {:id run-id}
+                                       i/insert-image! {:id image-id}
+                                       sp/save-screenshot! (throw (sutilt/slingshot-exception {:type :sql-exception :subtype ::sp/unique-constraint-violation :message "Duplicate thingy"}))]
+                             (insert-screenshot-fn))))))

-              (fact "throws a service exception when screenshot could not be stored in the database"
-                    (let [run-id 1
-                          image-file (io/as-file (io/resource "tapir_hat.png"))
-                          image-id 2]
-                      (s/insert-screenshot! {} run-id "myScreenshot" {:browser "chrome" :os "windows"} {:version "4.0"} image-file)
-                      => (throws IExceptionInfo (sutilt/is-service-exception? "Could not store screenshot in database: Database error" ::s/screenshot-cannot-store-in-db))
-                      (provided
-                        (p/get-run anything anything) => {:id run-id}
-                        (i/insert-image! anything anything) => {:id image-id}
-                        (sp/save-screenshot! anything anything anything anything anything anything anything)
-                        =throws=> (SQLException. "Database error"))))
+(deftest get-screenshot-by-id
+  (with-mock [sp/get-screenshot-by-id nil]
+    (is (nil? (s/get-screenshot-by-id {} 999)) "Returns nil when retrieving a screenshot that does not exist"))
+  (with-mock [sp/get-screenshot-by-id (throw (SQLException. "Database error"))]
+    (is (thrown+-with-msg? sutilt/service-exception? #"Could not retrieve screenshot with id 999: Database error"
+                           (s/get-screenshot-by-id {} 999)) "returns a service exception when an error occurs")))

-              (fact "throws a specific 'screenshot already exists' service exception when database layer reports a duplicate record"
-                    (let [run-id 1
-                          image-file (io/as-file (io/resource "tapir_hat.png"))
-                          image-id 2]
-                      (s/insert-screenshot! {} run-id "myScreenshot" {:browser "chrome" :os "windows"} {:version "4.0"} image-file)
-                      => (throws IExceptionInfo (sutilt/is-service-exception? "Could not store screenshot in database: screenshot with name and properties already exists" ::s/screenshot-cannot-store-in-db-already-exists))
-                      (provided
-                        (p/get-run anything anything) => {:id run-id}
-                        (i/insert-image! anything anything) => {:id image-id}
-                        (sp/save-screenshot! anything anything anything anything anything anything anything)
-                        =throws=> (sutilt/slingshot-exception {:type :sql-exception :subtype ::sp/unique-constraint-violation :message "Duplicate thingy"})))))
-
-       (facts "get-screenshot-by-id"
-              (fact "returns nil when retrieving a screenshot that does not exist"
-                    (s/get-screenshot-by-id {} 999) => nil
-                    (provided
-                      (sp/get-screenshot-by-id anything anything) => nil))
-
-              (fact "returns a service exception when an error occurs"
-                    (s/get-screenshot-by-id {} 999)
-                    => (throws IExceptionInfo (sutilt/is-service-exception? "Could not retrieve screenshot with id 999: Database error" ::s/screenshot-cannot-retrieve-from-db))
-                    (provided (sp/get-screenshot-by-id anything anything) =throws=> (SQLException. "Database error"))))
-
-       (facts "get-screenshots-by-run-id"
-              (fact "returns a list of screenshots from a run"
-                    (s/get-screenshots-by-run-id {} 123)
-                    => [{:id 1} {:id 2}]
-                    (provided (sp/get-screenshots anything 123) => [{:id 1} {:id 2}]))
-
-              (fact "throws a service exception when an error occurs"
-                    (s/get-screenshots-by-run-id {} 123)
-                    => (throws IExceptionInfo (sutilt/is-service-exception? "Could not retrieve screenshots: An error occured 1" ::s/screenshot-cannot-retrieve-by-run-from-db))
-                    (provided (sp/get-screenshots anything 123) =throws=> (SQLException. "An error occured 1")))))
+(deftest get-screenshots-by-run-id
+  (with-mock [sp/get-screenshots [{:id 1} {:id 2}]]
+    (is (= [{:id 1} {:id 2}] (s/get-screenshots-by-run-id {} 123)) "Returns a list of screnshots from a run"))
+  (with-mock [sp/get-screenshots (throw (SQLException. "An error occurred 1"))]
+    (is (thrown+-with-msg? sutilt/service-exception? #"Could not retrieve screenshots: An error occurred 1"
+                           (s/get-screenshots-by-run-id {} 123)))))


Fixed offering requests loading placeholder

--- src/name_bazaar/ui/components/offering_request/list_item.cljs
+++ src/name_bazaar/ui/components/offering_request/list_item.cljs
@@ -18,23 +18,23 @@
       (let [{:keys [:offering-request/node :offering-request/name :offering-request/requesters-count]} offering-request]
         [:div
          {:style (styles/search-results-list-item @xs?)}
-         (when-not node
-           [list-item-placeholder])
-         [row-with-cols
-          {:style (merge styles/search-results-list-item-header
-                         (if node styles/opacity-1 styles/opacity-0))
-           :between "sm"
-           :middle "sm"}
-          [col
-           {:xs 12 :sm 5}
-           [:div
-            {:style styles/list-item-ens-record-name}
-            name]]
-          [col
-           {:xs 6 :sm 3}
-           [:div
-            {:style (styles/offering-requests-list-item-count @xs?)}
-            requesters-count (pluralize " request" requesters-count)]]]]))))
+         (if-not node
+           [list-item-placeholder]
+           [row-with-cols
+            {:style (merge styles/search-results-list-item-header
+                           (if node styles/opacity-1 styles/opacity-0))
+             :between "sm"
+             :middle "sm"}
+            [col
+             {:xs 12 :sm 5}
+             [:div
+              {:style styles/list-item-ens-record-name}
+              name]]
+            [col
+             {:xs 6 :sm 3}
+             [:div
+              {:style (styles/offering-requests-list-item-count @xs?)}
+              requesters-count (pluralize " request" requesters-count)]]])]))))

 (defn offering-request-list-item []
   (let [xs? (subscribe [:district0x/window-xs-width?])]


Add support for "SCAN" flow type values [#1778]

--- backend/src/akvo/lumen/import/flow_v2.clj
+++ backend/src/akvo/lumen/import/flow_v2.clj
@@ -51,6 +51,10 @@
   response)

 (defmethod render-response "NUMBER"
+  [_ response]
+  response)
+
+(defmethod render-response "SCAN"
   [_ response]
   response)


Change bpm to 128

Change bpm to 128

--- src/overtone_workspace/grunbles.clj
+++ src/overtone_workspace/grunbles.clj
@@ -4,7 +4,7 @@
 ;; Inspired by an example in an early chapter of the SuperCollider book

 (definst grumble [speed 6 freq-mul 1]
-  (let [snd (mix (map #(* (lf-saw (* % freq-mul 100))
+  (let [snd (mix (map #(* (lf-tri (* % freq-mul 100))
                           (max 0 (+ (lf-noise1:kr speed)
                                     (env-gen (perc 20 100) :action FREE))))
                       [1 (/ 2 3) (/ 3 2) 2]))]
@@ -19,21 +19,21 @@
 ;; (grumble :freq-mul 2)
 ;; (ctl grumble :speed 3000)

-(volume (/  8  127))
+(volume (/  4  127))

-(def metro (metronome 10))
+(def metro (metronome 128))

 (defn player [beat notes]
   (let [notes (if (empty? notes)
                 [4 8 2 1.5]
                 notes)]
     (at (metro beat)
-        (grumble :freq-mul 0.5))
-    (at (metro beat)
-        (if (zero? (mod beat 5))
-          (grumble :freq-mul 1)))
+        (do
+          (if (zero? (mod beat 8)) (grumble :freq-mul 0.5))
+          (if (zero? (mod beat 8)) (grumble :freq-mul 1))
+          ))
     (at (metro (+ 0.5 beat))
-        (if (zero? (mod beat 6))
+        (if (zero? (mod beat 16))
           (grumble :freq-mul (choose notes))))
     (apply-by (metro (inc beat)) #'player (inc beat) (next notes) [])
     ))


Fix thumbnails generation.

Fix thumbnails generation.

--- src/uxbox/util/images.clj
+++ src/uxbox/util/images.clj
@@ -13,6 +13,9 @@
            java.io.ByteArrayInputStream
            java.io.ByteArrayOutputStream))

+;; Related info on how thumbnails generation
+;;  http://www.imagemagick.org/Usage/thumbnails/
+
 (defn thumbnail
   ([input] (thumbnail input nil))
   ([input {:keys [size quality format]
@@ -26,12 +29,13 @@
      (let [[width height] size
            pipe (Pipe. in out)
            op (doto (IMOperation.)
-                (.addImage (into-array String ["-"]))
-                (.thumbnail (int width) (int height))
+                (.addRawArgs ^java.util.List ["-"])
+                (.autoOrient)
+                (.thumbnail (int width) (int height) "^")
                 (.gravity "center")
                 (.extent (int width) (int height))
                 (.quality (double quality))
-                (.addImage (into-array String [(str format ":-")])))
+                (.addRawArgs ^java.util.List [(str format ":-")]))
            cmd (doto (ConvertCmd.)
                  (.setInputProvider pipe)
                  (.setOutputConsumer pipe))]


[#244] Remove "useless" test

[#244] Remove "useless" test

* This was an exploratory test, it adds to the build time and we're
  already testing the filter/projection queries in the production code

--- api/test/clojure/org/akvo/flow_api/datastore_test.clj
+++ api/test/clojure/org/akvo/flow_api/datastore_test.clj
@@ -1,31 +0,0 @@
-(ns org.akvo.flow-api.datastore-test
-  (:require  [akvo.commons.gae.query :as q]
-             [clojure.test :refer [use-fixtures deftest testing is]]
-             [org.akvo.flow-api.component.remote-api]
-             [org.akvo.flow-api.datastore :as ds]
-             [org.akvo.flow-api.fixtures :as fixtures])
-  (:import [com.google.appengine.api.datastore DatastoreServiceFactory]
-           java.util.Date))
-
-(def system {:components
-             {:remote-api #'org.akvo.flow-api.component.remote-api/local-api}
-             :endpoints {}
-             :config {}})
-
-(use-fixtures :once (fixtures/system system))
-
-(deftest reducible-queries
-  (let [remote-api (:remote-api fixtures/*system*)]
-    (ds/with-remote-api remote-api "akvoflowsandbox"
-      (let [dss (DatastoreServiceFactory/getDatastoreService)
-            now (Date.)]
-        (testing "Getting more than 1K entities"
-          (is (> (count
-                  (into []
-                        identity
-                        (ds/reducible-gae-query dss
-                                                {:kind "QuestionAnswerStore"
-                                                 :filter (q/< "createdDateTime" now)
-                                                 :projections {"value" String}}
-                                                {})))
-                 1000)))))))


Addition of content to article.cljs

Addition of content to article.cljs

--- src-cljs/rmfu_ui/article.cljs
+++ src-cljs/rmfu_ui/article.cljs
@@ -1,4 +1,106 @@
 (ns rmfu-ui.article)

 (defn article []
-  [:h1 "Article"])
+[:div.container.jumbotron.largemain
+ [:div.row
+  [:div.col-lg-12
+   [:h1
+    "Article"]
+   [:div.pre-scrollable
+    [:h4.col-lg-9.articleheading
+     "New Legislation that will impact you!"]
+    [:p.col-lg-3.date
+     "October 1, 2015"]
+    [:p
+     "    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute\n              irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n              "
+     [:br]
+     [:br]
+     "    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute\n              irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n              "
+     [:br]
+     [:br]
+     "    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute\n              irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n              "
+     [:br]
+     [:br]
+     "    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute\n              irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n              "
+     [:br]
+     [:br]
+     "    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute\n              irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n              "
+     [:br]
+     [:br]
+     "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure\n              dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n              "
+     [:br]
+     [:br]
+     "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure\n              dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n              "
+     [:br]
+     [:br]
+     "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure\n              dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n              "
+     [:br]
+     [:br]
+     "Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure\n              dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.\n            "]]
+   [:br]
+   [:div.greybox
+    [:ul.list-inline
+     [:li
+      [:button.btn.btn-default
+       {:type "button", :value "add"}
+       "Collapse"]]
+     [:li
+      [:button.btn.btn-default
+       {:type "button", :value "add"}
+       "Topics"]]
+     [:li
+      [:button.btn.btn-default
+       {:type "button", :value "add"}
+       "Comments"]]
+     [:li
+      [:button.btn.btn-default
+       {:type "button", :value "add"}
+       "Share"]]
+     [:li
+      [:button.btn.btn-default
+       {:type "button", :value "add"}
+       "Archive"]]]
+    [:ul.list-inline
+     [:li
+      [:a
+       {:href "#"}
+       "Fertilizer"]]
+     [:li
+      [:a
+       {:href "#"}
+       "Legislation"]]
+     [:li
+      [:a
+       {:href "#"}
+       "Vegetables"]]
+     [:li
+      [:a
+       {:href "#"}
+       "Grain"]]
+     [:li
+      [:a
+       {:href "#"}
+       "Fruit"]]
+     [:li
+      "80246 +5 Miles"]]
+    [:div.pre-scrollable.height150
+     [:div.col-lg-3.date
+      "Oct 1, 2015"]
+     [:div.col-lg-9.comment
+      "Joe - Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididul Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."]
+     [:div.col-lg-3.date
+      "Oct 1, 2015"]
+     [:div.col-lg-9.comment
+      "Bob - Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et!"]
+     [:div.col-lg-3.date
+      "Oct 1, 2015"]
+     [:div.col-lg-9.comment
+      "Bill - Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum."]
+     [:div.col-lg-3.date
+      "Oct 1, 2015"]
+     [:div.col-lg-9.comment
+      "Roscoe - Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat."]
+     [:div.col-lg-3.date
+      "Oct 1, 2015"]
+     [:div.col-lg-9.comment
+      "Tiberius - Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur."]]]]]])


Restoring these subs

Restoring these subs

--- src/day8/re_frame_10x/subs.cljs
+++ src/day8/re_frame_10x/subs.cljs
@@ -81,6 +81,18 @@
   :app-db/root
   (fn [db _]
     (get db :app-db)))
+
+(rf/reg-sub
+  :app-db/current-epoch-app-db-after
+  :<- [:epochs/current-event-trace]
+  (fn [trace _]
+    (get-in trace [:tags :app-db-after])))
+
+(rf/reg-sub
+  :app-db/current-epoch-app-db-before
+  :<- [:epochs/current-event-trace]
+  (fn [trace _]
+    (get-in trace [:tags :app-db-before])))

 (rf/reg-sub
   :app-db/paths


Fix line break.

Fix line break.

--- src/afterglow/controllers.clj
+++ src/afterglow/controllers.clj
@@ -562,7 +562,8 @@
            :doc "Keeps track of all controller elements that should
   receive beat feedback. A map whose keys are a tuple of [midi-device
   channel note kind], and whose values are [metronome on-value
-  off-value device-map disconnect-handler]."} beat-feedback
+  off-value device-map disconnect-handler]."}
+  beat-feedback
   (atom {}))

 (defonce ^{:private true


correct spelling

correct spelling

--- figwheel-core/project.clj
+++ figwheel-core/project.clj
@@ -1,5 +1,5 @@
 (defproject figwheel-core "0.1.0-SNAPSHOT"
-  :description "Figwheel core provides code reloading facilties for clojurescript."
+  :description "Figwheel core provides code reloading facilities for clojurescript."
   :url "https://github.com/bhauman/lein-figwheel"
   :license {:name "Eclipse Public License - v 1.0"
             :url "http://www.eclipse.org/legal/epl-v10.html"}


whitespace

whitespace

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -65,8 +65,8 @@
                        :sem {:pred :accept}}}

    "acertar" {:espanol {:boot-stem "aciert"}
-             :synsem {:cat :verb
-                      :sem {:pred :guess}}}
+              :synsem {:cat :verb
+                       :sem {:pred :guess}}}

    "acompañar" {:synsem {:cat :verb
                          :sem {:pred :accompany}}}


added poder

added poder

--- src/babel/espanol/lexicon.clj
+++ src/babel/espanol/lexicon.clj
@@ -382,7 +382,13 @@

    "pintar" {:synsem {:cat :verb
                       :sem {:pred :paint}}}
-
+
+   "poder" {:espanol {:boot-stem1 "pued"
+                        :boot-stem2 "pod"}
+              :synsem {:cat :verb
+                       :sem {:pred :can}}}
+
+
    "quedarse" (let [subject-semantics (ref {:animate true})
                     subject-agr (ref :top)]
                 {:synsem {:cat :verb


s/info/debug/

s/info/debug/

--- src/babel/italiano/writer.clj
+++ src/babel/italiano/writer.clj
@@ -68,7 +68,7 @@
   (writer/generate-from-spec
    (let [model
          (create-model-for-spec spec)]
-     (log/info (str "created custom model from spec: " spec "; new model: " (keys model)))
+     (log/debug (str "created custom model from spec: " spec "; new model: " (keys model)))
      model)
    (strip-refs spec)
    (cond


Test on number? because that's clearer than fn?.

--- src/klangmeister/synthesis.cljs
+++ src/klangmeister/synthesis.cljs
@@ -11,11 +11,10 @@
   (.-destination context))

 (defn plug [param input context at duration]
-  "Plug an input into an audio parameter,
-  accepting both numbers and ugens."
-  (if (fn? input)
-    (-> input (run-with context at duration) (.connect param))
-    (.setValueAtTime param input at)))
+  "Plug an input into an audio parameter, accepting both numbers and nodes."
+  (if (number? input)
+    (.setValueAtTime param input at)
+    (-> input (run-with context at duration) (.connect param))))

 (defn gain [level]
   (fn [context at duration]


add source titles for special forms #132

--- src/main/cljs_api_gen/parse.clj
+++ src/main/cljs_api_gen/parse.clj
@@ -427,7 +427,10 @@
     (let [location (parse-location form)
           extras {:type "special form"}
           docs (get doc-map (symbol (:name special)))
-          final (merge special location extras docs)]
+          final (-> special
+                    (merge location docs)
+                    (assoc :type "special form")
+                    (assoc-in [:source :title] "Parser code"))]
       final)))

 ;;--------------------------------------------------------------------------------
@@ -475,10 +478,12 @@
   (when-let [specials (parse-repl-specials* form)]
     (let [location (parse-location form)
           make-map (fn [name-]
-                     (let [attrs {:name (str name-)
-                                  :type "special form (repl)"}
+                     (let [base {:name (str name-)
+                                 :type "special form (repl)"}
                            docs (get doc-map name-)]
-                       (merge location attrs docs)))]
+                       (-> base
+                           (merge location docs)
+                           (assoc-in [:source :title] "repl specials table"))))]
      (doall (map make-map specials)))))

 ;;--------------------------------------------------------------------------------