This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-08-26
Channels
- # announcements (4)
- # babashka (8)
- # beginners (75)
- # calva (26)
- # cider (33)
- # circleci (5)
- # clojure (36)
- # clojure-dev (2)
- # clojure-europe (25)
- # clojure-nl (4)
- # clojure-spec (38)
- # clojure-uk (47)
- # clojurescript (15)
- # cloverage (2)
- # conjure (64)
- # core-async (41)
- # cursive (13)
- # data-science (2)
- # datalog (16)
- # datascript (22)
- # datomic (9)
- # duct (2)
- # emacs (81)
- # figwheel-main (1)
- # fulcro (4)
- # jobs (2)
- # jobs-discuss (29)
- # kaocha (3)
- # meander (11)
- # membrane (21)
- # off-topic (1)
- # portal (1)
- # re-frame (1)
- # reitit (1)
- # releases (2)
- # remote-jobs (31)
- # shadow-cljs (26)
- # specter (5)
- # sql (26)
- # tools-deps (19)
- # vim (12)
extreme beginner Q: getting this from "lein figwheel":
[dev@dev ~/clojure/jobwatch]$ lein figwheel
Figwheel: Cutting some fruit, just a sec ...
2020-08-25 17:26:53,238 [main] WARN clj-antlr.common - multi-hinted-let is deprecated and will be removed in a future clj-antlr release. Migrate to char-stream functionality.
Exception in thread "main" Syntax error compiling at (luminus/http_server.clj:20:26).
at clojure.lang.Compiler.analyze(Compiler.java:6808)
at clojure.lang.Compiler.analyze(Compiler.java:6745)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3820)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7109)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
...
at clojure.main.main(main.java:38)
Caused by: java.lang.RuntimeException: No such var: http-kit/server-stop!
at clojure.lang.Util.runtimeException(Util.java:221)
at clojure.lang.Compiler.resolveIn(Compiler.java:7388)
at clojure.lang.Compiler.resolve(Compiler.java:7358)
at clojure.lang.Compiler.analyzeSymbol(Compiler.java:7319)
at clojure.lang.Compiler.analyze(Compiler.java:6768)
... 103 more │
... any idea what the deal is? brand-new Luminus project ("+reagent +http-kit +postgres +cljs +graphql +auth")I imagine there's something useful in that stack trace, but I don't see how to enable greater verbosity.
I can repro @theron.bair...
...It seems to be a version compatibility issue that is somehow triggered when you try to start things via Figwheel. If I do lein repl
and (require 'luminus.http-server)
it loads just fine.
There's so much in that template that it's hard for me to tell what's causing the problem (this is why I don't recommend Luminus for beginners: when things go wrong, there are far too many moving parts for them to stand any chance at debugging the problem).
Well... when I say "beginner", I mean mostly "with Clojure's peculiarities". But yes, there are certainly a lot of moving parts.
http-kit/server-stop!
is new in http-kit 2.4.0, which is what luminus-http-kit
0.1.8 is bringing in. I think lein figwheel
is causing an earlier version of http-kit to be loaded but I cannot figure out how (since I don't use Figwheel).
Jetty is fine so, yeah, skip http-kit. We use Jetty in production, to power 40+ online dating sites in a dozen languages worldwide -- it's solid for high-traffic stuff.
Early on we saw random "thread death" errors with an earlier version of Jetty so we switched to http-kit, which was reliable but not supported by New Relic for monitoring, so we switched back to (a later version of) Jetty to get better monitoring and it's been rock solid since then @theron.bair
Hi! What would be the most effective way of finding if :done is set to true in ANY of the maps the following vector? [ [{:done true}{:done false}] [{:done false}] ]
@michael.e.loughlin so some will traverse all dimensions of the vector?
if you have no more than 2 dimensions in your sequence this works:
(some (fn [xs] (some :done xs)) your-seq)
thank you both @michael.e.loughlin @emilien there are always some elegant solutions in clojure.. just need to internalize them. 🙂
Any idea how to rewrite this CSS config
input[type="time"]::-webkit-calendar-picker-indicator {
background: none;
}
in Garden/CSS?I found the line
;;ignore println statements in prod
(set! *print-fn* (fn [& _]))
I understand print-fn is, but I would like to see docs for it and all such global variables (or whatever they are called). Are they listed anywhere? I am guessing it is specific to Clojure since it is not defined anywhere in the Luminus-project I am reading.
Thanks! I had the wrong repl open XD
I don't think that's a clojure thing
You are right, it is only in cljs-core it seems 🙂
I'll ask in the luminus channel then 🙂 It was hard to google.
if you want a list of all in-scope dynvars: (->> *ns* ns-name ns-refers vals (map symbol) (filter #(clojure.string/starts-with? (name %) "*")) sort pprint)
Thanks! I'll play around with it 🙂
presumably print-fn will be in there somewhere :)
not sure that will work in cljs
Hello all!, I’m a beginner and I’m trying to implement a SPA. I used a https://github.com/reagent-project/reagent-template template. I want to include an authentication/authorization schema. I have seen https://github.com/cemerick/friend and https://github.com/funcool/buddy-auth/. What do you recommend? Do you have good recommendations to read about web application development in clojure/clojurescript?
For full-stack Luminus is a good start https://luminusweb.com/
SPA you have a variety of options most common ones based on React. React wrappers: Reagent, rum, helix, uix Frameworks: Fulcro (relay-like), re-frame (redux-like)
Excellent, I’m gonna check Thanks a lot!
I would just caution that there are a lot of moving parts in Luminus and most folks new-to-Clojure tend to struggle with it. There is a book to go with it, Web Development in Clojure (in Beta for the Third Edition, so you buy the ebook and get updates as work on the book progresses). https://pragprog.com/titles/dswdcloj3/web-development-with-clojure-third-edition/
Without the book, making sense of the generated Luminus project, is really pretty tough for beginners. And Fulcro is equally bewildering for beginners.
Web development with Clojure -- especially an SPA using ClojureScript on the front end and Clojure on the backend -- tends to be a lot harder for beginners than web development in a lot of other languages...
Yes it is hard!, I think I’m gonna start with Luminus, then move to SPA when I master the basics.
You might want to start with just Ring + Compojure to get the basics mastered. Then perhaps look at https://github.com/seancorfield/usermanager-example which uses Ring, Compojure, Component, Selmer, and next.jdbc
. And then look at Luminus.
@kaxaw75836 I think Component is easier for beginners to understand (and I prefer it in production code over Integrant). The same goes for Selmer -- since it's like Django templates.
Sorry, I'm a bit late. @seancorfield would you mind explaining what's your opinion on tolitius/mount? At first sight, stuartsierra.component looks like much more boilerplate with no clear benefits.. but I must be missing something in component.
Thanks! I'll spend more time exploring the component then. That's good I noticed your message in #beginners
component
makes it very easy to swap out components for testing and allows you to apply the start
/`stop` lifecycle via metadata to Clojure objects. For example next.jdbc.connection/component
uses that approach on a function to provide a minimal component-compatible approach to building connection pools.
See https://github.com/seancorfield/next-jdbc/blob/develop/src/next/jdbc/connection.clj#L285-L316
Integrant has both good and bad aspects, IMO. I like the data-centric approach in theory but I dislike the fragmented code that tends to appear when you implement the various hooks the Integrant provides.
For example https://github.com/dharrigan/nextjdbc-integrant/tree/master/src/simple has Integrant-specific defmethod
's all over the code base so trying to form a mental model of the "system" is much harder (for me, at least) and it looks much harder to swap out "components" / lifecycles when stubbing for testing.
Also, we have UI folks on our team who do HTML/CSS/JS and they can edit our Selmer templates but would not be able to edit Hiccup data 🙂
@kaxaw75836 For learning purpose, I redo the great usermanager eg. and decide to move some libraries to learn them too. - Compojure -> Reitit - Component -> Integrant Maybe it can help : https://github.com/PrestanceDesign/usermanager-reitit-integrant-example
Thx so much for your useful repo and helping @seancorfield
@kaxaw75836 We're using Bidi in one app at work, instead of Compojure. I suspect if we were starting over, we might use Reitit everywhere.
I like how Reitit looks, based on @jacek.schae’s new course https://www.jacekschae.com/learn-reitit-pro/pfec2 for which I reviewed all the next.jdbc
code.
Perfect, thx! I'll put tomorrow an README too with backlink to your repo and usage to run the app.
the place where we use bidi the reverse routing was really nice in the beginning as our urls shifted around, but the urls have been fairly stable for sometime now
the big difference in my mind between compojure and most other routing libraries is in compojure finding the route and executing the handler are a single operation
you can't ask a compojure route what handler a url would hit without invoking that handler
splitting that up allows for some nice integrations with things like component, bidi can return a keyword (instead of a ring handler like most of the examples show), which you can use to lookup the handler component by name
I haven't used reitit, and have only been vaguely keeping an eye on it, but it seems to want to bake(maybe that is just the docs) in the idea that routing is a function of urls -> handlers, not urls -> whatever data I want, which is not a decision I am a big fan of
Looks like it can use names instead of handlers in the routes https://cljdoc.org/d/metosin/reitit/0.5.5/doc/basics/path-based-routing