Fork me on GitHub
#clojure
<
2016-10-05
>
shaun-mahood00:10:09

@juliobarros: Is everything working fine on alpha12? Everything working on alpha13 on non-windows?

jrheard00:10:56

what kinda spec errors?

juliobarros00:10:03

@shaun-mahood: no does not work on alpha12. @jrheard all kinds of problems. Starting with call to clojure.core/ns does not conform to spec:

juliobarros00:10:44

Ah. He had the jre installed instead of the jdk. Thanks.

shaun-mahood01:10:45

@juliobarros: I may or may not have done that before... :)

derwolfe02:10:19

I'm working on some code that uses a protocol and a record. I'm thinking that I need to stub out a method (so that it doesn't make an http call). Would the typical way of handling this be to make my own implementation of the protocol and then reify the method I'd like to stub?

dvorme04:10:03

@kidpollo : >>I don’t want to have a flamewar here but is there some definitive place where the clojure indentation style is defined?<< Emacs. (Grins, ducks, runs…)

bfabry05:10:09

@derwolfe generally we would just reify the protocol as a stub object. this is a pretty common pattern when using component

dominicm11:10:16

@dvorme clojure style guide is the closest. There are a few open issues of interest disputing small parts.

dominicm11:10:43

https://github.com/bbatsov/clojure-style-guide/issues/126 this is the one I fall on the side of de raen on.

fellshard15:10:37

The two-space gives more rapid parsing, imo, since I don't have to check if it's a nested vs. sequential element.

alexisvincent15:10:47

Hi guys, I have an issue with futures that I just can wrap my head around. Calling future-cancel on a future I have, refuses to set Thread/interupted to true. If im not mistaken this is the expected behaviour?

alexisvincent15:10:12

(future
            (try
              (do
                (while (not (Thread/interrupted))
                  (println (Thread/interrupted))
                  (let [tmp-buffer (byte-array 10000)
                        cnt (.read target-data-line tmp-buffer 0 (alength tmp-buffer))]
                    (when (> cnt 0)
                      (s/put! stream tmp-buffer))))
                ;(.write output-stream tmp-buffer 0 cnt)))

                (s/close! stream))
              ;(.close output-stream))
              (catch Exception e (println e))))

alexisvincent15:10:25

this is the future. But Thread/interrupted is perpetually true

alexisvincent15:10:40

future-cancelled? and future-done? both return true

norman16:10:05

If anyone out there is using artifactory as a clojure maven repository with jenkins, I’d love to chat for a few minutes. I’m having no problem deploying to artifactory with leiningen, but I’m having some problems using the jenkins plugin.

jeroenvandijk16:10:56

@petrounias I’ve played with future-cancel which basically does Thread/interrupt. This only works when the underlying thread is checking for it. So e.g. if you are calculating the fibonacci sequence and you dont have intermediate checks, future-cancel does nothing

jeroenvandijk16:10:22

So in your case, maybe something else is holding up before it gets to the check?

alexisvincent16:10:11

@jeroenvandijk I am checking it… (while (not (Thread/interrupted)) and this loop is running a few times a second. Weird. Ill try explicitly call interupt. but from what ive read, future-cancel should do this

seancorfield16:10:14

@lvh re: cloverage — any plans to provide a Boot task for it?

lvh16:10:37

@seancorfield There’s a preliminary PR up

lvh16:10:43

not enough people who use boot to review and test it though

seancorfield16:10:00

:raised_hand::skin-tone-2: I’ll volunteer...

seancorfield16:10:19

Anything I need to know before taking a look at it?

lvh16:10:52

Not off the top of my head

alexisvincent16:10:45

literally just read that!

alexisvincent16:10:20

I added it because it wasnt working. Then probably fixed that bug.

alexisvincent16:10:33

and it continued not working xD

trptcolin16:10:47

(.isInterrupted thread) might do what you want

alexisvincent16:10:24

its ok if it clears it. The problem was that I was doing a print of the value

trptcolin16:10:25

(or cache the status in a local after reading it)

seancorfield16:10:45

@lvh I see it only supports clojure.test … we use Expectations so that may be too many variables (although the Expectations folks are looking at ways to work better with test tooling and that means supporting the clojure.test "API").

seancorfield16:10:16

Reminds me… I need to prod the Expectations folks about moving under the clojure-expectations organization umbrella!

lvh16:10:15

@seancorfield The workaround for midje is just to wrap it in deftest

lvh16:10:20

it’s not particularly complex integration

lvh16:10:25

but yeah one step at a time

alexisvincent16:10:37

@trptcolin sigh. That wasnt it. Still not working

lvh16:10:40

cloverage didn’t get anything merged for a while, not at least it has a maintainer 🙂

metametadata16:10:06

@alexisvincent some time ago I was also struggling with Java thread interruption, found this article to have the best explanation - https://www.ibm.com/developerworks/java/library/j-jtp05236/index.html

seancorfield17:10:07

@lvh We’re going to try to implement the clojure.test protocol in Expectations at some point https://github.com/jaycfields/expectations/issues/70 (note: it’ll be moving to https://github.com/clojure-expectations soon).

lvh17:10:16

cool 🙂

stand18:10:37

Is there any way to make a call to (date? #inst "2016-13-14") return false instead of throwing a weird runtime exception?

(defn date? [d]
  (try
    (instance? java.util.Date d)
    (catch Exception e false)))

habanerao18:10:37

A Clojure newbie question - as someone interested in reactive programming with Clojure, I noticed that RxClojure (reactivex extensions for Clojure) isn't an active project. Could some of the Clojurians share your thoughts on what is the best way to approach reactive programming with Clojure?

bfabry18:10:23

@stand probably not, using an incorrect reader literal is basically a syntax error, so it's gunna blow up

bfabry18:10:15

@stand it's like if I were to write 1.4.2

shaun-mahood18:10:05

@habanerao: Have you read https://www.packtpub.com/web-development/clojure-reactive-programming ? It's an excellent book and should give you lots to work with.

shaun-mahood18:10:39

@habanerao: If you have any interest in ClojureScript, there is a lot that essentially reactive programming there as well (or at least heavily inspired by it depending on your definition)

stand18:10:25

Ugh! How can you, for example validate reader literal input from an edn file then or create a spec for a map key with a reader literal?

bfabry18:10:06

well, if you think it's likely that people will mistype that literal then I would not use it, and have them enter data which you can validate and coerce to a date instead

habanerao18:10:00

@shaun-mahood: I reviewed the book briefly recently - it indeed was a good book and helped me gain some practical knowledge on the topic. However, it depends heavily on RxClojure - almost every example uses it. Wondering if RxClojure is not active because it is a contained bridge between Clojure and RxJava or if the community has gone in a different direction...

dvorme18:10:34

@habanerao : for cljs web applications in a reactive style, I can’t recommend Hoplon and its companion projects highly enough. One thing I like: Hoplon isn’t a framework so it integrates nicely with other Clojure/cljs tools.

dpsutton19:10:31

I'm getting different timestamps from my db depending upon which machine i'm reading from, whether it be windows or a ubuntu 16.04 box

dpsutton19:10:25

does anyone know what could cause this?

dpsutton19:10:34

as far as i can tell, both machines agree on the current time

blueberry19:10:09

@dpsutton Windows does its own daylight saving time management, and does not respect that your BIOS does that, too.

dpsutton19:10:42

is there a good way to handle the fact that these two platforms fundamentally disagree about what timestamp is in a database?

dpsutton19:10:48

that's pretty scary to me

tomjkidd19:10:56

@habanerao This might not be what you want, please let me know if you already considered it, but core.async is used to create channels and the type of pipeline you would typically make with observables doesn't pay attention to the objects themselves, but the channels. Then you have parts of the system put things on and take them off, with varying types of coordination.

dpsutton20:10:03

both platforms agree on the current UTC time when i call (new java.util.Date)

shayanjm20:10:59

Has anyone here successfully been able to use a “dockerized” kafka & Zookeeper set up with clojure?

shayanjm20:10:33

I’m trying to produce messages to a really trivial kafka set up (1 broker, 1 topic, 1 partition) but every time I try to produce a message it says that there was an invalid record exception

bostonaholic20:10:02

@shayanjm not sure if this will help, but this is what’s in our docker-compose.yml

zookeeper:
      image: zookeeper:3.4
      network_mode: "service:backend"

  kafka:
      image: wurstmeister/kafka:0.10.0.1
      network_mode: "service:backend"
      environment:
          KAFKA_ADVERTISED_PORT: 9092

shayanjm20:10:25

@bostonaholic that’s almost exactly what’s in mine - did you dockerize your clojure application as well?

shayanjm20:10:53

do you launch it from the same docker-compose?

bostonaholic20:10:39

it’s launched from the Dockerfile

shayanjm20:10:27

Interesting. I have a feeling this is a network issue but I can’t wrap my brain around it. I just dockerized my clj app and I’m still getting the exception despite the request coming from another docker container

shayanjm20:10:44

I’m thinking I might have to link the containers in this case

shayanjm20:10:52

instead of just communicating over an exposed/bound port

bostonaholic20:10:17

I don’t know much about docker, honestly

shayanjm20:10:35

Neither do I. My assumption here is that docker is doing something funky with the message content in some way that Kafka isn’t expecting

shayanjm20:10:54

so I can send data to the service just fine via the bound port, but the request is malformed by the time it hits Kafka