DB-reader palauttaa ei-laiskoja listoja

DB-reader palauttaa ei-laiskoja listoja

--- mtg-pairings-wer/src/mtg_pairings/db_reader.clj
+++ mtg-pairings-wer/src/mtg_pairings/db_reader.clj
@@ -1,89 +1,112 @@
 (ns mtg-pairings.db-reader
-  (:require [clojess.core :as db]))
+  (:require [clojess.core :as db]
+            [mtg-pairings.util :as util]))

 (defn open [filename]
   (db/open-db filename))

 (defn tournaments
-  "Returns a list of tournaments in the database"
-  [db]
-  (->> (db/table db "Tournament")
-    db/rows
-    (map #(select-keys % [:TournamentId :Title :StartDate]))))
+  "Returns a list of tournaments in the database matching the given criteria"
+  [db criteria]
+  (doall (as-> (db/table db "Tournament") <>
+           (db/rows <> criteria)
+           (map #(select-keys % [:TournamentId :Title :StartDate :NumberOfRounds]) <>))))

 (def bye
   {:id 0
    :name "***BYE***"
    :dci-numbers []})

-(defn dcinumbers-for-players
+(defn data-for-players
   "Returns a list of DCI numbers for a list of players"
   [db players]
   (let [person-table (db/table db "Person")]
-    (for [player players
-          :let [person (db/row person-table (:PersonId player))]]
-      (:PrimaryDciNumber person))))
+    (doall (for [player players
+                 :let [person (db/row person-table (:PersonId player))]]
+             {:dci (:PrimaryDciNumber person)
+              :name (str (:LastName person) ", " (:FirstName person)
+                         (when (seq (:MiddleInitial person))
+                           (str " " (:MiddleInitial person))))}))))
+
+(defn teams
+  [db tournament-id]
+  (let [team-table (db/table db "Team")
+        teamplayer-table (db/table db "TeamPlayers")]
+    (doall (for [team (db/rows team-table {:TournamentId tournament-id})
+                 :let [teamplayers (db/rows teamplayer-table {:TeamId (:TeamId team)})]]
+             {:id (:TeamId team)
+              :name (:Name team)
+              :players (data-for-players db teamplayers)}))))

-(defn teams
-  "Returns a list of teams in the tournament with the given id number."
+(defn id->team
+  "Returns a map of team-id -> team in the tournament with the given id number."
   [db tournament-id]
-  (let [team-table (db/table db "Team")
-        teamplayer-table (db/table db "TeamPlayers")]
-    (into {} (for [team (db/rows team-table {:TournamentId tournament-id})
-                   :let [teamplayers (db/rows teamplayer-table {:TeamId (:TeamId team)})]]
-               {(:TeamId team) {:id (:TeamId team)
-                                :name (:Name team)
-                                :dci-numbers (dcinumbers-for-players db teamplayers)}}))))
-
-(defn teams-from-ids
-  [team-ids all-teams]
-  (if (= 2 (count team-ids))
-    (let [pair (map all-teams team-ids)]
-      [pair (reverse pair)])
-    [[(all-teams (first team-ids)) bye]]))
+  (into {} (for [team (teams db tournament-id)]
+             [(:id team) team])))

 (defn results-for-round
+  [db round-id]
+  (let [match-table (db/table db "Match")
+        result-table (db/table db "TeamMatchResult")
+        matches (db/rows match-table {:RoundId round-id})]
+   (doall (for [match matches
+                :let [[first-row second-row] (db/rows result-table {:MatchId (:MatchId match)})]]
+            (merge {:table_number (:TableNumber match)}
+                   (if (or (nil? second-row) (> (:TeamId first-row) (:TeamId second-row)))
+                     {:team1_wins (:GameWins first-row)
+                      :team2_wins (:GameLosses first-row)
+                      :draws (:GameDraws first-row)}
+                     {:team1_wins (:GameWins second-row)
+                      :team2_wins (:GameLosses second-row)
+                      :draws (:GameDraws second-row)}))))))
+
+(defn pairings-for-round
+  "Returns a list of pairings for the round so that team1 is the one with the higher id"
   [db round-id all-teams]
   (let [match-table (db/table db "Match")
         result-table (db/table db "TeamMatchResult")
-        matches (db/rows match-table {:RoundId round-id})]
-   (for [match matches
-         :let [[first-row second-row] (db/rows result-table {:MatchId (:MatchId match)})]]
-     (if (>= (:GameWins first-row) (:GameWins second-row))
-       {:GameWins (:GameWins first-row)
-        :GameLosses (:GameLosses first-row)
-        :GameDraws (:GameDraws first-row)
-        :WinnerTeamId (:TeamId first-row)
-        :LoserTeamId (:TeamId second-row)}
-       {:GameWins (:GameWins second-row)
-        :GameLosses (:GameLosses second-row)
-        :GameDraws (:GameDraws second-row)
-        :WinnerTeamId (:TeamId second-row)
-        :LoserTeamId (:TeamId first-row)}))))
-
-(defn pairings-for-round
-  [db round-id all-teams]
-  (let [match-table (db/table db "Match")
-        result-table (db/table db "TeamMatchResult")
-        matches (db/rows match-table {:RoundId round-id})
-        results (for [match matches]
-                  (map :TeamId (db/rows result-table {:MatchId (:MatchId match)})))]
-    (mapcat #(teams-from-ids % all-teams) results)))
+        matches (db/rows match-table {:RoundId round-id})]
+    (doall (for [match matches
+                 :let [match-teams (map :TeamId (db/rows result-table {:MatchId (:MatchId match)}))
+                       teams (reverse (sort match-teams))
+                       team1 (first teams)
+                       team2 (second teams)]]
+             {:team1 (:name (all-teams team1))
+              :team2 (:name (all-teams team2))
+              :table_number (:TableNumber match)}))))

 (defn rounds
   [db tournament-id]
-  (-> (db/table db "Round")
-    (db/rows {:TournamentId tournament-id})
-    (select-keys [:RoundId :Number])))
+  (doall (as-> (db/table db "Round") <>
+           (db/rows <> {:TournamentId tournament-id})
+           (map #(select-keys % [:RoundId :Number]) <>))))
+
+(defn results
+  [db tournament-id]
+  (let [round-table (db/table db "Round")
+        rounds (sort-by :Number (db/rows round-table {:TournamentId tournament-id}))]
+    (doall (for [round rounds
+                 :let [results (results-for-round db (:RoundId round))]
+                 :when (seq results)]
+             results))))

 (defn pairings
   [db tournament-id]
   (let [round-table (db/table db "Round")
-        rounds (db/rows round-table {:TournamentId tournament-id})
-        teams (teams db tournament-id)]
-    (for [round rounds]
-      (pairings-for-round db (:RoundId round) teams))))
-
-(defn print-pairings [pairings]
-  (doseq [pairing pairings]
-    (println (:name (first pairing)) "-" (:name (second pairing)))))
+        rounds (sort-by :Number (db/rows round-table {:TournamentId tournament-id}))
+        teams (id->team db tournament-id)]
+    (doall (for [round rounds
+                 :let [pairings (pairings-for-round db (:RoundId round) teams)]
+                 :when (seq pairings)]
+             pairings))))
+
+(defn seatings
+  [db tournament-id]
+  (let [tournamenttable-table (db/table db "TournamentTable")
+        seat-table (db/table db "Seat")
+        teams (id->team db tournament-id)
+        tables (db/rows tournamenttable-table {:TournamentId tournament-id})]
+    (doall (for [table tables
+                 seat (db/rows seat-table {:TournamentTableId (:TournamentTableId table)})]
+             {:table_number (:TableNumber table)
+              :team (-> seat :TeamId teams :name)}))))


Fix bug in 0645d8b

Fix bug in 0645d8b

--- src/cljs/kixi/hecuba/tabs/hierarchy/tapestry.cljs
+++ src/cljs/kixi/hecuba/tabs/hierarchy/tapestry.cljs
@@ -147,9 +147,10 @@
                                                   :label-dist -35
                                                   :label {:text-anchor "start"}
                                                   :format #(condp = %
-                                                              0 lcb
-                                                              gradations ucb
-                                                              (/ gradations 2) midcb)})
+                                                             0 lcb
+                                                             gradations ucb
+                                                             (/ gradations 2) midcb
+                                                             nil)})
                                         :data     [(merge (heatmap-spec
                                                            :yellow-magenta-cyan
                                                            (vec (for [x (map #(/ % gradations)(range 0 gradations))]
@@ -168,15 +169,15 @@
      ((comp (partial take c) (partial drop (* c i))) data)) (range r)))

 (defn- data-loop [cursor input-chan]
-  (go (loop [{:keys [data dates lcb ucb grads]} (<! input-chan)]
-        (set-new-heatmap-data!
-         (:heatmap cursor)
-         data
-         lcb
-         ucb
-         grads
-         dates)
-        (recur (<! input-chan)))))
+  (go-loop [{:keys [data dates lcb ucb grads]} (<! input-chan)]
+      (set-new-heatmap-data!
+       (:heatmap cursor)
+       data
+       lcb
+       ucb
+       grads
+       dates)
+      (recur (<! input-chan))))

 (defn chart
   [{:keys [width height data-chan fill-out-of-range-cells? x-label y-label]


Fix metrics name typo

Fix metrics name typo

--- scheduler/src/cook/mesos/scheduler.clj
+++ scheduler/src/cook/mesos/scheduler.clj
@@ -237,7 +237,7 @@
           (log/error e "Mesos scheduler status update error"))))))

 (timers/deftimer [cook-mesos scheduler tx-report-queue-processing-duration])
-(meters/defmeter [cook-mesos schedulery tx-report-queue-datoms])
+(meters/defmeter [cook-mesos scheduler tx-report-queue-datoms])
 (meters/defmeter [cook-mesos scheduler tx-report-queue-update-job-state])
 (meters/defmeter [cook-mesos scheduler tx-report-queue-job-complete])
 (meters/defmeter [cook-mesos scheduler tx-report-queue-tasks-killed])
@@ -463,7 +463,7 @@
               ;TODO assign the ports to actual available ones, and configure the environment variables; look at the Fenzo API to match up with it
               ;First we need to convince mesos to actually offer ports
               ;then, we need to allocate the ports (incremental or bulk?) copy from my book.
-
+
               ;; Note that this transaction can fail if a job was scheduled
               ;; during a race. If that happens, then other jobs that should
               ;; be scheduled will not be eligible for rescheduling until


Highlight changing triangles.

Highlight changing triangles.

--- src/videotest/falling/fall_core.clj
+++ src/videotest/falling/fall_core.clj
@@ -31,10 +31,10 @@
 (def PIX-CNT1 (int (* DISPLAY-WIDTH DISPLAY-HEIGHT 4)))
 (def PIX-CNT2 (int (* DISPLAY-WIDTH DISPLAY-HEIGHT)))

-(def ALPHA-STILL 255.0)
+(def ALPHA-STILL 100.0)

 ;; 32 works
-(def NUM-COL-BINS 32.0)
+(def NUM-COL-BINS 64.0)
 (def DISPLAY-BIN-SIZE (/ DISPLAY-WIDTH NUM-COL-BINS))
 (def NUM-ROW-BINS (/ DISPLAY-HEIGHT DISPLAY-BIN-SIZE))

@@ -103,13 +103,16 @@
     false
     (let [changes (map (comp math/abs -)
                        current-color previous-color)
-          channel-change-big-enough? #(< 0 100 %)]
+          channel-change-big-enough? #(< 50 %)]
       (some channel-change-big-enough? changes))))
+
+(defn color-with-alpha [c alpha]
+  (conj (vec (take 3 c)) alpha))

 (defn mosaic-color [current-color previous-color]
   (if (color-changed? current-color previous-color)
-    [255 0 0 255]
-    current-color))
+    current-color
+    (color-with-alpha current-color ALPHA-STILL)))

 (defn draw-mosaic
   [tri-points tri-glyphs drawn-mat
@@ -147,7 +150,7 @@

 (defn draw [state]
   (let [{:keys [p-image frame-mat]} state]
-    (q/background 0)
+    (q/background 255)
     (q/push-matrix)
     (q/translate DISPLAY-WIDTH 0)
     (q/scale -1 1)


handle console output much cleaner

handle console output much cleaner

--- src-cljs/cljsbuild_ui/exec.cljs
+++ src-cljs/cljsbuild_ui/exec.cljs
@@ -16,48 +16,48 @@
 (def js-spawn (aget child-proc "spawn"))

 ;;------------------------------------------------------------------------------
-;; Paser Compiler Output
+;; Determine Compiler Output Line Type
 ;;------------------------------------------------------------------------------

 ;; NOTE: this probably belongs in it's own library or emitted as EDN from the
 ;; compiler itself
 ;; we can get by with regex and duct tape for now ;)

-(defn- start-error-line? [s]
-  (and (.test #"Compiling " s)
-       (.test #"failed\." s)))
-
-(defn- end-error-line? [s]
-  (.test #"Subprocess failed" s))
-
-(def end-error-msg (str "***END ERROR***" (uuid)))
-
-(defn- end-error-line? [s]
+(defn- red-line? [s]
+  (.test #"\[31m" s))
+
+(def ^:private stopped-signal (str "*** OUTPUT STOPPED *** " (uuid)))
+
+(defn- end-line? [s]
   (or (.test #"Subprocess failed" s)
-      (= s end-error-msg)))
+      (= s stopped-signal)))
+
+(defn- success-line? [s]
+  (and (.test #"Successfully compiled" s)
+       (.test #"seconds\." s)))
+
+(defn- warning-line? [s]
+  (.test #"^WARNING: " s))

 (defn- start-line? [s]
   (and (.test #"Compiling " s)
        (.test #"]\.\.\.$" s)))

-(defn- success-line? [s]
-  (and (.test #"Successfully compiled" s)
-       (.test #"seconds\." s)))
-
-(defn- warning-line? [s]
-  (.test #"^WARNING: " s))
-
-(defn- determine-output-type
+(defn- determine-line-type
   "Returns the type of line output from the compiler.
    nil if we do not recognize the line or don't care what it is"
   [s]
   (cond
-    (start-error-line? s) :start-error
-    (end-error-line? s) :end-error
+    (red-line? s) :error
+    (end-line? s) :end-output
     (success-line? s) :success
     (warning-line? s) :warning
     (start-line? s) :start
     :else nil))
+
+;;------------------------------------------------------------------------------
+;; Extract Info From Lines
+;;------------------------------------------------------------------------------

 (defn- extract-time-from-success-msg [s]
   (-> s
@@ -131,9 +131,6 @@
     ;; TODO: more error types go here
     :else nil))

-(defn- red-line? [s]
-  (.test #"\[31m" s))
-
 (defn- extract-error-msg [full-error-txt]
   (->> full-error-txt
     split-lines
@@ -151,52 +148,84 @@
     (map clean-warning-line)
     (into [])))

+(defn- clean-line
+  "Clean bash escape characters from a console output line."
+  [s]
+  (-> s
+    (replace #"\033" "")    ;; remove escape characters
+    (replace #"\[\dm" "")   ;; remove color codes
+    (replace #"\[\d\dm" "")
+    trim))
+
+(defn- on-console-line
+  "Handles each line from the compiler console output.
+   It parses them using regex and puts the results onto a core.async channel."
+  [raw-line return-chan inside-error? err-msg-buffer]
+  (let [line-type (determine-line-type raw-line)
+        cleaned-line (clean-line raw-line)]
+
+    ; (js-log raw-line)
+    ; (js-log cleaned-line)
+    ; (if line-type
+    ;   (log (str "##### line type: " line-type)))
+    ; (js-log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
+
+    ;; start an error sequence
+    (when (and (not @inside-error?)
+               (= line-type :error))
+      (reset! inside-error? true)
+      (reset! err-msg-buffer []))
+
+    ;; collect error messages
+    (when (and @inside-error?
+               (= line-type :error))
+      (swap! err-msg-buffer conj cleaned-line))
+
+    ;; close the error sequence when we see a non red-line
+    (when (and @inside-error?
+               line-type
+               (not= line-type :error))
+      (reset! inside-error? false)
+      (put! return-chan [:error @err-msg-buffer]))
+
+    ;; start compiling signal
+    (when (= line-type :start)
+      (put! return-chan [:start (extract-target-from-start-msg raw-line)]))
+
+    ;; compilation success
+    (when (= line-type :success)
+      (put! return-chan [:success (extract-time-from-success-msg raw-line)]))
+
+    ;; warnings
+    (when (= line-type :warning)
+      (put! return-chan [:warning (extract-warning-msgs raw-line)]))))
+
 (defn- on-console-output
   "This function gets called with chunks of text from the compiler console output.
-   It parses them using regex and puts the results onto a core.async channel."
-  [raw-output c inside-error? err-msg-buffer err-msg-timeout]
-  (let [trimmed-output (trim raw-output)
-        output-type (determine-output-type trimmed-output)]
-
-    (js-log "raw output:")
-    (js-log trimmed-output)
-    (if output-type
-      (js-log (str "### output type: " output-type)))
-    (js-log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
-
-    ;; close the error sequence if we catch any signal
-    (when (and output-type @inside-error?)
-      (js/clearTimeout @err-msg-timeout)
-      (reset! inside-error? false)
-      (put! c [:error (extract-error-msg @err-msg-buffer)]))
-
-    ;; concatenate error message
-    (when @inside-error?
-      (swap! err-msg-buffer str raw-output "\n"))
-
-    ;; start error signal
-    (when (= output-type :start-error)
-      (reset! inside-error? true)
-      (reset! err-msg-buffer raw-output)
-
-      ;; send an "end error" signal 25ms from start of the error
-      (let [t (js/setTimeout
-                #(on-console-output end-error-msg c inside-error?
-                   err-msg-buffer err-msg-timeout)
-                25)]
-        (reset! err-msg-timeout t)))
-
-    ;; start compiling signal
-    (when (= output-type :start)
-      (put! c [:start (extract-target-from-start-msg trimmed-output)]))
-
-    ;; compilation success
-    (when (= output-type :success)
-      (put! c [:success (extract-time-from-success-msg trimmed-output)]))
-
-    ;; warnings
-    (when (= output-type :warning)
-      (put! c [:warning (extract-warning-msgs trimmed-output)]))))
+   We split it on newlines and then handle each line individually."
+  [raw-output return-chan inside-error? err-msg-buffer stopped-output-timeout]
+
+  ; (js-log "raw output:")
+  ; (js-log raw-output)
+  ; (js-log "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
+
+  ;; clear timeout whenever we receive a new chunk
+  (js/clearTimeout @stopped-output-timeout)
+
+  ;; parse every line of the output
+  (doall
+    (map
+      #(on-console-line % return-chan inside-error? err-msg-buffer)
+      (split-lines raw-output)))
+
+  ;; Set a timeout to indicate the output has stopped 50ms after the last chunk
+  ;; is received.
+  ;; NOTE: this is used to determine when the output has "stopped" so we can
+  ;; close the error sequence
+  (let [t (js/setTimeout
+            #(on-console-line stopped-signal return-chan inside-error? err-msg-buffer)
+            50)]
+    (reset! stopped-output-timeout t)))

 (defn- on-close-child [c]
   (put! c [:finished])
@@ -233,7 +262,7 @@
     (js-exec (str "kill " lein-pid))))

 ;; I fought with this for hours re: trying to kill the process from node.js
-;; this is hacky, but it seems to work everywhere I've tested
+;; this feels hacky, but it seems to work
 (defn- kill-auto-on-unix [pid]
   (let [child (js-spawn "ps"
                 (array "-o" "pid" "--no-headers" "--ppid" pid))]
@@ -254,13 +283,13 @@
         child (spawn "lein cljsbuild auto" (convert-cwd prj-key))
         inside-error? (atom false)
         err-msg-buffer (atom "")
-        err-msg-timeout (atom nil)]
+        stopped-output-timeout (atom nil)]
     (.setEncoding (.-stderr child) "utf8")
     (.setEncoding (.-stdout child) "utf8")
     (.on (.-stderr child) "data"
-      #(on-console-output % c inside-error? err-msg-buffer err-msg-timeout))
+      #(on-console-output % c inside-error? err-msg-buffer stopped-output-timeout))
     (.on (.-stdout child) "data"
-      #(on-console-output % c inside-error? err-msg-buffer err-msg-timeout))
+      #(on-console-output % c inside-error? err-msg-buffer stopped-output-timeout))
     (.on child "close" #(on-close-child c))

     ;; save the child pid
@@ -289,13 +318,13 @@
         child (spawn "lein cljsbuild once" (convert-cwd prj-key))
         inside-error? (atom false)
         err-msg-buffer (atom "")
-        err-msg-timeout nil]
+        stopped-output-timeout nil]
     (.setEncoding (.-stderr child) "utf8")
     (.setEncoding (.-stdout child) "utf8")
     (.on (.-stderr child) "data"
-      #(on-console-output % c inside-error? err-msg-buffer err-msg-timeout))
+      #(on-console-output % c inside-error? err-msg-buffer stopped-output-timeout))
     (.on (.-stdout child) "data"
-      #(on-console-output % c inside-error? err-msg-buffer err-msg-timeout))
+      #(on-console-output % c inside-error? err-msg-buffer stopped-output-timeout))
     (.on child "close" #(on-close-child c))
     ;; return the channel
     c))
@@ -326,5 +355,5 @@

 (defn- extract-target-from-start-msg [s]
   (-> s
-    (replace #"^.*Compiling \"" "")
+    (replace #"^Compiling \"" "")
     (replace #"\".+$" "")))


Indent

Indent

--- src-cljs/frontend/api/path.cljs
+++ src-cljs/frontend/api/path.cljs
@@ -1,5 +1,5 @@
 (ns frontend.api.path
-            (:require [goog.string :as gstring]))
+  (:require [goog.string :as gstring]))

 (defn settings-path [project]
   (case (:vcs_type project)


simple swiss progression test passing

simple swiss progression test passing

--- src-cljs/tourney_nerd/core.cljs
+++ src-cljs/tourney_nerd/core.cljs
@@ -251,19 +251,30 @@

 (defn- advance-swiss-round
   "Advance a single Swiss Round if possible."
-  [all-games round-to-advance]
+  [all-teams all-games round-to-advance]
   (let [next-round (inc round-to-advance)
         games-list (map (fn [[game-id game]] (assoc game :game-id game-id)) all-games)
         games-in-this-round (remove #(not= round-to-advance (:swiss-round %)) games-list)
         games-in-next-round (remove #(not= next-round (:swiss-round %)) games-list)
+        next-round-game-ids (map :game-id games-in-next-round)
         all-games-finished? (every? game-finished? games-in-this-round)]
     (cond
-      ;; TODO: advance games here
+      ;; TODO: make this less ugly
       all-games-finished?
-      all-games
+      (let [next-round-matchups (create-matchups all-teams all-games next-round)
+            new-games (atom all-games)]
+        (doall
+          (map-indexed (fn [idx [teamA-id teamB-id]]
+                         (let [game-id (nth next-round-game-ids idx)]
+                           (swap! new-games update-in [game-id] merge
+                             {:teamA-id teamA-id
+                              :teamB-id teamB-id})))
+                       next-round-matchups))
+        @new-games)

       ;; TODO: try to advance games based on simulation here

+      ;; else just return the games in their current state
       :else
       all-games)))

@@ -281,13 +292,14 @@
 (defn- advance-swiss-games
   "Given a tournament state, advances the Swiss games if possible."
   [state]
-  (let [swiss-rounds-set (games->swiss-rounds (:games state))
+  (let [all-teams (:teams state)
+        swiss-rounds-set (games->swiss-rounds (:games state))
         swiss-rounds-list (-> swiss-rounds-set vec sort)]
     ;; advance each round
     (reduce
       (fn [state round-num]
         (let [all-games (:games state)
-              updated-games (advance-swiss-round all-games round-num)]
+              updated-games (advance-swiss-round all-teams all-games round-num)]
           (assoc state :games updated-games)))
       state
       ;; the last swiss round cannot "advance"; ignore it


Debugged the save-every code in util.clj.

--- src/main/clojure/brainardlab/nben/retina/util.clj
+++ src/main/clojure/brainardlab/nben/retina/util.clj
@@ -133,22 +133,22 @@
 (defn- finish-print-every [[analfn finfn every-k iter dat]]
   (println "Simulation finished after " iter " iterations.")
   (finfn dat))
-(defn- analysis-save-every [[analfn finfn R run embed every-k iter dat] sig]
+(defn- analysis-save-every [[analfn finfn R run embed every-k iter outdir dat] sig]
   (if (and (> iter 0) (= 0 (mod iter every-k)))
-    (write-simulation (simulation-filename R iter run :embed embed) R (finfn dat)))
-  [analfn finfn R run every-k (inc iter) (analfn dat sig)])
-(defn- finish-save-every [[analfn finfn R run embed every-k iter dat]]
+    (write-simulation (str outdir "/" (simulation-filename R iter run)) R (finfn dat) :embed embed))
+  [analfn finfn R run embed every-k (inc iter) outdir (analfn dat sig)])
+(defn- finish-save-every [[analfn finfn R run embed every-k iter outdir dat]]
   (finfn dat))
 (defn- init-print-every [analfn finfn every-k start-dat]
   [analfn finfn every-k 0 start-dat])
-(defn- init-save-every [analfn finfn R run embed every-k start-dat]
-  [analfn finfn R run every-k 0 start-dat])
-(defn- make-analysis [save-every print-every Rs run embed]
+(defn- init-save-every [analfn finfn R run embed every-k outdir start-dat]
+  [analfn finfn R run embed every-k 0 outdir start-dat])
+(defn- make-analysis [save-every outdir print-every Rs run embed]
   (let [n (count Rs)
         [init1 anal1 fin1]
         (if save-every
           [(map #(init-save-every correlation-analysis correlation-analysis
-                                  %1 run embed save-every nil)
+                                  %1 run embed save-every outdir nil)
                 Rs)
            (repeat n analysis-save-every)
            (repeat n finish-save-every)]
@@ -177,12 +177,14 @@
         samples (get plan :samples [2500000])
         embed (get plan :embed true)
         save-every (get plan :save-every)]
+    (if (nil? plan) (throw (IllegalArgumentException. "Plan not found")))
     (doseq [image-count samples
             run runs]
       (if verbose
         (println (format "Simulating %d retinas with %d samples from cache %s (run = %d)..."
                          (count my-retinas) image-count hs-cache-filename run)))
       (let [[inits analfns finfns] (make-analysis save-every
+                                                  output-dir
                                                   (when verbose print-every)
                                                   my-retinas
                                                   run


move subcat-terminators to after :subcat inference from semantics

--- src/babel/italiano/lexicon.cljc
+++ src/babel/italiano/lexicon.cljc
@@ -144,18 +144,7 @@
                    :case case}
           :italiano {:cat cat
                      :case case}}))
-
-      (default ;; a verb defaults to intransitive.
-       {:synsem {:cat :verb
-                 :subcat {:1 {:top :top}
-                          :2 '()}}})
-
-      (default ;; a verb defaults to transitive if not intransitive.
-       {:synsem {:cat :verb
-                 :subcat {:1 {:top :top}
-                          :2 {:top :top}
-                          :3 '()}}})
-
+
       (default ;; a verb's first argument's case is nominative.
        {:synsem {:cat :verb
                  :subcat {:1 {:cat :noun
@@ -178,6 +167,17 @@
                    :subcat {:2 {:sem object-semantics}}
                    :sem {:obj object-semantics}}}))

+      (default ;; a verb defaults to intransitive.
+       {:synsem {:cat :verb
+                 :subcat {:1 {:top :top}
+                          :2 '()}}})
+
+      (default ;; a verb defaults to transitive if not intransitive.
+       {:synsem {:cat :verb
+                 :subcat {:1 {:top :top}
+                          :2 {:top :top}
+                          :3 '()}}})
+
       (default ;;  a preposition's first argument defaults to the semantic object of preposition.
        (let [object-semantics (atom :top)]
          {:synsem {:cat :prep


remove start-system fn

remove start-system fn

--- example/src/via/example/client/core.cljs
+++ example/src/via/example/client/core.cljs
@@ -15,8 +15,4 @@

 (enable-console-print!)

-(defn start-system
-  []
-  (component/start (app/system)))
-
-(defonce system (start-system))
+(defonce system (component/start (app/system)))


CMR-3823 Update comment

CMR-3823 Update comment

--- search-app/src/cmr/search/services/query_walkers/keywords_extractor.clj
+++ search-app/src/cmr/search/services/query_walkers/keywords_extractor.clj
@@ -12,7 +12,7 @@
     [c]
     "Extracts keywords and keyword like values from keyword conditions and conditions which apply
      to keywords scoring. Returns 2 sequences of keywords - one list from the
-     keyword condition and one from fields.")
+     keyword condition and one from fields in the format {:keywords [...] :field-keywords [...]}")
   (contains-keyword-condition?
    [c]
    "Returns true if the query contains a keyword condition?"))


generated keystore pass fix

generated keystore pass fix

--- src/celestial/ssl.clj
+++ src/celestial/ssl.clj
@@ -20,7 +20,9 @@
     java.util.Date
     sun.security.x509.CertAndKeyGen
     sun.security.x509.X500Name)
-  (:use [clojure.core.strint :only (<<)]))
+  (:use
+    [celestial.common :only (get*)]
+    [clojure.core.strint :only (<<)]))

 (def keysize 1024)
 (def cname "celesital-ops.local")
@@ -31,7 +33,7 @@
 (def country "IL")
 (def validity 1096)
 (def alias- "celetial-jetty")
-(def key-pass (.toCharArray  "foobar"))
+(def key-pass (.toCharArray  (get* :celestial :cert :password)))

 (defn generate
   "Generates a java keystore file with defined spec"


* src/clj/cljs/core.clj: if we have a protocol mask no need to call type_satisfies_

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -549,11 +549,13 @@
         [part bit] (fast-path-protocols p)
         msym (symbol (core/str "-cljs$lang$protocol_mask$partition" part "$"))]
     `(let [~xsym ~x]
-       (if (and (coercive-not= ~xsym nil)
-                (or
-                 ~(if bit `(unsafe-bit-and (. ~xsym ~msym) ~bit))
-                 ~(bool-expr `(. ~xsym ~(symbol (core/str "-" prefix))))))
-         true
+       (if (coercive-not= ~xsym nil)
+         (if (or ~(if bit `(unsafe-bit-and (. ~xsym ~msym) ~bit))
+                 ~(bool-expr `(. ~xsym ~(symbol (core/str "-" prefix)))))
+           true
+           (if (coercive-not (. ~xsym ~msym))
+             (cljs.core/type_satisfies_ ~psym ~xsym)
+             false))
          (cljs.core/type_satisfies_ ~psym ~xsym)))))

 (defmacro lazy-seq [& body]


* src/clj/cljs/core.clj: record -ilookup is now much, much faster

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -312,6 +312,7 @@
                             (drop-while seq? (next s)))
                      ret)))]
     (let [gs (gensym)
+          ksym (gensym "k")
 	  impls (concat
 		 impls
 		 ['IRecord
@@ -328,11 +329,10 @@
 		  `(~'-with-meta [this# ~gs] (new ~tagname ~@(replace {'__meta gs} fields)))
 		  'ILookup
 		  `(~'-lookup [this# k#] (-lookup this# k# nil))
-		  `(~'-lookup [this# k# else#]
-			      (get (merge (hash-map ~@(mapcat (fn [fld] [(keyword fld) fld])
-							      base-fields))
-					  ~'__extmap)
-				   k# else#))
+		  `(~'-lookup [this# ~ksym else#]
+         (cond
+           ~@(mapcat (fn [f] [`(identical? ~ksym ~(keyword f)) f]) base-fields)
+           :else (get ~'__extmap ~ksym else#)))
 		  'ICounted
 		  `(~'-count [this#] (+ ~(count base-fields) (count ~'__extmap)))
 		  'ICollection


fix for add-prop on non-viruses

fix for add-prop on non-viruses

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -470,7 +470,7 @@
   ([state side card key n {:keys [placed] :as args}]
    (let [updated-card (if (re-find #"Virus" (:subtype card))
                         (assoc card :added-virus-counter true)
-                        (card)
+                        card
                         )]
      (update! state side (update-in updated-card [key] #(+ (or % 0) n)))
      (if (= key :advance-counter)


Start of dynamic pass-through abilities.

--- src/clj/game/core.clj
+++ src/clj/game/core.clj
@@ -1301,6 +1301,15 @@
         (when-let [activatemsg (:activatemsg ab)] (system-msg state side activatemsg))
         (resolve-ability state side ab card targets))))

+(defn play-dynamic-ability [state side {:keys [card ability targets] :as args}]
+  (let [abilities (:abilities card)
+        ab (get-in card [:abilities ability])
+        cost (:cost ab)]
+    (when (or (nil? cost)
+              (apply can-pay? state side cost))
+        (when-let [activatemsg (:activatemsg ab)] (system-msg state side activatemsg))
+        (resolve-ability state side ab card targets))))
+
 (defn turn-message [state side start-of-turn]
   (let [pre (if start-of-turn "started" "is ending")
         hand (if (= side :runner) "their Grip" "HQ")
@@ -1701,9 +1710,13 @@
 (defn copy-abilities [state side dest source]
   (let [source-def (card-def source)
         source-abilities (if (:abilities source-def) (:abilities source-def) ())
+        ; i think this just copies some bare minimum of info, and relies on the card-def to supply the actual data. We may have to copy the entire thing and conj {:dynamic :something} into it so we handle it as a full dynamic ability
+        ; source-abilities (for [ab source-abilities]
+        ;             (assoc (select-keys ab [:cost :pump :breaks])
+        ;               :label (or (:label ab) (and (string? (:msg ab)) (capitalize (:msg ab))) "")
+        ;               :dynamic :copy))
         source-abilities (for [ab source-abilities]
-                    (assoc (select-keys ab [:cost :pump :breaks])
-                      :label (or (:label ab) (and (string? (:msg ab)) (capitalize (:msg ab))) "")))
+                      (conj {:dynamic :copy} ab))
         dest-card (merge dest {:abilities source-abilities})]
           (prn "copy-abilities")
           (prn "source-abilities" source-abilities)


check for either Basic or Single conn managers

--- src/clj_http/core.clj
+++ src/clj_http/core.clj
@@ -22,6 +22,7 @@
            (org.apache.http.conn.params ConnRoutePNames)
            (org.apache.http.impl.client DefaultHttpClient)
            (org.apache.http.impl.conn BasicClientConnectionManager
+                                      SingleClientConnManager
                                       ProxySelectorRoutePlanner)
            (org.apache.http.auth UsernamePasswordCredentials AuthScope)
            (org.apache.http.util EntityUtils)))
@@ -113,7 +114,8 @@
           (try
             (proxy-super close)
             (finally
-              (when (instance? BasicClientConnectionManager conn-mgr)
+              (when (or (instance? SingleClientConnManager conn-mgr)
+                        (instance? BasicClientConnectionManager conn-mgr))
                 (.shutdown conn-mgr))))))
       (EntityUtils/toByteArray ^HttpEntity http-entity))))

@@ -220,7 +222,8 @@
          (proxy [HttpResponseInterceptor] []
            (process [resp ctx]
              (response-interceptor resp ctx)))))
-      (when (instance? BasicClientConnectionManager conn-mgr)
+      (when (or (instance? SingleClientConnManager conn-mgr)
+                (instance? BasicClientConnectionManager conn-mgr))
         (.addHeader http-req "Connection" "close"))
       (doseq [[header-n header-v] headers]
         (if (coll? header-v)
@@ -266,6 +269,7 @@
                 (dissoc :save-request?))
             resp))
         (finally
-          (when (and (instance? BasicClientConnectionManager conn-mgr)
+          (when (and (or (instance? SingleClientConnManager conn-mgr)
+                         (instance? BasicClientConnectionManager conn-mgr))
                      (not= :stream as))
             (.shutdown ^ClientConnectionManager conn-mgr)))))))


compile

compile

--- src/evalback/core.clj
+++ src/evalback/core.clj
@@ -84,10 +84,10 @@
   (let [ toc (timeout request-timeout)
         [solver c] (alts!! [@worker toc])]
     (if-not (= c toc)
-      (close! toc)
+      (do (close! toc)
       (let [result (solver request)]
         (>!! @worker solver)
-        result)
+        result))
       (into request {:status :error :result "The system is under heavy load. Please try again later."}))))


Actually return the comic-urls

Actually return the comic-urls

--- src/clj/comic_reader/server.clj
+++ src/clj/comic_reader/server.clj
@@ -61,8 +61,8 @@
         page-list (get-following-pages site comic
                                        chapter-map
                                        (safe-read-string page))]
-    (if-let [comic-urls nil]
-      (edn-response)
+    (if-let [comic-urls (map :url page-list)]
+      (edn-response comic-urls)
       (edn-response (gen-error-data request) 404))))

 (c/defroutes routes


close #43

close #43

--- src/clj/starcity/pages/auth.clj
+++ src/clj/starcity/pages/auth.clj
@@ -4,6 +4,7 @@
             [starcity.models.account :as account]
             [starcity.middleware :refer [get-component]]
             [starcity.util :refer :all]
+            [buddy.auth :refer [authenticated?]]
             [bouncer.core :as b]
             [bouncer.validators :as v]
             [clojure.string :refer [trim]]
@@ -101,7 +102,9 @@

 (defn handle-login [req]
   (case (:request-method req)
-    :get  (ok (render-login req))
+    :get  (if (authenticated? req)
+            (response/redirect "/me")
+            (ok (render-login req)))
     :post (authenticate req)
     (ok (render-login req))))


fix BE rules based on subs

fix BE rules based on subs

--- src/clj/swarmpit/event/rule.clj
+++ src/clj/swarmpit/event/rule.clj
@@ -20,7 +20,8 @@
     (match? [_ event]
       (service-container-event? event))
     (subscription [_ event]
-      {:handler :service-list})
+      {:handler :service-list
+       :params  nil})
     (subscribed-data [_ event]
       (api/services-memo))))

@@ -29,7 +30,8 @@
     (match? [_ event]
       (service-container-event? event))
     (subscription [_ event]
-      {:handler :task-list})
+      {:handler :task-list
+       :params  nil})
     (subscribed-data [_ event]
       (api/tasks-memo))))

@@ -38,7 +40,8 @@
     (match? [_ event]
       (= "service" (:Type event)))
     (subscription [_ event]
-      {:handler :service-list})
+      {:handler :service-list
+       :params  nil})
     (subscribed-data [_ event]
       (api/services))))

@@ -47,7 +50,8 @@
     (match? [_ event]
       (= "node" (:Type event)))
     (subscription [_ event]
-      {:handler :node-list})
+      {:handler :node-list
+       :params  nil})
     (subscribed-data [_ event]
       (api/nodes))))


Refactor parse- and act-on-input out of main

--- src/cljs/reframe_test/huet.cljs
+++ src/cljs/reframe_test/huet.cljs
@@ -132,6 +132,35 @@
   (let [f (get char-fn-map (char c) nil)]
     (or f no-op)))

+(defn act-on
+  "Determine and apply a function to the zipper based on input. Return the modified
+ zipper (or return the original zipper if the called fn returns nil)."
+  [zipper input]
+  (let [next-fn (interpret input)
+        next-zip (next-fn zipper)]
+    (if next-zip
+      (do
+        (swap! history conj next-zip)
+        next-zip)
+      zipper)))
+
+; -main versions are no longer appropriate
+#_(defn -main
+  "Loop indefinitely over user input, interpreting each char as a
+  zipper command"
+  [& args]
+  (println "Walking zipper. '?' for help.")
+  (let [init-zip (new-zipper)
+        term (Terminal/getTerminal)]
+    (loop [zipper init-zip]
+      (println)
+      (println zipper)
+      (let [input (char (.readCharacter term System/in))
+            _ (println "zipper going in is " zipper)
+            next-zip (act-on zipper input)
+            _ (println "next-zip is now " next-zip)]
+        (recur next-zip)))))
+
 #_(defn -main
   "Loop indefinitely over user input, interpreting each char as a
   zipper command"


added form list view

added form list view

--- src/cljs/swarmpit/material.cljs
+++ src/cljs/swarmpit/material.cljs
@@ -139,4 +139,40 @@
         #js {:onClick on-click-fn}
         (svg
           #js {:hoverColor "red"}
-          trash-icon)))))+          trash-icon)))))
+
+(defn form-list-view [headers items width]
+  (let [table-el-height #js {:height "20px"}]
+    (theme
+      (table
+        #js {:selectable false
+             :style      #js {:width width}}
+        (table-header
+          #js {:displaySelectAll  false
+               :adjustForCheckbox false
+               :style             #js {:border "none"}}
+          (table-row
+            #js {:displayBorder false
+                 :style         table-el-height}
+            (map-indexed
+              (fn [index header]
+                (table-header-column
+                  #js {:key   (str "header" index)
+                       :style table-el-height}
+                  header))
+              headers)))
+        (table-body
+          #js {:showRowHover       false
+               :displayRowCheckbox false}
+          (map-indexed
+            (fn [index item]
+              (table-row
+                #js {:key       (str "row" index)
+                     :rowNumber index
+                     :style     table-el-height}
+                (->> (keys item)
+                     (map #(table-row-column
+                             #js {:key   (str (name %) index)
+                                  :style table-el-height}
+                             (% item))))))
+            items))))))


add routes

add routes

--- src/cljs/tumblrsearch/core.cljs
+++ src/cljs/tumblrsearch/core.cljs
@@ -6,10 +6,15 @@
             [om.core :as om :include-macros true]
             [om.dom :as dom :include-macros true]
             [clojure.string :as s :refer [replace]]
-            ;[figwheel.client :as fw :include-macros true]
+            [figwheel.client :as fw :include-macros true]
+            ; routing
+            [secretary.core :as secretary :include-macros true :refer [defroute]]
+            [goog.events :as events]
             )
   (:import [goog.net Jsonp]
            [goog Uri]
+           goog.History
+           goog.History.EventType
            ))

 (enable-console-print!)
@@ -55,23 +60,21 @@
               (put! ajax-chan {:error false
                                :search-term search-term
                                :items (filter
-                                        #(= (:type %) "photo")
+                                        (fn [item] (= (:type item) "photo"))
                                         (js->clj (.. % -response) :keywordize-keys true))})
               ; otherwise error
               (put! ajax-chan {:error true})))))

-(defn new-search [data state owner]
-  (when (not (empty? (:text state)))
-    (om/transact!
-      data #(assoc %
-                   :current-state :loading
-                   :current-search (:text state)
-                   :current-items []
-                   :before 0
-                   :window-width (.. js/window -innerWidth)
-                   ))
-    (om/set-state! owner :text "")
-    (go (async-search @data (:ajax-chan state)))))
+(defn new-search [data query ajax-chan]
+  (om/transact!
+    data #(assoc %
+                 :current-state :loading
+                 :current-search query
+                 :current-items []
+                 :before 0
+                 :window-width (.. js/window -innerWidth)
+                 ))
+  (go (async-search @data ajax-chan)))

 ; Key handling ---

@@ -88,7 +91,11 @@
   (let [k (key-event->keycode e)]
     (when (legal-key k)
       (condp = k
-        ENTER (new-search data state owner)
+        ENTER (do
+                (when (not (empty? (:text state)))
+                  (set! js/window.location.hash ((-> @data :routes :search)
+                                                 {:query (:text state)}))
+                  (om/set-state! owner :text "")))
         ESC   (om/set-state! owner :text "")))))

 ; render ---
@@ -113,14 +120,17 @@
                (dom/button
                  #js {:onClick (fn [e]
                                  (.preventDefault e)
-                                 (new-search data state owner))}
+                                 (when (not (empty? (:text state)))
+                                   (set! js/window.location.hash ((-> @data :routes :search)
+                                                                  {:query (:text state)}))
+                                   (om/set-state! owner :text ""))
+                                 )}
                  "Search")
                ; clear button
                (dom/button
                  #js {:onClick (fn [e]
                                  (.preventDefault e)
                                  (om/set-state! owner :text "")
-                                 (om/transact! data reset-state)
                                  )}
                  "Clear")))))

@@ -141,40 +151,42 @@
 (defn items-view [data owner]
   (let [col-n (quot (:window-width data) IMGSIZE)
         left-offset (int (/ (mod (.. js/window -innerWidth) IMGSIZE) 2))]
+
     (apply dom/div #js {:className "images"}
+
            (om/build-all
              item-view
              (->> (:current-items data)
-                  #(loop [items   %
-                          coll    []
-                          idx     0
-                          offsets (zipmap (range col-n) (repeat 0))]
-                     (if (empty? items) coll
-                       (let [item  (first items)
-                             title (s/replace (:slug item)  #"-"  " ")
-                             photo (-> item :photos first :alt_sizes second)]
-                         (if (or (nil? (:height photo)) (nil? (:width photo)))
-                           ; nil size found - drop the image
-                           (recur (rest items) coll idx offsets)
-                           ; ok
-                           (let [offset-n    (mod idx col-n)
-                                 offset      (apply min-key second offsets)
-                                 offset-x    (+ left-offset (* IMGSIZE (first offset)))
-                                 offset-y    (second offset)
-                                 new-height  (int (* (:height photo) (/ IMGSIZE (:width photo))))
-                                 new-offsets (update-in offsets [(first offset)] #(+ % new-height))
-                                 new-item {:index idx
-                                           :title title
-                                           :photo photo
-                                           :post_url (:post_url item)
-                                           :x offset-x
-                                           :y offset-y
-                                           }]
-                             (recur
-                               (rest itemss)
-                               (conj coll new-item)
-                               (inc idx)
-                               new-offsets)))))))))))
+                  (#(loop [items   %
+                           coll    []
+                           idx     0
+                           offsets (zipmap (range col-n) (repeat 0))]
+                      (if (empty? items) coll
+                        (let [item  (first items)
+                              title (s/replace (:slug item)  #"-"  " ")
+                              photo (-> item :photos first :alt_sizes second)]
+                          (if (or (nil? (:height photo)) (nil? (:width photo)))
+                            ; nil size found - drop the image
+                            (recur (rest items) coll idx offsets)
+                            ; ok
+                            (let [offset-n    (mod idx col-n)
+                                  offset      (apply min-key second offsets)
+                                  offset-x    (+ left-offset (* IMGSIZE (first offset)))
+                                  offset-y    (second offset)
+                                  new-height  (int (* (:height photo) (/ IMGSIZE (:width photo))))
+                                  new-offsets (update-in offsets [(first offset)] + new-height)
+                                  new-item {:index idx
+                                            :title title
+                                            :photo photo
+                                            :post_url (:post_url item)
+                                            :x offset-x
+                                            :y offset-y
+                                            }]
+                              (recur
+                                (rest items)
+                                (conj coll new-item)
+                                (inc idx)
+                                new-offsets))))))))))))

 ;; Loading ------------------------------------------------
@@ -189,7 +201,8 @@
                       (dom/button
                         #js {:onClick (fn [e]
                                         (.preventDefault e)
-                                        (om/transact! data reset-state))}
+                                        (set! js/window.location.hash ((-> @data :routes :index)))
+                                        )}
                         "Reset")
                       ; loading
                       (dom/h2 nil "loading"))
@@ -210,7 +223,30 @@
                       (dom/button
                         #js {:onClick (fn [e]
                                         (.preventDefault e)
-                                        (om/transact! data reset-state))}
+                                        (set! js/window.location.hash "")
+                                        )}
+                        "Reset")
+                      ; loading
+                      (dom/h2 nil "loading"))
+             ; photo list
+             (items-view data owner))))
+
+;; loaded ------------------------------------------------
+
+
+(defn render-loaded [data owner]
+  (om/component
+    (dom/div nil
+             (dom/div #js {:className "header"}
+                      ; title
+                      (dom/h1 nil (str "Current search: "
+                                       (:current-search data)))
+
+                      (dom/button
+                        #js {:onClick (fn [e]
+                                        (.preventDefault e)
+                                        (set! js/window.location.hash "")
+                                        )}
                         "Reset"))
              ; item list
              (items-view data owner))))
@@ -225,7 +261,7 @@
              (dom/button
                #js {:onClick (fn [e]
                                (.preventDefault e)
-                               (om/transact! data reset-state ))}
+                               (set! js/window.location.hash ""))}
                "Cancel"))))

 ;; App -----------------------------------------------
@@ -239,65 +275,85 @@
           (cond
             ; loading error
             (:error response)
+            (om/transact! data
+                          #(assoc %
+                                  :before 0
+                                  :current-state :error
+                                  :error "AJAX error"
+                                  :current-search ""
+                                  :current-items []))
+
+            (and (= (:current-search @data) (:search-term response))
+                 (empty? (response :items)))
+            (if (empty? (:current-items @data))
+              ; nothing found error
               (om/transact! data
                             #(assoc %
                                     :before 0
                                     :current-state :error
-                                    :error "AJAX error"
+                                    :error "Tag not found"
                                     :current-search ""
-                                    :current-items []))
-
-            (and (= (:current-search @data) (:search-term response))
-                 (empty? (response :items)))
-              (if (empty? (:current-items @data))
-                ; nothing found error
-                (om/transact! data
-                              #(assoc %
-                                      :before 0
-                                      :current-state :error
-                                      :error "Tag not found"
-                                      :current-search ""
-                                      :current-items []
-                                      ))
-                ; loaded final
-                (om/transact! data #(assoc % :current-state :loaded-final)))
+                                    :current-items []
+                                    ))
+              ; loaded final
+              (om/transact! data #(assoc % :current-state :loaded-final)))
             ; not error, search term match, not empty - let's go!
             (and (= (:current-search @data) (:search-term response))
                  (not (empty? (response :items))))
-              (om/transact! data
-                            #(assoc %
-                                    :current-state :loaded
-                                    :current-items (concat (:current-items @data)
-                                                           (:items response))
-                                    :before (:timestamp (last (response :items)))
-                                    ))))))))
+            (om/transact! data
+                          #(assoc %
+                                  :current-state :loaded
+                                  :current-items (concat (:current-items @data)
+                                                         (:items response))
+                                  :before (:timestamp (last (response :items)))
+                                  ))))))))

 (defn async-window-scroll [data ajax-chan]
   (.addEventListener js/window "scroll"
+                     (fn []
+                       (when
+                         (and
+                           (= :loaded (:current-state @data))
+                           (let [body (.. js/document -body)
+                                 html  (.. js/document -documentElement)
+                                 height (max (.. body -scrollHeight)
+                                             (.. body -offsetHeight)
+                                             (.. html -clientHeight)
+                                             (.. html -scrollHeight)
+                                             (.. html -offsetHeight)
+                                             )]
+                             (> 100
+                                (- height
+                                   (+ (.. js/window -innerHeight)
+                                      (.. js/window -scrollY))))))
+                         (om/transact! data #(assoc % :current-state :loading))
+                         (go (async-search @data ajax-chan))))))
+
+(defn async-window-resize [data]
+  (.addEventListener
+    js/window "resize"
     (fn []
-      (when
-        (and
-          (= :loaded (:current-state @data))
-          (let [body (.. js/document -body)
-                html  (.. js/document -documentElement)
-                height (max (.. body -scrollHeight)
-                            (.. body -offsetHeight)
-                            (.. html -clientHeight)
-                            (.. html -scrollHeight)
-                            (.. html -offsetHeight)
-                            )]
-            (> 100
-               (- height
-                  (+ (.. js/window -innerHeight)
-                     (.. js/window -scrollY))))))
-        (om/transact! data #(assoc % :current-state :loading))
-        (go (async-search @data ajax-chan))))))
-
-(defn async-window-resize [data]
-   (.addEventListener
-     js/window "resize"
-     (fn []
-       (om/transact! data #(assoc % :window-width (.. js/window -innerWidth))))))
+      (om/transact! data #(assoc % :window-width (.. js/window -innerWidth))))))
+
+
+(defn setup-navigation [data ajax-chan]
+
+  (secretary/set-config! :prefix "#")
+
+  (defroute search-route "/search/:query" [query]
+    (new-search data query ajax-chan))
+
+  (defroute index-route "/" []
+    (om/transact! data reset-state))
+
+  (om/transact! data #(assoc % :routes
+                             {:index index-route
+                              :search search-route}))
+
+  (let [h (History.)]
+    (goog.events/listen h EventType/NAVIGATE #(secretary/dispatch! (.-token %)))
+    (doto h
+      (.setEnabled true))))

 (om/root
   (fn [data owner]
@@ -305,10 +361,11 @@
       om/IWillMount
       (will-mount [_]
         (let [ajax-chan (chan 1)]
+          (om/set-state! owner :ajax-chan ajax-chan)
           (async-response-loop data ajax-chan)
           (async-window-scroll data ajax-chan)
           (async-window-resize data)
-          (om/set-state! owner :ajax-chan ajax-chan)))
+          (setup-navigation data ajax-chan)))
       om/IRenderState
       (render-state [this local-state]
         (dom/div nil
@@ -322,3 +379,12 @@
                    )))))
   (atom initial-state)
   {:target (. js/document (getElementById "app"))})
+
+
+;; Routing
+
+
+(fw/watch-and-reload
+  :websocket-url   "ws://localhost:3449/figwheel-ws"
+  :jsload-callback (fn [] (print "reloaded")))
+


Remove :edit to :edit-text for consistency

--- src/clojure/neko/ui/mapping.clj
+++ src/clojure/neko/ui/mapping.clj
@@ -32,8 +32,8 @@
              :attributes {:text "Default button"}}
     :linear-layout {:classname android.widget.LinearLayout
                     :inherits :view-group}
-    :edit {:classname android.widget.EditText
-           :inherits :view}
+    :edit-text {:classname android.widget.EditText
+                :inherits :view}
     :text-view {:classname android.widget.TextView
                 :inherits :view}
     :list-view {:classname android.widget.ListView


Get last line number for additions

Get last line number for additions

In the unified view, these are on the same line, which can cause
additions to be hidden incorrectly if their line number doesn't match.

--- src/gitique/core.cljs
+++ src/gitique/core.cljs
@@ -149,8 +149,8 @@
   (let [new-lines-list (flatten (:new (-> file :patch pure/parse-diff)))
         new-lines (zipmap (map :index new-lines-list) new-lines-list)]
     (doseq [line (util/qsa ".diff-table tr" element)]
-      (let [line-number-element (util/qs "[data-line-number]" line)
-            line-number (if line-number-element (.getAttribute line-number-element "data-line-number") "0")]
+      (let [line-number-elements (util/qsa "[data-line-number]" line)
+            line-number (if (empty? line-number-elements) "0" (.getAttribute (last line-number-elements) "data-line-number"))]
         (if-let [new-line (new-lines (js/parseInt line-number 10))]
           (when (= :context (:type new-line)) (util/add-class line "gitique-context"))
           (util/add-class line "gitique-hidden"))))))


pack/unpack payload

pack/unpack payload

--- src/common/plastic/servant.cljs
+++ src/common/plastic/servant.cljs
@@ -97,14 +97,24 @@

 (declare post-message)

+(defn pack-payload [context msg-id sender command args]
+  (js-obj
+    "msg-id" msg-id
+    "sender" (name sender)
+    "command" (name command)
+    "args" (measure-time (benchmark? context) transit-label ["encode args"]
+             (transit/write (:writer context) args))))
+
+(defn unpack-payload [context payload]
+  {:msg-id  (aget payload "msg-id")
+   :sender  (keyword (aget payload "sender"))
+   :command (keyword (aget payload "command"))
+   :event   (measure-time (benchmark? context) transit-label ["decode args"]
+              (transit/read (:reader context) (aget payload "args")))})
+
 (defn process-message [context payload]
   (binding [globals/*current-thread* (get-thread-label context)]
-    (let [msg-id (aget payload "msg-id")
-          sender (keyword (aget payload "sender"))
-          command (keyword (aget payload "command"))
-          args (aget payload "args")
-          event (measure-time (benchmark? context) transit-label ["decode args"]
-                  (transit/read (:reader context) args))
+    (let [{:keys [msg-id sender command event]} (unpack-payload context payload)
           pre-handler (fn [db]
                         (start-dispatch-recording! context sender)
                         db)
@@ -122,12 +132,7 @@
                                       (with-final-handler final-handler)))))))

 (defn post-message* [context recipient msg-id command args]
-  (let [payload (js-obj
-                  "msg-id" msg-id
-                  "sender" (name (get-thread-id context))
-                  "command" (name command)
-                  "args" (measure-time (benchmark? context) transit-label ["encode args"]
-                           (transit/write (:writer context) args)))
+  (let [payload (pack-payload context msg-id (get-thread-id context) command args)
         post-fn (get-socket context recipient)]
     (post-fn payload)))


Table widget automatically extends when a cell beyond the current scheme is set.

--- src/conexp/gui/editors/util.clj
+++ src/conexp/gui/editors/util.clj
@@ -486,6 +486,14 @@
          :model    model
          :handler  (ref {})

+         :get-row-count
+         (fn-swing-doc "Gets the row count of the table"
+           [] (.getRowCount table))
+
+         :get-column-count
+         (fn-swing-doc "Gets the column count of the table"
+           [] (.getColumnCount table))
+
          :set-handler
          (fn-doc "Set the widgets handler function.

@@ -594,9 +602,16 @@
     column     _integer identifying a column
     contents   _the new contents"
                         [widget row column contents]
-                        (.setValueAt (get-control widget)
-                          (!!!! widget :set-cell-value-hook row column contents)
-                          row column))]
+                        (let [ columns (!! widget :get-column-count)
+                               rows    (!! widget :get-row-count)]
+                          (do
+                            (if (>= column columns)
+                              (!!!! widget :extend-columns-to (+ 1 column)))
+                            (if (>= row rows)
+                              (!!!! widget :extend-rows-to (+ 1 row)))
+                            (.setValueAt (get-control widget)
+                              (!!!! widget :set-cell-value-hook row column contents)
+                              row column))))]
                     [:set-handler :set-cell-value-hook
                       (fn-doc "This hook takes requested contents and turns them into
   allowed contents.
@@ -609,8 +624,38 @@

   Returns the new allowed contents for the cell (as string)."
                         [widget row column contents]
-                        (str contents))
-                    ]]]
+                        (str contents))]
+                    [:set-handler :extend-columns-to
+                      (fn-swing-doc "Extends the current table to have (at least) the
+  specified number of columns.
+
+  Parameters:
+    widget     _the widget object
+    columns    _desired number of columns"
+                        [widget columns]
+                        (let [old-columns (!! widget :get-column-count)]
+                          (if (< old-columns columns)
+                            (do
+                              (!! widget :set-column-count columns)
+                              (!!!! widget :extend-columns-hook old-columns columns)))))]
+                    [:set-handler :extend-rows-to
+                      (fn-swing-doc "Extends the current table to have (at least) the
+  specified number of rows.
+
+  Parameters:
+    widget     _the widget object
+    rows    _desired number of rows"
+                        [widget rows]
+                        (let [old-rows (!! widget :get-row-count)]
+                          (if (< old-rows rows)
+                            (do
+                              (!! widget :set-row-count rows)
+                              (!!!! widget :extend-rows-hook old-rows rows)))))]
+                    [:set-handler :extend-rows-hook
+                      (fn-doc "Dummy extend hook" [widget old-rows new-rows] nil)]
+                    [:set-handler :extend-columns-hook
+                      (fn-doc "Dummy extend hook" [widget old-columns new-columns] nil)]
+                    ]]
     (do
       (deliver self widget)
       (one-by-one defaults unroll-parameters-fn-map widget)


Don't use venantius/ultra due to some errors

--- clojure/profiles.clj
+++ clojure/profiles.clj
@@ -11,7 +11,7 @@
                   ;; A Leiningen plugin for a superior development environment
                   ;; See: [Introduction Blog Post](https://blog.venanti.us/ultra/)
                   ;; https://github.com/venantius/ultra
-                  [venantius/ultra "0.5.2"]
+                  ;;[venantius/ultra "0.5.2"]

                   ;; Pretty-print a representation of the project map
                   [lein-pprint "1.2.0"]


more require

more require

--- src/main/clojure/com/narkisr/couchfs/couch_file.clj
+++ src/main/clojure/com/narkisr/couchfs/couch_file.clj
@@ -47,8 +47,8 @@
   ([file] (-> file :content (apply [])))
   ([file f] (-> file :content (apply []) f)))

-(defn fetch-size
-  ([file] (-> file :size (apply []))))
+(defn fetch-size [file]
+  (-> file :size (apply [])))

 (defn rename-file [from to]
   "This expensive, couch does not have a rename built in https://issues.apache.org/jira/browse/COUCHDB-715"


Update resource.clj

Update resource.clj

--- src/iyye/resource.clj
+++ src/iyye/resource.clj
@@ -17,6 +17,7 @@
 (ns iyye.resource
   (:require
     [iyye.task :refer [start-task stop-task]]
+    [iyye.persistence :as persistence]
     [clojure.tools.logging :as log]))

 (defprotocol Resource
@@ -91,8 +92,9 @@
     [(start-task day)
      (dosync ref-set (:day-start day) (System/currentTimeMillis))
      (dosync ref-set awake-or-sleep true)
-     (log/info "next day: " @num-days)
-     (dosync (alter num-days inc))]))
+     (dosync (alter num-days inc))
+     (persistence/record-day @num-days)
+     (log/info "next day: " @num-days)]))

 (defn is-day-over? [day] (are-resources-exhausted? day))

@@ -101,6 +103,7 @@
 (defn start-night [night]
   (doall
     [(start-task night)
+     (persistence/record-night @num-days)
      (dosync ref-set (:night-start night) (System/currentTimeMillis))]))

 (defn stop-day [day]
@@ -111,3 +114,6 @@
 (defn stop-night [night]
   (dorun
     [(stop-task night)]))
+
+(defn load-day! []
+  (dosync (ref-set num-days (persistence/load-days))))


New status for jobs: disabled flag

New status for jobs: disabled flag

--- src/emender_jenkins/results.clj
+++ src/emender_jenkins/results.clj
@@ -80,6 +80,18 @@
                   :else                             :failure)
             :does-not-exists)))

+(defn compute-job-disabled
+    [jenkins-job-status buildable?]
+    ; check if the 'disabled' option is set in job config
+    (if (not buildable?)
+        true
+        (if jenkins-job-status ; job is buildable, so let's check the icon
+            (cond (= jenkins-job-status "blue")     false
+                  (= jenkins-job-status "yellow")   false
+                  (= jenkins-job-status "disabled") true
+                  :else                             false)
+            true)))
+
 (defn parse-int
     [string]
     (java.lang.Integer/parseInt string))
@@ -107,6 +119,7 @@
              :environment (job-name->environment job-name preview-jobs-suffix stage-jobs-suffix prod-jobs-suffix)
              :book-name   (job-name->book-name job-name)
              :job-status  (compute-job-status job-color buildable?)
+             :disabled    (compute-job-disabled job-color buildable?)
              :message     message
              :results     (parse-test-results message)
             })))


main function in bootstrap fixed

main function in bootstrap fixed

--- src/kixi/eventlog/bootstrap.clj
+++ src/kixi/eventlog/bootstrap.clj
@@ -27,7 +27,7 @@
       (cond-> (:repl opts)
         (assoc :repl-server (mk-repl-server {:port (:repl-port opts)})))))

-(defn main [args]
+(defn -main [& args]
   (log/info "Starting kixi.eventlog")
   (let [[opts args banner]
         (cli args


prevent errors without lines from throwing

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

--- src/lt/objs/eval.cljs
+++ src/lt/objs/eval.cljs
@@ -433,13 +433,14 @@
                 :triggers #{:click :double-click :clear!}
                 :tags #{:inline :inline.exception}
                 :init (fn [this info]
-                        (let [content (->inline-exception this info)]
-                          (object/merge! this (assoc info
-                                                :widget (ed/line-widget (ed/->cm-ed (:ed info))
-                                                                        (-> info :loc :line)
-                                                                        content
-                                                                        {:coverGutter false})))
-                          content)))
+                        (when (-> info :loc :line)
+                          (let [content (->inline-exception this info)]
+                            (object/merge! this (assoc info
+                                                  :widget (ed/line-widget (ed/->cm-ed (:ed info))
+                                                                          (-> info :loc :line)
+                                                                          content
+                                                                          {:coverGutter false})))
+                            content))))

 (behavior ::inline-exceptions
           :triggers #{:editor.exception}


Improve docstring.

Improve docstring.

--- src/lt/objs/tabs.cljs
+++ src/lt/objs/tabs.cljs
@@ -558,7 +558,7 @@

 (cmd/command {:command :tabs.goto
               :hidden true
-              :desc "Tab: Goto tab #; 8 for last tab"
+              :desc "Tab: Goto tab # or :last"
               :exec (fn [x]
                       (let [ts (ctx/->obj :tabset)
                             tabcount (count (:objs @ts))


navis outside containers, order of css imports

--- src/ontrail/pages.clj
+++ src/ontrail/pages.clj
@@ -72,13 +72,13 @@

 (defn head [title]
   [:head
-   [:link {:rel "stylesheet" :href "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"}]
-   [:link {:rel "stylesheet" :href "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css"}]
    [:link {:rel "stylesheet" :href "/s/css/font-awesome.min.css"}]
    [:link {:rel "stylesheet" :href "/s/css/froala_editor.min.css"}]
    [:link {:rel "stylesheet" :href "/s/css/froala_style.min.css"}]
    [:link {:rel "stylesheet" :href "/s/css/simple.css"}]

+   [:link {:rel "stylesheet" :href "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css"}]
+   [:link {:rel "stylesheet" :href "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap-theme.min.css"}]
    [:meta {:name "viewport" :content "width=device-width, initial-scale=1"}]
    [:meta {:http-equiv "X-UA-Compatible" :content "IE=edge"}]
    [:meta {:charset "utf-8"}]
@@ -210,8 +210,7 @@
   [:html
    (head (:title ex))
    [:body {:role "document"}
-    [:div
-     (navi user)
+    (navi user)
      [:div.container
       [:div.row
        [:div.col-md-12
@@ -234,7 +233,7 @@
              [:div.commentDiv
               [:p [:span.date (:date comment)] " " [:span.username (str (:user comment))]]
               [:p.commentBody (:body comment)]]]]])]
-       [:div.commentContainer "Ei kommentteja"])]]])
+       [:div.commentContainer "Ei kommentteja"])]])

 (defn today []
   (formats/to-form-date (time/now)))
@@ -253,8 +252,8 @@
   [:html
    (head "Lisää")
    [:body {:role "document"}
+    (navi user)
     [:div.container
-     (navi user)
      [:h2 "Lisää uusi suoritus"]

      [:form {:role "form" :accept-charset "UTF-8" :method "POST" :action (url "/addex")}


add CLI option to print riffmuse version

--- src/riffmuse/core.clj
+++ src/riffmuse/core.clj
@@ -70,6 +70,7 @@
       (cond
         (re-find #"(?i)help|^h" args-string)       (println (str header help))
         (re-find #"(?i)rand(om)?|^r$" args-string) (-main (rand-nth scale-choices))
+        (re-find #"(?i)version|^v" args-string)    (println header)
         :else (try
                 (let [scale (parse-scale args-string)
                       riff  (generate-riff (notes scale))]


* src/clj/cljs/core.clj: fix some typos

* src/clj/cljs/core.clj: fix some typos

--- src/clj/cljs/core.clj
+++ src/clj/cljs/core.clj
@@ -17,7 +17,7 @@
                             with-loading-context with-local-vars with-open with-out-str with-precision with-redefs
                             satisfies?

-                            aget aset + - * / <= >= == zero? pos? neg? inc dec rem]))
+                            aget aset + - * / < <= > >= == zero? pos? neg? inc dec rem]))

 (alias 'core 'clojure.core)

@@ -95,19 +95,19 @@
   ([x y & more] `(== (== ~x ~y) ~@more)))

 (defmacro dec
-  ([x] `(- x 1)))
+  ([x] `(- ~x 1)))

 (defmacro inc
-  ([x] `(+ x 1)))
+  ([x] `(+ ~x 1)))

 (defmacro zero?
-  ([x] `(== x 0)))
+  ([x] `(== ~x 0)))

 (defmacro pos?
-  ([x] `(> x 0)))
+  ([x] `(> ~x 0)))

 (defmacro neg?
-  ([x] `(< x 0)))
+  ([x] `(< ~x 0)))

 (defmacro rem
   ([num div] (list 'js* "(~{} % ~{})" num div)))


default REPLs to :cache-analysis true

default REPLs to :cache-analysis true

--- src/clj/cljs/repl.clj
+++ src/clj/cljs/repl.clj
@@ -638,18 +638,20 @@
   (let [ups-deps (cljsc/get-upstream-deps)
         {:keys [analyze-path repl-verbose warn-on-undeclared special-fns static-fns] :as opts
          :or   {warn-on-undeclared true}}
-        (assoc (merge (-repl-options repl-env) opts)
-          :init init
-          :need-prompt prompt
-          :flush flush
-          :read read
-          :print print
-          :caught caught
-          :reader reader
-          :print-no-newline print-no-newline
-          :source-map-inline source-map-inline
-          :ups-libs (:libs ups-deps)
-          :ups-foreign-libs (:foreign-libs ups-deps))]
+        (merge
+          {:cache-analysis true}
+          (assoc (merge (-repl-options repl-env) opts)
+            :init init
+            :need-prompt prompt
+            :flush flush
+            :read read
+            :print print
+            :caught caught
+            :reader reader
+            :print-no-newline print-no-newline
+            :source-map-inline source-map-inline
+            :ups-libs (:libs ups-deps)
+            :ups-foreign-libs (:foreign-libs ups-deps)))]
     (env/with-compiler-env
      (or (::env/compiler repl-env) (env/default-compiler-env opts))
      (binding [ana/*cljs-ns* 'cljs.user


added http-url

added http-url

--- src/clj_http/core.clj
+++ src/clj_http/core.clj
@@ -321,7 +321,7 @@
   (clojure.pprint/pprint (bean http-req)))

 (defn- build-response-map
-  [^HttpResponse response req ^HttpUriRequest http-req
+  [^HttpResponse response req ^HttpUriRequest http-req http-url
    conn-mgr ^HttpClientContext context]
   (let [^HttpEntity entity (.getEntity response)
         status (.getStatusLine response)
@@ -346,6 +346,7 @@
       (-> response
           (assoc :request req)
           (assoc-in [:request :body-type] (type body))
+          (assoc-in [:request :http-url] http-url)
           (update-in [:request]
                      #(if (opt req :debug-body)
                         (assoc % :body-content
@@ -441,7 +442,7 @@
              client (http-client req conn-mgr http-url proxy-ignore-hosts)]
          (try
            (build-response-map (.execute client http-req context)
-                               req http-req conn-mgr context)
+                               req http-req http-url conn-mgr context)
            (catch Throwable t
              (when-not (conn/reusable? conn-mgr)
                (conn/shutdown-manager conn-mgr))
@@ -460,7 +461,7 @@
                      (completed [this resp]
                        (try
                          (respond (build-response-map
-                                   resp req http-req conn-mgr context))
+                                   resp req http-req http-url conn-mgr context))
                          (catch Throwable t
                            (when-not (conn/reusable? conn-mgr)
                              (conn/shutdown-manager conn-mgr))


(MAINT) Clean up request handler test

(MAINT) Clean up request handler test

This commit cleans up a test that was using Java-style
syntax for reifying a protocol instance, and moves
the variables into a let block instead of using `def`
inside of the test.

--- test/unit/puppetlabs/services/request_handler/request_handler_core_test.clj
+++ test/unit/puppetlabs/services/request_handler/request_handler_core_test.clj
@@ -234,37 +234,33 @@
                         ring-codec/url-encode))))))

 (deftest handle-request-test
-  (def dummy-service
-    (reify jruby/JRubyPuppetService
-      (borrow_instance [_] {})
-      (return_instance [_ _])
-      (free_instance_count [_])
-      (mark_all_environments_expired_BANG_ [_])
-      (flush_jruby_pool_BANG_ [_])))
-
-  (def dummy-service-with-timeout
-    (reify jruby/JRubyPuppetService
-      (borrow_instance [_] nil)
-      (return_instance [_ _])
-      (free_instance_count [_])
-      (mark_all_environments_expired_BANG_ [_])
-      (flush_jruby_pool_BANG_ [_])))
-
-  (logutils/with-test-logging
-    (testing "slingshot bad requests translated to ring response"
-      (let [bad-message "it's real bad"]
-        (with-redefs [core/as-jruby-request (fn [_ _]
-                                              (core/throw-bad-request!
-                                               bad-message))]
-          (let [response (core/handle-request {:body (StringReader. "blah")}
-                                              dummy-service
-                                              {})]
-            (is (= 400 (:status response)) "Unexpected response status")
-            (is (= bad-message (:body response)) "Unexpected response body"))
-          (let [response (core/handle-request {:body (StringReader. "")}
-                                              dummy-service-with-timeout
-                                              {})]
-            (is (= 503 (:status response)) "Unexpected response status")
-            (is (.startsWith
-                  (:body response)
-                  "Attempt to borrow a JRuby instance from the pool"))))))))
+  (let [dummy-service (reify jruby/JRubyPuppetService
+                        (borrow-instance [_] {})
+                        (return-instance [_ _])
+                        (free-instance-count [_])
+                        (mark-all-environments-expired! [_])
+                        (flush-jruby-pool! [_]))
+        dummy-service-with-timeout (reify jruby/JRubyPuppetService
+                                     (borrow-instance [_] nil)
+                                     (return-instance [_ _])
+                                     (free-instance-count [_])
+                                     (mark-all-environments-expired! [_])
+                                     (flush-jruby-pool! [_]))]
+    (logutils/with-test-logging
+      (testing "slingshot bad requests translated to ring response"
+        (let [bad-message "it's real bad"]
+          (with-redefs [core/as-jruby-request (fn [_ _]
+                                                (core/throw-bad-request!
+                                                  bad-message))]
+            (let [response (core/handle-request {:body (StringReader. "blah")}
+                             dummy-service
+                             {})]
+              (is (= 400 (:status response)) "Unexpected response status")
+              (is (= bad-message (:body response)) "Unexpected response body"))
+            (let [response (core/handle-request {:body (StringReader. "")}
+                             dummy-service-with-timeout
+                             {})]
+              (is (= 503 (:status response)) "Unexpected response status")
+              (is (.startsWith
+                    (:body response)
+                    "Attempt to borrow a JRuby instance from the pool")))))))))


change the default md renderer and the page directory

--- src/tamaki/config.clj
+++ src/tamaki/config.clj
@@ -3,9 +3,9 @@

 (def config
   (letfn [(cat [tail] (symbol "tamaki.hook" tail))]
-    {:renderers {:md ""}
+    {:renderers {:md "tamaki.lwml.markdown/read-md"}
      :build "build"
-     :pages "pages"
+     :pages "resources/pages"
      :hooks {:clean [(cat "clean")]
              :validate [(cat "validate")]
              :initialize [(cat "initialize")]


[#5839] fix logo on welcome screen on desktop

Signed-off-by: Dmitry Novotochinov <b5b1b877a7d2fe39ba1f1c39d1fd1abc6e284505@gmail.com>

--- src/status_im/ui/components/icons/vector_icons.cljs
+++ src/status_im/ui/components/icons/vector_icons.cljs
@@ -180,17 +180,34 @@
     (if platform/ios? :icons/dots-horizontal :icons/dots-vertical)
     n))

+(defn- match-color [color]
+  (cond
+    (keyword? color)
+    (case color
+      :dark colors/black
+      :gray colors/gray
+      :blue colors/blue
+      :active colors/blue
+      :white colors/white
+      :red colors/red
+      colors/black)
+    (string? color)
+    color
+    :else
+    colors/black))
+
 (defn desktop-icon
   [name {:keys [color container-style style accessibility-label width height]
          :or   {accessibility-label :icon}}]
   (let [default-viewbox {:width 24 :height 24}
-        icon-style      (if width
-                          (assoc default-viewbox :width width :height height)
-                          default-viewbox)]
+        icon-style (if width
+                     (assoc default-viewbox :width width :height height)
+                     default-viewbox)
+        color-style {:tint-color (match-color color)}]
     [react/view {:style               container-style
                  :accessibility-label accessibility-label}
      [react/image {:source (get icons (normalize-property-name name))
-                   :style  (merge icon-style style)}]]))
+                   :style  (merge icon-style color-style style)}]]))

 (defn mobile-icon
   [name {:keys [color container-style accessibility-label width height]
@@ -199,21 +216,7 @@
   [react/animated-view {:style               container-style
                         :accessibility-label accessibility-label}
    (if-let [icon-fn (get icons (normalize-property-name name))]
-     (let [icon-vec (icon-fn
-                     (cond
-                       (keyword? color)
-                       (case color
-                         :dark colors/black
-                         :gray colors/gray
-                         :blue colors/blue
-                         :active colors/blue
-                         :white colors/white
-                         :red colors/red
-                         colors/black)
-                       (string? color)
-                       color
-                       :else
-                       colors/black))]
+     (let [icon-vec (icon-fn (match-color color))]
        (if width
          (update icon-vec 1 assoc :width width :height height)
          icon-vec))


Remove vacuum analyze from performance test

--- src/test/clojure/pdok/featured/performance_test.clj
+++ src/test/clojure/pdok/featured/performance_test.clj
@@ -14,11 +14,6 @@
 (defn clean-db []
   (j/execute! test-db ["DROP SCHEMA IF EXISTS \"featured_performance_performance-set\" CASCADE"])
   (j/execute! test-db ["DROP SCHEMA IF EXISTS \"performance-set\" CASCADE"]))
-
-(defn vacuum-tables []
-  (j/execute! test-db ["VACUUM ANALYZE \"featured_performance_performance-set\".feature"] :transaction? false)
-  (j/execute! test-db ["VACUUM ANALYZE \"featured_performance_performance-set\".feature_stream"] :transaction? false)
-  (j/execute! test-db ["VACUUM ANALYZE \"featured_performance_performance-set\".timeline_col1"] :transaction? false))

 (defn generate-new-features [ids difficult?]
   (with-bindings {#'generator/*difficult-geometry?* difficult?}
@@ -52,8 +47,7 @@
                       (merge {:check-validity-on-delete false} cfg)
                       "performance-set" persistence [timeline])]
       (dorun (processor/consume processor features))
-      (let [statistics (processor/shutdown processor)
-            _ (vacuum-tables)]
+      (let [statistics (processor/shutdown processor)]
       (:statistics statistics)))))

 (deftest double-file-test


CMR-2939 Fix a typo that somehow snuck in my last merge

--- transmit-lib/src/cmr/transmit/echo/soap/group.clj
+++ transmit-lib/src/cmr/transmit/echo/soap/group.clj
@@ -86,7 +86,7 @@
   "Convenience function to allow retrieving a group by the group name and user id of one of its members, without needing to know any guids.
     returns a map containing the group information for the matched group, if any."
   [token group-name member-name]
-  (let [member ((user/get-user-by-user-name {:token token :user-name member-name}))
+  (let [member (user/get-user-by-user-name {:token token :user-name member-name})
         member-guid (:guid member)
         group (->> (get-group-names-by-member {:token token :member-guid member-guid})
                    (filter #(= (:name %) group-name))


s/debug/trace/

s/debug/trace/

--- src/babel/forest.clj
+++ src/babel/forest.clj
@@ -191,7 +191,10 @@
               (filter (fn [result]
                         (not (fail? result)))
                       (map (fn [complement]
-                             (let [debug (log/debug (str (morph bolt) ": trying lexical complement:" (morph complement)))
+                             (let [debug (log/debug (str "["
+                                                         (get-in bolt [:rule]) " "
+                                                         (morph bolt) "]: trying lexical complement:" (morph complement)
+                                                         ))
                                    result
                                    (unifyc bolt
                                            (path-to-map path
@@ -228,7 +231,7 @@
                               (log/debug (str " pred@" path " = " (strip-refs (get-in bolt (concat path [:synsem :sem :pred])))))
                               (log/debug (str " agr@" path " = " (strip-refs (get-in bolt (concat path [:synsem :agr])))))))
                           complement-candidate-lexemes))))
-            (do (log/debug (str "add-complement after adding complement: "
+            (do (log/trace (str "add-complement after adding complement: "
                                 (string/join ","
                                              (map (fn [each]
                                                     (morph each))


improve log message

improve log message

--- src/babel/reader.clj
+++ src/babel/reader.clj
@@ -58,7 +58,7 @@
 (defn generate-using-db [spec source-language target-language]
   (let [spec (unify spec
                     {:synsem {:subcat '()}})]
-    (log/debug (str "spec pre-borges/generate:" spec))
+    (log/debug (str "(generate-using-db): spec:" spec))
     (generate spec source-language target-language)))

 (defn id2expression [id]


Rename protocol

Rename protocol

--- src/beehive/hive.clj
+++ src/beehive/hive.clj
@@ -21,14 +21,14 @@

 (set! *warn-on-reflection* true)

-(defprotocol NewHive
+(defprotocol Hive
   (beehive-name [this])
   (result-metrics [this])
   (rejected-metrics [this])
   (latency-metrics [this])
   (back-pressure [this]))

-(extend-protocol NewHive
+(extend-protocol Hive
   APersistentMap
   (beehive-name [this] (:name this))
   (result-metrics [this] (:result-metrics this))


Remove duplicated code.

Remove duplicated code.

--- src/bytebuf/core.clj
+++ src/bytebuf/core.clj
@@ -1,70 +0,0 @@
-(ns bytebuf.core
-  (:refer-clojure :exclude [read byte float double short long bytes])
-  (:require [bytebuf.spec :as spec]
-            [bytebuf.buffer :as buffer]
-            [bytebuf.proto :as proto]))
-
-;; (import-vars
-;;  [bytebuf.spec
-;;   compose-type
-;;   spec
-;;   string
-;;   string*
-;;   int32
-;;   int64
-;;   short
-;;   integer
-;;   long
-;;   float
-;;   double
-;;   byte
-;;   bytes
-;;   bool]
-;;  [bytebuf.buffer
-;;   allocate]
-;;  [bytebuf.proto
-;;   size])
-
-(def compose-type spec/compose-type)
-(def spec spec/spec)
-(def string spec/string)
-(def string* spec/string*)
-(def int32 spec/int32)
-(def int64 spec/int64)
-(def short spec/short)
-(def integer spec/integer)
-(def long spec/long)
-(def float spec/float)
-(def double spec/double)
-(def byte spec/byte)
-(def bytes spec/bytes)
-(def bool spec/bool)
-(def allocate buffer/allocate)
-(def size proto/size)
-
-(defn write!
-  "Write data into buffer following the specified
-  spec instance."
-  ([buff data spec]
-   (write! buff data spec {}))
-  ([buff data spec {:keys [offset] :or {offset 0}}]
-   (locking buff
-     (spec/write spec buff offset data))))
-
-(defn read*
-  "Read data from buffer following the specified spec
-  instance. This method returns a vector of readed data
-  and the data itself.
-  If you need only data, use `read` function."
-  ([buff spec]
-   (read* buff spec {}))
-  ([buff spec {:keys [offset] :or {offset 0}}]
-   (locking buff
-     (spec/read spec buff offset))))
-
-(defn read
-  "Read data from buffer following the specified
-  spec instance. This function is a friend of `read*`
-  and it returns only the readed data."
-  [& args]
-  (second (apply read* args)))


[Add] separating line

[Add] separating line


(dom/style el :attr) now returns computed style attr (formerly it returned inline style declarations only).

--- src/cljs/c2/dom.cljs
+++ src/cljs/c2/dom.cljs
@@ -72,7 +72,7 @@
 (defn style
   ([el] (throw (js/Error. "TODO: return map of element styles")))
   ([el x] (match [x]
-                 [(k :when keyword?)] (gstyle/getStyle el (name k))
+                 [(k :when keyword?)] (gstyle/getComputedStyle el (name k))
                  [(m :when map?)] (doseq [[k v] m] (style el k v))))
   ([el k v] (gstyle/setStyle el (name k) v)))


Eagerly stringify most literals

Eagerly stringify most literals

--- src/cljs/go/core.clj
+++ src/cljs/go/core.clj
@@ -18,7 +18,9 @@
   ;; Eagerly stringify any string or char literals.
   (let [clean-xs (reduce (fn [acc x]
                            (core/cond
-                            (core/or (core/string? x) (core/char? x))
+                            (core/or (core/string? x) (core/char? x)
+                                     (core/integer? %) (core/float? %)
+                                     (core/true? %) (core/false? %))
                             (if (core/string? (peek acc))
                               (conj (pop acc) (core/str (peek acc) x))
                               (conj acc (core/str x)))
@@ -28,9 +30,7 @@
         ;; clean-xs now has no nils, chars, or string-adjoining-string. bools,
         ;; ints and floats will be emitted literally to allow JS string coersion.
         strs (->> clean-xs
-                  (map #(if (core/or (core/string? %) (core/integer? %)
-                                     (core/float? %) (core/true? %)
-                                     (core/false? %))
+                  (map #(if (core/string? %)
                           "~{}"
                           "Str_cljs__core__IFn___invoke__arity__1(~{})"))
                   (interpose "+")


SVG axis helper g should have .axis class. Ticks should also have their own class.

--- src/cljx/c2/svg.cljx
+++ src/cljx/c2/svg.cljx
@@ -96,10 +96,10 @@
                       [(:or :left :top)] -1
                       [(:or :right :bottom)] 1)]

-    (into [:g.axis {:class (name orientation)}
+    (into [:g {:class (str "axis " (name orientation))}
            [:line.rule (apply hash-map (interleave [y1 y2] (:range scale)))]]
           (map (fn [d]
-                 [:g.major-tick {:transform (translate {x 0 y (scale d)})}
+                 [:g.tick.major-tick {:transform (translate {x 0 y (scale d)})}
                   [:text {x (* parity text-margin)} (formatter d)]
                   [:line {x1 0 x2 (* parity major-tick-width)}]])
                ticks))))


Remove duplicate sentry message

Remove duplicate sentry message

This was left in when I messed up merging a PR.

--- src/clojars/main.clj
+++ src/clojars/main.clj
@@ -28,7 +28,6 @@
 (defn -main [& args]
   (try
     (configure args)
-    (println "clojars-web: enabling raven-clj client dsn:project-id:" (:project-id (raven-clj/parse-dsn (:sentry-dsn @config))))
     (let [dsn (:sentry-dsn @config)]
       (if (not dsn)
         (throw (Exception. (str "No :sentry-dsn key value found in config - " @config))))


use natal-shell in om next template

use natal-shell in om next template

--- resources/om-next.cljs
+++ resources/om-next.cljs
@@ -2,21 +2,14 @@
 (set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))

 (ns $PROJECT_NAME_HYPHENATED$.core
-  (:require [om.next :as om :refer-macros [defui]]))
+  (:require [om.next :as om :refer-macros [defui]])
+  (:require-macros [natal-shell.components :refer [view text image touchable-highlight]]
+                   [natal-shell.alert-ios :refer [alert]]))

 ;; Reset js/React back as the form above loads in a different React
 (set! js/React (js/require "react-native/Libraries/react-native/react-native.js"))

-;; Set up some methods to help create React Native elements
-(defn view [opts & children]
-  (apply js/React.createElement js/React.View (clj->js opts) children))
-
-(defn text [opts & children]
-  (apply js/React.createElement js/React.Text (clj->js opts) children))
-
-
-;; Set up our Om UI
 (defonce app-state (atom {:app/msg "Welcome to $PROJECT_NAME$"}))

 (defui WidgetComponent
@@ -25,9 +18,19 @@
          '[:app/msg])
   Object
   (render [this]
-          (let [{:keys [app/msg]} (om/props this)]
-            (view {:style {:flexDirection "column" :margin 40}}
-                  (text {:style {:fontSize 50 :fontWeight "100"}} msg)))))
+    (let [{:keys [app/msg]} (om/props this)]
+      (view {:style {:flexDirection "column" :margin 40 :alignItems "center"}}
+        (text
+          {:style {:fontSize 50 :fontWeight "100" :marginBottom 20 :textAlign "center"}}
+          msg)
+
+        (image {:source {:uri "https://raw.githubusercontent.com/cljsinfo/logo.cljs/master/cljs.png"}
+                :style {:width 80 :height 80 :marginBottom 30}})
+
+        (touchable-highlight
+          {:style {:backgroundColor "#999" :padding 10 :borderRadius 5}
+           :onPress #(alert "HELLO!")}
+          (text {:style {:color "white" :textAlign "center" :fontWeight "bold"}} "press me"))))))

 ;; om.next parser
 (defmulti read om/dispatch)


More projects!

More projects!

--- resources/projects.clj
+++ resources/projects.clj
@@ -66,4 +66,23 @@
  :graft
  {:name "graft"
   :url "http://github.com/hiredman/graft"
-  :description "translate uris to functions for ring"}}
+  :description "translate uris to functions for ring"}
+
+ :chinese-democracy
+ {:name "Chinese Democracy"
+  :url "http://github.com/hiredman/chinese-democracy"
+  :description "Master^H^H^H^H^H^HChairman Election"}
+
+ :cabeza-de-vaca
+ {:name "Cabeza de Vaca"
+  :url "http://github.com/Seajure/cabeza-de-vaca"
+  :description "Embark on a voyage of discovery… Local network discovery."}
+ :radagast
+ {:name "Radagast"
+  :url "http://github.com/Seajure/radagast"
+  :description "Simplistic test coverage"}
+
+ :reducate
+ {:name "Reducate"
+  :url "http://github.com/Seajure/reducate"
+  :description "A reduce-like macro."}}


Fixed some syntax errors in analyze-data.gzip.

--- project/analyze-data/src/analyze_data/gzip.clj
+++ project/analyze-data/src/analyze_data/gzip.clj
@@ -1,6 +1,6 @@
 (ns analyze-data.gzip
-  (:require '[clojure.java.io :as io])
-  (:import java.util.zip GZIPInputStream GZIPOutputStream))
+  (:require [clojure.java.io :as io])
+  (:import (java.util.zip GZIPInputStream GZIPOutputStream)))

 (defn gzip-reader
   "Like io/reader but reads input that is compressed with gzip."


Integrate main into edge.system meta info

--- main/src/edge/web_listener.clj
+++ main/src/edge/web_listener.clj
@@ -10,6 +10,7 @@
    edge.yada.lacinia
    [edge.examples :refer [authentication-example-routes]]
    [edge.hello :refer [hello-routes other-hello-routes]]
+   [edge.system.meta :as system.meta]
    [hiccup.core :refer [html]]
    [integrant.core :as ig]
    [ring.util.mime-type :refer [ext-mime-type]]
@@ -80,3 +81,12 @@
 (defmethod ig/halt-key! :edge/web-listener [_ {:keys [listener]}]
   (when-let [close (:close listener)]
     (close)))
+
+(defmethod system.meta/useful-info :edge/web-listener
+  [_ config state]
+  (str
+    "Web server listening on "
+    (let [vhost (bidi.vhosts/coerce-to-vhost (-> state :config ::vhost))]
+      (if (= vhost :*)
+        (str "http://localhost" ":" (-> state :listener :port))
+        (str (name (:scheme vhost)) "://" (:host vhost))))))


system.protocols ns has been blacklisted for reloading

--- core/src/cljc/hellhound/system/protocols.cljc
+++ core/src/cljc/hellhound/system/protocols.cljc
@@ -1,4 +1,4 @@
-(ns hellhound.system.protocols)
+(ns ^{:clojure.tools.namespace.repl/load false} hellhound.system.protocols)

 (defprotocol Splitter


Fix issue where leaving a group could dispatch nil, causing an error

--- src/braid/core/client/core/events.cljs
+++ src/braid/core/client/core/events.cljs
@@ -602,18 +602,19 @@
 (reg-event-fx
   :leave-group
   (fn [{state :db :as cofx} [_ {:keys [group-id group-name]}]]
-    {:db
-     (-> state
-         (helpers/display-error (str "left-" group-id)
-                                (str "You have been removed from " group-name)
-                                :info)
-         (helpers/remove-group group-id)
-         (cond->
-             (get-in state [:preferences :groups-order])
-           (update-in [:preferences :groups-order]
-                      (partial filterv #(not= % group-id)))))
-     :dispatch [(when (= group-id (state :open-group-id))
-                 :redirect-from-root)]}))
+    (-> {:db
+         (-> state
+             (helpers/display-error (str "left-" group-id)
+                                    (str "You have been removed from " group-name)
+                                    :info)
+             (helpers/remove-group group-id)
+             (cond->
+                 (get-in state [:preferences :groups-order])
+               (update-in [:preferences :groups-order]
+                          (partial filterv #(not= % group-id)))))}
+        (cond->
+            (= group-id (state :open-group-id))
+          (assoc :dispatch [:redirect-from-root])))))

 (reg-event-db
   :add-open-thread