This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-04-22
Channels
- # beginners (17)
- # cider (3)
- # cljsrn (18)
- # clojure (76)
- # clojure-france (1)
- # clojure-italy (4)
- # clojure-nl (3)
- # clojure-poland (1)
- # clojure-uk (5)
- # clojurescript (33)
- # core-async (10)
- # datomic (31)
- # duct (5)
- # emacs (4)
- # fulcro (1)
- # graphql (5)
- # keechma (3)
- # off-topic (36)
- # onyx (1)
- # re-frame (4)
- # reagent (9)
- # reitit (9)
- # shadow-cljs (11)
- # vim (2)
Anyone able to quickly spot why evaling this code in my repl would produce the correct results e.g (= 1 (jdbc/query db-info "select COUNT(*) from dogs;")
is true. But when i run lein test
i get false (there are no inserted rows). I tried inserting a delay in case for some reasons the insert wasn’t synchronize.
I suspect i’m doing something much more basic wrong.
Very beginner question. Is (require '[clojure.string :as s])
supposed to creash lein test
with Call to clojure.core/ns did not conform to spec
exception?
@U55CJ7CDV (require '[clojure.string :as s]) by itself as a top level form should not cause that error, but if you try to do (ns my.test.namespace (require '[clojure.string :as s])) it likely will.
The syntax is slightly different inside an ns form. This should work:
(ns my.test.ns (:require [clojure.string :as s]))
i think lein ancient does this
you can try lein hiera
🙂
@drewverlee probably test is using in memory db?
it is actually, why does that tell you something?
when making an uberjar with lein, is it recommended to use :aot :all? does it matter?
@squarenegative There's a camp that thinks you shouldn't use AOT at all.
At World SIngles, we do not AOT anything.
Our uberjars are pure source (well, clojure.core
is compiled, but that's how it is packaged).
@seancorfield what's the advantage of not AOT compiling?
AOT can be very problematic...
A lot of problems have been fixed over the years but and, if it's the very last step of deployment of a complete application, rather than a library, it can help with startup time, but if startup time isn't a problem, it just isn't worth it, IMO. https://dev.clojure.org/display/design/AOT+Problem+Overview
I guess it's more reasonable to consider compiling AoT if you're developing a gui application
Agreed. For server processes, I see no values in AOT at all.
but then again, is there really any considerable differences in startup time? I've never measured it
If you have a lot of code and a lot of dependencies, yeah, start up time can be "high" -- but, to be honest, we see more startup overhead from New Relic weaving all the classes than from Clojure compilation...
No, you don't need AOT at all.
But you'll want to specify the main namespace.
I think lein
makes that more difficult than it needs to be.
which gives me Warning: The Main-Class specified does not exist within the jar. It may not be executable as expected. A gen-class directive may be missing in the namespace which contains the main method, or the namespace has not been AOT-compiled.
Specify clojure.main
as the :main
. Then the JAR will run a REPL by default.
clojure.main
accepts -m
to specify a "main" namespace.
So you can have a single JAR file with multiple -main
functions in different namespaces, and specify which one to run at startup.
java -jar myapp.jar -m my.namespace
It doesn't run "as a REPL".
I just meant that clojure.main
's default behavior -- if you do not specify -m
-- is to start a REPL.
But Clojure's normal behavior is basically how the REPL works: load code, compile it to bytecode, run it.
If you use the official clj
command-line stuff instead of lein
to run code, it works this way (without making an uberjar).
yeah, i heard about that. i'm still new though and lein seems super easy, so sticking with it for now
Yeah, although I think Boot is much more intuitive.
is there a way to get the uberjar without aot, and be able to run it as just java -jar app.jar
? assumign I only have one main
If anyone wants to mess around with foundationdb: https://github.com/alex-dixon/clj-foundationdb
I'm working on a project where I'm implementing SSO via SAML with a single SP and a variable amount of IDPs. I've used buddy-auth in the past for regular user/password auth, but I was unable to tell if that library supports SSO via SAML. Can anyone recommend a stable library?
@kharper General advice: if there isn’t a proper clj lib available, just use a Java lib directly
often using the java lib is better even if there is a wrapper available
especially if mutation or io are in the fundamental domain of the lib
I realize there is a dedicated channel, posting here as that channel does not seem very active: for those using Neanderthal + ClojureCuda, is there any sample code that uses cuBlas + custom kernel funtions? With neanderthal I see code for using cublas. With ClojureCuda, I see how to sue custom kernels, but I can't find sample code that uses both on a single piece of gpu memory.
piggy backing on that conversation about AOT, has anyone tried using clojure for aws lambda functions?
I know java in general performs pretty subpar compared to python and nodejs for cold starts
I use https://github.com/portkey-cloud/portkey for clojure + aws lambda. It's not been a problem so far.
@emccue I've heard of people using Clojure for AWS Lamba, but also keeping things running. I've also heard of people using ClojureScript / Node instead to address launch latency concerns.
To give some context, we have a need for a 3rd party to send us an "event" for any kind of interaction a user makes with content
whatever we put in that lambda will be a small amount of code; the majority of the work will be in the infrastructure and finding a way to be reliable in the case that an aws region goes down
Have you tried https://github.com/portkey-cloud/portkey ?