This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-10-23
Channels
- # 100-days-of-code (2)
- # aws (1)
- # beginners (105)
- # boot (36)
- # calva (4)
- # cider (56)
- # clara (37)
- # cljdoc (16)
- # cljs-dev (19)
- # clojure (44)
- # clojure-dev (20)
- # clojure-italy (24)
- # clojure-nl (3)
- # clojure-serbia (2)
- # clojure-spec (15)
- # clojure-uk (44)
- # clojurescript (41)
- # code-reviews (3)
- # core-async (12)
- # cursive (24)
- # datomic (4)
- # emacs (1)
- # figwheel-main (10)
- # fulcro (168)
- # funcool (2)
- # hyperfiddle (15)
- # jobs (2)
- # jobs-discuss (79)
- # juxt (19)
- # lein-figwheel (1)
- # leiningen (2)
- # luminus (14)
- # mount (8)
- # nrepl (9)
- # off-topic (9)
- # other-languages (1)
- # pathom (32)
- # reitit (6)
- # ring-swagger (3)
- # shadow-cljs (10)
- # slack-help (11)
- # spacemacs (20)
- # sql (29)
- # tools-deps (28)
- # vim (29)
- # yada (4)
hello guys
is there a tool for reformatting clojure code from cmdline ?
If you use Leininge, there is cljfmt https://github.com/weavejester/cljfmt
Looks like this project can do it without Leiningen or a JVM installed, using Node.js, in case that is of interest: https://github.com/snoe/node-cljfmt/
Depending on what you do, you might also be interested in rewrite-clj which preserves the textual aspect of code (indentation, comments, reader-macros ...) but presents it in the form of an AST (or should I say Concrete Syntax Tree ?). https://github.com/xsc/rewrite-clj
that's good
thanks guys
We have designed the 2 services in which one uses def
and other mount/defstate
to connect with mongo DB. Both are working good
Can we get suggestion on which approach is better and downside of other?
I’m not experienced in mount
, but it’s better to have stateless code (components) and let a framework to “inject” stateful objects into your stateless components. That’s how https://github.com/duct-framework/duct works
some advantages of defstate
compared to def
:
- you can override dependencies for tests
- you can load all namespaces without having a database up since connection happens on mount/start
instead of namespace load
- you can grep for defstate
to find external dependencies
have a look at alternatives like component, integrant and commix (super obscure but my favorite 😄), compare them and see which one you prefer
@U3L6TFEJF “better” => stateless code, less place for errors and as you said “you can load all namespaces without having a database up”
oh, I think I misread your sentence as “I’m not experienced in mount, but these other things, like duct, are better”. reading it back I see you were not arguing against mount, my bad 🙂
That’s OK 😉
I work with both and I can say they overlap.
if you create a mongodb connection inside def, and use gen-class or aot, the build process fails if it can't connect to mongo
clojure doesn't have a "compile mode" where side effects inside forms are not run - top level side effects are always run by clojure
I'd like to find out at runtime if a certain namespace can be loaded. find-ns
only works off namespaces that are already loaded. What's the best way to do this?
Have a look at http://clojure.github.io/tools.namespace/#clojure.tools.namespace/find-namespaces-in-dir and sister functions
Ooops, that function is deprecated. Look at this instead http://clojure.github.io/tools.namespace/index.html#clojure.tools.namespace.find/find-namespaces-in-dir
Yes, that finds namespaces in a directory, but I'd like to find to find namespace wherever it is in classpath
I don't know what classpath the app was ran with
http://clojure.github.io/tools.namespace/index.html#clojure.tools.namespace.find/find-namespaces :poop:
Hello people, this is my Base64 codec pet project. I also went on building a native image with GraalVM which seems to work nicely, although not very much tested. Only concern is that I don't see that big speedup (only about 2x) in some cases. Any feedback/tips appreciated https://github.com/Sorrop/base64clj
i'm having trouble organizing my code. how are separate components of the system supposed to communicate? does it make sense to assign each logical component of the system a URL and have them send letters (with sender-receiver URLs) to a "post-service"? if so how is that URL thing to be constructed? do I conceive of namespaces as URLs? or should I write a dynamic registry for running processes? are there any libs/examples that might shed some light on this matter?
Also this blog post: https://vvvvalvalval.github.io/posts/2018-07-23-datascript-as-a-lingua-franca-for-domain-modeling.html#experience_report:_bandsquare
Anyone who can recommend a polling-lib? Currently Investigating a good way of creating a method which I can call upon when I need to run a certain function every XXX ms. It also needs to be able to stop after a certain condition is met (I.E I get a certain status back from an api call.. database w/e)
if I made one I would name it are-we-there-yet
haha maybe that is what I should name it 😉 if I don't find anything to use
Maybe this: https://github.com/overtone/at-at Also check under 'Scheduling' at https://www.clojure-toolbox.com/
looks nice. im gonna try it out
quartz is not what i need right now, I need to be able to initiate a polling-job from another function call and I need to define the "Job(a function that does something)" on the fly.
@jarvinenemil regarding your actual question, I ended up using ScheduledThreadPoolExecutor directly in the past when the task was specific to one server, then updating to Quartzite when it needed to run on a cluster basis
I'll check it out, thanks @noisesmith and @jeff.terrell for the advices ✌️
at-at is a thin wrapper on ScheduledThreadPoolExecutor fwiw