don't include format-fn in html attributes

--- src/clj_money/web/shared.clj
+++ src/clj_money/web/shared.clj
@@ -212,9 +212,11 @@
   [:div.form-group
     (when-not (:suppress-label? options)
       [:label.control-label {:for name} (humanize name)])
-    [:input.form-control (merge options {:id name
-                                         :name name
-                                         :value value})]])
+    [:input.form-control (-> options
+                             (dissoc :format-fn)
+                             (merge {:id name
+                                     :name name
+                                     :value value}))]])

 (defn text-input-element
   ([name value] (text-input-element name value {}))
@@ -239,10 +241,12 @@
   "Renders a HTML input field"
   ([model attribute options]
    (form-group model attribute (:suppress-label? options)
-     [:input.form-control (merge options {:id attribute
-                                          :name attribute
-                                          :value ((or (:format-fn options)
-                                                      identity) (get model attribute))})])))
+               [:input.form-control (-> options
+                                        (dissoc :format-fn)
+                                        (merge {:id attribute
+                                                :name attribute
+                                                :value ((or (:format-fn options)
+                                                            identity) (get model attribute))}))])))

 (defn date-input-field
   ([model attribute] (date-input-field model attribute {}))
@@ -250,8 +254,7 @@
    (form-group model attribute (:suppress-label? options)
                [:div.input-group.date-field
                 [:input.form-control
-                 (merge {:format-fn format-date}
-                        options
+                 (merge options
                         {:id attribute
                          :name attribute
                          :value (format-date (get model attribute))})]


profile

profile

--- src/cljs/fractals/email.cljs
+++ src/cljs/fractals/email.cljs
@@ -262,6 +262,9 @@
              [:tr [:td "Detection of all sorts of data with NSDataDetector"]]
              [:tr [:td "Native custom sharing and editing controls with UIActivityViewController and UIMenuController"]])]
               [:tr [:td {:style {:background-color "#fff"}} "We have mastered Objective-C's MVC, view controllers pattern, view hierarchy, containers and storyboards implementations. This leverage us to do hybrid apps where performance incentive codes are implemented in Object-C and React Native business logic."]]
+
+              (comment [:tr [:td {:style {:background-color "#fff"}}
+                             "In order to run at 60 FPS, we are implementing declarative api which will work with Native diver as The async nature of the React Native bridge incurs an inherent performance penalty, preventing JavaScript code from running at high framerates."]])
               ]]]]]]]]]])

 (rum/defc technology-stack [state]
@@ -614,6 +617,14 @@
       [:tr  [:td  (android-email)]
        ]
       [:tr
+       [:td {:style {:padding "7px"
+                     :font-size "1.2rem"
+                     :background-color "#7D889C"
+                     :font-weight 500
+                     :color :white}}
+        [:span {:style {:font-size "1.8rem"}} "T"]"echnology Stack"]
+       ]
+      [:tr
        [:td
         [:table
          [:tbody
@@ -728,12 +739,12 @@
                              :background-color "rgb(41, 73, 130)"}}
                 [:div {:style {:font-size "1.1rem"
                                :padding "4px"}}
-                 "Hello " [:img {:style {:height "12px"}
-                                 :src "http://strativ.se/wp-content/uploads/2016/04/logo_zerif_default.png"}]]
+                 "Hello " [:img {:style {:height "21px"}
+                                 :src "http://www.logicaltriangle.com/images/company_logo.png"}]]
                 [:div {:style {:fond-size "1rem"
                                :color "#f1f1f1"
                                :padding-left "5px"
-                               :text-align :left}} "Please accept my Résumé for React Native Developer	– iPhone and Android."]]]
+                               :text-align :left}} "Please accept my Résumé for Fullstack developer – iPhone and Android"]]]

           [:tr
            [:td {:style {
@@ -756,9 +767,9 @@
                                            }
                                    :src "https://pbs.twimg.com/profile_images/616309728688238592/pBeeJQDQ.png"}]]
                    [:td [:a {:href "https://github.com/aryabhatiya"} "https://github.com/aryabhatiya"]]
-                   [:td [:img {:style {:height "23px"
-                                       :padding-right "3px"}
-                               :src "https://cdn1.iconfinder.com/data/icons/simple-icons/2048/heroku-2048-black.png"}]]
-                   [:td [:a {:href "https://pacific-earth-90914.herokuapp.com/#/"}
-                         "https://pacific-earth-90914.herokuapp.com/#/"]]
-                   ]]]]]]]]]]]]])
+                   (comment
+                     [:td [:img {:style {:height "23px"
+                                         :padding-right "3px"}
+                                 :src "https://cdn1.iconfinder.com/data/icons/simple-icons/2048/heroku-2048-black.png"}]]
+                     [:td [:a {:href "https://pacific-earth-90914.herokuapp.com/#/"}
+                           "https://pacific-earth-90914.herokuapp.com/#/"]])]]]]]]]]]]]]])


Fix issue introduced with the chat refactoring

--- src/cljs/netrunner/chat.cljs
+++ src/cljs/netrunner/chat.cljs
@@ -18,23 +18,21 @@
             messages (get-in @app-state [:channels ch])]
         (swap! app-state assoc-in [:channels ch] (conj messages text)))))

-(defn send-msg [cursor owner]
+(defn send-msg [channel owner]
   (let [input (om/get-node owner "msg-input")
         text (.-value input)]
-    (when-not (zero? (alength text))
+    (when-not (empty? text)
       (aset input "value" "")
       (.focus input)
-      (put! out-channel #js {:type "chat"
-                             :channel (name (first (:active-channel @cursor)))
-                             :msg text}))))
+      (put! out-channel #js {:type "chat" :channel (name channel) :msg text}))))

-(defn msg-input-view [cursor owner]
+(defn msg-input-view [{:keys [channel]} owner]
   (om/component
    (sab/html
     [:div.msg-box
      [:input {:type "text" :ref "msg-input" :placeholder "Say something..."
-              :onKeyPress #(when (== (.-keyCode %) 13) (send-msg cursor owner))}]
-     [:button {:on-click #(send-msg cursor owner)} "Send"]])))
+              :onKeyPress #(when (== (.-keyCode %) 13) (send-msg channel owner))}]
+     [:button {:on-click #(send-msg channel owner)} "Send"]])))

 (defn channel-view [{:keys [channel active-channel]} owner]
   (reify
@@ -75,6 +73,6 @@
         [:div.chat-box
          [:div.blue-shade.panel.message-list
           (om/build-all message-view (get-in cursor [:channels (:channel state)]))]
-         (om/build msg-input-view cursor)]]))))
+         (om/build msg-input-view state)]]))))

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


Let spectators leave the game

Let spectators leave the game

fixes #1293

--- src/cljs/netrunner/main.cljs
+++ src/cljs/netrunner/main.cljs
@@ -51,12 +51,14 @@
      [:div.float-right
       (let [c (count (:games cursor))]
         (str c " Game" (when (not= c 1) "s")))]
-     (when-let [game (some #(when (= (:gameid cursor) (:gameid %)) %) (:games cursor))]
+     (if-let [game (some #(when (= (:gameid cursor) (:gameid %)) %) (:games cursor))]
        (when (:started game)
          [:div.float-right
           (when (not= (:side @app-state) :spectator)
             [:a.concede-button {:on-click #(netrunner.gameboard/send-command "concede" {:user (:user @app-state)})} "Concede"])
-          [:a {:on-click #(netrunner.gamelobby/leave-game)} "Leave game"]]))
+          [:a {:on-click #(netrunner.gamelobby/leave-game)} "Leave game"]])
+       (when (= (:side @app-state) :spectator)
+         [:div.float-right [:a {:on-click #(netrunner.gamelobby/leave-game)} "Leave game"]]))
      (when-let [game (some #(when (= (:gameid cursor) (:gameid %)) %) (:games cursor))]
        (when (:started game)
          (let [c (count (:spectators game))]


Add nodejs bootstrap from ClojureScript's repl/node.clj and resolves #56

--- src/cljs/replumb/nodejs.cljs
+++ src/cljs/replumb/nodejs.cljs
@@ -2,7 +2,25 @@

 (defn init-fn!
   []
-  (set! (.. js/global -cljs -user) #js {}))
+  (set! (.. js/global -cljs -user) #js {})
+  ;; AR - mimicking clojurescript/src/main/clojure/cljs/repl/node.clj
+  ;; This solves https://github.com/ScalaConsultants/replumb/issues/56
+  ;; node.clj - monkey-patch goog.require, skip all the loaded checks
+  (js* "goog.isProvided_ = function(x) { return false; };")
+  ;; node.clj - load cljs.core, setup printing
+  (set! (.-require js/goog)
+        (fn [name]
+          (js/CLOSURE_IMPORT_SCRIPT
+           (aget (.. js/goog -dependencies_ -nameToPath) name))))
+  ;; node.clj - load cljs.core, setup printing
+  (do
+    (set! *loaded-libs* #{"cljs.core"})
+    (set! (.-require js/goog)
+          (fn [name reload]
+            (when (or (not (contains? *loaded-libs* name)) reload)
+              (set! *loaded-libs* (conj (or *loaded-libs* #{}) name))
+              (js/CLOSURE_IMPORT_SCRIPT
+               (aget (.. js/goog -dependencies_ -nameToPath) name)))))))

 (def default-opts
   "Node.js default set of options for read-eval-call.


make it more explicit that ouput is a folder

--- src/corpusmaker/entities.clj
+++ src/corpusmaker/entities.clj
@@ -64,7 +64,7 @@

 (defn join-abstract-type
   "Execute a flow to join type and abstract info"
-  [abstract-file type-file out-file]
+  [abstract-file type-file out-folder]
   (let [
     ;; first pipe to extract abstracts data
     p-abstracts (->
@@ -97,6 +97,6 @@
     flow (c/flow
       {"abstracts" (c/lfs-tap (c/text-line "line") abstract-file)
        "types" (c/lfs-tap (c/text-line ["offset" "line"]) type-file)}
-      (c/lfs-tap (c/text-line) out-file)
+      (c/lfs-tap (c/text-line) out-folder)
       (c/map joined #'serialize-tuple :< Fields/ALL :fn> "line" :> "line"))]
     (c/exec flow)))


80 chars

80 chars

--- src/corpusmaker/entities.clj
+++ src/corpusmaker/entities.clj
@@ -118,7 +118,7 @@
   (if (nil? redirect) orig redirect))

 (defn count-incoming
-  "Count the number of incoming links to a resource for simple popularity ranking"
+  "Count the number of incoming links to a resource for popularity ranking"
   ([link-file redirect-file out-folder]
     (count-incoming link-file redirect-file out-folder false))
   ([link-file redirect-file out-folder to-clj]


Replace time filter when adding a new one

--- src/day8/re_frame/trace.cljs
+++ src/day8/re_frame/trace.cljs
@@ -147,12 +147,20 @@
       (< (:query query) (:duration trace)))))

 (defn add-filter [filter-items filter-input filter-type]
+  ;; prevent duplicate filter strings
   (if-not (some #(= filter-input (:query %)) @filter-items)
-    (swap! filter-items conj {:id (random-uuid)
-                              :query (if (= filter-type :contains)
-                                       (str/lower-case filter-input)
-                                       (js/parseFloat filter-input))
-                              :filter-type filter-type})))
+    (do
+      ;; if existing, remove prior filter for :slower-than
+      (when (and (= :slower-than filter-type)
+                 (some #(= filter-type (:filter-type %)) @filter-items))
+        (swap! filter-items (fn [item]
+                              (remove #(= :slower-than (:filter-type %)) item))))
+      ;; add new filter
+      (swap! filter-items conj {:id (random-uuid)
+                                :query (if (= filter-type :contains)
+                                         (str/lower-case filter-input)
+                                         (js/parseFloat filter-input))
+                                :filter-type filter-type}))))

 (defn render-traces [showing-traces filter-items filter-input trace-detail-expansions]
   (doall


Renamed function geo-attr to geometry

Renamed function geo-attr to geometry

A beter naming is without the attritbute (attr) postfix.

[PDOK-3512]

--- src/gml_to_featured/code.clj
+++ src/gml_to_featured/code.clj
@@ -16,7 +16,7 @@
 (def key->fn {:s/tag `[tag]
               :s/id-attr `[id-attr]
               :s/inner-gml `[inner-gml]
-              :s/geo-attr `[geo-attr]})
+              :s/geometry `[geometry]})

 (defn parse-selector-vector [key selector]
   (let [;; convert tags to fn, do use them in de xml1-> selector
@@ -91,7 +91,7 @@

 (def moment (function "moment"))

-(def geo-attr (function "geo-attr"))
+(def geometry (function "geometry"))

 (defn inner-gml [input]
   (let [inner (zip/down input)]


update execution engine for new parser

update execution engine for new parser

--- src/graphql_clj/executor.clj
+++ src/graphql_clj/executor.clj
@@ -1,5 +1,6 @@
 (ns graphql-clj.executor
   (:require [graphql-clj.parser :as parser]
+            [graphql-clj.schema-validator :as sv]
             [graphql-clj.resolver :as resolver]
             [graphql-clj.error :as gerror]
             [graphql-clj.validator.errors :as ve]
@@ -8,82 +9,153 @@
             [clojure.string :as str]))

 (defn- resolve-field-on-object
-  [{:keys [resolver-fn parent-type-name field-name args-fn]} {:keys [context resolver vars]} parent-result]
-  (let [resolve (or resolver-fn (resolver parent-type-name field-name))]
+  [{:keys [resolver-fn name args-fn]} {:keys [context resolver vars]} parent-type-name parent-result]
+  (let [resolve (or resolver-fn (resolver parent-type-name name))]
     (resolve context parent-result (when args-fn (args-fn vars)))))

 (declare execute-fields)

 (defn- complete-value
-  [{:keys [selection-set field-name kind of-kind required] :as field-entry} state result]
+  [{:keys [selection-set name type required] :as field-entry} state result]
+  (printf "complete-value: field-entry: %s, type: %s, result: %s%n" field-entry type result)
   (when (and required (nil? result))
-    (gerror/throw-error (format "NOT_NULL field \"%s\" assigned a null value." field-name)))
-  (when result
-    (cond
-      (#{:SCALAR :ENUM} kind)             result
-      (#{:OBJECT :INTERFACE :UNION} kind) (execute-fields selection-set state result)
-      (#{:LIST} kind)                     (map #(complete-value (merge field-entry of-kind) state %) result))))
+    (gerror/throw-error (format "NOT_NULL field \"%s\" assigned a null value." name)))
+  (let [type-name (:name type)
+        kind (:kind type)
+        of-kind (:of-kind type)]
+    (when result
+      (cond
+        (#{:SCALAR :ENUM} kind)             result
+        (#{:OBJECT :INTERFACE :UNION} kind) (execute-fields selection-set state type-name result)
+        (#{:LIST} kind)                     (map #(complete-value (merge field-entry of-kind) state %) result)
+        :else (gerror/throw-error (format "Unknow field(%s) kind: %s%n" name kind))))))

-(defn- get-field-entry [{:keys [name field-name] :as field-entry} state parent-result]
-  [(or name field-name) (->> (resolve-field-on-object field-entry state parent-result)
+(defn- get-field-entry [{:keys [name field-name] :as field-entry} state parent-type-name parent-result]
+  (printf "get-field-entry: field-entry: %s, parent-result: %s%n" field-entry parent-result)
+  [(or name field-name) (->> (resolve-field-on-object field-entry state parent-type-name parent-result)
                              (complete-value field-entry state))])

+(defn- get-field-type
+  [schema parent-type-name field-name]
+  (let [parent-type (get-in schema [:type-map parent-type-name])
+        field-map (:field-map parent-type)
+        field-type-name (get-in field-map [field-name :type :name])
+        field-type (get-in schema [:type-map field-type-name])]
+    (if field-type
+      field-type
+      (gerror/throw-error (format "get-field-type: unknow field-type for field(%s : %s)%n" parent-type-name field-name)))))
+
 (defn- execute-fields
-  [fields state root-value]
-  (->> fields (map #(get-field-entry % state root-value)) (into {})))
+  [fields {:keys [schema] :as state} parent-type-name parent-value]
+  (printf "execute-fields: fields:%s%n" fields)
+  (let [parent-type (get-in schema [:type-map parent-type-name])
+        field-map (:field-map parent-type)]
+    (printf "execute-fields: parent-type: %s%n" parent-type)
+    (->> fields
+         (map (fn [field] (assoc field :type (get-field-type schema parent-type-name (:name field)))))
+         (map #(get-field-entry % state parent-type-name parent-value))
+         (into {}))))

-(defn- guard-missing-vars! [{:keys [variable-definitions]} {:keys [vars]}]
+(defn- guard-missing-vars! [{:keys [variable-definitions]} vars]
   (let [required-vars (->> (remove :default-value variable-definitions) (map :variable-name) set)
         input-vars    (set (map name (keys vars)))
         missing-vars  (set/difference required-vars input-vars)]
     (when-not (empty? missing-vars)
       (gerror/throw-error (format "Missing input variables (%s)." (str/join "," missing-vars))))))

-(defn- execute-statement [{:keys [selection-set] :as document} state]
-  (guard-missing-vars! document state)
-  (execute-fields selection-set state :root))
+(defn- execute-statement [{:keys [selection-set] :as statement} {:keys [variables] :as state}]
+  (guard-missing-vars! statement variables)
+  (execute-fields selection-set state 'QueryRoot :root))

 (defn- execute-document
-  [{:keys [document state]}]
-  (let [operation-definitions (:operation-definitions document)]
-    {:data (into {} (map #(execute-statement % state) operation-definitions))}))
-
-(defn- schema-or-state->state
-  "Schema validation inside execution phase for backwards compatibility"
-  [schema-or-state]
-  (if (or (:errors schema-or-state) (:spec-map schema-or-state))
-    schema-or-state
-    (do (prn "Warning: the result of graphql-clj.validator/validate-schema should be passed to execute instead of a schema string")
-        (validator/validate-schema schema-or-state))))
-
-(defn- statement-or-state->state
-  "Statement parsing and validation inside execution phase for backwards compatibility"
-  [state statement-or-state]
-  (if (string? statement-or-state)
-    (do (prn "Warning: the result of graphql-clj.validator/validate-statement should be passed to execute instead of a statement string")
-        (-> statement-or-state parser/parse (validator/validate-statement state)))
-    statement-or-state))
-
-(defn- prepare [schema-or-state statement-or-state]
-  (let [state (schema-or-state->state schema-or-state)]
-    (ve/guard-errors! state)
-    (let [validated-statement (statement-or-state->state state statement-or-state)]
-      (ve/guard-errors! validated-statement)
-      validated-statement)))
+  [document state]
+  (printf "execute-document: document: %s%n" document)
+  {:data (into {} (map #(execute-statement % state) document))})

 ;; Public API

 (defn execute
-  ([context schema-or-state resolver-fn statement-or-state]
-   (execute context schema-or-state resolver-fn statement-or-state nil))
-  ([context schema-or-state resolver-fn statement-or-state variables]
-   (try
-     (let [validated-statement (prepare schema-or-state statement-or-state)
-           state (assoc schema-or-state :context context
-                                        :vars variables
-                                        :resolver (resolver/create-resolver-fn schema-or-state resolver-fn))]
-       (execute-document (assoc validated-statement :state state)))
-     (catch Exception e
-       (if-let [error (ex-data e)]
-         (if (map? error) error {:errors [error]})
-         (throw e))))))
+  [context [schema-errors schema] resolver-fn [statement-errors document] variables]
+  (if (seq schema-errors)
+    (gerror/throw-error "Schema validation error" schema-errors))
+  (if (seq statement-errors)
+    {:errors statement-errors}
+    (execute-document document {:variables variables
+                                :context context
+                                :schema schema
+                                :resolver (resolver/create-resolver-fn schema resolver-fn)})))
+
+;; testing data
+(def test-schema
+  "enum DogCommand { SIT, DOWN, HEEL }
+
+type Dog implements Pet {
+  name: String!
+  nickname: String
+  barkVolume: Int
+  doesKnowCommand(dogCommand: DogCommand!): Boolean!
+  isHousetrained(atOtherHomes: Boolean): Boolean!
+  owner: Human
+}
+
+interface Sentient {
+  name: String!
+}
+
+interface Pet {
+  name: String!
+}
+
+type Alien implements Sentient {
+  name: String!
+  homePlanet: String
+}
+
+type Human implements Sentient {
+  name: String!
+}
+
+enum CatCommand { JUMP }
+
+type Cat implements Pet {
+  name: String!
+  nickname: String
+  doesKnowCommand(catCommand: CatCommand!): Boolean!
+  meowVolume: Int
+}
+
+union CatOrDog = Cat | Dog
+union DogOrHuman = Dog | Human
+union HumanOrAlien = Human | Alien
+
+type QueryRoot {
+  dog: Dog
+}")
+
+(def test-query-1
+  "query getDogName {
+  dog {
+    name
+  }
+}")
+
+(def test-validated-schema (-> test-schema
+                               parser/parse-schema
+                               sv/validate-schema))
+
+(def test-validated-document (-> test-query-1
+                                  parser/parse-query-document
+                                  ((fn [s]
+                                     [nil s]))))
+
+(defn test-resolver-fn [type-name field-name]
+  (printf "resolver-fn: type-name: %s, field-name: %s%n" type-name field-name)
+  (let [f (get-in {"QueryRoot" {"dog" (fn [& args]
+                                        {:name "Test Dog 1"})}}
+                  [(name type-name) (name field-name)])]
+    (printf "resolver fn: %s%n" f)
+    (if f
+      (println (f)))
+    f))
+
+;; (execute nil test-validated-schema test-resolver-fn test-validated-statement nil)


Remove double import

Remove double import

--- src/icecap/handlers/core.clj
+++ src/icecap/handlers/core.clj
@@ -2,8 +2,7 @@
   "The core handler API and behavior."
   (:require [schema.core :as s]
             [manifold.stream :as ms]
-            [manifold.deferred :as md]
-            [manifold.deferred :as d]))
+            [manifold.deferred :as md]))

 (def get-schema nil) ;; anti-defonce behaavior of get-schema
 (defmulti get-schema


Don't need dynamic *ns* binding to refer clojure

--- boot/pod/src/boot/pod.clj
+++ boot/pod/src/boot/pod.clj
@@ -315,8 +315,7 @@
       (create-ns 'pod)
       (dosync (alter @#'clojure.core/*loaded-libs* conj 'pod))
       (alter-var-root #'*ns* (constantly (the-ns 'pod)))
-      (clojure.core/binding [clojure.core/*ns* clojure.core/*ns*]
-        (clojure.core/refer-clojure)))))
+      (clojure.core/refer-clojure))))

 (defn lifecycle-pool
   [size create destroy & {:keys [priority]}]


fix overlay position on landscape images

--- src/synterify/image.clj
+++ src/synterify/image.clj
@@ -29,15 +29,20 @@
                                 (:y overlay-size))
         image-scale-factor (/ output-height
                               (:y image-size))
-        output-width (Math/min
+        output-width (Math/max
                        (int (* overlay-scale-factor
                                (:x overlay-size)))
                        (int (* image-scale-factor
-                               (:x image-size))))]
+                               (:x image-size))))
+        overlay-scaled-size (map-values (partial * overlay-scale-factor) overlay-size)
+        image-scaled-size (map-values (partial * image-scale-factor) image-size)
+        ]
     {:x                   output-width
      :y                   output-height
-     :overlay-scaled-size (map-values (partial * overlay-scale-factor) overlay-size)
-     :image-scaled-size   (map-values (partial * image-scale-factor) image-size)}))
+     :overlay-pos-x       (- output-width (:x overlay-scaled-size))
+     :overlay-pos-y       0
+     :overlay-scaled-size overlay-scaled-size
+     :image-scaled-size   image-scaled-size}))

 (defn- combine-images
   [image overlay output-image-size]
@@ -53,7 +58,7 @@
                 (get-in output-image-size [:image-scaled-size :y])
                 nil)
     (.drawImage output-graphics
-                overlay 0 0
+                overlay (:overlay-pos-x output-image-size) (:overlay-pos-y output-image-size)
                 (get-in output-image-size [:overlay-scaled-size :x])
                 (get-in output-image-size [:overlay-scaled-size :y])
                 nil)


Using a continuation passing style because nothing else seems to work properly. Not actually working right yet. Need a ClojureScript bug to be fixed.

--- client/clojurescript/src/portal/core.cljs
+++ client/clojurescript/src/portal/core.cljs
@@ -9,20 +9,26 @@
 (defn context
   "Look up a context. If no context exists, create one."
   [id]
-  (or (@contexts id)
-      (get
-       (swap! contexts assoc id
-              {:results []
-               :count 0
-               :stdout []
-               :stderr []})
-       id)))
+  (let [id (str id)]
+    (or (@contexts id)
+        (get
+         (swap! contexts assoc id
+                {:results {}
+                 :eval 0
+                 :result 0
+                 :callbacks {}
+                 :stdout []
+                 :stderr []})
+         id))))

 (defn update-context
   "Update a context."
   [id key f & args]
-  (context id)
-  (swap! contexts update-in [id key] (fn [old] (apply f old args))))
+  (let [id (str id)]
+    (context id)
+    (get-in
+     (swap! contexts update-in [id key] (fn [old] (apply f old args)))
+     [id key])))

 (defn netstring
   "Create a netstring."
@@ -31,11 +37,12 @@
 (defn parse-message
   "Parse a Portal message."
   [message]
-  (let [message (second (.split (apply str (butlast (str message)))":"))
-        [id type content] (.split message " ")]
+  (let [message (second (split (string/join (butlast (str message))) #":" 2))
+        [id type content] (split message #" " 3)]
+    (prn "message:" message)
     {:type (keyword type)
      :id id
-     :content content}))
+     :content (string/join " " content)}))

 (defn send-message
   "Send a portal message."
@@ -44,9 +51,12 @@

 (defn eval
   "Evaluate code."
-  ([sock form] (eval sock form (rand-int 9999999999999999)))
-  ([sock form id & [callback]]
-     (send-message sock id "eval" form)))
+  ([sock form callback] (eval sock form (rand-int 9999999999999999) callback))
+  ([sock form id callback]
+     (send-message sock id "eval" form)
+     (update-context id :callbacks assoc
+                     (update-context id :eval inc)
+                     callback)))

 (defn tail
   "Tail stdout or stderr from a context."
@@ -57,18 +67,27 @@
     (cond (#{:stdout :stderr} type)
           (update-context id type conj content)
           (#{:result :error :read-error} type)
-          (update-context id :results conj [type content]))
-    (prn data)))
+          (let [count (update-context id :result inc)]
+            #_(prn @contexts)
+            ((get-in (context id) [:callbacks count])
+             (let [vals (butlast (.split content "\n"))]
+               (if (= type :result)
+                 vals
+                 (conj (butlast vals) {type (last vals)}))))))
+    #_(prn data)))

 (defn connect
   ([port] (connect port "localhost"))
   ([port host]
-     (let [sock (.createConnection net port host)]
-       (.on sock "data" on-data))))
+     (doto (.createConnection net port host)
+       (.on "data" on-data))))
+
+(defn test-fn [data]
+  (prn "result" data))

 (defn -main [& args]
   (let [sock (connect 1337 "localhost")]
-    (eval sock "(range 1000)")
-    (eval sock "(+ 5 5)")))
+    (eval sock "(+ 1 2 3 4 5)" test-fn)
+    (eval sock "(slurp \"http://lazybot.org\")" test-fn)))

 (set! *main-cli-fn* -main)


fix(aoc): fix requires

fix(aoc): fix requires

--- clojure/adventofcode/src/adventofcode/core.clj
+++ clojure/adventofcode/src/adventofcode/core.clj
@@ -1,8 +1,8 @@
 (ns adventofcode.core
   (:gen-class))

-(require '[adventofcode.days.day1 :as day4])
-(require '[adventofcode.days.day4 :as day6])
+(require '[adventofcode.days.day4 :as day4])
+(require '[adventofcode.days.day6 :as day6])

 (defn -main
   "Run all days"


Add load-thumbandinfo-for-index.

Add load-thumbandinfo-for-index.

--- src/beebster_clj/core.clj
+++ src/beebster_clj/core.clj
@@ -26,6 +26,16 @@
   "get-iplayer info for entered index"
   [index]
   (split-lines (:out (apply sh (flatten (conj (list index) iplayer-info))))))
+
+(defn load-thumbandinfo-for-index
+  "grep url for thumbnail size44, title and description
+   for entered index."
+  [index]
+  (let [ind (get-info index)]
+    (list
+     (map #(re-find #"htt.*" %) (filter #(re-find #"thumbnail4.*" %) ind))
+     (map #(re-find #"[A-Z].*" %) (filter #(re-find #"desc:.*" %) ind))
+     (map #(re-find #"[A-Z0-9].*" %) (filter #(re-find #"title:.*" %) ind)))))

 (defn get-thumb-from-search
   "return list of thumbnail for searchterm."


First (highly buggy) pass at implementing the sort algorithm.

--- src/blutwurst/planner.clj
+++ src/blutwurst/planner.clj
@@ -1,5 +1,6 @@
 (ns blutwurst.planner
     (:require [taoensso.timbre :as timbre :refer [trace]]
+              [clojure.set :as setops]
               [clojure.pprint :refer :all]))

 (defn- find-nodes-without-incoming-connections [nodes edges]
@@ -9,7 +10,34 @@
                  edges)
          nodes))

+(defn- incoming-to-node [node edge]
+ (and (= (:to-schema edge) (:schema node))
+      (= (:to-name edge) (:name edge))))
+
 (defn- topological-schema-sort [all-nodes nonentrant-nodes edges result]
+ (trace "Entering topological schema sort non-entrant: " (pr-str (seq nonentrant-nodes))
+        "Edges: " (pr-str (seq edges ))
+        "Result: " (pr-str (seq result))
+        "All nodes: " (pr-str (seq all-nodes)))
+
+ (if (empty? nonentrant-nodes)
+  (if (not (empty? edges))
+   nil ; error
+   result)
+
+  (let [current-node (first nonentrant-nodes)
+        nonentrant-nodes (rest nonentrant-nodes)
+        result (cons current-node result)
+        pruned-edges (keep (complement (partial incoming-to-node current-node)) edges)]
+
+    (recur all-nodes
+           (concat nonentrant-nodes
+                  (find-nodes-without-incoming-connections (setops/intersection all-nodes result nonentrant-nodes)
+                                                           pruned-edges))
+           ;nonentrant-nodes
+           pruned-edges
+           result)
+  ))
 )

 (defn- extract-edges [nodes]
@@ -30,6 +58,7 @@
  (let [nodes (:tables schema)
        edges (extract-edges nodes)]
   (pprint edges)
+  (trace "Preparing to sort graph....")

   (topological-schema-sort nodes
                            (find-nodes-without-incoming-connections nodes edges)


First version of CreateCompetitionView

First version of CreateCompetitionView

--- src/tango/cljs/client.cljs
+++ src/tango/cljs/client.cljs
@@ -351,7 +351,16 @@
                                       :onChange #(do
                                                   (om/transact! reconciler `[(app/set-import-status
                                                                                {:status :importing})])
-                                                  (on-click-import-file %))}))))
+                                                  (on-click-import-file %))}))
+
+            ;(dom/li
+            ;  #js {:className (if (= active-page-key page-key) "active" "")
+            ;       :onClick   #(om/transact! component `[(app/select-page {:page ~page-key})])}
+            ;  (dom/a nil button-name))
+            (dom/button #js {:className "btn btn-default"
+                             :onClick #(om/transact! reconciler
+                                                     `[(app/select-page {:page :create-new-competition})])}
+                        "Skapa ny..")))
         (= import-status :importing) (dom/h3 nil "Importerar, vänligen vänta..")))))

 ;;;;;;;;;;;;;;;;;;;;
@@ -460,6 +469,37 @@
               (dom/th #js {:width "20"} "Panel")
               (dom/th #js {:width "20"} "Type")))
           (apply dom/tbody nil (map (om/factory ScheduleRow) activites)))))))
+
+;;;;;;;;;;;;;;;;;;;;
+;; Create Competition
+(defui CreateCompetitionView
+  Object
+  (render [this]
+    (dom/div nil
+      (dom/h3 nil "Competition Information")
+      (dom/form nil
+        (dom/div #js {:className "form-group"}
+          (dom/label nil "Name")
+          (dom/input #js {:type "text" :className "form-control"}))
+
+        (dom/div #js {:className "form-group"}
+          (dom/label nil "Place")
+          (dom/input #js {:type "text" :className "form-control"}))
+
+        (dom/div #js {:className "form-group"}
+          (dom/label nil "Date")
+          (dom/input #js {:type "text" :className "form-control"}))
+
+        (dom/div #js {:className "form-group"}
+          (dom/label nil "Organizer")
+          (dom/input #js {:type "text" :className "form-control"}))
+        )
+
+      (dom/h3 nil "Competition Options")
+      (dom/form nil
+        (dom/div #js {:className "form-group"}
+          (dom/label #js {:className "checkbox"}
+            (dom/input #js {:type "checkbox"} "Prop")))))))

 ;;;;;;;;;;;;;;;;;;;;
 ;; Menu
@@ -525,6 +565,7 @@

             (dom/div #js {:className "col-sm-10 col-sm-offset-2 col-md-10 col-md-offset-2 main"}
               (condp = spage
+                :create-new-competition ((om/factory CreateCompetitionView))
                 :properties ((om/factory PropertiesView) selected-competition)
                 :classes ((om/factory ClassesView) selected-competition)
                 :competitions ((om/factory CompetitionsView)


Add streaming transit encoding support.

Add streaming transit encoding support.

--- src/uxbox/util/transit.clj
+++ src/uxbox/util/transit.clj
@@ -5,13 +5,50 @@
 ;; Copyright (c) 2016 Andrey Antukh <niwi@niwi.nz>

 (ns uxbox.util.transit
-  (:require [catacumba.serializers :as sz]
-            [uxbox.util.time :as dt]))
+  (:require [cognitect.transit :as t]
+            [uxbox.util.time :as dt])
+  (:import java.io.ByteArrayInputStream
+           java.io.ByteArrayOutputStream))
+
+(def ^:private +reader-handlers+
+  dt/+read-handlers+)
+
+(def ^:private +write-handlers+
+  dt/+write-handlers+)
+
+(defn reader
+  ([istream]
+   (reader istream nil))
+  ([istream {:keys [type] :or {type :json}}]
+   (t/reader istream type {:handlers +reader-handlers+})))
+
+(defn read!
+  "Read value from streamed transit reader."
+  [reader]
+  (t/read reader))
+
+(defn writer
+  ([ostream]
+   (writer ostream nil))
+  ([ostream {:keys [type] :or {type :json}}]
+   (t/writer ostream type {:handlers +write-handlers+})))
+
+(defn write!
+  [writer data]
+  (t/write writer data))

 (defn decode
-  [data]
-  (sz/decode data :transit+json {:handlers dt/+read-handlers+}))
+  ([data]
+   (decode data nil))
+  ([data opts]
+   (with-open [input (ByteArrayInputStream. data)]
+     (read! (reader input opts)))))

 (defn encode
-  [data]
-  (sz/encode data :transit+json {:handlers dt/+write-handlers+}))
+  ([data]
+   (encode data nil))
+  ([data opts]
+   (with-open [out (ByteArrayOutputStream.)]
+     (let [w (writer out opts)]
+       (write! w data)
+       (.toByteArray out)))))


Turned the "bare" Swing widgets into widgets.

--- src/fm/simrunner/gui/view.clj
+++ src/fm/simrunner/gui/view.clj
@@ -111,16 +111,16 @@
         alignment-panel (doto (JPanel. (BorderLayout.))
                               (.add input-panel BorderLayout/NORTH))
         scroll-pane     (JScrollPane. alignment-panel)]
-    {:widget   scroll-pane
-     :contents {:inputs (add-inputs input-panel specs)}}))
+    (gui/widget :config-editor scroll-pane
+                :contents {:inputs (add-inputs input-panel specs)})))

 (defn- console []
   (let [text-area   (doto (JTextArea.)
                           (.setEditable false)
                           (.setPreferredSize (Dimension. 0 150)))
         scroll-pane (JScrollPane. text-area)]
-    {:widget   scroll-pane
-     :contents {:text-area text-area}}))
+    (gui/widget :console scroll-pane
+                :contents {:text-area (gui/widget :text-area text-area)})))

 (defn simrunner-view []
   (let [tool-bar      (tool-bar)
@@ -130,10 +130,10 @@
                             (.add (:widget tool-bar) BorderLayout/NORTH)
                             (.add (:widget config-editor) BorderLayout/CENTER)
                             (.add (:widget console) BorderLayout/SOUTH))]
-    {:widget   main-panel
-     :contents {:tool-bar      tool-bar
-                :config-editor config-editor
-                :console       console}}))
+    (gui/widget :simrunner-view main-panel
+                :contents {:tool-bar      tool-bar
+                           :config-editor config-editor
+                           :console       console})))

 (defn simrunner-frame [& {:as options}]
   (let [options (apply concat options)


PLD: add tooltip for disabled maps

PLD: add tooltip for disabled maps

--- src/hatti/views/dataview.cljs
+++ src/hatti/views/dataview.cljs
@@ -148,8 +148,15 @@
                                                            :views :active))]
                          (cond
                            (and (= view :map) no-geodata?)
-                           [:a {:class "inactive" :title "No geodata"}
-                            (name view)]
+                           ;; TODO add tooltips for disabled tabs here
+                           [:a.inactive
+                            (str (name view) " ")
+                            [:span.tooltip
+                             [:span.tip-info.tooltip
+                              (str
+                               " The Map tab is disabled because this form "
+                               "has no location questions.")]
+                             [:span.tip-question "?"]]]
                            :else
                            [:a
                             {:href (when active? (str "#/" (name view)))


A fix on the close routine; make sure lets go of button after a roof retry

--- src/chicken_coop/core.clj
+++ src/chicken_coop/core.clj
@@ -105,11 +105,11 @@
                                 (update-status! :warnings)
                                 (hb/reverse! hb)
                                 (Thread/sleep 1000) ; make sure door lets go of button
-                                (loop []
-                                  (when (or (closed? roof-btn)
-                                            (max-time-up max-time-ms start-time))
-                                    (log "Reeling complete; trying again.")
-                                    (lower-with-log)))
+                                (wait-till (or (closed? roof-btn)
+                                               (max-time-up max-time-ms start-time))
+                                  (log "Reeling complete; trying again.")
+                                  (lower-with-log)
+                                  (Thread/sleep 1000)) ; make sure does lets go of button
                                 (recur (inc tries)))
         ; After a certain amount of time, just give up
         (max-time-up max-time-ms start-time)


* src/clj/cljs/compiler.clj: fix bug around fns whose only non-zero arity is variadic (i.e. hash-set). was emitting a false - false does not get emitted as empty string like nil does.

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -459,7 +459,7 @@
               (do (emitln "default:")
                   (emitln "return " n ".cljs$lang$arity$variadic("
                           (comma-sep (butlast maxparams))
-                          (and (> (count maxparams) 1) ", ")
+                          (when (> (count maxparams) 1) ", ")
                           "cljs.core.array_seq(arguments, " max-fixed-arity "));"))
               (let [pcnt (count (:params meth))]
                 (emitln "case " pcnt ":")


* src/clj/cljs/compiler.clj: mark defrecord and deftype as :type true in namespaces atom

--- src/clj/cljs/compiler.clj
+++ src/clj/cljs/compiler.clj
@@ -1263,6 +1263,7 @@
            (fn [m]
              (let [m (assoc (or m {})
                        :name t
+                       :type true
                        :num-fields (count fields))]
                (merge m
                  {:protocols (-> tsym meta :protocols)}
@@ -1276,7 +1277,7 @@
   (let [t (:name (resolve-var (dissoc env :locals) tsym))]
     (swap! namespaces update-in [(-> env :ns :name) :defs tsym]
            (fn [m]
-             (let [m (assoc (or m {}) :name t)]
+             (let [m (assoc (or m {}) :name t :type true)]
                (merge m
                  {:protocols (-> tsym meta :protocols)}
                  (when-let [line (:line env)]


add metadata to the schema

add metadata to the schema

--- src/clj/runbld/schema.clj
+++ src/clj/runbld/schema.clj
@@ -167,6 +167,7 @@
    :scheduler                  s/Str
    :url                        s/Str
    :console-url                s/Str
+   (s/optional-key :metadata)  s/Str
    :tags                       [s/Str]
    (s/optional-key :number)    s/Str
    (s/optional-key :executor)  s/Str
@@ -321,6 +322,7 @@
                :number              m/keyword
                :executor            m/keyword
                :node                m/keyword
+               :metadata            m/multi-string
                :last-success
                {:properties
                 {:id                m/keyword


Don't allow admin password reset

Don't allow admin password reset

--- src/clj_crud/accounts.clj
+++ src/clj_crud/accounts.clj
@@ -144,7 +144,10 @@
   :post! (fn [ctx]
            (let [email (get-in ctx [:request :params :email])
                  errors (reduce merge {}
-                                [(when-not (accounts/valid-email? email)
+                                [(when (= email "admin@example.com")
+                                   ;; don't allow reset admin password
+                                   [:email "Invalid email"])
+                                 (when-not (accounts/valid-email? email)
                                    [:email "Invalid email"])])
                  account {:email email}]
              (if (seq errors)


Use partial instead of an anonymous function as an arg to juxt

--- src/cljs/fatlip/core.cljs
+++ src/cljs/fatlip/core.cljs
@@ -327,9 +327,7 @@
         edges (->> next-ordered
                    (filter vector?)
                    (map (juxt identity
-                              (fn [seg-c]
-                                (mapcat #(-> % :characters)
-                                        (:edges seg-c)))))
+                              (partial mapcat #(-> % :characters))))
                    (map (fn [[seg-c characters]]
                           [seg-c #{(Edge. seg-c seg-c characters)}]))
                    (into {})


hardcode machine ip

hardcode machine ip

--- src/cljs/mpd/network.cljs
+++ src/cljs/mpd/network.cljs
@@ -57,7 +57,7 @@
   (log "  network")
   (log "connecting...")

-  (let [ws (js/WebSocket. "ws://127.0.0.1:8197")]
+  (let [ws (js/WebSocket. "ws://10.247.110.131:8197")]
     (doall (map #(aset ws (first %) (second %))
            [["onopen" websocket-open]
             ["onclose" websocket-close]


Basic light methods

Basic light methods

--- src/clojure/yaw/world.clj
+++ src/clojure/yaw/world.clj
@@ -1,6 +1,7 @@
 (ns yaw.world
   (:import (yaw.engine.meshs MeshBuilder)
-           (yaw.engine World))
+           (yaw.engine World)
+           (yaw.engine.light AmbientLight DirectionalLight))
   (:require [yaw.mesh]))
   ;;(gen-class)

@@ -143,6 +144,23 @@
   [world idx camera]
   (.addCamera world idx camera))

+;;LIGHT------------------------------------------------------------
+(defn lights "Retrieve the lighting settings of the world scene" [world] (.getSceneLight world))
+
+(defn set-ambient-light!
+  "Set the ambient light of the world"
+  [world & {:keys [r g b i]
+            :or {r 1 g 1 b 1 i 1}}]
+  (.setAmbient (lights world) (AmbientLight. r g b i)))
+
+(defn set-sun!
+  "Set the sun of the world"
+  [world & {:keys [color direction]
+            :or {color [1 1 1 0.6]
+                 direction [-1 -1 -1]}}]
+  (let [[r g b i] color [dx dy dz] direction]
+  (.setSun (lights world) (DirectionalLight. r g b i dx dy dz))))
+
 ;;COLLISIONS------------------------------------------------------

 (defn create-bouding-box!


Eagerly evaluate the body of a while

Eagerly evaluate the body of a while

--- src/clojure_ruby/core.clj
+++ src/clojure_ruby/core.clj
@@ -92,7 +92,7 @@
   (let [[_ predicate & body] stmt
         predicate (evaluate predicate)]
     (if predicate
-      (map evaluate body))))
+      (mapv evaluate body))))

 (defn evaluate-all [stmts]
   (when-let [[stmt & stmts] stmts]


Disconnect nicely.

Disconnect nicely.

--- src/clojurecraft/core.clj
+++ src/clojurecraft/core.clj
@@ -89,7 +89,8 @@
       (let [packet (.poll outqueue 1 TimeUnit/SECONDS)]
         (when packet
           (let [[packet-type, payload] packet]
-            (write-packet bot packet-type payload))))))
+            (write-packet bot packet-type payload)))))
+    (write-packet bot :disconnectkick {:reason "Bye!"}))
   (println "done - output handler")
   (println "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"))


fix classpath call

fix classpath call

--- src/cake/tasks/compile.clj
+++ src/cake/tasks/compile.clj
@@ -9,7 +9,7 @@
   (let [src (file "src" "jvm")]
     (when (.exists src)
       (ant Javac {:destdir     (file "classes")
-                  :classpath   (classpath project)
+                  :classpath   (classpath)
                   :srcdir      (path src)
                   :fork        true
                   :failonerror true}))))


tile-at-coord? checks to see if a tile is in a specific location

--- src/tile_game/board.clj
+++ src/tile_game/board.clj
@@ -98,12 +98,15 @@
 (defn impassable? [board dist-map tile]
   (> (nth dist-map (tile->index board tile)) (* 2 (dimension board))))

+(defn tile-at-coord? [board tile coord]
+  (= (tile->coords board tile) coord))
+
 (defn path-to [board goal & [avoid]]
   (let [dist-map (distance-map board goal avoid)]
     (if (impassable? board dist-map 0)
       '()
       (loop [path '() board board]
-        (if (= (tile->coords board 0) goal)
+        (if (tile-at-coord? board 0 goal)
           (reverse path)
           (let [moves (sort-by #(nth dist-map (tile->index board %))
                                (clojure.set/difference (legal-moves board)
@@ -139,7 +142,13 @@
   (let [dist-map (distance-map board goal avoid)]
     (if (impassable? board dist-map tile)
       '()
-      'foo)))
+      (loop [path '() board board]
+        (if (tile-at-coord? board tile goal)
+          (reverse path)
+          (let [direction :up
+                moves (move-tile board tile direction avoid)]
+            (recur (cons direction path)
+                   (reduce slide board moves))))))))

 (defn solve-tile [board tile]
   (let [solved (solved-tiles board)


Refactor deserializer.

Refactor deserializer.

--- src/konserve/serializers.cljc
+++ src/konserve/serializers.cljc
@@ -32,10 +32,13 @@
    (defrecord FressianSerializer [custom-read-handlers custom-write-handlers]
      PStoreSerializer
      (-deserialize [_ read-handlers bytes]
-       (let [reader (fress/create-reader bytes
-                                         :handlers (merge custom-read-handlers
-                                                          (incognito-read-handlers read-handlers)))]
-         (fress/read-object reader)))
+       (let [buf->arr (.from js/Array (.from js/Int8Array bytes))
+             buf      (fress.impl.buffer/BytesOutputStream. buf->arr (count buf->arr))
+             reader   (fress/create-reader buf
+                                           :handlers (merge custom-read-handlers
+                                                            (incognito-read-handlers read-handlers)))
+             read     (fress/read-object reader)]
+         read))
      (-serialize [_ bytes write-handlers val]
        (let [writer (fress/create-writer bytes
                                          :handlers (merge
@@ -61,3 +64,7 @@
 (defn string-serializer []
   (map->StringSerializer {}))

+
+
+
+


Minor cleanup

Minor cleanup

--- src/clara/rules/engine.clj
+++ src/clara/rules/engine.clj
@@ -383,7 +383,7 @@

 (defn- construct-condition [condition result-binding]
   (let [type (first condition)
-        constraints (apply vector (rest condition))
+        constraints (vec (rest condition))
         binding-keys (variables-as-keywords constraints)]

     `(->Condition ~(resolve type)
@@ -414,7 +414,7 @@
 (defn- parse-expression [expression]
   (if (operators (first expression))
     {:type (keyword (first expression))
-     :content (apply vector (map parse-expression (rest expression)))}
+     :content (vec (map parse-expression (rest expression)))}
     {:type :condition :content (create-condition expression)}))

 (defn parse-lhs
@@ -470,19 +470,19 @@

           ;; If there are no disjunctions in the processed children, no further changes are needed.
           {:type :and
-           :content (apply vector children)}
+           :content (vec children)}

           ;; The children had disjunctions, so distribute them to convert to DNF.
           {:type :or
            :content (into [] (for [disjunction disjunctions]
                                {:type :and
-                                :content (apply vector (cons disjunction conjunctions))}))})
+                                :content (vec (cons disjunction conjunctions))}))})

         :or
         {:type :or
          ;; Nested disjunctions can be merged into the parent disjunction. We
          ;; the simply append nested conjunctions to create our DNF.
-         :content (apply vector (concat disjunctions conjunctions))  }))))
+         :content (vec (concat disjunctions conjunctions))  }))))

 (declare add-rule*)


formatting / additional :req

formatting / additional :req

--- src/clj/game/cards-ice.clj
+++ src/clj/game/cards-ice.clj
@@ -335,12 +335,12 @@

    "Chrysalis"
    {:abilities [(do-net-damage 2)]
-    :access {:optional
-              {:req (req (not= (first (:zone card)) :discard))
-               :prompt "Use Chrysalis to do 2 net damage?"
-               :yes-ability {:effect (effect (damage :net 2 {:card card}))
-                             :msg "do 2 net damage"}}
-			   :msg "force the Runner to encounter Chrysalis"}}
+    :access {:req (req (not= (first (:zone card)) :discard))
+             :msg "force the Runner to encounter Chrysalis"
+             :optional {:req (req (not= (first (:zone card)) :discard))
+                        :prompt "Use Chrysalis to do 2 net damage?"
+                        :yes-ability {:effect (effect (damage :net 2 {:card card}))
+                        :msg "do 2 net damage"}}}}

    "Chum"
    {:abilities [(do-net-damage 3)]}


Add optional n reports to insert.

Add optional n reports to insert.

--- src/clj/hbg_crime/core.clj
+++ src/clj/hbg_crime/core.clj
@@ -73,8 +73,8 @@
        (distinct)))

 (defn insert-all-current-reports
-  []
-  (doseq [report (filter identity (all-current-reports))]
+  [& [n]]
+  (doseq [report (filter identity (all-current-reports n))]
     (db/insert-report report)))

 (defn reports-as-json


munchMap case for binary ops, still needs to dispatch on operator type and handle Temps

--- src/clj/minijava/munch.clj
+++ src/clj/minijava/munch.clj
@@ -82,11 +82,27 @@
   	  		s (munch adr)]
   				 (emit (movl s d))
   				 d)) ;;Since Mem is an expression, it returns a temp.
-
+
+;; Handles binop cases
+;(defmulti munchOp (fn [op r1 r2] op))
+;(defmulti munchOp [:+] [op rand1 rand2])
+
+(defmethod munchMap [:minijava.ir/BinaryOp clojure.lang.Keyword :minijava.exp/expression :minijava.exp/expression]
+  [exp op rand1 rand2]
+  (cond (and (isit? rand1 :minijava.ir/Const)
+             (isit? rand2 :minijava.ir/Const))
+        (emit (addl (CONST (:val rand1))
+                    (CONST (:val rand2))))
+        (isit? rand1 :minijava.ir/Const)
+        (emit (addl (CONST (:val rand1))
+                    (munch rand2)))
+        (isit? rand2 :minijava.ir/Const)
+        (emit (addl (CONST (:val rand2))
+                    (munch rand1)))))

 (defmethod munchMap [:minijava.ir/Const java.lang.Integer]
   [x value]
   	;;Const(i) -> Movl $i Temp
   	(let [d (Temp (minijava.ir.temp.Temp.))]
   				 (emit (movl (CONST value) d))
-  				 d)) ;;Since Mem is an expression, it returns a temp.+  				 d)) ;;Since Mem is an expression, it returns a temp.


state save

state save

--- src/clj_blueflood/core.clj
+++ src/clj_blueflood/core.clj
@@ -29,12 +29,10 @@
    (cass-execute query {}))
   ([query opts]
    (let [opts (merge {:consistency :one} opts)]
-     (log/spy
-     (alia/execute (:session @cass-state) query opts))))
-  )
+     (alia/execute-async (:session @cass-state) query opts))))

 (defn cass-prepared-insert [& data]
-  (log/info "Inserting the following data: " data)
+  ;(log/info "Inserting the following data: " data)
   (cass-execute (:prepared-insert @cass-state) {:values data}))

 (defn init-cass
@@ -44,10 +42,16 @@
   ([options]
    (log/info "Initializing connections to cassandra")
    (let [cluster (alia/cluster {:contact-points (get options :nodes ["localhost"])
-                                :port (get options :port 9042)})
+                                :port (get options :port 9042)
+                                :query-options {:consistency :one}
+                                :pooling-options
+                                {:core-connections-per-host {:remote 16 :local 16}
+                                 :max-connections-per-host {:remote 100 :local 100}
+                                 :max-simultaneous-requests-per-connection {:remote 32 :local 32}
+                                 :min-simultaneous-requests-per-connection {:remote 16 :local 16}}})
          session (alia/connect cluster)]

-     (alia/execute session (use-keyspace "DATA"))
+     (alia/execute session (use-keyspace "TESTDATA"))

      (reset! cass-state
              {:cluster cluster
@@ -60,27 +64,22 @@
         :let [{:keys [tenantId metricName
                       metricValue collectionTime]} datapoint
               metric-name (str tenantId "." metricName)]]
-    (do
-      (log/spy datapoint)
-      (log/spy
-        (cass-prepared-insert metric-name collectionTime (str metricValue))
-        )))
-  )
+    (cass-prepared-insert metric-name collectionTime (str metricValue))))

 (defn solo-ingest-handler [req]
   (log/info "I was asked to handle a request for a single tenant")
-  (log/spy (ingest-processor
-    (map #(assoc % :tenantId (get-in req [:params :tenant-id])) (:body req) )))
-
-  (response "blarg"))
+  (for [x (doall (ingest-processor
+                   (map #(assoc % :tenantId (get-in req [:params :tenant-id])) (:body req) )))]
+    @x)
+  (response ""))

 (defn ingest-handler [req]
   (log/info "OMG A WHALE SHOWED UP!")
-  (response
-  (ingest-processor (:body req))
-    ))
+  (for [x (doall (ingest-processor (:body req)))]
+      @x)
+  (response ""))

 (defn- json-request? [request]
@@ -135,11 +134,12 @@

     (log/info "Starting the server - here I go!")
-    (log/spy (map #(assoc % :a 1) [{:b 2} {:c 3} {:d 4}]))
     (init-cass {:nodes (:nodes options)
                 :port (:cass-port options)})
     (log/info "Cassandra has been initialized. Now to give the routes to ring")
-    (run-server root-handler {:port (:port options)})))
+    (run-server root-handler {:port (:port options)
+                              :thread 20
+                              :worker-name-prefix "httpkit-"})))


Remove unnecessary code

Remove unnecessary code

--- src/clj_gatling/report.clj
+++ src/clj_gatling/report.clj
@@ -22,7 +22,7 @@
         scenario-start [(:name scenario) id "USER" "START" start id]
         scenario-end [(:name scenario) id "USER" "END" end end]
         requests (mapcat #(vector (map-request (:name scenario) %)) (:requests scenario))]
-    (vec (concat [scenario-start] requests [scenario-end]))))
+    (concat [scenario-start] requests [scenario-end])))

 (defn create-result-lines [start-time result]
   (let [timestamp (unparse-local (formatter "yyyyMMddhhmmss") start-time)


Clean up some code

Clean up some code

--- src/cljs/ladders/core.cljs
+++ src/cljs/ladders/core.cljs
@@ -5,19 +5,14 @@
               [accountant.core :as accountant]
               [cljs.pprint :as pprint]))

-(defn assoc-if [pred map key val]
-  (if (pred)
-    (assoc map key val)
-    map))
-
 (defn menu [selected]
   (let [menu-options [["/" "Home"]
                       ["/users" "Users"]
                       ["/result" "Add Challenge"]]]
     [:ul {:class "nav nav-pills"}
      (map (fn [[url option-name]]
-            (let [li-attrs {:role "presentation"}
-                  li-attrs (assoc-if #(= selected option-name) li-attrs :class "active")]
+            (let [class (if (= selected option-name) "active" "")
+                  li-attrs {:role "presentation" :class class}]
               ^{:key url} [:li li-attrs [:a {:href url} option-name]]))
           menu-options)]))


add hash

add hash

--- src/cljs/re_dnd/views.cljs
+++ src/cljs/re_dnd/views.cljs
@@ -80,6 +80,7 @@
          :on-mouse-up   (partial reorder-fn id (:id de))}
         [drag-handle de]]
        [:div.dropped-element-body.col-md-11
+        ^{:key (hash de)} ;;force rerender everytime `de` changes. since it's an multimethods, this might otherwise fail sometimes.
         [dropped-widget de]]
        [:div {:style {:clear :both}}]])))


making graphs more useful

making graphs more useful

--- src/cljs/tictag/views.cljs
+++ src/cljs/tictag/views.cljs
@@ -27,7 +27,7 @@
             [re-com.core :as re-com])
   (:import [goog.date.Interval]))

-(def simple-formatter (f/formatter "yyyy-MM"))
+(def simple-formatter (f/formatter "yyyy-MM-dd"))

 (defn format-day-to-time [day]
   (let [in-seconds (* day 24 60 60 1000)]
@@ -35,9 +35,9 @@

 (defn circle-for-ping [ping]
   [:ellipse {:rx    2
-             :ry    12
-             :style {:opacity "0.1"}
-             :fill  "black"}])
+             :ry    2
+             :style {:opacity "0.5"}
+             :fill  "#396AB1"}])

 (declare matrix-plot-view)

@@ -50,32 +50,40 @@
     (matrix-plot-view @count @width @height @min-day @max-day)))

 (defn time-axis [yscale]
-  (c2.svg/axis yscale
-               (range 0 (* 24 60 60) (* 60 60))
-               :orientation :right
-               :formatter #(str (/ % 60 60) ":00")))
+  [:g {:style {:stroke "#396AB1"}}
+   (c2.svg/axis yscale
+                (range 0 (* 24 60 60) (* 4 60 60))
+                :orientation :right
+                :formatter #(str (/ % 60 60) ":00"))])

 (defn hist-axis [density-yscale]
-  (c2.svg/axis density-yscale
-               (range 0 25)
-               :orientation :left
-               :label "Hours (per day)"))
+  [:g {:style {:stroke "#DA7C30"}}
+   (c2.svg/axis density-yscale
+                [0 8 16 24]
+                :orientation :left
+                :text-margin 25
+                :label-margin 40
+                :label "Hours (per day)")])

 (defn days-axis [xscale]
   (c2.svg/axis
    xscale
    (let [[r0 r1] (:domain xscale)]
-     (range r0 r1 (js/Math.round (/ (- r1 r0) 10))))
+     (butlast (range r0 r1 (js/Math.round (/ (- r1 r0) 10)))))
    :orientation :bottom
+   :text-margin 25
+   :label-margin 43
+   :major-tick-width 12
    :formatter format-day-to-time
-   :label "Day"))
+   :label "Date"))

 (defn cum-axis [yscale]
-  (c2.svg/axis
-   yscale
-   (conj (:ticks (c2.ticks/search (:domain yscale))) (second (:domain yscale)))
-   :orientation :right
-   :label "Hours (cum)"))
+  [:g {:style {:stroke "#3E9651"}}
+   (c2.svg/axis
+    yscale
+    (timbre/spy (conj (:ticks (c2.ticks/search (:domain yscale))) (second (:domain yscale))))
+    :orientation :right
+    :label "Hours (cum)")])

 (defn axes [xscale yscale density-yscale count-scale width height margin min-day max-day]
   [:g {:style       {:stroke       "black"
@@ -83,12 +91,11 @@
                      :font-weight  "100"}
        :font-size   "14px"
        :font-family "sans-serif"}
-   (when-not (= (:domain count-scale) [0 0])
      [:g
       [:g {:transform (c2.svg/translate [(- width margin) 0])}
        [cum-axis count-scale]]
       [:g {:transform (c2.svg/translate [margin 0])}
-       [hist-axis density-yscale]]])
+       [hist-axis density-yscale]]]
    [:g {:transform (c2.svg/translate [(/ width 2) 0])}
     [time-axis yscale]]
    [:g {:transform (c2.svg/translate [0 (- height margin)])}
@@ -96,7 +103,8 @@

 (defn histogram [xscale density-yscale height margin]
   (let [day-totals (subscribe [:day-totals])]
-    [:g
+    [:g {:style {:fill    "#DA7C30"
+                 :opacity "0.8"}}
      (doall
       (for [[d freq] @day-totals]
         (let [hours  (* freq 0.75)
@@ -106,9 +114,7 @@
            {:x      (xscale d)
             :y      scaled
             :height (- height scaled margin)
-            :style  {:opacity "0.2"}
-            :fill   "#0000cc"
-            :width  5}])))]))
+            :width  1}])))]))

 (defn matrix [xscale yscale]
   (let [pings (subscribe [:pings])]
@@ -127,9 +133,9 @@
       (when @totals
         [:g
          [:g {:style {:fill :none
-                      :stroke "black"
-                      :stroke-width "3"
-                      :opacity "0.5"}}
+                      :stroke "#3E9651"
+                      :stroke-width "1"
+                      :opacity "0.8"}}
           (c2.svg/line
            (map
             (fn [[day total]]
@@ -145,14 +151,18 @@
                                         :range [margin (- height margin)])
         density-yscale (c2.scale/linear :domain [0 24]
                                         :range [(- height margin) margin])
-        count-scale    (c2.scale/linear :domain [0 (js/Math.round (* 0.75 count))]
+        count-scale    (c2.scale/linear :domain [0 (js/Math.ceil (* 0.75 count))]
                                         :range [(- height margin) margin])]
-    [:svg {:style {:width (str width "px") :height (str height "px")}}
-     [axes xscale yscale density-yscale count-scale width height margin min-day max-day]
-     [:g
-      ^{:key "hist"} [histogram xscale density-yscale height margin]
-      ^{:key "matrix"} [matrix xscale yscale]
-      ^{:key "cumulative"} [cumulative xscale count-scale width height margin]]]))
+    (if-not (= (:domain count-scale) [0 0])
+      [:svg {:style {:width (str width "px") :height (str height "px")
+                     :background-color "#eee"
+                     :border "1px solid black"}}
+       [axes xscale yscale density-yscale count-scale width height margin min-day max-day]
+       [:g
+        ^{:key "hist"} [histogram xscale density-yscale height margin]
+        ^{:key "matrix"} [matrix xscale yscale]
+        ^{:key "cumulative"} [cumulative xscale count-scale width height margin]]]
+      [:svg {:style {:width (str width "px") :height "1px"}}])))

 (defn tag-table-row-view [tag count tag-% minutes active? time-per-day]
   [:tr (if active?
@@ -185,16 +195,17 @@
   (let [tag-counts            (subscribe [:sorted-tag-counts])
         ping-query            (subscribe [:ping-query])]
     [re-com/v-box
+     :gap "1em"
      :align :center
      :children
-     [[matrix-plot]
-      [re-com/input-text
+     [[re-com/input-text
        :style {:border-radius "0px"}
        :width "100%"
        :placeholder "Query"
        :model (reagent/atom "")
        :change-on-blur? false
        :on-change #(dispatch [:debounced-update-ping-query %])]
+      [matrix-plot]
       [re-com/box
        :child
        [:table


hardening/requested fixes

hardening/requested fixes

--- src/clojure/flambo/sql.clj
+++ src/clojure/flambo/sql.clj
@@ -89,9 +89,7 @@
     (.put options "quote" quote)
     (if schema
       (-> sql-context .read (.format "csv") (.options options) (.schema schema) .load)
-      (-> sql-context .read (.format "csv") (.options options) .load)
-      )))
-
+      (-> sql-context .read (.format "csv") (.options options) .load))))

 (defn register-data-frame-as-table
   "Registers the given DataFrame as a temporary table in the
@@ -213,8 +211,8 @@
         (persistent! v)))))

 (defsparkfn
-  ^{:doc "Coerce `org.apache.spark.sql SparkSession.Row` objects into Clojure
-maps with each map created from its respective row."}
+  ^{:doc "Coerce an `org.apache.spark.sql SparkSession.Row` objects into
+Clojure maps with each map created from its respective row."}
   row->map [^org.apache.spark.sql.Row row]
   (let [n (.length row)
         schema (.schema row)
@@ -258,7 +256,7 @@
       f/first
       struct-to-map))

-(defn setup-temp-view
+(defn setup-temporary-view
   "Create or replace a temporary view from a JSON file or Parquet at **url**.
   The temporary name will be set to **table-name** (if provided) and the type
   of data is expected is given in the `:type` key, which is one of the
@@ -267,11 +265,12 @@
 * `:parquet` - parquet table format (default)
 * `:json` - a JSON formatted file
 * `:csv` - a comma delimited file"
-  [url table-name & {:keys [type csv-options schema infer-schema?]
-                     :or {infer-schema? true
-                          csv-options {:header true :separator "," :quote "'"}}}]
-  (let [type (or type :parquet)
-        options (java.util.HashMap.)
+  [sql-context url table-name &
+   {:keys [type csv-options schema infer-schema?]
+    :or {type :parquet
+         infer-schema? true
+         csv-options {:header true :separator "," :quote "'"}}}]
+  (let [options (java.util.HashMap.)
         infer-schema? (and (nil? schema) infer-schema?)]
     (.put options "path" url)
     (if (and (= type :csv) csv-options)
@@ -280,28 +279,22 @@
           (.putAll options)))
     (if (and (nil? schema) infer-schema?)
       (.put options "inferSchema" "true"))
-    (-> (sql-context)
-        .read
-        (.format (name type))
-        (.options options)
-        ((fn [df]
-           (if infer-schema?
-             (.schema df schema))
-           df))
-        .load
-        ((fn [df]
-           (if table-name
-             (.createOrReplaceTempView df table-name)
-             df))))))
+    (cond-> (.read sql-context)
+      true (.format (name type))
+      true (.options options)
+      infer-schema? (.schema schema)
+      true .load
+      table-name (.createOrReplaceTempView table-name))
+    sql-context))

 (defn query
   "Query a parquet file at **url** with **sql** statement creating temporary
   table key **table** (default to `tmp`).

-  See [[setup-temp-view]] for `:type` key."
+  See [[setup-temporary-view]] for `:type` key."
   [url sql & {:keys [table partitions] :as m
               :or {table "tmp"}}]
-  (apply setup-temp-view url table (apply concat m))
+  (apply setup-temporary-view url table (apply concat m))
   (-> (.getOrCreate (SparkSession/builder))
       (.sql sql)
       ((fn [df]
@@ -312,7 +305,7 @@
 (defn schema-from-url
   "Return a schema as a map from a parquet table at **url**.

-  See [[setup-temp-view]] for `:type` key."
+  See [[setup-temporary-view]] for `:type` key."
   [url & {:keys [type]}]
   (-> (query url "select * from tmp" :type type)
       (schema)))
@@ -460,14 +453,6 @@
   ([^Dataset df type- f]
    (.flatMap df (flat-map-function f) (encoder-for-type type-))))

-(defn ^Dataset flat-map
-  "Similar to `map`, but each input item can be mapped to 0 or more output
-  items (so the function `f` should return a collection rather than a single
-  item)"
-  ([^Dataset df f] (flat-map df :object f))
-  ([^Dataset df type- f]
-   (.flatMap df (flat-map-function f) (encoder-for-type type-))))
-
 (defn ^Dataset for-each-partition
   "Run function **f** for each partition in a dataframe."
   [^Dataset df f]


> encoded

> encoded

--- src/clojure/nossal/app.clj
+++ src/clojure/nossal/app.clj
@@ -94,7 +94,7 @@
   (GET "/%F0%9F%91%89:encoded-id{[a-zA-Z0-9]+}" [encoded-id] ; /👉:encoded-id
     (redirect encoded-id))

-  (GET "/>:encoded-id{[a-zA-Z0-9]+}" [encoded-id] ; />:encoded-id
+  (GET "/%3E:encoded-id{[a-zA-Z0-9]+}" [encoded-id] ; />:encoded-id
     (redirect encoded-id))

   (route/resources "/")


CMR-294: Updated valid mime-types to include MENDS ISO.

--- src/cmr/umm/mime_types.clj
+++ src/cmr/umm/mime_types.clj
@@ -6,8 +6,8 @@

 ;; Need to determine which ISO types will be supported when implementing ISO user stories.
 (def concept-type->valid-mime-types
-  {:collection #{"application/echo10+xml", "application/iso_prototype+xml", "application/iso:smap+xml",
-                 "application/iso19115+xml", "application/dif+xml"}
-   :granule #{"application/echo10+xml", "application/iso_prototype+xml", "application/iso:smap+xml",
+  {:collection #{"application/echo10+xml", "application/iso+xml", "application/iso-smap+xml",
+                 "application/iso-mends+xml", "application/iso19115+xml", "application/dif+xml"}
+   :granule #{"application/echo10+xml", "application/iso+xml", "application/iso-smap+xml",
               "application/iso19115+xml"}})


elmish-subapps: remove dead vm code

elmish-subapps: remove dead vm code

--- examples/elmish-subapps/src/app/core.cljs
+++ examples/elmish-subapps/src/app/core.cljs
@@ -43,9 +43,7 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defn view-model
   [model]
-  (-> model
-      (mvsa/track-keys [:friend-list-visible? :counter-visible?])
-      (assoc :app-model-log (reaction (pr-str @model)))))
+  (mvsa/track-keys model [:friend-list-visible? :counter-visible?]))

 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defn view


remove primitive prefixes

remove primitive prefixes

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@10102 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- plugins/SlideExplorer2/src/slide_explorer/canvas.clj
+++ plugins/SlideExplorer2/src/slide_explorer/canvas.clj
@@ -143,30 +143,30 @@

 (defmulti draw-primitive (fn [g2d shape params] shape))

-(defmethod draw-primitive :primitive-arc
+(defmethod draw-primitive :arc
   [g2d shape {:keys [l t w h filled start-angle arc-angle]}]
   (if filled
     (.fillArc g2d l t w h start-angle arc-angle)
     (.drawArc g2d l t w h start-angle arc-angle)))

-(defmethod draw-primitive :primitive-ellipse
+(defmethod draw-primitive :ellipse
   [g2d shape {:keys [l t w h filled]}]
   (if filled
     (.fillOval g2d l t w h)
     (.drawOval g2d l t w h)))

-(defmethod draw-primitive :primitive-image
+(defmethod draw-primitive :image
   [g2d shape {:keys [image l t w h]}]
   (.drawImage g2d image
               l t
               (or w (.getWidth image))
               (or h (.getHeight image)) nil))

-(defmethod draw-primitive :primitive-line
+(defmethod draw-primitive :line
   [g2d shape {:keys [l t r b filled]}]
   (.drawLine g2d l t r b))

-(defmethod draw-primitive :primitive-polygon
+(defmethod draw-primitive :polygon
   [g2d shape {:keys [vertices filled closed]}]
   (let [xs (int-array (map :x vertices))
         ys (int-array (map :y vertices))
@@ -177,13 +177,13 @@
         (.drawPolygon g2d xs ys n)))
         (.drawPolyline g2d xs ys n)))

-(defmethod draw-primitive :primitive-rect
+(defmethod draw-primitive :rect
   [g2d shape {:keys [l t w h filled]}]
   (if filled
     (.fillRect g2d l t w h)
     (.drawRect g2d l t w h)))

-(defmethod draw-primitive :primitive-round-rect
+(defmethod draw-primitive :round-rect
   [g2d shape {:keys [l t w h filled arc-radius arc-width arc-height]}]
   (if filled
     (.fillRoundRect g2d l t w h
@@ -209,7 +209,7 @@
                  (float (- x (/ width 2)))
                  (float (+ y (/ height 2))))))

-(defmethod draw-primitive :primitive-text
+(defmethod draw-primitive :text
   [g2d shape  {:keys [text x y font]}]
   (let [{:keys [name bold italic underline strikethrough size]} font
         style (bit-or (if bold Font/BOLD 0) (if italic Font/ITALIC 0))
@@ -270,22 +270,22 @@
 (reset!
   grafix
   [
-   [:primitive-round-rect
+   [:round-rect
     {:l 20 :t 10 :w 300 :h 300
      :arc-radius 100
      :filled true :color :pink
      :rotate 50}]
-   [:primitive-round-rect
+   [:round-rect
     {:l 20 :t 10 :w 300 :h 300
      :arc-radius 100 :rotate 50
      :filled false :color 0xE06060
      :stroke {:width 5
               :cap :round
               :dashes [10 10] :dash-phase 0}}]
-   [:primitive-ellipse
+   [:ellipse
     {:l 25 :t 15 :w 110 :h 90
      :filled true :color :yellow :alpha 0.5}]
-   [:primitive-polygon
+   [:polygon
     {:vertices [{:x 100 :y 100}
                 {:x 50 :y 150}
                 {:x 50 :y 220}
@@ -299,7 +299,7 @@
               :cap :butt
               :join :bevel
               :miter-limit 10.0}}]
-   [:primitive-text
+   [:text
     {:x 180 :y 120 :text "Testing..."
      :color :blue
      :alpha 0.4
@@ -311,18 +311,19 @@
             :underline false
             :strikethrough false
             :size 60}}]
-   [:primitive-line
+   [:line
     {:x 180 :y 220 :w 0 :h 50 :color :red
      :stroke {:width 10 :cap :round}
      :alpha 0.7}]
-   [:primitive-line
+   [:line
     {:x 180 :y 220 :w 30 :h 0 :color 0x00AA00
      :alpha 0.6
      :stroke {:width 4}}]
-   [:primitive-arc
+   [:arc
     {:l 30 :t 20 :w 150 :h 100
-     :start-angle 30 :arc-angle 100 :color :green
-     :filled true
+     :start-angle 30 :arc-angle 100 :color 0x004000
+     :filled false
+     :stroke {:width 10}
      :alpha 0.7}]
    ])


use id update-es uses it

use id update-es uses it

--- src/ctia/http/handler.clj
+++ src/ctia/http/handler.clj
@@ -132,7 +132,7 @@
         :login login
         (ok (flows/update-flow #(read-actor @actor-store %)
                                realize-actor
-                               #(update-actor @actor-store "" login %)
+                               #(update-actor @actor-store (:id %) login %)
                                :actor
                                id
                                login


missing vcproj files

missing vcproj files

git-svn-id: 03a8048b5ee8463be5048a3801110fb50f378627@8443 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd

--- buildscripts/buildcheck/src/buildcheck/core.clj
+++ buildscripts/buildcheck/src/buildcheck/core.clj
@@ -74,11 +74,28 @@
         pattern (re-pattern (str "MMSetup" bits "BIT_[^\\s]+?_" date-token ".exe"))]
     (re-find pattern txt)))

+(defn missing-vcproj []
+  (let [device-adapter-parent-dirs [(File. micromanager "/DeviceAdapters")
+                                    (File. micromanager "/SecretDeviceAdapters")]
+        device-adapter-dirs (filter #(and (.isDirectory %)
+                                          (not (.. % getName (startsWith "."))))
+                                    (mapcat #(.listFiles %) device-adapter-parent-dirs))
+        directories-without-vcproj
+        (filter identity
+                (for [device-adapter-dir device-adapter-dirs]
+                  (when (empty? (filter #(.. % getName (endsWith ".vcproj"))
+                                        (file-seq device-adapter-dir)))
+                    device-adapter-dir)))]
+        (sort
+          (clojure.set/difference
+            (set (map #(.getName %) directories-without-vcproj))
+            #{"dc1394" "Video4Linux"}))))
+
 (defn device-vcproj-files []
-  (let [device-adapter-dirs [(File. micromanager "/DeviceAdapters")
-                         (File. micromanager "/SecretDeviceAdapters")]]
+  (let [device-adapter-parent-dirs [(File. micromanager "/DeviceAdapters")
+                                    (File. micromanager "/SecretDeviceAdapters")]]
     (filter #(.. % getName (endsWith ".vcproj"))
-            (mapcat file-seq device-adapter-dirs))))
+            (mapcat file-seq device-adapter-parent-dirs))))

 (defn dll-name [file]
   (second (re-find #"mmgr_dal_(.*?).dll" (.getName file))))
@@ -123,7 +140,7 @@
          (str-lines (flatten (list data)))
          "None.")))

-(defn report-build-errors [bits mode]
+(defn report-build-errors [bits mode test]
   (let [f (result-file bits mode)
         result-txt (slurp f)
         vs-error-text (visual-studio-error-text result-txt)
@@ -132,7 +149,7 @@
         outdated-jars (map #(.getName %)
                            (old-jars (File. micromanager "Install_AllPlatforms") 24))
         installer-ok (exe-on-server? bits today-token)]
-    (when-not (and (empty? vs-error-text) (empty? outdated-dlls)
+    (when-not (and (empty? vs-error-text) (empty? outdated-dlls) (not test)
                    (empty? javac-errs) (empty? outdated-jars)
                    installer-ok)
       (str
@@ -148,14 +165,16 @@
         "\n\nIs installer download available on website?\n"
         (if installer-ok "Yes" "No. (build missing)\n")
         (when (= 32 bits)
-          (report-segment "Missing device pages" (missing-device-pages)))
+          (str
+            (report-segment "Missing device pages" (missing-device-pages))
+            (report-segment "Missing .vcproj files" (missing-vcproj))))
       ))))

 (defn make-full-report [mode send?]
   (let [report
         (str
-          (report-build-errors 32 mode)
-          (report-build-errors 64 mode))]
+          (report-build-errors 32 mode false)
+          (report-build-errors 64 mode false))]
     (if-not (empty? report)
       (do
         (when send?
@@ -165,6 +184,9 @@
         (println report))
       (println "Nothing to report."))))

+(defn test-report []
+  (println (report-build-errors 32 :full true)))
+
 (defn -main [mode]
   (make-full-report (get {"inc" :inc "full" :full} mode) true))


removing unnecessary -init call

removing unnecessary -init call

--- src/desdemona/ui/core.cljs
+++ src/desdemona/ui/core.cljs
@@ -24,4 +24,3 @@
       (secretary/locate-route path))})
   (accountant/dispatch-current!)
   (mount-root))
-(init!)


refer describe in refs-test example

refer describe in refs-test example

--- src/examples/refs_test.clj
+++ src/examples/refs_test.clj
@@ -1,5 +1,6 @@
-(ns com.stuartsierra.lazytest.refs-test
-  (:use [com.stuartsierra.lazytest :only (spec is given defcontext)]))
+(ns refs-test
+  (:use [com.stuartsierra.lazytest
+         :only (spec describe given defcontext)]))

 (defcontext two-refs []
   [(ref 1) (ref 1)])
@@ -14,10 +15,13 @@
   (doseq [t threads]
     (.stop t)))

-(spec ref-stress-test
-      (given [rs two-refs
-              tt buncha-threads]
-        (let [[ra rb] rs]
-          (every? true? (for [i (range 1000000)]
-                          (let [[a b] (dosync [@ra @rb])]
-                            (= a b)))))))
+(describe *ns*
+ (spec ref-stress-test
+   "Two refs, updated and read in transactions"
+   (given [rs two-refs
+           tt buncha-threads]
+     "should always have consistent values."
+     (let [[ra rb] rs]
+       (every? true? (for [i (range 1000000)]
+                       (let [[a b] (dosync [@ra @rb])]
+                         (= a b))))))))


good so far

good so far

--- src/epicea/typed/core.clj
+++ src/epicea/typed/core.clj
@@ -134,12 +134,49 @@

 (spec/def ::arg-list (spec/* ::arg-decl))

-(spec/def ::statement (constantly true))
+(spec/def ::sexpr (spec/cat
+                   :op ::expr
+                   :args (spec/* ::expr)))
+
+(spec/def ::expr (spec/or :number number?
+                          :keyword keyword?
+                          :symbol symbol?
+                          :sexprs ::sexpr
+                          :string string?))
+(spec/def ::exprs (spec/* ::expr))

 (spec/def ::typed-fun (spec/cat
                        :return-type ::type
                        :arg-list (spec/spec ::arg-list)
-                       :body (spec/* ::statement)))
+                       :body ::exprs))
 (assert (not=
          ::spec/invalid
          (spec/conform ::typed-fun [nil [:double 'a :double 'b] :a :b :c])))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Compilable
+
+(defn compile-expr [argmap expr cb]
+  (cb argmap [:compiled expr]))
+
+(def empty-argmap {})
+
+(defn compile-exprs [argmap exprs cb]
+  (cond
+    (empty? exprs) nil
+    (empty? (rest exprs)) (compile-expr argmap (first exprs) cb)
+    :default (compile-expr
+              argmap (first exprs)
+              (fn [new-argmap _]
+                (compile-exprs new-argmap (rest exprs) cb)))))
+
+(defmacro with-typed [& args]
+  (let [parsed (spec/conform ::exprs args)]
+    (if (= ::spec/invalid parsed)
+      (throw (RuntimeException.
+              (str "Failed to parsed typed: "
+                   (spec/explain-str ::exprs args))))
+      (compile-exprs empty-argmap parsed (fn [final-argmap final-value]
+                                           [:final final-value])))))
+
+
+(macroexpand '(with-typed 9 (+ 4 5)))


Allow gravatar-img to set whatever default URL

--- src/foreclojure/users.clj
+++ src/foreclojure/users.clj
@@ -72,14 +72,16 @@

 (let [canonical-email (comp string/trim string/lower-case)
       md5 #(DigestUtils/md5Hex %)
-      no-gravatar-url (static-url "images/no-gravatar.png")
-      encoded (URLEncoder/encode no-gravatar-url)]
-  (defn gravatar-img [{:keys [email size class] :or {size 24}}]
+      as-url #(URLEncoder/encode (static-url %))
+      no-gravatar-url (as-url "images/no-gravatar.png")]
+  (defn gravatar-img [{:keys [email size class default] :or {size 24}}]
     (let [hash (if email
                  (md5 (canonical-email email))
                  "0000000000000000")
           url (str (name *http-scheme*) "://www.gravatar.com/avatar/"
-                   hash "?s=" size "&d=" encoded)]
+                   hash "?s=" size "&d=" (if default
+                                           (as-url default)
+                                           no-gravatar-url))]
       [:img (conj {:src url, :alt "gravatar icon"
                    :width size :height size}
                   (when class {:class class}))])))


Moderate cleanup/refactoring

Moderate cleanup/refactoring

--- src/foreclojure/utils.clj
+++ src/foreclojure/utils.clj
@@ -4,15 +4,16 @@
   (:require [sandbar.stateful-session :as session]
             (ring.util [response :as response])))

-(defmacro dbg[x] `(let [x# ~x] (println '~x "=" x#) x#))
+(defmacro dbg [x]
+  `(let [x# ~x] (println '~x "=" x#) x#))

-(defn flash-error [msg url]
-  (do (session/flash-put! :error msg)
-      (response/redirect url)))
+(defn flash-fn [type]
+  (fn [msg url]
+    (session/flash-put! type msg)
+    (response/redirect url)))

-(defn flash-msg [msg url]
-  (do (session/flash-put! :message msg)
-      (response/redirect url)))
+(def flash-error (flash-fn :error))
+(def flash-msg (flash-fn :message))

 (defmacro def-page [page-name [& args] & code]
   `(defn ~page-name [~@args]
@@ -53,4 +54,4 @@
        [:img {:src "/PoweredMongoDBbeige50.png"}]]]
      [:div {:id "content"} body]
      [:footer
-      [:span {:id "footer"} "© 2011 David Byrne" ]]]]))+      [:span {:id "footer"} "© 2011 David Byrne" ]]]]))


* playing around with the aparapi-matrix examples, seeing if they run and whatnot

* apparently i can write my own java functions, then toss them around in clojure.

* a java class interfacing with Aparapi is probably the best place to implement the hamming distance algorithm

* can't wait to crush these bits, though obviously this idea isn't original

--- src/gpu_genomics/core.clj
+++ src/gpu_genomics/core.clj
@@ -1,6 +1,57 @@
-(ns gpu-genomics.core)
+(ns gpu-genomics.core
+  (:refer-clojure :exclude [* - + == /])
+  (:require [aparapi-matrix.core :as ac]
+            [clojure.core.matrix.protocols :as mp]
+            [clojure.core.matrix.implementations :as mi]
+            [clojure.core.matrix.compliance-tester :as mc])
+  (:use [clojure.core.matrix]
+        [clojure.core.matrix.operators]))

-(defn foo
-  "I don't do a whole lot."
-  [x]
-  (println x "Hello, World!"))
+;; trying out the aparapi-matrix example
+;; https://github.com/bobuhiro11/aparapi-matrix/blob/master/src/clojure/aparapi_matrix/example.clj
+(defn example-run
+  []
+  (mp/is-scalar? (ac/get-instance))
+
+  (ac/get-substance (ac/get-instance))
+  (ac/get-substance (mp/new-vector (ac/get-instance) 1))
+  (mi/get-canonical-object (ac/get-instance))
+  (mp/dimension-count (ac/get-instance) 0)
+  (mp/dimension-count (ac/get-instance) 1)
+  (mp/dimensionality (ac/get-instance))
+
+  (mp/get-1d (ac/get-instance) 0)
+  (mp/get-2d (ac/get-instance) 0 1)
+  (mp/get-nd (ac/get-instance) [0 1])
+  (mp/set-2d (ac/get-instance) 0 1 100)
+  (mp/transpose (ac/get-instance))
+  (mp/convert-to-nested-vectors (ac/get-instance))
+  (class (mp/convert-to-nested-vectors (ac/get-instance)))
+  (.toString (ac/get-instance))
+  (str (ac/get-instance))
+  (let [a (mp/construct-matrix (ac/get-instance) [[4 3] [3 2]])
+        b (inverse a)]                                      ; [[-2 3] [3 -4]]
+    (mmul a b))
+  (vec (ac/get-substance (mp/element-multiply (ac/get-instance) (ac/get-instance))))
+
+  (set-current-implementation :aparapi-matrix)
+  (prn (shape (array [[1 2] [3 4] [5 6]])))                        ; [3 2]
+  (dimension-count (array [[1 2] [3 4] [5 6]]) 0)           ; 3
+  (dimension-count (array [[1 2] [3 4] [5 6]]) 1)           ; 2
+  (new-matrix 3 2)                                          ; [[0 0] [0 0] [0 0]]
+  (class (mp/convert-to-nested-vectors (new-matrix 3 2)))
+  (set-selection (array [[1 2] [3 4] [5 6]]) :all :all 10)
+  (* (new-matrix 1000 100) (new-matrix 100 1000))
+  (str ac/last-execution-mode " " ac/last-execution-time)
+
+  (prn (shape (* (new-matrix 1000 100) (new-matrix 100 1000))))
+  )
+
+;;hmmm REPL no werky =( =((((((((((((
+;; the code seems to be compiled into some intermediate step
+;; so commands in REPL don't work.  this is sad, but GPU is still crunchin
+(ac/set-execution-mode :CPU)
+(example-run)
+
+(ac/set-execution-mode :GPU)
+(example-run)


split body of platform block - dry code up - prep for yaml selector (#2102)

--- src-cljs/frontend/components/setup_project.cljs
+++ src-cljs/frontend/components/setup_project.cljs
@@ -17,7 +17,7 @@
     (render [_]
       (html
         [:.projects-dropdown
-         [:h4 "Repository"]
+         [:h2 "Repository"]
          (if (nil? projects)
            [:.spinner-placeholder (spinner)]
            (dropdown/dropdown
@@ -31,6 +31,24 @@
                             (map (fn [repo]
                                    (let [repo-id (repo-model/id repo)]
                                      [repo-id (vcs-url/project-name (:vcs_url repo))]))))}))]))))
+
+(defn- one-platform [{:keys [selected-project]} owner]
+  (reify
+    om/IRender
+    (render [_]
+      (html
+        (let [org-login (:username selected-project)
+              repo-name (:name selected-project)
+              vcs-type (:vcs_type selected-project)]
+          [:div.one-platform
+           [:p "Know what you are doing? " [:a {:href "#"} "Read Documentation"]]])))))
+
+(defn- two-platform [{:keys [selected-project]} owner]
+  (reify
+    om/IRender
+    (render [_]
+      (html
+        [:div "Language: " (:language selected-project)]))))

 (def ^:private platform-osx-default {:os :osx :platform "1.0"})
 (def ^:private platform-linux-default {:os :linux :platform "1.0"})
@@ -107,7 +125,9 @@
                   "2.0 "
                   [:span.new-badge]])]
               [:p "CircleCI 2.0 offers teams more power, flexibility, and control with configurable Jobs that are broken into Steps. Compose these steps within a job at your discretion. Also supports most public Docker images and custom images with your own dependencies."]]]]
-           [:div "Repo Language: " (:language selected-project)]])))))
+           (if (= platform "1.0")
+             (om/build one-platform {:selected-project selected-project})
+             (om/build two-platform {:selected-project selected-project}))])))))

 ; https://stackoverflow.com/a/30810322
 (defn- copy-to-clipboard [config-string]
@@ -136,7 +156,6 @@
               [:div
                [:h1 "Setup Project"]
                [:p "CircleCI helps you ship better code, faster. Let's add some projects on CircleCI. To kick things off, you'll need to choose a project to build. We'll start a new build for you each time someone pushes a new commit."]
-               [:p "Know what you are doing? " [:a {:href "#"} "Read Documentation"]]
                (om/build projects-dropdown {:projects projects
                                             :selected-project selected-project})]))
           (when selected-project


replaced multiple calls to remove-matches per stacktrace, with one call to remove-matches per stacktrace.

--- src/midje/util/exceptions.clj
+++ src/midje/util/exceptions.clj
@@ -19,18 +19,14 @@
 (defn stacktrace-as-strings [ex]
   (map #(.toString %) (.getStackTrace ex)))

-(defn remove-matches [re strings] (remove #(re-find re %) strings))
+(defn remove-matches [re strings]
+  (remove #(re-find re %) strings))

 (defn without-clojure-strings [all-strings]
-  (->> all-strings
-       (remove-matches #"^java\.")
-       (remove-matches #"^clojure\.")
-       (remove-matches #"^sun\.")
-       (remove-matches #"^swank\.")
-       (remove-matches #"^user\$eval")))
+  (remove-matches #"^java\.|^clojure\.|^sun\.|^swank\.|^user\$eval" all-strings))

 (defn without-midje-or-clojure-strings [all-strings]
-  (remove-matches #"^midje" (without-clojure-strings all-strings)))
+  (remove-matches #"^java\.|^clojure\.|^sun\.|^swank\.|^user\$eval|^midje" all-strings))

 (defn user-error-exception-lines [ex]
   (cons (.toString ex)
@@ -38,8 +34,8 @@

 (defn friendly-exception-lines [ex prefix]
   (cons (.toString ex)
-	(map #(str prefix %)
-	     (without-midje-or-clojure-strings (stacktrace-as-strings ex)))))
+    (map #(str prefix %)
+      (without-midje-or-clojure-strings (stacktrace-as-strings ex)))))

 (defn friendly-exception-text [ex prefix]
   (join line-separator (friendly-exception-lines ex prefix)))


Fix misaligned parens :flushed:

Fix misaligned parens :flushed:

--- src/metabase/api/dataset.clj
+++ src/metabase/api/dataset.clj
@@ -42,8 +42,8 @@
   (read-check Database database)
   ;; try calculating the average for the query as it was given to us, otherwise with the default constraints if there's no data there.
   ;; if we still can't find relevant info, just default to 0
-  {:average (or (query/average-execution-time-ms (qputil/query-hash) query)
-                (query/average-execution-time-ms (qputil/query-hash) (assoc query :constraints default-query-constraints))
+  {:average (or (query/average-execution-time-ms (qputil/query-hash query))
+                (query/average-execution-time-ms (qputil/query-hash (assoc query :constraints default-query-constraints)))
                 0)})

 (defn as-csv


Derive karma reporter from default reporter

Fixes https://github.com/honzabrecka/karma-reporter/issues/11

Previously, if another package added a report type to the default
reporter, karma-reporter would not display it by default. Now,
the behavior is the opposite - any new report types will be
run by default, and the user can implement the multimethod if they
wish to hide the report.

--- src/jx/reporter/karma.cljs
+++ src/jx/reporter/karma.cljs
@@ -77,6 +77,15 @@

 (defmethod cljs.test/report :karma [_])

+;; By default, all report types for :cljs.test reporter are printed
+(derive ::karma :cljs.test/default)
+
+;; Do not print "Ran <t> tests containing <a> assertions."
+(defmethod cljs.test/report [::karma :summary] [_])
+
+;; Do not print "Testing <ns>"
+(defmethod cljs.test/report [::karma :begin-test-ns] [m])
+
 (defmethod cljs.test/report [::karma :begin-test-var] [_]
   (vreset! test-var-time-start (now))
   (vreset! test-var-result []))


implemented label resolve

implemented label resolve

--- src/kondolisp/compiler.clj
+++ src/kondolisp/compiler.clj
@@ -2,7 +2,7 @@

 (ns kondolisp.compiler
   (:use [clojure core]
-        [clojure.contrib str-utils pprint]
+        [clojure.contrib str-utils pprint seq-utils]
 	[clj-match])
   (:require [clojure.walk]
 	    [clojure.contrib str-utils2])
@@ -316,4 +316,21 @@
    (throw (Exception. (str "Compile error: " exp)))
    ))

-
+(defn compile-compact [program]
+  program)
+
+(defn compile-resolve-labels [program]
+  (let [[_ labels]
+        (reduce (fn [[idx labels] inst]
+                  (if (symbol? inst)
+                    [idx (assoc labels inst idx)]
+                    [(+ 1 idx) labels]))
+                [0 {}] program)]
+    (map (fn [inst]
+           (if (empty? (rest inst))
+             inst
+             (let [[inst-name inst-operand] inst]
+               (if (symbol? inst-operand)
+                 `(~inst-name ~(inst-operand labels))
+                 inst))))
+         (filter #(not (symbol? %)) program))))


Sync folders on *nix, close FileOutputStream for Windows.

--- src/konserve/filestore.clj
+++ src/konserve/filestore.clj
@@ -16,10 +16,16 @@
   (:import [java.io
             DataInputStream DataOutputStream
             FileInputStream FileOutputStream]
-           [java.nio.file Files StandardCopyOption]))
+           [java.nio.channels FileChannel]
+           [java.nio.file Files StandardCopyOption FileSystems Path OpenOption]))

 ;; A useful overview over fsync on Linux:
 ;; https://www.usenix.org/conference/osdi14/technical-sessions/presentation/pillai
+
+
+(defn- sync-folder [folder]
+  (let [p (.getPath (FileSystems/getDefault) folder (into-array String []))]
+    (.force (FileChannel/open p (into-array OpenOption [])) true)))

 (defn delete-store
@@ -28,7 +34,11 @@
   (let [f (io/file folder)]
     (doseq [c (.list f)]
       (.delete (io/file (str folder "/" c))))
-    (.delete f)))
+    (.delete f)
+    (try
+      (sync-folder folder)
+      (catch Exception e
+        nil))))

 (defn list-keys
@@ -119,11 +129,11 @@
               (.flush dos)
               (when (:fsync config)
                 (.sync fd))
+              (.close fos)
               (Files/move (.toPath new-file) (.toPath f)
                           (into-array [StandardCopyOption/ATOMIC_MOVE]))
               (when (:fsync config)
-                (.sync fd)
-                #_(.sync (.getFD (FileInputStream. (io/file folder)))))
+                (sync-folder folder))
               [(get-in old rkey)
                (get-in new rkey)]
               (catch Exception e
@@ -182,22 +192,19 @@
             (.flush dos)
             (when (:fsync config)
               (.sync fd))
-            #_(.renameTo new-file f)
+            (.close fos) ;; required for windows
             (Files/move (.toPath new-file) (.toPath f)
                         (into-array [StandardCopyOption/ATOMIC_MOVE]))
             (when (:fsync config)
-              (.sync fd)
-              #_(.sync (.getFD (FileInputStream. (io/file folder)))))
+              (sync-folder folder))
             (catch Exception e
               (.delete new-file)
-              (.sync fd)
               (ex-info "Could not write key."
                        {:type :write-error
                         :key key
                         :exception e}))
             (finally
               (.close fos))))))))
-

 (defn new-fs-store