Fork me on GitHub
#clojure
<
2020-01-14
>
solf07:01:57

I remember reading somewhere about one of the "big" java profilers that had specific clojure support, which one is it?

solf07:01:41

Maybe I remember it wrong. Or also just a recommendation to use that is not yourkit (too expensive for the little use I have of it)

vlaaad07:01:03

clj-async-profiler is a great library for profiling from the repl

solf09:01:53

It is useful and simple to use, thanks

hindol09:01:39

And clj-java-decompiler is a great tool for understanding WHY something is slow, in comparison to Java for example. You decompile the byte code and generate Java code and voila, you see the expensive operations.

borkdude11:01:27

I love the clj-async-profiler as well

dharrigan12:01:58

So, I'm trying to launch a repl (in a docker container, for experimentation), and I'm trying to specify an address (by default the repl only listens on localhost), so following networking conventions to listen on all interfaces, I do this:

dharrigan12:01:12

-Dclojure.server.repl={:address,0.0.0.0,:port,55555,:accept,clojure.core.server/io-prepl}

dharrigan12:01:18

but I get this:

dharrigan12:01:52

Exception in thread "main" java.lang.NumberFormatException: Invalid number: 0.0.0.0
	at clojure.lang.EdnReader.readNumber(EdnReader.java:224)
	at clojure.lang.EdnReader.read(EdnReader.java:136)
	at clojure.lang.EdnReader.readDelimitedList(EdnReader.java:766)
	at clojure.lang.EdnReader$MapReader.invoke(EdnReader.java:680)

dharrigan12:01:10

According to the guide, here

dharrigan12:01:21

address is defined as address - host or address, defaults to loopback

p-himik12:01:21

0.0.0.0 is an invalid construct in CLJ. Try using "0.0.0.0".

dharrigan12:01:36

trying (I thought that might be the case)

dharrigan12:01:16

ta very much

👍 1
dpsutton14:01:55

anyone know who i can reach out to on clojurist together? Want to convince coworker to work on clojure-lsp but need info on time commitments to see if he can commit to it for 3 months. anyone know who best to talk to?

zignd15:01:48

Hey guys, I need some help regarding building an uberjar. Currently my personal project runs find through lein run , I can also compile it through lein uberjar, but there's probably something wrong in this compilation, that it because when I try to run it I get the following error message:

zignd15:01:27

Here's is my project.clj:

zignd15:01:07

I believe there might be something wrong in the :profiles {:uberjar {}} section, but I couldn't find much online, can anyone help me? Do I need to add some sort of exception for the schema.core namespace so that during the compilation it adds it to the uberjar?

ghadi15:01:15

what does your ns macro look like at the top of twito.data.users-schemas @zignd?

zignd22:01:17

Hey @U050ECB92, sorry for taking this long to reply. Can you still help me? The ns macro looks like this:

(ns twito.data.users-schemas
  (:require [schema.core :as s]
            [schema.coerce :as schema-coerce]
            [clj-time.core :as time]
            [clj-time.coerce :as time-coerce]))

zignd22:01:08

Also, I'm not using the schema/core/Schema protocol in any explicit place in the project

noisesmith17:01:56

@zignd schema.core/Schema is not a class, it's a protocol, if it doesn't resolve properly that usually would mean you didn't require schema.core before accessing it

zignd22:01:27

Hey @U051SS2EU, sorry for taking this long to reply, could you still help me? 😅 I'm not actually using the schema.core/Schema protocol in anywhere explicitly in the project. It's weird because the application runs through lein run

noisesmith23:01:37

odd - one thing to check is that you are using the standalone jar and not the project jar that uberjar also creates, there could be something going on with aot plus protocol usage though, where requiring schema.core redefines the protocol

zane19:01:35

If namespaces a.b.c, and a.b.d both need to use code that is not used by any other namespaces would it be more idiomatic to put that shared code in: (1) a.b (2) a.b.util or similar (1) a.b.c (or a.b.d)

👀 1
dpsutton19:01:58

does c depend on d or vice versa?

zane19:01:09

Let's assume not.

seancorfield19:01:34

Depending on what exactly the shared code is and what c and d "do", I'd either put the shared code in c (or d) and have d depend on c (or vice versa) -- or create a new a.b.x ns that both a.b.c and a.b.d depend on.

seancorfield19:01:00

The idiomatic goal would be to group functionality by namespace, so it depends on the specific functionality 🙂

😊 1
zane19:01:14

Got it. What would you put in a.b, if anything?

👀 1
zane19:01:40

I've seen it sometimes used as a "public" API for all of a.b.*.

seancorfield19:01:23

It really depends on the specifics. I don't think you can have completely generic guidelines for namespace organization, to be honest.

zane19:01:09

That's fair.

seancorfield19:01:25

In next.jdbc, there's nothing in "a" and the primary public API in "a.b", and then there are more specialized functions in "a.b.c" for various "c" values.

zane19:01:30

I'm just wondering what kind of things I should consider when choosing between the available options.

zane19:01:43

Got it. That's helpful.

seancorfield19:01:08

At work we have a bunch of ws.member.* namespaces but no ws.member ns. Each of those "a.b.c" namespaces has specific groupings of functionality that relate to members (on our web sites).

👍 2
seancorfield19:01:38

We also have some ws.<domain>.* namespaces. Some of those have ws/<domain>.clj, some don't.

seancorfield20:01:00

@zane Have you read Elements of Clojure? That has some good discussions around how to name/organize namespaces.

1
zane20:01:12

I have, but this is a good reason to give it another read!

seancorfield20:01:41

Page 20, primarily.

seancorfield20:01:51

Part of the guidance there would question whether you really needed a.b.c and a.b.d in the first place, rather than just having everything in a.b 🙂

zane20:01:14

Ah, I have the Kindle version. Where is page 20 relative to the table of contents?

seancorfield20:01:15

It's just before the Naming Macros section.

zane20:01:23

(Ah, I guess the ToC is pretty spartan.)

zane20:01:26

Got it. Thanks!

seancorfield20:01:18

Starting "In theory, a namespace can hold an unlimited number of functions..."

aptr32223:01:22

I need to upload file over sftp. What library should I use?

bfabry23:01:56

I doubt there's a clojure sftp library so I would go with the most common/popular/well-garded Java sftp library

Cora23:01:23

or shell out, depending on what you need

ghadi23:01:50

Apache Mina is one such library

aptr32223:01:58

just upload

ghadi23:01:11

Or shell out

seancorfield23:01:45

At work, we use this library https://github.com/hierynomus/sshj (via Java interop)

aptr32223:01:12

thanks, guys

👍 1
seancorfield23:01:00

If you decide to use that hierynomus/sshj library, I'd be happy to share some of our code.