Fork me on GitHub
#clojure
<
2018-05-17
>
huthayfa01:05:44

can I create a fakes3 local service using amazonica

bmaddy01:05:16

I'm trying to push my first lib to clojars and am having problems with lein deploy clojars. When I get to the part where it wants me to enter my password for gpg, I paste it in (it's really long) and first of all, it displays it in plain text (not as asterisks) and when I hit enter, gpg doesn't seem to get the password. Does anyone know how to get around this?

noisesmith01:05:47

if you are hitting the tty interface for gpg, things have already gone wrong

noisesmith01:05:45

lein can't share stdio with another program outside the jvm, so to use gpg you need a graphical client, or ensure the key is currently unlocked in your cache

noisesmith01:05:37

also, the gpg signature of the artifact is incomplete with clojars at best, and can be disabled or skipped safely

bmaddy01:05:15

Oh, I'll just skip it then. Thanks for the advice @noisesmith!

ido04:05:34

Hey friends, can anyone shed some light about why the default implementation chosen for core.async buffers is Java LinkedList and not, for example, ArrayDeque?

huthayfa04:05:48

how could I set the s3 to skip the MD5 check on the uploaded file, I am trying to upload an image to local fakes3, but I get SdkClientException Unable to verify integrity of data upload. Client calculated content hash (contentMD5: 9Uw72PrP2ixIz7jhExr9dg== in base 64) didn't match hash (etag: 85dbae523824f9d892cb09e0af48f124 in hex)

roklenarcic07:05:20

why would you want that? Seems like something is going wrong with your client?

đź‘Ť 4
jco08:05:46

Does anyone know a library for controlling the mouse and keyboard? To simulate key presses and clicks?

djpowell09:05:54

Just wondering if any work or design has been done on the clj tooling for Windows?

Alex Miller (Clojure team)11:05:54

Yes, I’ve done a lot of work on it, just haven’t had the time to pull it over the line yet

xtreak2911:05:04

Not a direct answer but relevant SO answer ? TIL, LinkedList is also implemented as a doubly linked list and hence accessing last element is O(1). Also it seems that ArrayDeque was introduced in Java 6 but I don't know if supporting Java 5 was an issue at the time core async was written. git blame doesn't show any rationale behind this. https://stackoverflow.com/questions/6163166/why-is-arraydeque-better-than-linkedlist

xtreak2911:05:17

Till Clojure 1.6 (March 2014) JDK 5 was the minimum JDK version supported : https://dev.clojure.org/jira/browse/CLJ-1268 First commit to core.async was on May 2013. Just a wild guess Rich might have used it for JDK 5 compatibility. First core.async commit : https://github.com/clojure/core.async/commit/47b1d24c0291050a1188dbeee2fc9227f694eb3c

Alex Miller (Clojure team)11:05:30

It’s been long enough that I don’t recall why. It’s possible it was jdk 5 compatibility but I don’t remember that being a concern.

ido11:05:53

@alexmiller ArrayDeque should create a lot less GC pressure than a LinkedList , specially in high load...

Alex Miller (Clojure team)11:05:44

Feel free to submit a jira

jumar12:05:45

Why is Comparator implemented in clojure.lang.AFunction and not in clojure.lang.AFn? I was looking at AFn and was quite confused (I didn't even know that AFunction existed).

jumar12:05:26

Yeah, the message doesn't say much but thanks anyway!

Alex Miller (Clojure team)13:05:25

AFn is an abstract base class for function implementations and so is pretty generic

Alex Miller (Clojure team)13:05:24

AFunction is only used in one place and has a bunch more functionality, so it’s a much more narrow use case

Alex Miller (Clojure team)13:05:21

that one place being cached protocol functions

leonoel13:05:45

@alexmiller really ? all closures subclass AFunction, not only protocol functions

Alex Miller (Clojure team)13:05:09

point is still that AFn is a more generic base class

jumar13:05:02

That thing I understand but I was surprised that Callable and Runnable are implemented in AFn while Comparator in AFunction

Alex Miller (Clojure team)13:05:19

Callable and Runnable are extensions of the IFn interface and thus implemented in the base to provide as much of the base implementation as possible. Acting as a Comparator is not something that is a general part of the IFn contract and so is not in IFn or implemented in the base.

đź‘Ť 4
borkdude13:05:00

(defn unchunk
  [s]
  (when (seq s)
    (lazy-seq
     (cons (first s)
           (unchunk (next s))))))

(defn foo []
  (unchunk
   (map #(do (println "i" %)
             %)
        (unchunk (range 1 51)))))

(first (foo)) ;; returns 1, prints i 1, i 2
Why do I see i 1, i 2 printed here?

borkdude13:05:26

Ah, I see. It’s because of the outer unchunk call in foo

borkdude14:05:40

Hmm, this prints four of them…

(defn unchunk
  [s]
  (when (seq s)
    (lazy-seq
     (cons (first s)
           (unchunk (next s))))))

(defn foo []
  (map #(do (println "i" %)
            %)
       (unchunk (range 1 51))))

(first (mapcat vector (foo)))

ghadi14:05:23

I really see that as a defect not an enhancement. Most not totally lazy seqs are due to chunking (32). That one is due to arg count (4)

âž• 12
borkdude14:05:16

temporarily I’ll fix it by using the suggested patches:

(defn join
  [s]
  (lazy-seq
   (when-let [s (seq s)] 
     (concat (first s) (join (rest s))))))

(defn mapcat*
  "Patched mapcat, see CLJ-1218"
  ([f] (comp (map f) cat))
  ([f & colls]
   (join
    (apply map f colls))))

(defn foo []
  (map #(do (println "i" %)
            %)
       (unchunk (range 1 51))))

(first (mapcat* (comp vector str) (foo))) ;; only prints 1, returns "1"

Alex Miller (Clojure team)14:05:28

why is this important to you?

borkdude14:05:03

I’m writing a crawler and I want to have fine grained control about how many links get crawled.

Alex Miller (Clojure team)14:05:13

if you need to precisely control when and how much of a lazy seq is realized, then you should not be using lazy seqs

Alex Miller (Clojure team)14:05:59

instead you should be using reduce/transduce/loop-recur etc

borkdude14:05:25

do transducers offer fine grained control over how many elements of the intermediate steps get realized?

borkdude14:05:55

I’ll try and see

borkdude14:05:25

(first (sequence
          (comp
           (map #(do (println "i" %)
                     %))
           (mapcat vector))
          (range)))
Prints 0 .. 32

huthayfa14:05:01

@roklenarcic do you have some examples how to configure the client

borkdude14:05:09

I can use the more low level stuff, but if I do have fine grained control, I prefer the style of being able to use normal functions like take, first, etc.

borkdude14:05:49

eventually it all gets realized anyway, but for development I’d like to (take 2 ...) just for inspection and if it doesn’t realize too many, this is better

Alex Miller (Clojure team)15:05:09

expanding transducers get fully expanded on each step (mapcat is the prime example of this) - this is the difference in the transducer pull model vs seq push

dominicm20:05:46

I must be being stupid. I don't quite understand how you're recommending transducers be used here.

Alex Miller (Clojure team)15:05:23

if you want external control of iteration, then you need loop/recur.

Alex Miller (Clojure team)15:05:11

something that lets you take the next “thing” and choose when/whether to “do” it

martinklepsch15:05:58

looking for a lightweight lib to transform some HTML (specifically replace relative links/image src) — hickory, enlive come to mind, anything else I should check out?

noisesmith15:05:25

I've had great luck with enlive for that sort of thing

mpenet15:05:51

Jsoup might be usable too for this kind of things

borkdude16:05:43

@martinklepsch I love Jsoup personally

martinklepsch17:05:18

Do you know of some places that have some Clojure code that would help me get started with this kind of thing?

borkdude17:05:59

I’m working on some Clojure code now that uses Jsoup

borkdude17:05:55

@martinklepsch Could send you some code if you want.

borkdude16:05:01

@alexmiller core.async might be a great fit for this too, yes. thanks for the suggestions.

lilactown16:05:44

got a question about ring/jetty - I need to read the HttpInputOverHTTP obj in the :body, and then reset it so it can be read again by another middleware

lilactown16:05:59

how would I go about creating a new HttpInputOverHTTP or something similar?

lilactown16:05:40

ah, it's just an inputstream with a fancy name (at least, that's how the other mysterious middleware in my app uses it)

noisesmith16:05:04

well InputStream is abstract, so any particular one is going to be "fancy" in some way

christos17:05:04

I have a dependency problem i am trying fix for hours. core async seems to conflict with some other library and i get the following in the stack-trace: WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: clojure.tools.analyzer.utils, being replaced by: #'clojure.tools.analyzer.utils/boo lean? WARNING: boolean? already refers to: #'clojure.core/boolean? in namespace: clojure.tools.analyzer, being replaced by: #'clojure.tools.analyzer.utils/boolean? Exception in thread "main" java.lang.ExceptionInInitializerError at clojure.main.<clinit>(main.java:20) Caused by: java.lang.IllegalStateException: Attempting to call unbound fn: #'clojure.tools.analyzer.utils/boolean?, compiling:(clojure/core/async.clj:469:6)

christos17:05:49

Can anybody suggest a workournd

Alex Miller (Clojure team)17:05:20

what versions are you using?

christos17:05:40

[org.clojure/core.async "0.4.474"]

christos17:05:47

but the problem persists in previous

christos17:05:01

of course clojure is 1.9

Alex Miller (Clojure team)17:05:08

what else are you using?

christos17:05:41

the rama library

Alex Miller (Clojure team)17:05:44

are you using lein or something else?

Alex Miller (Clojure team)17:05:00

lein deps :tree shows what?

christos17:05:14

many things

christos17:05:50

i tried most of the suggestions if not all in lein deps 🌴

christos17:05:17

one of the first things i did but non of them seemed to solve the issue

Alex Miller (Clojure team)17:05:37

well I can’t help you without more information

christos17:05:47

sorry for the delay

christos17:05:54

the terminal dump is huge

Alex Miller (Clojure team)17:05:50

my guess is that you are getting an incompatible version of tools.analyzer and that’s causing core.async to fail

Alex Miller (Clojure team)17:05:23

if you’re on latest lein, you can lein deps :why org.clojure/tools.analyzer

christos17:05:35

Ok ill try that

Alex Miller (Clojure team)17:05:53

which will give you the dep path to the tools.analyzer version being used in the deps tree

christos17:05:56

[org.clojure/tools.analyzer 0.6.9]

Denis G17:05:46

Does clojure participate in Google Summer of Code? Will it be possible to apply as a student for clojure at GSoC 2019?

Alex Miller (Clojure team)17:05:13

This depends on a) whether someone sends in an application for Clojure and b) and then whether they accept us. All of those possibilities have occurred in the past.

Alex Miller (Clojure team)17:05:07

At this point, I think Cognitect will probably not lead this but I have encouraged Clojurists Together to do a.

Denis G17:05:26

Sounds awesome. Thanks. The community/students come up with the proposals or do the developers behind the clojure do it?

Alex Miller (Clojure team)17:05:29

Anyone can propose projects but there needs to be a mentor willing to do it with the student

jmacneal18:05:16

I'm currently a GSoC 2018 student working on a Clojure project, there were 2 or 3 projects this year looking for Clojure developers

christos17:05:49

Ok @alexmiller here is lein deps

Alex Miller (Clojure team)17:05:26

so you have tools.analyzer 0.6.9 at the top level and that’s what core.async includes as well

Alex Miller (Clojure team)17:05:07

another thing to watch out for is some sneaky snake including an older one of these libs inside their own jar (which is bad and wrong :)

Alex Miller (Clojure team)17:05:31

I think there is a lein plugin that you can use to find stuff like that

christos17:05:42

I just put tools analyzer there end excluded it from wherever i thought, including core.asyn and then forgot it there

christos17:05:00

The thing is a similar approach worked with a conflict in cheshire

christos17:05:05

i had before

christos17:05:35

Do you remember the name of the plugin ?

christos17:05:08

is it lein-pedantic ?