Fork me on GitHub
#clojure-europe
<
2020-03-27
>
helios08:03:45

ClojureD videos are up parrot

clojure-berlin 16
bananadance 12
bubblebobble 4
RAMart08:03:25

(:clojureD Lightning Talks are yet to come...)

slipset09:03:32

@ramart Super nice job with the intros 🙂

4
🙏 4
parrot 4
plexus10:03:26

I did find the use of use a little triggering

RAMart10:03:49

And the REPL didn't respond nil. Must be a fake.

😎 4
otfrom12:03:23

hmm... anyone know how to go from a BufferedImage to a byte[]? I'm having brain fail (I found some examples, but my head isn't screwed together enough to go from Java to clojure)

jasonbell12:03:31

Interop heaven

otfrom13:03:30

hmm... this give me most of what I want, but I'll have to round trip it from the file system https://github.com/Clojure2D/clojure2d/blob/master/src/clojure2d/core.clj#L2182

otfrom13:03:37

a bit blutak, baling wire, and bubble gum, but this works:

(defn ->workbook [comparison-defs]
  (let [wb-data (into []
                      (mapcat (fn [cd]
                                [(:title cd)
                                 (:table cd)]))
                      comparison-defs)
        wb-charts (into []
                        (map (fn [cd]
                               [(:title cd)
                                (-> cd :chart :chart-image :buffer ->byte-array)]))
                        comparison-defs)
        wb (apply xl/create-workbook wb-data)]
    (run! (fn [[sheet-name img]]
            (let [;; int pictureIdx = wb.addPicture(bytes, Workbook.PICTURE_TYPE_JPEG);
                  pic-idx (.addPicture wb img Workbook/PICTURE_TYPE_PNG)
                  sheet (xl/select-sheet sheet-name wb)
                  helper (.getCreationHelper wb)
                  drawing (.createDrawingPatriarch sheet)
                  anchor (.createClientAnchor helper)
                  _ (.setCol1 anchor 14)
                  _ (.setRow1 anchor 2)
                  ;; Picture pict = drawing.createPicture(anchor, pictureIdx);
                  ;; pict.resize();
                  pict (.createPicture drawing anchor pic-idx)]
              (.resize pict)))
          wb-charts)
    
    wb))

otfrom13:03:57

this will all be in witan.send.vis soon

jasonbell13:03:21

I wasn’t a huge amount of help to be honest.

otfrom13:03:35

(defn ->byte-array [^BufferedImage image]
  (with-open [out (.ByteArrayOutputStream.)]
    (ImageIO/write image "png" out)
    (.toByteArray out)))

otfrom13:03:28

you pointed me back to what I'd found before and made me look at it

jasonbell13:03:42

I’m having a wrestling match with Avro, and a dead letter queue 🙂

practicalli-johnny14:03:23

Quite a noticeable jump in Covid19 figures yesterday in the UK, from the governments own data https://www.arcgis.com/apps/opsdashboard/index.html#/f94c3c90da5b4e9f9a0b19484dd4bb14

otfrom14:03:34

hmm... need the time series on deaths really. Number of cases is a bad figure

ordnungswidrig21:03:12

The data point of how many tests are done is important to understand the number of cases. It’s missing from most sets I’ve seen.

otfrom22:03:59

Yeah, number of tests to positives is important. Scotland reports on that (and it is captured in other files in that repo)