This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2017-08-17
Channels
- # arachne (1)
- # beginners (42)
- # boot (4)
- # cider (28)
- # clara (9)
- # cljs-dev (149)
- # cljsrn (5)
- # clojure (185)
- # clojure-austin (2)
- # clojure-dusseldorf (4)
- # clojure-italy (14)
- # clojure-norway (1)
- # clojure-russia (18)
- # clojure-spec (35)
- # clojure-uk (36)
- # clojurescript (78)
- # core-async (6)
- # data-science (20)
- # datomic (48)
- # emacs (1)
- # fulcro (2)
- # garden (4)
- # hoplon (47)
- # jobs (5)
- # jobs-rus (1)
- # leiningen (2)
- # lumo (12)
- # off-topic (8)
- # om (8)
- # onyx (39)
- # parinfer (19)
- # re-frame (100)
- # reagent (15)
- # ring-swagger (1)
- # sql (8)
- # vim (1)
- # yada (20)
apparently, chrome headless can be used from command line to convert an HTML page to PDF. I dont know of any libs to make it more convenient though. https://tecadmin.net/create-pdf-google-chrome-headless/
@josh.freckleton I did with PhatomJS in Clojure, but not works with AWS lambda.
.. and I never tried.. but I saw the https://github.com/GoogleChrome/puppeteer what could be very interesting too.
If I remember what I use https://github.com/strongh/phantom-clj - maybe that.. of course you can export to pdf too (if I remember good)
I met very annoying problem with org.apache.cxf
. I generated files with wsdl2java
and tried to initiate Service class in REPL - it worked. Then I generated jar with lein uberjar
and it fails in moment of initiating this instance. Here is trace:
1. Unhandled java.lang.NullPointerException
(No message)
WSDLServiceFactory.java: 85 org.apache.cxf.wsdl11.WSDLServiceFactory/<init>
ServiceImpl.java: 217 org.apache.cxf.jaxws.ServiceImpl/initializePorts
ServiceImpl.java: 160 org.apache.cxf.jaxws.ServiceImpl/initialize
ServiceImpl.java: 129 org.apache.cxf.jaxws.ServiceImpl/<init>
ProviderImpl.java: 82 org.apache.cxf.jaxws.spi.ProviderImpl/createServiceDelegate
What may cause this problem? Whatโs the difference running lein repl
and java -jar
on generated jar with lein uberjar
?
@rmuslimov are you using AOT compilation?
:uberjar-merge-with {"META-INF/spring.handlers" [slurp (fn [x y] (str x "\n" y "\n")) spit]
"META-INF/spring.schemas" [slurp (fn [x y] (str x "\n" y "\n")) spit]
"META-INF/spring.tooling" [slurp (fn [x y] (str x "\n" y "\n")) spit]
"META-INF/cxf/bus-extensions.txt" [slurp (fn [x y] (str x "\n" y "\n")) spit]}
this magic thing in project.clj helpedI saw this (very similar) code from https://reagent-project.github.io/
(defn timer-component []
(let [seconds-elapsed (atom 0)]
(fn []
(js/setTimeout #(swap! seconds-elapsed inc) 1000)
[:h1 "Seconds Elapsed: " @seconds-elapsed] )))
Then when I tried to reimplement it again without looking, I had something like:
(defn timer-component []
(let [seconds-elapsed (atom 0)]
(js/setTimeout #(swap! seconds-elapsed inc) 1000)
[:h1 "Seconds Elapsed: " @seconds-elapsed] ))
> In this case the page only freezes at: "Seconds Elapsed: 0"
After multiple trials, I looked and noticed that I was missing the (fn [] )
below the let binding.
I assume that it is there for scope reasons. But I'm scratching my head like "What the hell" there is no loop here.
How come the seconds-elapsed is being updated every second?
As far as I know setTimeout
on JS land only executes a callback only once.
I guess I'm still not groking how loops work in Clojure.
So, my question: why the first piece of code is looping, when apparently there is no loop countruct?
Any explanation that could bring me to enlightment would be greatly appreciated. ๐@mohamedhayibor I believe code is looping because the component re-renders, and re-triggers the setTimeout
But in the original version, the (fn[])
wrapper prevents this from happening
Does that make sense?
Oops, it's backwards. My explanation
Reagent is looking for a fn
to render, and every time the anonymous function is called, the let
is triggered again and the setTimeout
is triggered again
But if you return mark-up instead of a function, it just gets redrawn every render cycle
@captainlexington waouh, got my mind blown. That makes sense. How often do you think the page is getting redrawn here before the 1 second mark?
That I couldn't tell you. It depends what else is going on in the app. I also might be completely wrong.
It /might/ be that reagant is re-rendering when atom is swap
ped
If it's a proper reagent atom instead of a native atom, reagent could know to listen for changes and re-render
Then, when it re-renders, it called the setTimeout
again
Hello all! Is there a way to lint a big map to find where is the key that is giving an error "...even number of forms"?
LESSON
dont do git reset --hard
with no commits in repository
everything got deleted YAY ๐
I'm working within in an emacs/cider environment, and for some reason it stays in that test
context, barring me from doing eg (
resource looks up relative to the classpath, not file system
and you canโt do ../ from the classpath
resources itself is on the classpath though, so ask for the thing you want without prefixing with resources
so if you have ../resources/foo/bar.txt
you can do (io/resource "foo/bar.txt")
to find it, if you are in the right project
regardless where the shell was in that project when starting
that worked :face_with_rolling_eyes:
thank you!