Fork me on GitHub
#clojure
<
2018-10-04
>
roklenarcic12:10:21

does anyone know of an open source project (on github or otherwise) that has a non-trivial amount of generative tests?

cddr20:10:20

I remember reading about some gnarly bugs found in the onyx project using generative tests

roklenarcic12:10:35

I'm eager to see how this is done

4
urzds12:10:17

Does java.net.url have a Clojure wrapper? Or is there a convenient way to getHost(), getPort(), getProtocol() without having to actually call these functions? Maybe by coercing the object into a map?

mpenet12:10:53

> (bean (java.net.URL. "https://google.com")) {:path "", :protocol "https", :ref nil, :content #object[sun.net.www.protocol.http.HttpURLConnection$HttpInputStream 0x3fc84c7c "sun.net.www.protocol.http.HttpURLConnection$HttpInputStream@3fc84c7c"], :authority "", :file "", :port -1, :host "", :class java.net.URL, :query nil, :defaultPort 443, :userInfo nil}

mpenet12:10:58

a bit ugly tho and wasteful

urzds13:10:54

So you'd recommend to just call getPort() instead?

dogenpunk13:10:19

Sorry if this seems gauche but, thanks @lprefontaine @alexmiller @seancorfield @tomfaulhaber and @m_m_m for your work on tools.trace. You saved my bacon yesterday! If I’ve missed any contributors, my apologies!

❤️ 4
gv13:10:33

Has anybody experience with setting up a Leiningen project to use JavaFX 11?

gv13:10:12

How do you set --module-path?

AlexU13:10:26

@olieidel JodaTime was good solution for Java 6/7. Because of api was old and time zone info were old too. From Java 8+ you got most powerful tool as time API. All samples with Clojure uses Date and Calendar. I think that is completely wrong. Keep it in mind

👍 4
kingcode14:10:50

Is there a way to avoid duplicating :require clauses with uneven nesting? I tried: (ns .. (:require [prefix [A :as a ]] [B [C :as bc]]])) but the B clause spits out an error…

cpmcdaniel15:10:30

Can someone verify my understanding of core.async go blocks? If I have only one go block in a program, and it’s taking from a channel that has a plethora of messages, then that block can/will be executing n times in parallel, where n is based on the number of cores.

Alex Miller (Clojure team)15:10:51

no, any particular go block will only ever be executing once at a time.

cpmcdaniel16:10:25

so, if you only have one go block in a program, you aren’t really utilizing all your cores?

cpmcdaniel16:10:55

well, not with go blocks anyway (ignoring other threads)

Alex Miller (Clojure team)16:10:51

That was never the intent

Alex Miller (Clojure team)16:10:18

You can use things like pipeline to get a parallel stage

cpmcdaniel14:10:58

@alexmiller is the same thing true with (thread ...)?

cpmcdaniel14:10:22

only one instance of that block will be executing at any particular time

cpmcdaniel14:10:05

I would hope not because these are intended for operations that may take some time waiting on i/o etc…

Alex Miller (Clojure team)14:10:41

thread launches the operation in a thread from an (expandable) thread pool

Alex Miller (Clojure team)14:10:04

threads are cached in that pool and reused but should always grow if you need another one

cpmcdaniel15:10:12

and if I have many go blocks, its the aggregate of those that can be executing in parallel n times

tomaas15:10:22

Hi, I have one route which uses m0 middleware. The handler of this routes assoc some data in session. The problem im having is that other routes use m1 and the middlware middleware-in-which-session-is-nil does not the session with data. What is happening there? How can I solve this?

noisesmith16:10:46

@urzds URL is kind of terrible, but nothing will be more efficient than just calling those methods - any clojure wrapper would be based on calling those methods

devurandom20:10:55

URL seemed nice, because it is builtin. What is the general recommendation? What should I use instead?

noisesmith20:10:00

I wonder - I've usually used str or format to construct URLs and clojure.string/split to break them up in the rare cases that I need to deconstruct them

noisesmith20:10:18

I hope there's a good library or alternative class but I don't know it off hand if so

noisesmith16:10:27

calling = on a URL talks to the network

Chris16:10:37

I’ve got a funny issue with boot-tools-deps. Before raising a ticket I thought I’d ask here in case anyone had any ideas. When using private repositories (having :mvn/repo in the deps.edn) the credentials in .m2/settings.xml are not being picked up and I get a 401. It works in pure tools.deps so the credentials are correct. Looking at the source of boot-tools-deps I think it might have something to do with it being run in a boot pod. Does anyone have any ideas what the issue might be?

isak17:10:04

when serializing custom records with nippy, is there a good way to defer to built-in structured writers, like you can in transit?

isak17:10:31

hm, I guess one is meant to just call serialize again inside the custom handlers

seancorfield17:10:59

@cbowdon Feel free to open an issue on the btd GitHub. I suspect it's due to Boot not picking that file up (since boot-tools-deps doesn't do any resolution itself -- it calls tools.deps.alpha and then it hands everything off to Boot itself).

Chris17:10:10

Thanks, I’ll carry on in #boot

seancorfield17:10:16

We can discuss in more depth in #boot

robert.spurrier20:10:54

I was walking to a hotel from my employers office in Durham, and totally freaked out when I walked by cognitect HQ. I had no idea it was two blocks away!!! (I work remote for the most part) I’m writing clojure based services for them right now and some clojure legends are right down the street. Feels good man! Love this community big time. Keep on keepin on

🙌 20
dpsutton20:10:09

it's simple to find their headquarters, not easy

👌 28
😂 20
rich 28
andy.fingerhut20:10:11

Looks complected with Tyrata to me 🙂

😁 28
Dormo21:10:55

Hi! I'm having some trouble translating this MongoDB query to Monger The query in JS:

db.getCollection('rooms').aggregate([
    { $unwind: "$tracks" },
    { $match: { $or: [{'tracks.type': "download"}, {'tracks.type': "upload"}]}},
    { $group: { _id: "$tracks.id" }}
]);
The query in Clojure/Monger:
(mc/aggregate  db "rooms" [{$unwind "$tracks"}
                             {$match {$or [{:tracks.type "download"}
                                           {:tracks.type "upload"}]}}
                             {$group {:_id "$tracks.id"}}]))

Dormo21:10:29

It gives me an error:

MongoCommandException Command failed with error 9: 'The 'cursor' option is required, except for aggregate with the explain argument' on server 127.0.0.1:27017. The full response is { "ok" : 0.0, "errmsg" : "The 'cursor' option is required, except for aggregate with the explain argument", "code" : 9, "codeName" : "FailedToParse" }  com.mongodb.connection.ProtocolHelper.getCommandFailureException (ProtocolHelper.java:115)

rutledgepaulv21:10:52

after the pipeline vector just add something like :cursor {:batch-size 20}

Dormo01:10:32

That worked! thanks

seancorfield21:10:43

A change of behavior from earlier MongoDB versions. Yeah, @rutledgepaulv’s suggestion sounds good.

rutledgepaulv21:10:10

not totally sure what the default cursor size used to be

rutledgepaulv21:10:45

sounds like 101

seancorfield21:10:27

MongoDB's continual API changes is part of why we've moved away from it (and why I no longer maintain CongoMongo).

rutledgepaulv21:10:58

yeah still waiting to see what becomes of transactions and monger

rutledgepaulv21:10:18

I’d like to use something else but it’s pretty ingrained at this point

seancorfield22:10:51

We went pretty all-in with MongoDB some years back but over the last year or so we've either stopped writing certain data to MongoDB or we've actively migrated data back from MongoDB to MySQL (Percona) and I think we'll be shutting down our MongoDB servers in a few months once one last legacy application is retired.

seancorfield22:10:49

We never migrated to MongoDB 3.x because of all the changes (we were beginning to regret using it by then).