Add documentation markup for functions a-b in core.

--- src/cljc/quil/core.cljc
+++ src/cljc/quil/core.cljc
@@ -252,7 +252,7 @@
   abs
   "Calculates the absolute value (magnitude) of a number. The
   absolute value of a number is always positive. Dynamically casts to
-  an int or float appropriately for Clojure."
+  an `int` or `float` appropriately for Clojure."
   [n]
   #?(:clj
      (if (u/int-like? n)
@@ -268,9 +268,9 @@
     :subcategory "Trigonometry"
     :added "1.0"}
   acos
-  "The inverse of cos, returns the arc cosine of a value. This
+  "The inverse of [[cos]], returns the arc cosine of a value. This
   function expects the values in the range of -1 to 1 and values are
-  returned in the range 0 to Math/PI (3.1415927)."
+  returned in the range 0 to `Math/PI` (3.1415927)."
   [n]
   #?(:clj (PApplet/acos (float n))
      :cljs (.acos (ap/current-applet) n)))
@@ -298,8 +298,8 @@
   color components set through the parameters define the
   reflectance. For example in the default color mode, setting x=255,
   y=126, z=0, would cause all the red light to reflect and half of the
-  green light to reflect. Used in combination with emissive, specular,
-  and shininess in setting the material properties of shapes."
+  green light to reflect. Used in combination with [[emissive]], [[specular]],
+  and [[shininess]] in setting the material properties of shapes."
   ([gray]
    #?(:clj (.ambient (current-graphics) (float gray))
       :cljs (.ambientMaterial (current-graphics) (float gray))))
@@ -315,7 +315,7 @@
     :added "1.0"}
   ambient-light
   "Adds an ambient light. Ambient light doesn't come from a specific direction,
-  the rays have light have bounced around so much that objects are
+  the rays of light have bounced around so much that objects are
   evenly lit from all sides. Ambient lights are almost always used in
   combination with other types of lights. Lights need to be included
   in the draw to remain persistent in a looping program. Placing them
@@ -336,7 +336,7 @@
        :subcategory "Trigonometry"
        :added "2.8.0"}
      angle-mode
-     "Sets the current mode of p5 to given mode. Default mode is :radians."
+     "Sets the current mode of p5 to given mode. Default mode is `:radians`."
      ([mode]
       (let [mode (u/resolve-constant-key mode angle-modes)]
         (.angleMode (current-graphics) mode)))))
@@ -351,7 +351,7 @@
   "Multiplies the current matrix by the one specified through the
   parameters. This is very slow because it will try to calculate the
   inverse of the transform, so avoid it whenever possible. The
-  equivalent function in OpenGL is glMultMatrix().
+  equivalent function in OpenGL is `glMultMatrix()`.

   Note that cljs has only 2d version and arguments differ see
   https://p5js.org/reference/#/p5/applyMatrix"
@@ -384,10 +384,10 @@
     :added "1.0"}
   arc
   "Draws an arc in the display window. Arcs are drawn along the outer
-  edge of an ellipse defined by the x, y, width and height
+  edge of an ellipse defined by the `x`, `y`, `width` and `height`
   parameters. The origin or the arc's ellipse may be changed with the
-  ellipse-mode function. The start and stop parameters specify the
-  angles at which to draw the arc. The mode is either :open, :chord or :pie."
+  [[ellipse-mode]] function. The `start` and `stop` parameters specify the
+  angles at which to draw the arc. The `mode` is either `:open`, `:chord` or `:pie`."
   ([x y width height start stop]
    (.arc (current-graphics) (float x) (float y) (float width) (float height)
          (float start) (float stop)))
@@ -404,9 +404,9 @@
     :subcategory "Trigonometry"
     :added "1.0"}
   asin
-  "The inverse of sin, returns the arc sine of a value. This function
+  "The inverse of [[sin]], returns the arc sine of a value. This function
   expects the values in the range of -1 to 1 and values are returned
-  in the range -PI/2 to PI/2."
+  in the range `-PI/2` to `PI/2`."
   [n]
   #?(:clj (PApplet/asin (float n))
      :cljs (.asin (ap/current-applet) n)))
@@ -418,10 +418,10 @@
     :subcategory "Trigonometry"
     :added "1.0"}
   atan
-  "The inverse of tan, returns the arc tangent of a value. This
+  "The inverse of [[tan]], returns the arc tangent of a value. This
   function expects the values in the range of -Infinity to
-  Infinity (exclusive) and values are returned in the range -PI/2 to
-  PI/2 ."
+  Infinity (exclusive) and values are returned in the range `-PI/2` to
+  `PI/2`."
   [n]
   #?(:clj (PApplet/atan (float n))
      :cljs (.atan (ap/current-applet) n)))
@@ -435,7 +435,7 @@
   atan2
   "Calculates the angle (in radians) from a specified point to the
   coordinate origin as measured from the positive x-axis. Values are
-  returned as a float in the range from PI to -PI. The atan2 function
+  returned as a `float` in the range from `PI` to `-PI`. The [[atan2]] function
   is most often used for orienting geometry to the position of the
   cursor. Note: The y-coordinate of the point is the first parameter
   and the x-coordinate is the second due to the structure of
@@ -458,7 +458,7 @@
     Because of limitations in Java, not all fonts can be used and some
     might work with one operating system and not others. When sharing a
     sketch with other people or posting it on the web, you may need to
-    include a .ttf or .otf version of your font in the data directory of
+    include a `.ttf` or `.otf` version of your font in the data directory of
     the sketch because other people might not have the font installed on
     their computer. Only fonts that can legally be distributed should be
     included with a sketch."
@@ -505,9 +505,9 @@
     :subcategory "Vertex"
     :added "2.0"}
   begin-contour
-  "Use the begin-contour and end-contour function to create negative
+  "Use the [[begin-contour]] and [[end-contour]] function to create negative
   shapes within shapes. These functions can only be within a
-  begin-shape/end-shape pair and they only work with the :p2d and :p3d
+  [[begin-shape]]/[[end-shape]] pair and they only work with the `:p2d` and `:p3d`
   renderers."
   []
   (.beginContour (current-graphics)))
@@ -521,7 +521,7 @@
        :added "1.0"}
      begin-raw
      "Enables the creation of vectors from 3D data. Requires
-  corresponding end-raw command. These commands will grab the shape
+  corresponding [[end-raw]] command. These commands will grab the shape
   data just before it is rendered to the screen. At this stage, your
   entire scene is nothing but a long list of individual lines and
   triangles. This means that a shape created with sphere method will
@@ -538,26 +538,26 @@
     :subcategory "Vertex"
     :added "1.0"}
   begin-shape
-  "Enables the creation of complex forms. begin-shape begins recording
-  vertices for a shape and end-shape stops recording. Use the mode
-  keyword to specify which shape create from the provided
+  "Enables the creation of complex forms. [[begin-shape]] begins recording
+  vertices for a shape and [[end-shape]] stops recording. Use the `mode`
+  keyword to specify which shape to create from the provided
   vertices. With no mode specified, the shape can be any irregular
   polygon.

-  The available mode keywords are :points, :lines, :triangles,
-                                  :triangle-fan, :triangle-strip,
-                                  :quads, :quad-strip.
-
-  After calling the begin-shape function, a series of vertex commands
-  must follow. To stop drawing the shape, call end-shape. The vertex
+  The available mode keywords are `:points`, `:lines`, `:triangles`,
+                                  `:triangle-fan`, `:triangle-strip`,
+                                  `:quads`, `:quad-strip`.
+
+  After calling the [[begin-shape]] function, a series of vertex commands
+  must follow. To stop drawing the shape, call [[end-shape]]. The [[vertex]]
   function with two parameters specifies a position in 2D and the
-  vertex function with three parameters specifies a position in
+  [[vertex]] function with three parameters specifies a position in
   3D. Each shape will be outlined with the current stroke color and
   filled with the fill color.

-  Transformations such as translate, rotate, and scale do not work
-  within begin-shape. It is also not possible to use other shapes,
-  such as ellipse or rect within begin-shape."
+  Transformations such as [[translate]], [[rotate]], and [[scale]] do not work
+  within [[begin-shape]]. It is also not possible to use other shapes,
+  such as [[ellipse]] or [[rect]] within [[begin-shape]]."
   ([] (.beginShape (current-graphics)))
   ([mode]
    (let [mode (u/resolve-constant-key mode shape-modes)]
@@ -596,8 +596,8 @@
     :added "1.0"}
   bezier-detail
   "Sets the resolution at which Beziers display. The default value is
-  20. This function is only useful when using the :p3d or :opengl
-  renderer as the default (:java2d) renderer does not use this
+  20. This function is only useful when using the `:p3d` or `:opengl`
+  renderer as the default (`:java2d`) renderer does not use this
   information."
   [detail]
   (.bezierDetail (current-graphics) (int detail)))
@@ -609,11 +609,11 @@
     :subcategory "Curves"
     :added "1.0"}
   bezier-point
-  "Evaluates the Bezier at point t for points a, b, c, d. The
-  parameter t varies between 0 and 1, a and d are points on the curve,
-  and b and c are the control points. This can be done once with the x
+  "Evaluates the Bezier at point `t` for points `a`, `b`, `c`, `d`. The
+  parameter `t` varies between 0 and 1, `a` and `d` are points on the curve,
+  and `b` and `c` are the control points. This can be done once with the x
   coordinates and a second time with the y coordinates to get the
-  location of a bezier curve at t."
+  location of a bezier curve at `t`."
   [a b c d t]
   (.bezierPoint (current-graphics) (float a) (float b) (float c)
                 (float d) (float t)))
@@ -639,13 +639,13 @@
     :added "1.0"}
   bezier-vertex
   "Specifies vertex coordinates for Bezier curves. Each call to
-  bezier-vertex defines the position of two control points and one
+  [[bezier-vertex]] defines the position of two control points and one
   anchor point of a Bezier curve, adding a new segment to a line or
-  shape. The first time bezier-vertex is used within a begin-shape
-  call, it must be prefaced with a call to vertex to set the first
-  anchor point. This function must be used between begin-shape and
-  end-shape and only when there is no parameter specified to
-  begin-shape."
+  shape. The first time [[bezier-vertex]] is used within a [[begin-shape]]
+  call, it must be prefaced with a call to [[vertex]] to set the first
+  anchor point. This function must be used between [[begin-shape]] and
+  [[end-shape]] and only when there is no parameter specified to
+  [[begin-shape]]."
   ([cx1 cy1 cx2 cy2 x y]
    (.bezierVertex (current-graphics)
                   (float cx1) (float cy1)
@@ -664,8 +664,8 @@
     :subcategory "Conversion"
     :added "1.0"}
   binary
-  "Returns a string representing the binary value of an int, char or
-  byte. When converting an int to a string, it is possible to specify
+  "Returns a `string` representing the binary value of an `int`, `char` or
+  `byte`. When converting an `int` to a `string`, it is possible to specify
   the number of digits used."
   ([val]
    #?(:clj (PApplet/binary (int val))
@@ -683,44 +683,46 @@
     :added "1.0"}
   blend
   "Blends a region of pixels from one image into another with full alpha
-  channel support. If src is not specified it defaults to current-graphics.
-  If dest is not specified it defaults to current-graphics.
-
-  Note: blend-mode function is recommended to use instead of this one.
+  channel support. If `src` is not specified it defaults to current-graphics.
+  If dest is not specified it defaults to [[current-graphics]].
+
+  Note: it is recommended to use the [[blend-mode]] function instead of this one.

   Available blend modes are:

-  :blend      - linear interpolation of colours: C = A*factor + B
-  :add        - additive blending with white clip:
-                                            C = min(A*factor + B, 255)
-  :darkest    - only the darkest colour succeeds:
-                                            C = min(A*factor, B)
-  :lightest   - only the lightest colour succeeds:
-                                            C = max(A*factor, B)
-  :difference - subtract colors from underlying image.
-  :exclusion  - similar to :difference, but less extreme.
-  :multiply   - Multiply the colors, result will always be darker.
-  :screen     - Opposite multiply, uses inverse values of the colors.
-  :overlay    - A mix of :multiply and :screen. Multiplies dark values
-                and screens light values.
-  :hard-light - :screen when greater than 50% gray, :multiply when
-                lower.
-  :soft-light - Mix of :darkest and :lightest. Works like :overlay,
-                but not as harsh.
-  :dodge      - Lightens light tones and increases contrast, ignores
-                darks.
-                Called \"Color Dodge\" in Illustrator and Photoshop.
-  :burn       - Darker areas are applied, increasing contrast, ignores
-                lights. Called \"Color Burn\" in Illustrator and
-                Photoshop.
+  | mode         | description |
+  |--------------|-------------|
+  |`:blend`      | linear interpolation of colours: C = A*factor + B
+  |`:add`        | additive blending with white clip:
+  |              |                             C = min(A*factor + B, 255)
+  |`:darkest`    | only the darkest colour succeeds:
+  |              |                             C = min(A*factor, B)
+  |`:lightest`   | only the lightest colour succeeds:
+  |              |                             C = max(A*factor, B)
+  |`:difference` | subtract colors from underlying image.
+  |`:exclusion`  | similar to :difference, but less extreme.
+  |`:multiply`   | Multiply the colors, result will always be darker.
+  |`:screen`     | Opposite multiply, uses inverse values of the colors.
+  |`:overlay`    | A mix of :multiply and :screen. Multiplies dark values
+  |              | and screens light values.
+  |`:hard-light` | :screen when greater than 50% gray, :multiply when
+  |              | lower.
+  |`:soft-light` | Mix of :darkest and :lightest. Works like :overlay,
+  |              | but not as harsh.
+  |`:dodge`      | Lightens light tones and increases contrast, ignores
+  |              | darks.
+  |              | Called \"Color Dodge\" in Illustrator and Photoshop.
+  |`:burn`       | Darker areas are applied, increasing contrast, ignores
+  |              | lights. Called \"Color Burn\" in Illustrator and
+  |              | Photoshop.

   In clj the following blend modes are also supported:
-  :subtract   - subtractive blending with black clip:
+  `:subtract`   - subtractive blending with black clip:
                                             C = max(B - A*factor, 0)

   In cljs the following blend modes are also supported:
-  :replace    - the pixels entirely replace the others and don't utilize
-                alpha (transparency) values."
+  `:replace`    - the pixels entirely replace the others and don't utilize
+                  alpha (transparency) values."
   ([x y width height dx dy dwidth dheight mode]
    (blend (current-graphics) (current-graphics) x y width height dx dy dwidth dheight mode))
   ([^PImage src-img x y width height dx dy dwidth dheight mode]
@@ -745,31 +747,33 @@

      Available blend modes are:

-     :blend      - linear interpolation of colours: C = A*factor + B
-     :add        - additive blending with white clip:
-                                               C = min(A*factor + B, 255)
-     :subtract   - subtractive blending with black clip:
-                                               C = max(B - A*factor, 0)
-     :darkest    - only the darkest colour succeeds:
-                                               C = min(A*factor, B)
-     :lightest   - only the lightest colour succeeds:
-                                               C = max(A*factor, B)
-     :difference - subtract colors from underlying image.
-     :exclusion  - similar to :difference, but less extreme.
-     :multiply   - Multiply the colors, result will always be darker.
-     :screen     - Opposite multiply, uses inverse values of the colors.
-     :overlay    - A mix of :multiply and :screen. Multiplies dark values
-                   and screens light values.
-     :hard-light - :screen when greater than 50% gray, :multiply when
-                   lower.
-     :soft-light - Mix of :darkest and :lightest. Works like :overlay,
-                   but not as harsh.
-     :dodge      - Lightens light tones and increases contrast, ignores
-                   darks.
-                   Called \"Color Dodge\" in Illustrator and Photoshop.
-     :burn       - Darker areas are applied, increasing contrast, ignores
-                   lights. Called \"Color Burn\" in Illustrator and
-                   Photoshop."
+     | mode         | description |
+     |--------------|-------------|
+     |`:blend`      | linear interpolation of colours: C = A*factor + B
+     |`:add`        | additive blending with white clip:
+     |              |                             C = min(A*factor + B, 255)
+     |`:subtract`   | subtractive blending with black clip:
+     |              |                             C = max(B - A*factor, 0)
+     |`:darkest`    | only the darkest colour succeeds:
+     |              |                             C = min(A*factor, B)
+     |`:lightest`   | only the lightest colour succeeds:
+     |              |                             C = max(A*factor, B)
+     |`:difference` | subtract colors from underlying image.
+     |`:exclusion`  | similar to :difference, but less extreme.
+     |`:multiply`   | Multiply the colors, result will always be darker.
+     |`:screen`     | Opposite multiply, uses inverse values of the colors.
+     |`:overlay`    | A mix of :multiply and :screen. Multiplies dark values
+     |              | and screens light values.
+     |`:hard-light` | :screen when greater than 50% gray, :multiply when
+     |              | lower.
+     |`:soft-light` | Mix of :darkest and :lightest. Works like :overlay,
+     |              | but not as harsh.
+     |`:dodge`      | Lightens light tones and increases contrast, ignores
+     |              | darks.
+     |              | Called \"Color Dodge\" in Illustrator and Photoshop.
+     |`:burn`       | Darker areas are applied, increasing contrast, ignores
+     |              | lights. Called \"Color Burn\" in Illustrator and
+     |              | Photoshop."
      [c1 c2 mode]
      (let [mode (u/resolve-constant-key mode blend-modes)]
        (PApplet/blendColor (u/clj-unchecked-int c1) (u/clj-unchecked-int c2) (int mode)))))
@@ -785,32 +789,34 @@
   There is a choice of the following modes to blend the source pixels (A)
   with the ones of pixels already in the display window (B):

-  :blend      - linear interpolation of colours: C = A*factor + B
-  :add        - additive blending with white clip:
-                                            C = min(A*factor + B, 255)
-  :subtract   - subtractive blending with black clip:
-                                            C = max(B - A*factor, 0)
-  :darkest    - only the darkest colour succeeds:
-                                            C = min(A*factor, B)
-  :lightest   - only the lightest colour succeeds:
-                                            C = max(A*factor, B)
-  :difference - subtract colors from underlying image.
-  :exclusion  - similar to :difference, but less extreme.
-  :multiply   - Multiply the colors, result will always be darker.
-  :screen     - Opposite multiply, uses inverse values of the colors.
-  :replace    - the pixels entirely replace the others and don't utilize
-                alpha (transparency) values.
-  :overlay    - mix of :multiply and :screen. Multiplies dark values,
-                and screens light values.
-  :hard-light - :screen when greater than 50% gray, :multiply when lower.
-  :soft-light - mix of :darkest and :lightest. Works like :overlay, but
-                not as harsh.
-  :dodge      - lightens light tones and increases contrast, ignores darks.
-  :burn       - darker areas are applied, increasing contrast, ignores
-                lights.
-
-  Note: in clj :hard-light, :soft-light, :overlay, :dodge, :burn
-  modes are not supported. In cljs :subtract mode is not supported.
+  | mode         | description |
+  |--------------|-------------|
+  |`:blend`      | linear interpolation of colours: C = A*factor + B
+  |`:add`        | additive blending with white clip:
+  |              |                             C = min(A*factor + B, 255)
+  |`:subtract`   | subtractive blending with black clip:
+  |              |                             C = max(B - A*factor, 0)
+  |`:darkest`    | only the darkest colour succeeds:
+  |              |                             C = min(A*factor, B)
+  |`:lightest`   | only the lightest colour succeeds:
+  |              |                             C = max(A*factor, B)
+  |`:difference` | subtract colors from underlying image.
+  |`:exclusion`  | similar to :difference, but less extreme.
+  |`:multiply`   | Multiply the colors, result will always be darker.
+  |`:screen`     | Opposite multiply, uses inverse values of the colors.
+  |`:replace`    | the pixels entirely replace the others and don't utilize
+  |              | alpha (transparency) values.
+  |`:overlay`    | mix of :multiply and :screen. Multiplies dark values,
+  |              | and screens light values.
+  |`:hard-light` | :screen when greater than 50% gray, :multiply when lower.
+  |`:soft-light` | mix of :darkest and :lightest. Works like :overlay, but
+  |              | not as harsh.
+  |`:dodge`      | lightens light tones and increases contrast, ignores darks.
+  |`:burn`       | darker areas are applied, increasing contrast, ignores
+  |              | lights.
+
+  Note: in clj `:hard-light`, `:soft-light`, `:overlay`, `:dodge`, `:burn`
+  modes are not supported. In cljs `:subtract` mode is not supported.

   factor is the alpha value of the pixel being drawn"
   ([mode]
@@ -825,7 +831,7 @@
     :added "1.0"}
   blue
   "Extracts the blue value from a color, scaled to match current color-mode.
-  Returns a float."
+  Returns a `float`."
   [color]
   (.blue (current-graphics) (u/clj-unchecked-int color)))

@@ -847,7 +853,7 @@
     :subcategory "Creating & Reading"
     :added "1.0"}
   brightness
-  "Extracts the brightness value from a color. Returns a float."
+  "Extracts the brightness value from a color. Returns a `float`."
   [color]
   (.brightness (current-graphics) (u/clj-unchecked-int color)))


* src/cljs/cljs/core.cljs: -pop on EmptyList should throw

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -1530,7 +1530,7 @@

   IStack
   (-peek [coll] nil)
-  (-pop [coll] #_(throw (js/Error. "Can't pop empty list")))
+  (-pop [coll] (throw (js/Error. "Can't pop empty list")))

   ICollection
   (-conj [coll o] (List. meta o nil 1 nil))


CMR-145: Added utility method to parse concept id.

--- src/cmr/common/util.clj
+++ src/cmr/common/util.clj
@@ -1,8 +1,6 @@
 (ns cmr.common.util
+  "Utility functions that might be useful throughout the CMR."
   (:require [cmr.common.log :refer (debug info warn error)]))
-
-;; Consider moving this and the utils from echo-metaviz into some kind of common cmr library.
-;; Do this before copying and pasting code into here or copying code out of here into another project.

 (defn sequence->fn
   [vals]
@@ -42,4 +40,10 @@
       (finally
         (info ~taskname " complete.")))))

-
+(defn parse-concept-id
+  "Split a concept id into concept-type-prefix, sequence number, and provider id."
+  [concept-id]
+  (let [prefix (first concept-id)
+        seq-num (re-find #"\d+" concept-id)
+        provider-id (get (re-find #"\d+-(.*)" concept-id) 1)]
+    {:concept-prefix prefix :sequence-number seq-num :provider-id provider-id}))


Version 0.4.0

Version 0.4.0

--- project.clj
+++ project.clj
@@ -1,4 +1,4 @@
-(defproject kraken-works/lein-template "0.4.0-SNAPSHOT"
+(defproject kraken-works/lein-template "0.4.0"
   :description "Leiningen template for kraken-works components"
   :url "https://github.com/democracyworks/kraken-works-lein-template"
   :license {:name "Eclipse Public License"


Remove println.

Remove println.

--- frontend/src/uxbox/main/data/shapes_impl.cljs
+++ frontend/src/uxbox/main/data/shapes_impl.cljs
@@ -25,7 +25,6 @@
   [state shape used-names page]
   (let [sid (uuid/random)
         shape (merge shape {:id sid :page page :name (generate-uniq-name used-names (:name shape) nil)})]
-    (println used-names)
     (as-> state $
       (update-in $ [:pages page :shapes] #(into [] (cons sid %)))
       (assoc-in $ [:shapes sid] shape))))


Restart peer after exception in processing loop.

--- src/onyx/peer/virtual_peer.clj
+++ src/onyx/peer/virtual_peer.clj
@@ -46,7 +46,8 @@
             (when (:lifecycle state)
               (component/stop @(:lifecycle state)))))))
     (catch Throwable e
-      (taoensso.timbre/error e (str e) "Error in processing loop"))
+      (taoensso.timbre/error e (str e) "Error in processing loop. Restarting.")
+      (close! restart-ch))
     (finally
      (taoensso.timbre/info "Fell out of processing loop"))))


Validate that input/output tasks have :onyx/plugin

--- src/onyx/static/validation.clj
+++ src/onyx/static/validation.clj
@@ -24,7 +24,8 @@

 (def catalog-entry-validator
   (schema/conditional #(or (= (:onyx/type %) :input) (= (:onyx/type %) :output))
-                      (merge base-catalog-entry-validator {:onyx/medium schema/Keyword})
+                      (merge base-catalog-entry-validator {:onyx/plugin schema/Keyword
+                                                           :onyx/medium schema/Keyword})
                       :else
                       (merge base-catalog-entry-validator {:onyx/fn schema/Keyword})))


util/hadoop.clj: add standard-map/reduce fns, use util.log

--- src/org/altlaw/util/hadoop.clj
+++ src/org/altlaw/util/hadoop.clj
@@ -34,8 +34,6 @@
   (let [the-name (str (name (ns-name *ns*)))]
     `(do
        (import-hadoop)
-
-       (def ~'*log* (org.apache.commons.logging.LogFactory/getLog ~the-name))

        (gen-class
         :name ~the-name
@@ -79,6 +77,32 @@
   [stage corpus]
   (str (job-path stage corpus) "/docids.tsv.gz"))

+(defn standard-map [this wkey wvalue output reporter]
+  (let [key (read-string (str wkey))
+        value (read-string (str wvalue))]
+    (log/debug "Mapper input: " (pr-str key)
+               " => " (log/logstr value))
+    (binding [*reporter* reporter]
+      (doseq [[key value] (my-map key value)]
+        (log/debug "Mapper OUTPUT: " (pr-str key)
+                   " => " (log/logstr value))
+        (.collect output (Text. (pr-str key))
+                  (Text. (pr-str value)))))))
+
+(defn standard-reduce [this wkey wvalues-iter output reporter]
+  (let [key (read-string (str wkey))
+        values (map #(read-string (str %)) (iterator-seq wvalues-iter))]
+    (log/debug "Reducer input: " (pr-str key)
+               " => " (log/logstr values))
+    (binding [*reporter* reporter]
+      (doseq [[key value] (my-reduce key value)]
+        (log/debug "Reducer OUTPUT: " (pr-str key)
+                   " => " (log/logstr value))
+        (.collect output (Text. (pr-str key))
+                  (Text. (pr-str value)))))))
+
+
+
 ;; (defmulti conf [job key value]
 ;;           (fn [job key value] key))


render list of projects

render list of projects

--- src/os/hashobject/views/index.clj
+++ src/os/hashobject/views/index.clj
@@ -6,7 +6,8 @@

 (defn render-project [project]
-  [:li.project (:name project)])
+  [:li.project
+   [:a {:href (:name project)} (:name project)]])

 (defn index [projects]


Removed definition of scale as it's a misleading term in the context.

--- src/overtunes/songs/at_all.clj
+++ src/overtunes/songs/at_all.clj
@@ -11,8 +11,7 @@
 (defn after [timing offset] #(timing (+ offset %)))
 (defn tempo [timing factor] #(timing (/ % factor)))

-(def scale 60)
-(defn ground [note] (+ scale note))
+(defn ground [note] (+ 60 note))

 (def note# (comp sampled-piano ground))
 (defn chord# [chord] (doseq [note (vals chord)] (note# note)))


Don't add entry to :cljs-opts-seq if boot-cljs does attach metadata

--- src/powerlaces/boot_figreload.clj
+++ src/powerlaces/boot_figreload.clj
@@ -87,12 +87,13 @@

 (defn cljs-opts-seq
   "Return a sequence of compiler options given boot's .cljs.edn files on
-  the fileset."
+  the fileset. If no :adzerk.boot-cljs/opts key is found on the tmpfile,
+  no entry is added to the output sequence."
   [tmpfiles]
-  (mapv #(-> {}
-             (assoc :build-id (-> % b/tmp-file .getPath util/build-id))
-             (merge (:adzerk.boot-cljs/opts %)))
-        tmpfiles))
+  (->> tmpfiles
+       (map #(when-let [opts (:adzerk.boot-cljs/opts %)]
+               (assoc opts :build-id (-> % b/tmp-file .getPath util/build-id))))
+       (remove nil?)))

 (defn make-build-config
   "Return an ClojureScript build configuration map akin to leinengen and


Standardize population app

Standardize population app

--- src/com/puppetlabs/puppetdb/http/experimental/population.clj
+++ src/com/puppetlabs/puppetdb/http/experimental/population.clj
@@ -3,23 +3,21 @@
             [com.puppetlabs.http :as pl-http]
             [ring.util.response :as rr])
   (:use [com.puppetlabs.jdbc :only (with-transacted-connection)]
+        com.puppetlabs.middleware
         [net.cgrand.moustache :only [app]]))

 (defn get-exported-resources
   "Ring app for fetching a map from exported resource to nodes exporting and
   collecting that resource."
-  [{:keys [params headers globals] :as request}]
-  (cond
-   (not (pl-http/acceptable-content-type
-         "application/json"
-         (headers "accept")))
-   (-> (rr/response "must accept application/json"))
+  [db]
+  (with-transacted-connection db
+    (pl-http/json-response (p/correlate-exported-resources))))

-   :else
-   (with-transacted-connection (:scf-db globals)
-     (pl-http/json-response (p/correlate-exported-resources)))))
+(def routes
+  (app
+    ["exported-resources"]
+    {:get (fn [{:keys [globals]}]
+            (get-exported-resources (:scf-db globals)))}))

 (def population-app
-  (app
-   ["exported-resources"]
-   {:get get-exported-resources}))
+  (verify-accepts-json routes))


Don't know: Tests for EL-gfp-exploration fail sporadically

So made the corresponding test case to show all unequal GCIs, instead of
only the first one.

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

--- src/conexp/contrib/tests/dl/languages/EL_gfp_exploration.clj
+++ src/conexp/contrib/tests/dl/languages/EL_gfp_exploration.clj
@@ -18,23 +18,25 @@
 ;;;

 (deftest- model-gcis-returns-correct-result
-  (are [model initial-ordering result] (if-let [[a b] ((fn find-first-unequal [seq-1 seq-2]
-                                                         (when-not (and (empty? seq-1)
-                                                                        (empty? seq-2))
-                                                           (let [a (first seq-1),
-                                                                 b (first seq-2)]
-                                                             (if (not= a b)
-                                                               [a b]
-                                                               (find-first-unequal (rest seq-1)
-                                                                                (rest seq-2))))))
-                                                       (model-gcis model 'initial-ordering)
-                                                       result)]
-                                         (do
-                                           (println "First unequal:")
-                                           (println "Got:" a)
-                                           (println "Exp:" b)
-                                           false)
-                                         true)
+  (are [model initial-ordering result] (letfn [(find-all-unequal [seq-1 seq-2]
+                                                 (when-not (and (empty? seq-1)
+                                                                (empty? seq-2))
+                                                   (let [a (first seq-1),
+                                                         b (first seq-2)]
+                                                     (if (not= a b)
+                                                       (cons [a b]
+                                                             (find-all-unequal (rest seq-1) (rest seq-2)))
+                                                       (find-all-unequal (rest seq-1) (rest seq-2))))))]
+                                         (let [unequals (find-all-unequal (model-gcis model 'initial-ordering)
+                                                                          result)]
+                                           (if-not (empty? unequals)
+                                             (do
+                                               (doseq [[a b] unequals]
+                                                 (println "Unequal:")
+                                                 (println "Got:" a)
+                                                 (println "Exp:" b))
+                                               false)
+                                             true)))
        paper-model [Male Female Father Mother]
        (with-dl SimpleDL
          (list (subsumption (and Male Female)
@@ -58,16 +60,16 @@
        small-model [Female Mother Male Father]
        (with-dl SimpleDL
          (list (subsumption (and Mother)
-                            (and Female (exists HasChild (and Female))))
+                            (and (exists HasChild (and Female)) Female))
                (subsumption (and Male)
                             (and Father))
                (subsumption (and Father)
                             (and Male))
                (subsumption (and (exists HasChild (and)))
                             (and (exists HasChild (and Female))))
-               (subsumption (and (exists HasChild (and)) Female)
+               (subsumption (and (exists HasChild (and Female)) Female)
                             (and Mother))
-               (subsumption (and Male Mother)
+               (subsumption (and Mother Male)
                             (and [(tbox All (and Father Mother (exists HasChild All))),
                                   All]))
                (subsumption (and (exists HasChild (and (exists HasChild (and Female)))))


greatly improves styling on inline component

--- src/datafrisk/core.cljs
+++ src/datafrisk/core.cljs
@@ -193,19 +193,27 @@
     (fn [& data]
       (let [data-frisk (:data-frisk @state-atom)
             visible? (:visible? data-frisk)]
-        [:div {:style (merge {:padding-top "10px"
-                              :max-height (if visible? "200px" 0)
-                              :flex-flow "row nowrap"
+        [:div {:style (merge {:flex-flow "row nowrap"
                               :transition "all 0.3s ease-out"
                               :z-index "5"}
+                             (when-not visible?
+                               {:overflow-x "hide"
+                                :overflow-y "hide"
+                                :max-height "30px"
+                                :max-width "100px"})
                              (:shell styles))}
          [FriskInlineVisibilityButton visible? (fn [_] (swap! state-atom assoc-in [:data-frisk :visible?] (not visible?)))]
          [:span "Data frisk"]
-         [:div {:style {:padding "10px"
-                        :height "100%"
-                        :box-sizing "border-box"
-                        :overflow-y "auto"}}
-          (map-indexed (fn [id x]
-                         ^{:key id} [Root x id state-atom]) data)]]))))
-
-
+         (when visible?
+           [:div {:style {:padding "10px"
+                          ;; TODO Make the max height and width adjustable
+                          :max-height "300px"
+                          :max-width "800px"
+                          :height "100%"
+                          :box-sizing "border-box"
+                          :overflow-x "auto"
+                          :overflow-y "auto"}}
+            (map-indexed (fn [id x]
+                           ^{:key id} [Root x id state-atom]) data)])]))))
+
+


Add more things required by itunes.

Add more things required by itunes.

--- src/defragment/feed.clj
+++ src/defragment/feed.clj
@@ -62,6 +62,7 @@
     (merge {:date (ymd-to-date [y m d])
             :show (if (-> show empty?) "" (unogg show))
             :basename f
+            :length (-> full-file jio/file .length)
             :link (str link f)
             :full-file full-file}
            (read-header full-file))))
@@ -93,7 +94,7 @@
 (defn format-item
   "logentry comes in from the view as :key date, :id guid, :value message.
    Change these to XML item elements for RSS feed."
-  [{:keys [file show date link date title artist]}]
+  [{:keys [file show date link date title artist length]}]
   (let [full-title (umisc/inter-str " - " [artist title])]
     (xml/element :item {}
                  (xml/element :title {}
@@ -102,8 +103,8 @@
                               full-title)
                  (xml/element :content:encoded {}
                               )
-                 (xml/element :enclosure:url {:type "audio/ogg"}
-                              ;; TODO: add length= in bytes
+                 (xml/element :enclosure:url {:type "audio/ogg"
+                                              :length length}
                               link)
                  (xml/element :itunes:duration {}
                               ;; TODO: XXX no, this must be th real duration. pull it out
@@ -155,7 +156,7 @@
              (xml/element :copyright {}
                           "sharenjoy")
              (xml/element :webMaster {}
-                          "info@spaz.org")
+                          "info@spaz.org (S.P.A.Z. Infoline)")
              (xml/element :language {}
                           "en")
              (xml/element :generator {}


Remove unused function (#273)

Remove unused function (#273)

--- src/refactor_nrepl/ns/rebuild.clj
+++ src/refactor_nrepl/ns/rebuild.clj
@@ -153,12 +153,6 @@
    (for [libspec libspecs]
      (create-libspec libspec))))

-(defn- create-prefixed-libspec-vector
-  [libspecs]
-  (vec
-   (for [{:keys [ns] :as libspec} libspecs]
-     (create-libspec (assoc libspec :ns (ns-suffix ns))))))
-
 (defn- create-prefixed-libspec-vectors
   [[libspec & more :as libspecs]]
   (if-not (:prefix-rewriting config/*config*)


Slightly faster and idiomatic put-string

--- src/robinson/swingterminal.clj
+++ src/robinson/swingterminal.clj
@@ -1,5 +1,6 @@
 ;; Functions for rendering state to screen
 (ns robinson.swingterminal
+  (:use     robinson.common)
   (:require [taoensso.timbre :as timbre])
   (:import
             java.util.concurrent.LinkedBlockingQueue
@@ -81,10 +82,12 @@
           default-bg-color (Color. (long default-bg-color-g) (long default-bg-color-g) (long default-bg-color-b))
           character-map    (atom (vec (repeat rows (vec (repeat columns (TerminalCharacter. \space default-fg-color default-bg-color #{}))))))
           cursor-xy        (atom nil)
+          offscreen-buffer (atom nil)
           key-queue        (LinkedBlockingQueue.)
           on-key-fn        (or on-key-fn
                                (fn default-on-key-fn [k]
                                  (.add key-queue k)))
+          image-observer   (atom nil)
           terminal-renderer (proxy [JComponent] []
                              (getPreferredSize []
                                (let [graphics      ^Graphics    (proxy-super getGraphics)
@@ -95,52 +98,57 @@
                                      char-height                (/ screen-height rows)]
                                  (Dimension. screen-width screen-height)))
                              (paintComponent [^Graphics graphics]
-                               (let [graphics-2d ^Graphics2D   (.create graphics)
-                                     font-metrics ^FontMetrics (.getFontMetrics graphics normal-font)
-                                     screen-width              (* columns (.charWidth font-metrics \space))
-                                     screen-height             (* rows (.getHeight font-metrics))
-                                     char-width                (/ screen-width columns)
-                                     char-height               (/ screen-height rows)]
-                                 (doto graphics-2d
-                                   (.setFont normal-font)
-                                   (.setColor default-bg-color)
-                                   (.setRenderingHint RenderingHints/KEY_ANTIALIASING RenderingHints/VALUE_ANTIALIAS_ON)
-                                   (.setRenderingHint RenderingHints/KEY_RENDERING RenderingHints/VALUE_RENDER_QUALITY)
-                                   (.fillRect 0 0 screen-width screen-height))
-                                 ;(doseq [row (range rows)]
-                                 ;  (println (apply str (map #(get % :character) (get @character-map row)))))
-                                 (doseq [row (range rows)
-                                         col (range columns)]
-                                   (let [c        (get-in @character-map [row col])
-                                         x        (long (* col char-width))
-                                         y        (long (- (* (inc row) char-height) (.getDescent font-metrics)))
-                                         fg-color (if (= @cursor-xy [col row])
-                                                    (get c :bg-color)
-                                                    (get c :fg-color))
-                                         bg-color (if  (= @cursor-xy [col row])
-                                                    (get c :fg-color)
-                                                    (get c :bg-color))
-                                         s        (str (get c :character))
-                                         style    (get c :style)]
-                                     (when (not= bg-color default-bg-color)
-                                       ;(println "filling rect" (* col char-width) (* row char-height) char-width char-height bg-color)
-                                       (doto graphics-2d
-                                         (.setColor bg-color)
-                                         (.fillRect (* col char-width) (* row char-height) char-width char-height)))
-                                     (when (not= s " ")
-                                       ;(println "drawing" s "@" x y fg-color bg-color)
-                                       (doto graphics-2d
-                                         (.setColor fg-color)
-                                         (.drawString s x y)))
-                                     (when (contains? style :underline)
-                                       (let [y (dec (* (inc row) char-height))]
-                                         (doto graphics-2d
+                               (log-time "blit"
+                                 (let [graphics-2d ^Graphics2D   (.create graphics)
+                                       font-metrics ^FontMetrics (.getFontMetrics graphics normal-font)
+                                       screen-width              (* columns (.charWidth font-metrics \space))
+                                       screen-height             (* rows (.getHeight font-metrics))
+                                       char-width                (/ screen-width columns)
+                                       char-height               (/ screen-height rows)
+                                       _                         (compare-and-set! offscreen-buffer nil (proxy-super createVolatileImage screen-width screen-height))
+                                       offscreen-graphics-2d     (.getGraphics @offscreen-buffer)]
+                                   (doto offscreen-graphics-2d
+                                     (.setFont normal-font)
+                                     (.setColor default-bg-color)
+                                     (.setRenderingHint RenderingHints/KEY_ANTIALIASING RenderingHints/VALUE_ANTIALIAS_ON)
+                                     (.setRenderingHint RenderingHints/KEY_RENDERING RenderingHints/VALUE_RENDER_QUALITY)
+                                     (.fillRect 0 0 screen-width screen-height))
+                                   ;(doseq [row (range rows)]
+                                   ;  (println (apply str (map #(get % :character) (get @character-map row)))))
+                                   (doseq [row (range rows)
+                                           col (range columns)]
+                                     (let [c        (get-in @character-map [row col])
+                                           x        (long (* col char-width))
+                                           y        (long (- (* (inc row) char-height) (.getDescent font-metrics)))
+                                           fg-color (if (= @cursor-xy [col row])
+                                                      (get c :bg-color)
+                                                      (get c :fg-color))
+                                           bg-color (if  (= @cursor-xy [col row])
+                                                      (get c :fg-color)
+                                                      (get c :bg-color))
+                                           s        (str (get c :character))
+                                           style    (get c :style)]
+                                       (when (not= bg-color default-bg-color)
+                                         ;(println "filling rect" (* col char-width) (* row char-height) char-width char-height bg-color)
+                                         (doto offscreen-graphics-2d
+                                           (.setColor bg-color)
+                                           (.fillRect (* col char-width) (* row char-height) char-width char-height)))
+                                       (when (not= s " ")
+                                         ;(println "drawing" s "@" x y fg-color bg-color)
+                                         (doto offscreen-graphics-2d
                                            (.setColor fg-color)
-                                           (.drawLine (* col char-width)
-                                                      y
-                                                      (* (inc col) char-width)
-                                                      y))))))
-                                 (.dispose graphics-2d))))
+                                           (.drawString s x y)))
+                                       (when (contains? style :underline)
+                                         (let [y (dec (* (inc row) char-height))]
+                                           (doto offscreen-graphics-2d
+                                             (.setColor fg-color)
+                                             (.drawLine (* col char-width)
+                                                        y
+                                                        (* (inc col) char-width)
+                                                        y))))))
+                                   (.drawImage graphics @offscreen-buffer 0 0 @image-observer)
+                                   #_(.dispose graphics-2d)))))
+          _                (reset! image-observer terminal-renderer)
           keyListener      (reify KeyListener
                              (keyPressed [this e]
                                ;(println "keyPressed keyCode" (.getKeyCode e) "escape" KeyEvent/VK_ESCAPE "escape?" (= (.getKeyCode e) KeyEvent/VK_ESCAPE))
@@ -204,12 +212,20 @@
             (let [fg-color (Color. (long (fg 0)) (long (fg 1)) (long (fg 2)))
                   bg-color (Color. (long (bg 0)) (long (bg 1)) (long (bg 2)))
                   s ^String string
-                  string-length (.length s)]
-              (for-loop [i 0 (< i string-length) (inc i)]
-                (let [col (+ col i)]
-                  (when (< -1 col columns)
-                    (let [character (TerminalCharacter. (.charAt s i) fg-color bg-color style)]
-                      (reset! character-map (assoc-in @character-map [row col] character)))))))))
+                  string-length (.length s)
+                  line           (transient (get @character-map row))]
+              (swap! character-map
+                (fn [cm]
+                  (assoc cm row (persistent!
+                                  (reduce
+                                    (fn [line [i c]]
+                                      (let [x (+ i col)]
+                                        (if (< -1 x columns)
+                                          (let [character (TerminalCharacter. c fg-color bg-color style)]
+                                            (assoc! line (+ i col) character))
+                                          line)))
+                                    line
+                                    (map-indexed vector s)))))))))
         (wait-for-key [this]
           (.take key-queue))
         (set-cursor [this xy]


Patch up prepare.

Patch up prepare.

--- src/onyx/log/commands/prepare_join_cluster.clj
+++ src/onyx/log/commands/prepare_join_cluster.clj
@@ -5,20 +5,8 @@
             [onyx.log.commands.common :as common]
             [onyx.extensions :as extensions]
             [onyx.peer.operation :as operation]
-            [onyx.scheduling.common-job-scheduler :as cjs]
+            [onyx.scheduling.common-job-scheduler :refer [reconfigure-cluster-workload]]
             [taoensso.timbre :refer [info] :as timbre]))
-
-(defn anticipating-coverage? [old new job-id]
-  (let [n-tasks (count (get-in new [:tasks job-id]))
-        n-tasks-covered (count (get-in new [:allocations job-id]))
-        n-volunteering (->> (:peers new)
-                            (filter #(cjs/reallocate-from-job? (:job-scheduler old) old new {:id %}))
-                            (count))]
-    (>= n-volunteering (- n-tasks n-tasks-covered))))
-
-(defn volunteer? [old new state job-id]
-  (and (cjs/reallocate-from-job? (:job-scheduler old) old new state)
-       (anticipating-coverage? old new job-id)))

 (defn add-site [replica {:keys [joiner peer-site]}]
   (-> replica
@@ -46,13 +34,15 @@
                 watcher (nth sorted-candidates index)]
             (-> replica
                 (update-in [:prepared] merge {watcher joining-peer})
-                (add-site args)))
+                (add-site args)
+                (reconfigure-cluster-workload)))
           replica))
       (-> replica
           (update-in [:peers] conj (:joiner args))
           (update-in [:peers] vec)
           (assoc-in [:peer-state (:joiner args)] :idle)
-          (add-site args)))))
+          (add-site args)
+          (reconfigure-cluster-workload)))))

 (defmethod extensions/replica-diff :prepare-join-cluster
   [entry old new]
@@ -79,38 +69,34 @@
           :args {:observer (:subject diff)
                  :subject (or (get (:pairs new) (:observer diff))
                               (:observer diff))}
-          :immediate? true}]
-        (and (:instant-join diff)
-             (= (:id peer-args) (:joiner (:args entry)))
-             (seq (:jobs new))
-             (volunteer? old new peer-args (:job peer-args)))
-        (do ;; SCHEDULER TODO: << Removed volunteer >>
-          nil)))
+          :immediate? true}]))

 (defmethod extensions/fire-side-effects! :prepare-join-cluster
   [{:keys [args]} old new diff state]
-  (cond (= (:id state) (:observer diff))
-        (let [ch (chan 1)]
-          (extensions/on-delete (:log state) (:subject diff) ch)
-          (go (when (<! ch)
-                (extensions/write-log-entry
-                 (:log state)
-                 {:fn :leave-cluster :args {:id (:subject diff)}}))
-              (close! ch))
-          (assoc state :watch-ch ch))
-        (= (:id state) (:subject diff))
-        (let [ch (chan 1)]
-          (extensions/on-delete (:log state) (:observer diff) ch)
-          (go (when (<! ch)
-                (extensions/write-log-entry
-                 (:log state)
-                 {:fn :leave-cluster :args {:id (:observer diff)}}))
-              (close! ch))
-          (assoc state :watch-ch ch))
-        (= (:id state) (:instant-join diff))
-        (do (extensions/open-peer-site (:messenger state)
-                                       (get-in new [:peer-sites (:id state)]))
-            (doseq [entry (:buffered-outbox state)]
-              (>!! (:outbox-ch state) entry))
-            (assoc (dissoc state :buffered-outbox) :stall-output? false))
-        :else state))
+  (common/start-new-lifecycle
+   (cond (= (:id state) (:observer diff))
+         (let [ch (chan 1)]
+           (extensions/on-delete (:log state) (:subject diff) ch)
+           (go (when (<! ch)
+                 (extensions/write-log-entry
+                  (:log state)
+                  {:fn :leave-cluster :args {:id (:subject diff)}}))
+               (close! ch))
+           (assoc state :watch-ch ch))
+         (= (:id state) (:subject diff))
+         (let [ch (chan 1)]
+           (extensions/on-delete (:log state) (:observer diff) ch)
+           (go (when (<! ch)
+                 (extensions/write-log-entry
+                  (:log state)
+                  {:fn :leave-cluster :args {:id (:observer diff)}}))
+               (close! ch))
+           (assoc state :watch-ch ch))
+         (= (:id state) (:instant-join diff))
+         (do (extensions/open-peer-site (:messenger state)
+                                        (get-in new [:peer-sites (:id state)]))
+             (doseq [entry (:buffered-outbox state)]
+               (>!! (:outbox-ch state) entry))
+             (assoc (dissoc state :buffered-outbox) :stall-output? false))
+         :else state)
+   diff))


+TODO

+TODO

--- src/babel/english/morphology.cljc
+++ src/babel/english/morphology.cljc
@@ -846,6 +846,7 @@
 (def english-specific-rules
   (list agreement))

+;; TODO: rewrite with recur or map or similar, rather than recursively.
 (defn exception-generator [lexicon]
   (if (not (empty? lexicon))
     (let [lexeme-kv (first lexicon)


clean up some declares

clean up some declares

--- src/cljs/cljs/core.cljs
+++ src/cljs/cljs/core.cljs
@@ -1112,6 +1112,7 @@
             (if (f y x) 1 0)))))))

 (declare to-array)
+
 (defn sort
   "Returns a sorted sequence of the items in coll. Comp can be
    boolean-valued comparison funcion, or a -/0/+ valued comparator.
@@ -2902,9 +2903,7 @@
              ret))))

 (declare tv-editable-root tv-editable-tail TransientVector deref
-         pr-sequential pr-sequential-writer pr-writer)
-
-(declare chunked-seq)
+         pr-sequential pr-sequential-writer pr-writer chunked-seq)

 (deftype PersistentVector [meta cnt shift root tail ^:mutable __hash]
   Object


using login from pages

using login from pages

--- src/cljs/ohds/core.cljs
+++ src/cljs/ohds/core.cljs
@@ -23,7 +23,6 @@
 (defn do-login [username password]
   (swap! app-state assoc :page :location)
   (println "Logging in" username password @app-state))
-

 (defn login-page []
   (let [username (atom "Username")
@@ -51,7 +50,7 @@
    [:div {:style {:padding "20px"}}]
    [:div
     (case (:page @app-state)
-      :login [login-page]
+      :login [p/login-page do-login app-state]
       :location [location-page])]])

 (defn main []


Forbit concatanation of "+ +" or "- -"

Forbit concatanation of "+ +" or "- -"

This dirty and incomplete hack should be reworked to cover all possible
cases

--- src/harnocode/core.cljs
+++ src/harnocode/core.cljs
@@ -112,7 +112,8 @@
                     tok-line   #(get-in % [:loc :end :line])
                     same-line? #(= (tok-line %1) (tok-line %2))

-                    need-space (and (not-punct? t1) (not-punct? t2))
+                    need-space (or (and (not-punct? t1) (not-punct? t2))
+                                   (and (= (:value t1) (:value t2))))       ; hack to fix cases like "+ +" -> "++". would be nice to make finer condition
                     glue-toks  (and (same-line? t1 t2)
                                     (or (contains? #{"++" "--"} (:value t2))
                                         (contains? #{"continue" "break" "return" "throw"} (:value t1))))]


Use RussianLightStemmer.

Use RussianLightStemmer.

--- src/clucy/analyzers.clj
+++ src/clucy/analyzers.clj
@@ -67,7 +67,8 @@
   {:en EnglishStemmer
    :fr FrenchStemmer
    :de GermanStemmer
-   :ru RussianStemmer})
+   :ru RussianStemmer
+   :ru-light RussianLightStemmer})

 (defn- build-analyzer
   ([analyzer-class]


flex-direction -> flexDirection

flex-direction -> flexDirection

--- src/blue_salamander/graphics.cljs
+++ src/blue_salamander/graphics.cljs
@@ -220,11 +220,11 @@
                 menutop (* h 0.6)]
             (if (= mode :victorymenu)
               ;; got all orbs, show completion screen
-              (dom/div #js {:style #js {:display "flex" :flex-direction "column" :position "absolute" :top "0px" :left "0px" :width w :height h :color "white" :fontSize 30}}
+              (dom/div #js {:style #js {:display "flex" :flexDirection "column" :position "absolute" :top "0px" :left "0px" :width w :height h :color "white" :fontSize 30}}
                        (dom/div #js {:style #js {:margin "auto"}} "All orbs gathered!")
                        (dom/div #js {:style #js {:margin "auto"}} "Press space for new level"))
               ;; otherwise show startup screen
-              (dom/div #js {:style #js {:display "flex" :flex-direction "column" :position "absolute" :top "0px" :left "0px" :width w :height h :color "white" :fontSize 30}}
+              (dom/div #js {:style #js {:display "flex" :flexDirection "column" :position "absolute" :top "0px" :left "0px" :width w :height h :color "white" :fontSize 30}}
                        (dom/div #js {:style #js { :margin "auto"}} "Blue Salamander")
                        (dom/div #js {:style #js { :margin "auto"}} "Press space to start"))))))
 (def game-menu (om/factory GameMenu {:keyfn :key}))
@@ -245,7 +245,7 @@
                  mesh-assets :assets/meshes
                  mode :gamemode
                  orbdata :orbs} props
-                rendererprops {:width width :height height :rapidrender false}
+                rendererprops {:width width :height height :rapidrender false :style {:position "absolute" :top 0 :left 0}}
                 sceneprops (assoc rendererprops :camera "playercamera")]
             ;; until assets are loaded, just say "loading..."
             (if (or (nil? texture-assets)
@@ -271,7 +271,7 @@
                        (if (not= mode :playing)
                          (game-menu {:gamemode mode :width width :height height})
                          (dom/div #js
-                                  {:style #js {:position "absolute" :top "20px" :left "20px" :color "white" :fontSize 30}}
+                                  {:style #js { :position "absolute" :top "20px" :left "20px" :color "white" :fontSize 30}}
                                   (str "Orbs remaining: " (count orbdata)))))))))

@@ -282,6 +282,10 @@
                                    :root-unmount js/ReactTHREE.unmountComponentAtNode})]
     (om/add-root! reconciler
                   GameScreen
-                  (gdom/getElement "app"))))
-
-
+                  (gdom/getElement "app"))
+    ;; catch resize events and update the canvas
+    (aset js/window "onresize" (fn [] (swap! app-state #(assoc %
+                                                          :screen/width (.-innerWidth js/window)
+                                                          :screen/height (.-innerHeight js/window)))))))
+
+


tests for Argus Security and Nisei Division

--- src/clj/test/cards-identities.clj
+++ src/clj/test/cards-identities.clj
@@ -1,4 +1,28 @@
 (in-ns 'test.core)
+
+(deftest argus-security
+  "Argus Security - Runner chooses to take 1 tag or 2 meat damage when stealing an agenda"
+  (do-game
+    (new-game
+      (make-deck "Argus Security: Protection Guaranteed" [(qty "Hostile Takeover" 2)])
+      (default-runner))
+    (play-from-hand state :corp "Hostile Takeover" "New remote")
+    (play-from-hand state :corp "Hostile Takeover" "New remote")
+    (take-credits state :corp)
+    (let [ht1 (get-in @state [:corp :servers :remote1 :content 0])
+          ht2 (get-in @state [:corp :servers :remote2 :content 0])]
+      (core/click-run state :runner {:server "Server 1"})
+      (core/no-action state :corp nil)
+      (core/successful-run state :runner nil)
+      (prompt-choice :runner "Steal")
+      (prompt-choice :runner "1 tag")
+      (is (= 1 (:tag (get-runner))) "Took 1 tag from stealing an agenda")
+      (core/click-run state :runner {:server "Server 2"})
+      (core/no-action state :corp nil)
+      (core/successful-run state :runner nil)
+      (prompt-choice :runner "Steal")
+      (prompt-choice :runner "2 meat damage")
+      (is (= 2 (count (:discard (get-runner)))) "Took 2 meat damage from stealing an agenda"))))

 (deftest cerebral-imaging-max-hand-size
   "Cerebral Imaging - Maximum hand size equal to credits"
@@ -133,6 +157,32 @@
       (is (= 3 (:credit (get-runner))))
       (card-ability state :runner nasir 0)
       (is (= 2 (:credit (get-runner)))))))
+
+(deftest nisei-division
+  "Nisei Division - Gain 1 credit from every psi game"
+  (do-game
+    (new-game
+      (make-deck "Nisei Division: The Next Generation" [(qty "Snowflake" 2)])
+      (default-runner))
+    (play-from-hand state :corp "Snowflake" "HQ")
+    (play-from-hand state :corp "Snowflake" "HQ")
+    (take-credits state :corp)
+    (let [s1 (get-in @state [:corp :servers :hq :ices 0])
+          s2 (get-in @state [:corp :servers :hq :ices 1])]
+      (core/click-run state :runner {:server "HQ"})
+      (core/rez state :corp s2)
+      (is (= 4 (:credit (get-corp))))
+      (card-ability state :corp s2 0)
+      (prompt-choice :corp "0 [Credits]")
+      (prompt-choice :runner "0 [Credits]")
+      (is (= 5 (:credit (get-corp))) "Gained 1 credit from psi game")
+      (core/no-action state :corp nil)
+      (core/rez state :corp s1)
+      (is (= 4 (:credit (get-corp))))
+      (card-ability state :corp s1 0)
+      (prompt-choice :corp "0 [Credits]")
+      (prompt-choice :runner "1 [Credits]")
+      (is (= 5 (:credit (get-corp))) "Gained 1 credit from psi game"))))

 (deftest quetzal-ability
   "Quetzal ability- once per turn"


refinements to accounts

refinements to accounts

make left-side? public
allow accounts to be filtered by type

--- src/clj_money/models/accounts.clj
+++ src/clj_money/models/accounts.clj
@@ -161,10 +161,14 @@

 (defn select-by-entity-id
   "Returns a list of all accounts in the system"
-  [storage-spec entity-id]
-  (with-storage [s storage-spec]
-    (map prepare-for-return
-         (select-accounts-by-entity-id s entity-id))))
+  ([storage-spec entity-id] (select-by-entity-id storage-spec entity-id {}))
+  ([storage-spec entity-id options]
+   (with-storage [s storage-spec]
+     (let [types (or (:include options)
+                     (set account-types))]
+       (->> (select-accounts-by-entity-id s entity-id)
+            (map prepare-for-return)
+            (filter #(types (:type %))))))))

 (defn- append-children
   [account all-accounts]
@@ -221,7 +225,7 @@
   (with-storage [s storage-spec]
     (delete-account s id)))

-(defn- left-side?
+(defn left-side?
   "Returns truthy if the specified account is asset or expense, falsey if anything else"
   [account]
   (#{:asset :expense} (:type account)))


Propagate exceptions

Propagate exceptions

--- src/clj_simple_chart/rhinoexp.clj
+++ src/clj_simple_chart/rhinoexp.clj
@@ -7,7 +7,9 @@
            (java.nio.charset StandardCharsets)))

 (defonce input (async/chan))
+(defonce exit (async/chan))
 (defonce output (async/chan))
+(defonce exception (async/chan))

 (defn js-handle [fn]
   (println "executing stuff in " (Thread/currentThread))
@@ -16,13 +18,20 @@
 (defn js-loop []
   (async/thread (while true
                   (let [fn (async/<!! input)]
-                    (async/>!! output (js-handle fn))))))
+                    (try
+                      (async/>!! output (js-handle fn))
+                      (catch Exception e
+                        (println "error in js-loop ..." (.getMessage e))
+                        (async/>!! exception e)))))))

 (defonce js-loop-thread (js-loop))

 (defn run-js-thread [f]
   (async/>!! input f)
-  (async/<!! output))
+  (let [[result ch] (async/alts!! [output exception])]
+    (if (= ch exception)
+      (throw result)
+      result)))

 ;;; ;;; ;;; STATE
 (defonce cx (atom nil))
@@ -56,46 +65,46 @@
   (when-not @cx (run-js-thread bootstrap-rhino)))

 (defn load-font [filename]
-  (when-not (get @fonts filename)
+  (if-not (get @fonts filename)
     (let [font-bytes (FileUtils/readFileToByteArray (File. filename))
           font-b64 (String. (base64/encode-bytes font-bytes))]
       (run-js-thread (fn []
                        (swap! fonts (fn [old-fonts]
                                       (println "loading font" filename)
                                       (assoc old-fonts filename (.call @parsefont @cx @scope @scope (object-array [font-b64])))))))
-      :done)))
+      :done)
+    :already-loaded))

-  (defn load-fonts []
-    (bootstrap-rhino-if-needed)
-    (doall (map load-font ["./resources/fonts/Roboto-Black.ttf"
-                           "./resources/fonts/Roboto-Regular.ttf"])))
+(defn load-fonts []
+  (bootstrap-rhino-if-needed)
+  (doall (map load-font ["./resources/fonts/Roboto-Black.ttf"
+                         "./resources/fonts/Roboto-Regular.ttf"])))

+;
+;(defn js-to-clj [x]
+;  (zipmap (map keyword (keys x)) (vals x)))
+;
+;

-  ;
-  ;(defn js-to-clj [x]
-  ;  (zipmap (map keyword (keys x)) (vals x)))
-  ;
-  ;
-
-  #_(defn get-path
-      [text size]
-      (let [font-bytes (FileUtils/readFileToByteArray (File. "./resources/fonts/Roboto-Black.ttf"))
-            cx (set-lang-version (Context/enter))
-            scope (.initStandardObjects cx)]
-        (load-jvm-npm cx scope)
-        (eval-str cx scope "var opentype = require('./resources/opentype.js');")
-        (eval-str cx scope "var b64 = require('./resources/base64-arraybuffer.js');")
-        (eval-str cx scope (str "var base64 = '" (String. (base64/encode-bytes font-bytes)) "';"))
-        (eval-str cx scope "var ab = b64.decode(base64);")
-        (eval-str cx scope "var font = opentype.parse(ab);")
-        (time (let [font (.get scope "font")
-                    getPath (NativeObject/getProperty font "getPath")
-                    path (.call getPath cx scope font (object-array [text 0 0 size]))
-                    bb-fn (NativeObject/getProperty path "getBoundingBox")
-                    to-path-data-fn (NativeObject/getProperty path "toPathData")
-                    bb (.call bb-fn cx scope path (object-array []))
-                    path (.call to-path-data-fn cx scope path (object-array []))
-                    result {:bounding-box (js-to-clj bb) :path path}]
-                (do result)
-                (Context/exit)
-                result))))+#_(defn get-path
+    [text size]
+    (let [font-bytes (FileUtils/readFileToByteArray (File. "./resources/fonts/Roboto-Black.ttf"))
+          cx (set-lang-version (Context/enter))
+          scope (.initStandardObjects cx)]
+      (load-jvm-npm cx scope)
+      (eval-str cx scope "var opentype = require('./resources/opentype.js');")
+      (eval-str cx scope "var b64 = require('./resources/base64-arraybuffer.js');")
+      (eval-str cx scope (str "var base64 = '" (String. (base64/encode-bytes font-bytes)) "';"))
+      (eval-str cx scope "var ab = b64.decode(base64);")
+      (eval-str cx scope "var font = opentype.parse(ab);")
+      (time (let [font (.get scope "font")
+                  getPath (NativeObject/getProperty font "getPath")
+                  path (.call getPath cx scope font (object-array [text 0 0 size]))
+                  bb-fn (NativeObject/getProperty path "getBoundingBox")
+                  to-path-data-fn (NativeObject/getProperty path "toPathData")
+                  bb (.call bb-fn cx scope path (object-array []))
+                  path (.call to-path-data-fn cx scope path (object-array []))
+                  result {:bounding-box (js-to-clj bb) :path path}]
+              (do result)
+              (Context/exit)
+              result))))


Form submits and changes app-state.

Form submits and changes app-state.

--- src/cljs/post_to_screen/core.cljs
+++ src/cljs/post_to_screen/core.cljs
@@ -5,18 +5,26 @@

 (enable-console-print!)

-(defonce app-state (atom {:text "Hello Chestnut!"}))
+(defonce app-state (atom {:posts []}))

-(defn post-form []
+(defn submit-code [posts e]
+  (let [code (-> js/document
+                 (.getElementById "code")
+                 .-value)]
+    (om/transact! posts #(conj % code))
+    (.preventDefault e)))
+
+(defn post-form [posts]
   (html
-    [:form.form-horizontal {:role "form"}
+    [:form.form-horizontal {:role "form"
+                            :on-submit (partial submit-code posts)}
      [:div.form-group
       [:label.control-label.col-xs-1 {:for "code"} "Code:"]
       [:div.col-xs-10
-       [:textarea.form-control {:rows "15"}]]]
+       [:textarea#code.form-control {:rows "15"}]]]
      [:div.form-group
       [:div.col-xs-offset-1.col-xs-10
-       [:button.btn.btn-primary {:type "submit"} "Post code"]]]]))
+       [:button.btn {:type "submit"} "Post code"]]]]))

 (defn tab-view [cursor owner]
   (reify
@@ -30,7 +38,7 @@
         [:div
          [:div.btn-group {:role "toolbar"}
           (map-indexed (fn [i tab]
-                         [(str "button.btn.btn-" (if (= i selected) "primary" "default"))
+                         [(str "button.btn.btn-default" (if (= i selected) ".active" ""))
                           {:type "button"
                            :on-click (fn [_] (om/set-state! owner [:selected] i))}
                           tab])
@@ -38,7 +46,7 @@
          [:hr]
          (case (get tabs selected)
            "Home" [:h2 "Home"]
-           "Post" (post-form))]))))
+           "Post" (post-form (:posts cursor)))]))))

 (defn application [cursor owner]
@@ -47,7 +55,7 @@
     (render [_]
       (html
         [:div.container
-         [:h1 (:text cursor)]
+         [:h1 "Post to screen"]
          (om/build tab-view cursor)]))))

 (defn main []


improve auth

improve auth

--- src/cljx/geschichte/p2p/auth.cljx
+++ src/cljx/geschichte/p2p/auth.cljx
@@ -43,56 +43,54 @@
 ;;     The user is now logged in, and doesn’t have to repeat this process again until their token expires or they want to authenticate on a new device.

 (defn- meta-published [pub-ch store trusted-hosts sessions [new-in out]]
-  (go-loop [{:keys [metas] :as p} (<! pub-ch)]
-    (let [nc (<! (new-commits! store metas))]
-      (<! (go-loop [counter 0]
-            (let [not-auth (filter #(not (@sessions (:user %))) nc)]
-              (if (empty? not-auth)
-                (do
-                  (>! new-in (assoc p ::authed true :users (set (keys @sessions))))
-                  ) ;; annotate authenticated user(s)
-                (do
-                  (>! out {:topic ::auth-required :users (set (map :user not-auth))})
-                  (<! (go-loop [p (<! pub-ch)]
-                        (if (= (:topic p) ::authed)
-                          (do
-                            (println "AUTHED" p)
-                            (swap! sessions (fn [old new] (apply assoc old new)) (:users p)))
-                          (recur (<! pub-ch)))))
-                  (if (> counter 5)
-                    (do
-                      (println "AUTH-FAILED" (set (map :user not-auth)))
-                      (>! out {:topic ::auth-failed :users (set (map :user not-auth)) :sessions @sessions}))
-                    (recur (inc counter)))))))))
+  (go-loop [{:keys [metas topic] :as p} (<! pub-ch)]
+    (when (= topic :meta-pub)
+     (let [nc (<! (new-commits! store metas))]
+       (<! (go-loop [counter 0]
+             (let [not-auth (filter #(not (@sessions (:user %))) nc)]
+               (if (empty? not-auth)
+                 (do
+                   (debug "AUTHED" (set (keys @sessions)))
+                   (>! new-in (assoc p ::authed true :users (set (keys @sessions))))
+                   (>! out {:topic ::authed :users (set (keys @sessions))}))
+                 (if (> counter 4)
+                   (do
+                     (debug "AUTH-FAILED" (set (map :user not-auth)))
+                     (>! out {:topic ::auth-failed :users (set (map :user not-auth))}))
+                  (do
+                   (>! out {:topic ::auth-required :users (set (map :user not-auth)) :tries-left (- 5 counter)})
+                   (<! (go-loop [p (<! pub-ch)]
+                         (if (= (:topic p) ::authed)
+                           (swap! sessions (fn [old new] (apply assoc old new)) (:users p))
+                           (recur (<! pub-ch)))))
+                   (recur (inc counter))))
+                 ))))))
     (recur (<! pub-ch))))

 (defn- auth-required [auth-req-ch auth-fn out]
   (go-loop [{:keys [users] :as a} (<! auth-req-ch)]
     (when a
-      (println "AUTH-REQ" a)
+      (debug "AUTH-REQ" users)
       (>! out
         {:topic ::auth
          :users (<! (auth-fn users))})
       (recur (<! auth-req-ch)))))

-(defn- authenticated [auth-ch credential-fn out]
+(defn- authenticated [auth-ch pub-ch credential-fn]
   (go-loop [a (<! auth-ch)]
     (when a
-      (println "AUTH" a)
-      (>! out
-        {:topic
-         ::authed
-         :users
-         (->> (:users a)
-              (map
-               (fn [[k v]]
-                 (vec [k
-                       (if (credential-fn {:username k :password v})
-                         (-> {(uuid) (java.util.Date.)})
-                         nil)])))
-              flatten)})
+      (let [authed-users {:topic ::authed
+                          :users (->> (:users a)
+                                      (map
+                                       (fn [[k v]]
+                                         (vec [k
+                                               (if (credential-fn {:username k :password v})
+                                                 (-> {(uuid) (java.util.Date.)})
+                                                 nil)])))
+                                      flatten)}]
+        (>! pub-ch authed-users))
       (recur (<! auth-ch)))))

@@ -101,15 +99,6 @@
     :meta-pub :meta-pub
     ::auth-required ::auth-required
     ::auth ::auth
-    ::authed ::authed
-    :unrelated))
-
-
-(defn- out-dispatch [{:keys [topic]}]
-  (case topic
-    ::auth-required ::auth-required
-    ::auth ::auth
-    ::authed ::authed
     :unrelated))

@@ -122,24 +111,19 @@
   (let [new-in (chan)
         pub-ch (chan)
         auth-ch (chan)
-        private-out (chan)
         auth-req-ch (chan)
         sessions (atom {})
-        p-in (pub in in-dispatch)
-        p-out (pub private-out out-dispatch)]
+        p-in (pub in in-dispatch)]
     (sub p-in :meta-pub pub-ch)
-    (meta-published pub-ch store trusted-hosts sessions [new-in private-out])
-
-    (sub p-out ::auth-required auth-req-ch)
+    (meta-published pub-ch store trusted-hosts sessions [new-in out])
+
+    (sub p-in ::auth-required auth-req-ch)
     (auth-required auth-req-ch auth-fn out)

-    (sub p-out ::auth auth-ch)
-    (authenticated auth-ch credential-fn out)
-
-    (sub p-out ::authed pub-ch)
+    (sub p-in ::auth auth-ch)
+    (authenticated auth-ch pub-ch credential-fn)

     (sub p-in :unrelated new-in)
-    (sub p-out :unrelated out)

     [new-in out]))

@@ -151,10 +135,10 @@
         out (chan)
         local-users {"user@mail.com" "P4ssw0rd"
                      "eve@mail.com" "lisp"
-                     "john" "satan"}
+                     "john" "haskell"}
         input-users {"user@mail.com" "P4ssw0rd"
                      "eve@mail.com" "lispo"
-                     "john" "satan"}
+                     "john" "haskell"}
         [new-in new-out] (auth (<!! (new-mem-store (atom
                                                     {"john" {42 {:id 42
                                                                  :causal-order {1 []}
@@ -172,6 +156,13 @@
                                (atom #{})
                                [in out])]

+    #_(go-loop [o (<! out)]
+      (println "OUT" o)
+      (recur (<! out)))
+    (go-loop [i (<! new-in)]
+      (println "NEW-IN" i)
+      (recur (<! new-in)))
+
     (go
       (>! in {:topic :meta-pub,
               :peer "STAGE",
@@ -184,9 +175,34 @@
                                   :branches {"master" #{2}}
                                   :schema {:type :geschichte
                                            :version 1}}}}})
-      (println "NEW-IN" (<! new-in))
+      (println "OUT" (<! out))
+      (>! in {:topic ::auth :users {"john" "häskell"}})
+      (println "OUT" (<! out))
+      (>! in {:topic ::auth :users {"john" "häskell"}})
+      (println "OUT" (<! out))
+      (>! in {:topic ::auth :users {"john" "häskell"}})
+      (println "OUT" (<! out))
+      (>! in {:topic ::auth :users {"john" "häskell"}})
+      (println "OUT" (<! out))
+      (>! in {:topic ::auth :users {"john" "häskell"}})
+      (println "OUT" (<! out))
+      (>! in {:topic :meta-pub,
+              :peer "STAGE",
+              :metas {"john" {42 {:id 42
+                                  :causal-order {1 []
+                                                 2 [1]}
+                                  :last-update (java.util.Date. 0)
+                                  :description "Bookmark collection."
+                                  :head "master"
+                                  :branches {"master" #{2}}
+                                  :schema {:type :geschichte
+                                           :version 1}}}}})
+      (println "OUT" (<! out))
+      (>! in {:topic ::auth :users {"john" "haskell"}})
+      (println "OUT" (<! out))
       ))

+
   (println "\n")


Minor improvements on data->transit helper.

--- src/clojure/catacumba/testing.clj
+++ src/clojure/catacumba/testing.clj
@@ -40,9 +40,10 @@

 (defn data->transit
   "Simple util to convert clojure data structures into transit"
-  [data]
-  (let [out (ByteArrayOutputStream.)]
-    (transit/write
-     (transit/writer out :json)
-     data)
-    (ByteArrayInputStream. (.toByteArray out))))
+  ([data]
+   (data->transit data :json))
+  ([data encoding]
+   (with-open [out (ByteArrayOutputStream.)]
+     (let [w (transit/writer out encoding)]
+       (transit/write w data)
+       (.toByteArray out)))))


Make /programmes redirect /programmes/

Make /programmes redirect /programmes/

--- src/kixi/hecuba/web.clj
+++ src/kixi/hecuba/web.clj
@@ -110,7 +110,8 @@
     ["login.html" (->WrapMiddleware (:login-form handlers) wrap-cookies)]
     ["auth" (->WrapMiddleware (:login-handler handlers) (comp wrap-params wrap-cookies))]

-    ["programmes" (->Secure (:programmes handlers) querier (:login-form handlers))]
+    ["programmes/" (->Secure (:programmes handlers) querier (:login-form handlers))]
+    ["programmes" (->Redirect 307 programmes)]

     ["chart.html" chart]
     ["counters.html" counters]


Rename "foo" subtask to "pprint"

Rename "foo" subtask to "pprint"

--- src/leiningen/droid.clj
+++ src/leiningen/droid.clj
@@ -4,6 +4,7 @@
 ;;
 (ns leiningen.droid
   (:refer-clojure :exclude [compile doall repl])
+  (:require clojure.pprint)
   (:use [leiningen.core.project :only [set-profiles]]
         [leiningen.core.main :only [abort]]
         [leiningen.help :only (subtask-help-for)]
@@ -25,10 +26,14 @@
           (println "lein-droid is a plugin for Clojure/Android development."
                    (subtask-help-for nil droid-var))))

-(defn foo
-  "This function just prints the project map."
-  [project & args]
-  (println project))
+(defn pprint
+  "Pretty-prints a representation of the project map."
+  [project & keys]
+  (if (seq keys)
+    (doseq [k keys]
+      (clojure.pprint/pprint (get project (read-string k))))
+    (clojure.pprint/pprint project))
+  (flush))

 (declare execute-subtask)

@@ -73,7 +78,7 @@
                    #'create-apk #'sign-apk #'zipalign-apk
                    #'install #'run #'forward-port #'repl
                    #'build #'apk #'deploy #'doall #'release #'help
-                   #'gather-dependencies #'jar]}
+                   #'gather-dependencies #'jar #'pprint]}
   droid
   "Supertask for Android-related tasks (see `lein droid` for list)."
   ([project]
@@ -120,7 +125,7 @@
     "jar" (jar project)

     ;; Help tasks
-    "foo" (foo project)
+    "pprint" (pprint project)
     "help" (help #'droid)

     (println "Subtask is not recognized:" name


CMR-1852: Forgot to save small change

CMR-1852: Forgot to save small change

--- umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10.clj
+++ umm-spec-lib/src/cmr/umm_spec/xml_to_umm_mappings/echo10.clj
@@ -94,8 +94,11 @@
                           :DetailedVariable (value-of sk "DetailedVariableKeyword")})
    :MetadataAssociations (for [ca (select doc "/Collection/CollectionAssociations")]
                            {
-                            ;; TODO what should I set this to
-                            :Type
+                            ;; TODO This should be set to CollectionType value as long as it matches
+                            ;; one of the allowed enumerated type values for this field. Otherwise we
+                            ;; should set it to nil.
+                            ;; When parsing it out we should use "Not Specified" if it isn't presents
+                            :Type nil
                             :Description (value-of ca "CollectionUse")
                             :EntryId (str (value-of ca "ShortName") "_" (value-of ca "VersionId"))
                             :Version (value-of ca "VersionId")


Added fdef for tiny functions. s/cat is needed for single arg functions

--- src/adventofcode1/one_b.clj
+++ src/adventofcode1/one_b.clj
@@ -70,6 +70,19 @@
   (= 1 (distance direction)))

 (s/def ::xy-direction (s/and (s/keys :req-un [::x-direction ::y-direction]) no-diagonals?))
+
+;; moved here, since no-diagonals? used in s/def above
+;; this are just for learning specs better
+(s/fdef distance
+        :args (s/alt :current ::xy :direction ::xy-direction)
+        :ret  integer?
+        )
+
+(s/fdef no-diagonals?
+        :args (s/cat :direction ::xy-direction)
+        :ret  boolean?
+        )
+

 (def north {:x-direction  0 :y-direction  1})
 (def south {:x-direction  0 :y-direction -1})


Fix wrong state tranformation on delete icon collection event.

--- src/uxbox/main/data/icons.cljs
+++ src/uxbox/main/data/icons.cljs
@@ -167,7 +167,7 @@

   rs/WatchEvent
   (-apply-watch [_ state s]
-    (let [type (get-in state [:dashboard :images :type])]
+    (let [type (get-in state [:dashboard :icons :type])]
       (->> (rp/req :delete/icon-collection id)
            (rx/map #(select-collection type))))))


Make icon rotation behave in the same way as rect.

--- frontend/src/uxbox/main/ui/shapes/icon.cljs
+++ frontend/src/uxbox/main/ui/shapes/icon.cljs
@@ -30,19 +30,31 @@

 ;; --- Icon Shape

+(defn- rotate
+  ;; TODO: revisit, i'm not sure if this function is duplicated.
+  [mt {:keys [x1 y1 x2 y2 width height rotation] :as shape}]
+  (let [x-center (+ x1 (/ width 2))
+        y-center (+ y1 (/ height 2))
+        center (gpt/point x-center y-center)]
+    (gmt/rotate* mt rotation center)))
+
+
 (mx/defc icon-shape
   {:mixins [mx/static]}
   [{:keys [id content metadata rotation x1 y1 modifiers] :as shape}]
-  (let [{:keys [width height]} (geom/size shape)
-        {:keys [resize displacement]} modifiers
+  (let [{:keys [resize displacement]} modifiers
+
+        xfmt (cond-> (gmt/matrix)
+               displacement (gmt/multiply displacement)
+               resize (gmt/multiply resize))
+
+        {:keys [x1 y1 width height] :as shape} (-> (geom/transform shape xfmt)
+                                                   (geom/size))

         view-box (apply str (interpose " " (:view-box metadata)))
+        xfmt (cond-> (gmt/matrix)
+               (pos? rotation) (rotate shape))

-        xfmt (cond-> (gmt/matrix)
-               resize (gmt/multiply resize)
-               displacement (gmt/multiply displacement)
-               rotation (gmt/rotate* rotation (gpt/point (+ x1 (/ width 2))
-                                                         (+ y1 (/ height 2)))))
         props {:id (str id)
                :x x1
                :y y1


scheduler: Don't try to preempt synthetic tasks.

--- scheduler/src/cook/mesos/rebalancer.clj
+++ scheduler/src/cook/mesos/rebalancer.clj
@@ -368,7 +368,13 @@
                    (dec remaining-preemption)
                    jobs-to-make-room-for
                    (conj pending-job-ents-to-run pending-job-ent)
-                   (into task-ents-to-preempt (:task preemption-decision)))
+                   (into task-ents-to-preempt
+                         ;; If a task has no id, it must be a synthetic task.
+                         ;; This means that on one iteration of (compute-next-state-and-preemption-decision),
+                         ;; the rebalancer decided to make room for a certain hypothetical task,
+                         ;; but on a subsequent iteration, it became clear that OTHER hypothetical tasks would be an even better outcome.
+                         ;; We shouldn't try to actually preempt tasks that were never scheduled.
+                         (filter :db/id (:task preemption-decision))))
             (recur state'
                    remaining-preemption
                    jobs-to-make-room-for


clojure: refactored the symmetries function

--- clojure/org/gavrog/clojure/pgraph_morphisms.clj
+++ clojure/org/gavrog/clojure/pgraph_morphisms.clj
@@ -141,10 +141,13 @@
                                        e2 (.get nw (.times d op))]]
                              [e1 e2]))))))))))

+(defn symmetry-from-base-pair [net b1 b2]
+  (let [start #(.source (.get % 0))
+        mat #(.differenceMatrix net %)]
+    (morphism net (start b1) (start b2) (Matrix/solve (mat b1) (mat b2)))))
+
 (defn symmetries [net]
-  (let [bases (iterator-seq (.iterator (.characteristicBases net)))
-        b (first bases)
-        start #(.source (.get % 0))
-        mat #(.differenceMatrix net %)
-        iso #(morphism net (start b) (start %) (Matrix/solve (mat b) (mat %)))]
-    (->> bases (map iso) (filter identity))))
+  (let [bases (iterator-seq (.iterator (.characteristicBases net)))]
+    (->> bases
+      (map (partial symmetry-from-base-pair net (first bases)))
+      (filter identity))))


fixed parallel binding mistake

fixed parallel binding mistake

--- src/me/panzoo/story.clj
+++ src/me/panzoo/story.clj
@@ -316,19 +316,19 @@

   (binding [*language* (or lang
                            (re-find #"(?<=\.)[^.]+$" path)
-                           *language*)
-            *single-comment* (or token
-                                 (first (languages *language*))
-                                 *single-comment*)]
-    (wrap-in-tags tag
-      (if (#{"markdown" "md"} *language*)
+                           *language*)]
+    (binding [*single-comment* (or token
+                                   (first (languages *language*))
+                                   *single-comment*)]
+      (wrap-in-tags tag
+        (if (#{"markdown" "md"} *language*)

 ; A markdown file is a special case. It is treated as a single comment block.

-        (html<- [:comment (slurp path)])
-        (do
-          (maybe-associate-brush path *language*)
-          (with-open [r (io/reader path)]
+          (html<- [:comment (slurp path)])
+          (do
+            (maybe-associate-brush path *language*)
+            (with-open [r (io/reader path)]

 ; Lines of source code are read lazily by `line-seq` and gathered lazily by
 ; `gather-lines`, Along with printing each chunk of comment or code to an
@@ -336,7 +336,7 @@
 ; be determined by the largest comment or code chunk and not the total size of
 ; the source file.

-            (each html<- (gather-lines (line-seq r)))))))))
+              (each html<- (gather-lines (line-seq r))))))))))

 ; Code chunks are wrapped in a `pre` with the correct incantation for
 ; SyntaxHighlighter in its `class` attribute; comments are run through the


push all images in circular buffer into imagecache, after an overflow

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -320,7 +320,8 @@
         camera-index (str (core getCameraDevice) "-CameraChannelIndex")]
     (doseq [event (:burst-data event)]
       (doseq [i (range (core getNumberOfCameraChannels))]
-        (when-not (@state :stop)
+        (when (or (core isSequenceRunning)
+                  (pos? (core getRemainingImageCount)))
           (let [image (pop-burst-image)
                 image+ (if-not slices
                          image
@@ -336,9 +337,12 @@
                            event)]
               (.put out-queue (make-TaggedImage (annotate-image image+ event+ @state
                                                                 (burst-time (:tags image) @state))))))
-          (when (core isBufferOverflowed)
-            (swap! state assoc :stop true)
-            (ReportingUtils/showError "Circular buffer overflowed."))))))
+          (when (and (not (@state :stop))
+                     (core isBufferOverflowed))
+            (swap! state assoc :stop true
+                               :circular-buffer-overflow true))))))
+  (when (@state :circular-buffer-overflow)
+    (ReportingUtils/showError "Circular buffer overflowed."))
   (while (and (not (@state :stop)) (. mmc isSequenceRunning))
     (Thread/sleep 5)))


show acquisition settings at start of an MDA

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

--- acqEngine/src/org/micromanager/acq_engine.clj
+++ acqEngine/src/org/micromanager/acq_engine.clj
@@ -547,6 +547,7 @@
 (defn run-acquisition [this settings out-queue]
   (try
     (def acq-settings settings)
+    (log (str "Starting MD Acquisition: " settings))
     (prepare-state this)
     (binding [state (.state this)]
       (def last-state state) ; for debugging


[search] Address race conditions in creating writers for lucene

--- src/braid/search/lucene.clj
+++ src/braid/search/lucene.clj
@@ -37,36 +37,43 @@
 (defonce -store (atom nil))
 (defn store
   []
-  (if-let [s @-store]
-    s
-    (let [s (if-let [store-path (config :lucene-store-location)]
-              (store/disk-store store-path)
-              (store/memory-store))]
-      (reset! -store s)
-      s)))
+  (swap! -store
+         (fn [s]
+           (or s
+               (if-let [store-path (config :lucene-store-location)]
+                 (store/disk-store store-path)
+                 (store/memory-store))))))
+
+(defonce writers-cache (agent {}))
+(defn writer
+  [store]
+  (send writers-cache update store
+        (fn [writer]
+          (or writer (store/store-writer store analyzer))))
+  (await-for 1000 writers-cache)
+  (get @writers-cache store))

 (defn index-message!
-  ([message]
-   (with-open [writer (store/store-writer (store) analyzer)]
-     (index-message! writer (store) message)))
-  ([writer reader message]
+  ([message] (index-message! (store) message))
+  ([store message]
    (let [message (-> message
                      (update :created-at (memfn getTime))
-                     (assoc :group-id (db.thread/thread-group-id (:thread-id message))))]
+                     (assoc :group-id (db.thread/thread-group-id (:thread-id message))))
+         wrtr (writer store)]
      (if-let [existing (try
                          (first
-                           (clucie/search reader {:group-id (:group-id message)
-                                                  :thread-id (:thread-id message)}
+                           (clucie/search store {:group-id (:group-id message)
+                                                 :thread-id (:thread-id message)}
                                           1))
-                           (catch IndexNotFoundException _
-                             nil))]
+                         (catch IndexNotFoundException _
+                           nil))]
        (clucie/update!
-         writer
+         wrtr
          (update existing :content str "\n" (:content message))
          [:group-id :thread-id :content]
          :thread-id (:thread-id message))
        (clucie/add!
-         writer
+         wrtr
          [message]
          [:group-id :thread-id :content])))))

@@ -93,10 +100,11 @@
   "Import all existing messages into Lucene"
   []
   ;; Need to have an index created to make a reader, so just insert a dummy record
-  (index-message! {:content "hello" :group-id (java.util.UUID/randomUUID)
-                   :thread-id (java.util.UUID/randomUUID) :created-at (java.util.Date.)})
-  (with-open [reader (store/store-reader (store))
-              writer (store/store-writer (store) analyzer)]
+  (index-message!
+    (store)
+    {:content "hello" :group-id (java.util.UUID/randomUUID)
+     :thread-id (java.util.UUID/randomUUID) :created-at (java.util.Date.)})
+  (with-open [reader (store/store-reader (store))]
     (doseq [msg (->> (d/q '[:find [(pull ?m pull-pattern) ...]
                            :in $ pull-pattern
                            :where [?m :message/id _]]
@@ -105,4 +113,4 @@
                     (map common/db->message))]
       (when (and (:group-id msg) (:thread-id msg) (:content msg)
                  (:created-at msg))
-        (index-message! writer reader msg)))))
+        (index-message! reader msg)))))


GAWB-1288: minor changes to make it not suck

--- src/cljs/org/broadinstitute/firecloud_ui/common/gcs_file_preview.cljs
+++ src/cljs/org/broadinstitute/firecloud_ui/common/gcs_file_preview.cljs
@@ -27,12 +27,15 @@
           (labeled "Google Bucket" (:bucket-name props))
           (labeled "Object" (:object props))
           [:div {:style {:marginTop "1em"}}
-           (if (> data-size 1800) (str "Last " (:previewLineCount @state) " lines of log are shown. Use the link below to view the full log.") "Log:")
+           (if (> data-size preview-byte-count) (str "Last " (:preview-line-count @state)
+                                       " lines of log are shown. Use the link below to view the full log.") "Log:")
+           ;; The max-height of 206 looks random, but it's so that the top line of the log preview is half cut-off
+           ;; to hint to the user that they should scroll up.
            (react/create-element
              [:div {:ref "preview" :style {:marginTop "1em" :whiteSpace "pre-wrap" :fontFamily "monospace"
-                                           :fontSize "90%" :overflow "auto" :maxHeight 206
+                                           :fontSize "90%" :overflowY "auto" :maxHeight 206
                                            :backgroundColor "#fff" :padding "1em" :borderRadius 8}}
-              (str (if (> data-size 1800) "...") (:preview @state))])]
+              (str (if (> data-size preview-byte-count) "...") (:preview @state))])]
           (when (:loading? @state)
             [Spinner {:text "Getting file info..."}])
           (when data
@@ -91,14 +94,17 @@
                                       :status status-code})))})
      (utils/ajax {:url (str "https://www.googleapis.com/storage/v1/b/" (:bucket-name props) "/o/"
                             (js/encodeURIComponent (:object props)) "?alt=media")
-                  :headers {"Authorization" (str "Bearer " (utils/get-access-token))  "Range" "bytes=-1800"}
+                  :headers {"Authorization" (str "Bearer " (utils/get-access-token))
+                            "Range" (str "bytes=-" preview-byte-count)}
                   :on-done (fn [{:keys [success? status-text raw-response]}]
-                             (swap! state assoc :preview raw-response)
-                             (swap! state assoc :previewLineCount (count (clojure.string/split raw-response #"\n+")))
+                             (swap! state assoc :preview raw-response
+                                    :preview-line-count (count (clojure.string/split raw-response #"\n+")))
                              (after-update
                                (fn []
                                  (aset (@refs "preview") "scrollTop" (aget (@refs "preview") "scrollHeight")))))}))})

+
+(def preview-byte-count 1800)

 (react/defc GCSFilePreviewLink
   {:render


remove console print

remove console print

--- src/clj/salava/badge/db.clj
+++ src/clj/salava/badge/db.clj
@@ -222,7 +222,6 @@
                                                        (assoc :user_badge_id user-badge-id
                                                               :ctime now
                                                               :mtime now))))))
-      (dump (:endorsement user-badge))
       (when (seq (:endorsement user-badge))
         (doseq [endorsement (:endorsement user-badge)]
           (when (map? endorsement)


Tweak hardocded resilience

Tweak hardocded resilience

--- src/clojush/meta_errors.clj
+++ src/clojush/meta_errors.clj
@@ -168,7 +168,7 @@
         0
         (if (> (/ (count (distinct hist))
                   (count hist))
-               2/5)
+               3/5)
           0
           1)))))