Fork me on GitHub
#clojure
<
2017-02-06
>
beppu01:02:17

Another one is http://descjop.org/ (although I haven't tried it yet).

rc114006:02:08

hi all , anyone here managed to use clj-http and a client side cert , when I try to make a call after providing the require keystores and trust stores i get the following error (CertPathValidatorException Path does not chain with any of the trust anchors sun.security.provider.certpath.PKIXCertPathValidator.validate (PKIXCertPathValidator.java:153)) , im too much of a clojure/java noob to know how im supposed to fix that

h.elmougy11:02:56

Navigate to source using M-. displays "Visit tags table (default TAGS)" instead of navigate. don't know what was happened it was working fine

villesv13:02:49

@rc1140 That error is very generic and merely means that the certificate presented could not be identified as trusted. That may happen for several trivial reasons not related to the content of the certificats. Could be a configuration error or - something that has tripped me several times - an assumption on Java keystore handling regarding what names the certificates should stored as in the keystore.

rc114013:02:41

@fnil thanks for getting back to me , forgot to update the chan , the issue in my case was that the server cert was out dated 😞

rc114013:02:55

and yeha i looked at that originally when trying to fix it

villesv13:02:58

@rc1140 Ah, yeah, that too

rc114013:02:15

deployed updated certs and everything works wonderfully 🙂

palo13:02:56

hi guys, looking for some solid tcp client for clj .. any hints ?

villesv13:02:20

@palo Aleph has a tcp client, doesn't it?

villesv13:02:48

Otherwise I think there is a netty-based-one

palo13:02:26

@fnil yeah just discovered this one 🙂 Will check it out .. thx

villesv13:02:47

Yeah, this is the one I was thinking about: https://github.com/gerritjvv/clj-tcp

villesv13:02:15

I have used Netty from Java before and was quite happy with it. Never tried the above library (clj-tcp) though.

palo13:02:33

Will check both .. aleph seems to be more solid based on stars so lets see ..

villesv13:02:59

Oh, yes, aleph is good - at least what I have seen of it

danielstockton13:02:35

Can anyone say why I get the following exception?

user=> (import 'java.util.zip.ZipOutputStream)
java.util.zip.ZipOutputStream
user=> ZipOutputStream.
CompilerException java.lang.ClassNotFoundException: ZipOutputStream., compiling:(/tmp/form-init5711048387653942292.clj:1:7619)

danielstockton13:02:09

Actually, I presume it's because it isn't in openjdk.

mgrbyte13:02:47

@danielstockton works for me here w/openjdk.

sgerguri13:02:57

nope, I have the Oracle JDK and it doesn’t work for me

danielstockton13:02:00

Hmm, yeah. I get the same exception with GZIPOutputStream too.

danielstockton13:02:16

openjdk version "1.8.0_121"

sgerguri13:02:29

I do get a different error, however:

CompilerException java.lang.IllegalArgumentException: No matching ctor found for class java.util.zip.ZipOutputStream, compiling:(/private/var/folders/lj/7jsmpmqs3f18n08f1gm5l6rw0000gn/T/form-init526093045682586576.clj:1:1)
This means the class can actually be found.

sgerguri13:02:04

And the error in my case is down to me using a nonexistent constructor.

danielstockton13:02:45

Did you do (ZipOutputStream.)? Because I get that error trying to wrap it in parens.

sgerguri13:02:07

But there is no zero-arg constructor for that class.

mgrbyte13:02:24

ah, didn't see the second line (construction attemp), sorry

joshjones13:02:32

yes, give it something and it works:

(java.util.zip.ZipOutputStream. (ByteArrayOutputStream.))

danielstockton13:02:22

Oh, i see. I am trying to give it something but I was using the threading macro. I guess that's a nono.

joshjones13:02:16

no, that works too

joshjones13:02:26

what’s your code?

danielstockton13:02:24

(-> ZipOutputStream.
    (Channels/newChannel)
    (.write (fress/write {:bob :test})))

danielstockton13:02:39

I lied (unintentionally) 😄 I'm not giving it a baos

mpenet13:02:14

first value is not wrapped for free, it's just threaded in the rest

danielstockton13:02:46

(-> (ZipOutputStream. (java.io.ByteArrayOutputStream.))
    (Channels/newChannel)
    (.write (fress/write {:bob :test})))
is my code now, I've got a different error but I should be good to continue on my own. Thanks

danielstockton13:02:29

It works if i use a GZIPOutputStream..

joshjones13:02:40

just to be clear about what mpenet just said: the first arg of most (all?) core threading macros is a form that is evaluated, and ZipOutputStream. is not what you want to do. If there were a no-arg constructor for the class, you still have to call the constructor by using: (ZipOutputStream.)

danielstockton13:02:59

Yep, I understood, thanks.

danielstockton13:02:25

I knew that but was getting confused by all the errors.

shayanjm17:02:34

I'm not really familiar with Executors... I have a fixed threadpool in which I'd like to initialize every thread with a Kafka consumer before they start work (pulling data from Kafka using the consumer)

shayanjm17:02:42

how would I go about doing this?

qqq18:02:49

does anyone have a basic working electron app I can copy/paste? the first two results I got from github are not working for me

plins19:02:03

hello everyone, using schema.core how can I create a field with a varying type? some link s/Str :or s/Number

plins19:02:11

something like *

plins19:02:38

stumble on this function but no examples were provided, any clue on the syntax?

plins19:02:43

found example on GH thx

plins20:02:16

still struggling to get this working

(schema/defschema Table
  (schema/cond-pre {:headers [schema/Str]
                                             :rows [[schema/Num]]}
                                           {:headers [schema/Str]
                                             :rows [[schema/Str]]}))
any ideas on how this should work?

pesterhazy20:02:36

I think you can also use s/conditional

pesterhazy20:02:43

(def EitherFooOrBar
  (s/conditional #(foo-like? %) Foo :else Bar))

pesterhazy20:02:02

@plins don't understand your example

shayanjm20:02:54

Is anyone here familiar with high performance in clojure? I'm hitting a bottleneck using an executor fixed thread pool and I'm not sure how to reason about it

shayanjm20:02:31

gisting code right now

plins20:02:00

@pesterhazy, i want to create a field inside a schema, which can be either an integer or a String

jr20:02:23

:rows [[(s/cond-pre s/Num s/Str)]]

shayanjm20:02:58

Basically, I'm trying to figure out how to speed up this particular consumer. Its only job is to consume from a single topic and write the data to a DB. The timestamp is calculated before the DB query is even fired

shayanjm20:02:45

on slow inputs (i.e: 10 messages in a small burst) I can see <100 msec elapsed time

shayanjm20:02:14

but as the input speeds up, the average elapsed time gets huge (>2 secs for ~500 bursted messages)

shayanjm20:02:57

Not really sure what's going on. Would love to speed this up but just throwing threads at it hasn't really been helping either

qqq20:02:05

hasn't spec replaced schema, or does schema still have something to offer?

pesterhazy20:02:43

schema works well for many of us

geoffs20:02:45

schema's api isn't considered alpha still...

shayanjm20:02:44

and the timestamp is generated before the DB query anyway

tanzoniteblack20:02:13

@plins here's what I think you want from your example:

(schema/defschema Table
  {:headers [schema/Str]
   :rows [[(schema/cond-pre schema/Str schema/Num)]]})

tanzoniteblack20:02:33

this returns a schema where the given item must be a map that contains only the keys :headers and :rows; :headers must be a (possibly empty) list/vector of strings; and :rows must be a vector of vectors (any of them possibly empty, or the entire containing vector might be empty); each of these sub-vectors/lists will be composed of a miss-match of strings or numbers

joshjones20:02:32

so 10 db transactions take 100ms — and 500 transactions take 2000ms (or more) … is that right? @shayanjm

tanzoniteblack20:02:35

if you want each of the subvectors/lists to be composed of only strings or only numbers, but to allow either of them as possibilities:

(schema/defschema Table
  {:headers [schema/Str]
   :rows [(schema/cond-pre [schema/Str] [schema/Num])]})

plins20:02:38

(def str-or-number (schema/cond-pre schema/Num schema/Str))
(schema/defschema Table
  {:headers [str-or-number]
   :rows [[str-or-number]]})
ended up with this

tanzoniteblack20:02:16

yep, that would do it

clodeindustrie21:02:26

hi there, just compiled an uberjar for my project (that is basically just dependencies for the moment) and it’s spitting out a 25MB jar, I this normal ?

tbaldridge21:02:16

@shayanjm step 1: turn on reflection warnings vis (set! warn-on-reflection true) at the top of the file

tbaldridge21:02:38

(set! *warn-on-reflection* true)

shayanjm21:02:58

@joshjones - better statement would be that "getting" 500 messages takes 2000ms or more

shayanjm21:02:08

"getting" 10 messages takes 100ms

shayanjm21:02:16

this doesn't account for database transaction time.

shayanjm21:02:25

this is purely "how quickly can I grab messages from Kafka"

tbaldridge21:02:30

The compiler will then warn you about several reflection issues your code has. That can make a huge difference. Especially in get-next-message

shayanjm21:02:08

@tbaldridge before or after the ns block?

shayanjm21:02:43

kk checking it out

shayanjm21:02:41

yeah got a few reflection warnings

tbaldridge21:02:59

aside from that, I'd look into what your db/insert-match<! function is doing. I'd stub that out for testing at first, and afterwards perhaps look into batching writes to the database

shayanjm21:02:41

@tbaldridge: Yeah, so that timestamp is recorded before insert-match<! is fired. The elapse on the timestamp is irrespective of how long it takes to transact to the DB

shayanjm21:02:12

it's taking ~2 seconds on average to even get a message from the kafka topic

tbaldridge21:02:09

@shayanjm also, I'd look a bit into how you're measuring time here. Depending on how you are enqueuing these messages, I'm not sure you're measuring what you think you're measuring

tbaldridge21:02:26

If the thing writing to the queue is on another box you could be experiencing time skew.

shayanjm21:02:45

@tbaldridge: A timestamp is slapped onto the message when written to the queue (process is local)

tbaldridge21:02:52

Also, at some point you're measuring the delivery time of Kafka.

shayanjm21:02:57

and slapped onto the message once that message is pulled from the queue

shayanjm21:02:30

Yeah I guess my assumption here is that there's no way Kafka could possibly be the bottleneck... that might be an unfair assumption

shayanjm21:02:38

I think there's a pretty easy way to verify that, one minute

qqq21:02:28

does anyone have datascript working with persistent storage? (no I don't want datomic -- I'm writing a re-fram/electron app, and I need a way to persist my datascript)

mruzekw21:02:11

@qqq I’ve done some thinking on this and I’ve come up with 2 options: Save an edn file to disk or persist to localstorage

qqq21:02:04

@mruzekw : either way, is it with https://github.com/tonsky/datascript-transit read-transit-str and write-transit-str ? I found a github issue where someone wanted "incremental logging" and the answer was "no, you have to write entire db out even after 1 change"

alanspringfield22:02:20

Is there a good way of using Datascript with re-frame without having to rewrite the reference implementation?

schmee22:02:42

alanspringfield have you checked out https://github.com/mpdairy/posh?

alanspringfield22:02:14

@schmee thanks for the suggestion

alanspringfield22:02:01

so posh is a complete replacement for re-frame?

schmee23:02:27

I think so, I haven’t used either of them enough to comment really

schmee23:02:18

I just finished watching this talk, and he made pretty convincing case for Posh IMO 🙂

alanspringfield23:02:42

@schmee Thanks again. Seems like a pretty interesting talk