Fork me on GitHub
#clojure
<
2015-10-15
>
ericnormand00:10:17

yeah, I've tried that

ericnormand00:10:23

but I need the .m2 during build

lfn300:10:59

@ericnormand: yeah the build server does the same thing.

lfn300:10:53

Keeping the ‘building’ and ‘packaging’ step separate is a good idea imo, since the tools to do those things are different.

lfn300:10:23

Although I mean you could probably write ‘lein docker’ or something.

nberger00:10:46

@ericnormand: "but I need the .m2 during build" you mean your build server? which starts over with a clean .m2? We cache it there, so it's the same from build to build. But perhaps you mean a different thing?

danielcompton00:10:30

Is it a bad idea to make my own Closeable-like protocol which is the same as Closeable but doesn’t return void? I want to communicate to the caller whether the timeout has been exceeded. The alternative would be to throw a TimeoutException, though i’m not sure if that’s the Clojure’y way

richiardiandrea00:10:25

I guess it is a pure design decision, where returning conveys that part of the protocol is to give back a result...imho now Closeable reads: "ok, I will perform the side effect of closing the resource, I will return nil"

richiardiandrea00:10:52

but yours would read: "look, I am closing, but here is something back to you"

richiardiandrea00:10:11

don't know if it's clear but for me it makes sense

richiardiandrea00:10:24

sorry, i missed a not

richiardiandrea00:10:33

it does not makes sense 😄

richiardiandrea00:10:53

if Closeable is a purely side-effecting function

richiardiandrea00:10:59

it should return nil

danielcompton01:10:51

I think I’m being guided toward throwing an exception

ericnormand01:10:33

@nberger: we're building the war in the docker build. We're starting with a lein docker image to guarantee we have clojure

richiardiandrea01:10:37

note, this is only "my honest opinion" , it'd be great to listen to others 😄

ericnormand01:10:46

@nberger, @lfn3: it's actually quite annoying because any time we do a docker build after changing the project.clj, it has to fetch all dependencies again

ericnormand01:10:17

hence me trying to fix it somehow

lfn301:10:33

@ericnormand: so is there any reason you don’t want to do the build outside the container?

nberger01:10:40

@ericnormand: Perhaps you could COPY the m2 repository before COPYing project.clj... but that might bring you some new problems, not sure...

ericnormand01:10:43

@lfn3: i guess the reason is so you can do docker build, use docker-compose etc to build your containers

ericnormand01:10:28

@nberger: that might work, but we don't have an .m2 dir yet. it's all in the building containers

lfn302:10:57

@ericnormand: well you’d just be using lein uberjar && docker build . I mean up to you, but personally I really wouldn’t want to be deploying lein along with my app if I can avoid it.

ericnormand02:10:20

yeah, I see what you mean

ericnormand02:10:00

we have a weird deployment

datajohnny02:10:15

Hi, I have a skeleton app with a postgres db but everytime I try to do the connection it is being refused im doing a docker docker-compose build is there a specific db url I must use?

datajohnny02:10:57

I am current using this one jdbc:

lfn302:10:30

@ericnormand: Every deployment is a unique and beautiful snowflake. Why else would we build so many complicated tools to handle them?

lfn302:10:36

¯\(ツ)

ericnormand02:10:42

it's kind of crazy

ericnormand02:10:54

we should just use the war!

ericnormand02:10:15

it's already packaged up

ericnormand02:10:22

we do have a crazy deploy

ericnormand02:10:43

unfortunately I was very new to Docker when we started and didn't understand what was happening

ericnormand02:10:26

we spent a lot of time trying to get things to work properly using just the Dockerfile (no env vars for instance).

ericnormand02:10:29

do you start with a java image?

roberto02:10:35

is there any tutorial on component for a total newbie?

roberto02:10:48

some sort of component for dummies ?

ericnormand02:10:46

@roberto: I don't know of anything myself, but I'm sure there's something out there

ericnormand02:10:03

I just googled around a little

roberto02:10:27

been looking around, but all the docs I’ve found make a lot of assumptions about what I know

roberto02:10:40

it has been my greatest frustration with clojure

ericnormand02:10:55

what do you know? what's your level?

roberto02:10:58

btw, I love your videos

roberto02:10:14

I’ve built a couple small web apps already

roberto02:10:25

I’m comfortable with the language, but not with the tooling

roberto02:10:50

i have to dig into a lot of the source code for the libraries out there everytime I want to use one

ericnormand02:10:11

I dig a lot, too

lfn302:10:46

@ericnormand: yeah so we just use the java8 image from docker hub

ericnormand02:10:03

ok, interesting

ericnormand02:10:36

I may be advocating for that the next time we tweak our deployment

ericnormand02:10:42

it would save a ton of time

lfn303:10:36

Yeah go for it. Tell them some random dude who looks like a doge on the internet told you to do it 😏

magnars07:10:30

what sort of Session stores are people using for Ring? I don't want them in memory, since that forces logouts on people during redeploys.

ul07:10:46

i use redis

ul07:10:45

no, self-made wrapper using carmine

ul07:10:58

ah, sorry

ul07:10:05

carmine's built-in

magnars07:10:52

ahh, I see. I'll have a look at that. Thanks!

mpenet07:10:02

yeah rrss requires a background process to clean up expired sessions, carmine is smarter with this

mpenet07:10:16

(it uses redis expiration on keys)

magnars08:10:30

Carmine looks really great.

mpenet08:10:30

Actually I think rrss might be more lightweight in memory given how redis performs the ttl on normal keys, but more risky with the background process thing if you have a ton of opened session, and a tiny bit slower with expiration time updates. small tradeoffs, but I still prefers carmine's

mo-love08:10:25

Gold morning

mo-love08:10:58

Greetings from Mannheim, Germany

magnars08:10:11

Greetings from Oslo, Norway simple_smile

zenleaf08:10:11

Hi to all from Nelspruit, South Africa

mo-love09:10:20

@magnars what are you using clojure for?

mo-love09:10:41

What kind of programs?

gjnoonan09:10:20

@mo-love: Hello from England

magnars09:10:35

@mo-love everything, really simple_smile I've got several static websites built with clojure, three clojure web apps running in production, two of them for paying clients, as well as writing tools and stuff for myself - on top of creating a few web games with it.

mo-love09:10:41

@gjnoonan hey! Where about in England are you from?

gjnoonan09:10:25

The North, East Yorkshrie

mo-love09:10:11

@magnars cool. I am using it for natural language processing and generation. Lotsa fun.

gjnoonan09:10:20

@magnars: can’t wait for more Zombies 😄

magnars09:10:48

@gjnoonan: cool, will be a new episode in not too long simple_smile

mo-love09:10:33

Episode? What are you talking about? A podcast?

ska09:10:43

Are there any clojure libraries that are easy to use from Java w/o having to get a Var and invoke it? I'd like to study how people are doing it.

magnars09:10:45

It's a Clojure-flavored screencast http://www.parens-of-the-dead.com/

mikera09:10:02

@ska getting a Var an invoking it is probably the best way to use Clojure from Java. The other way is to use gen-class / AOT compilation but IMHO that is more complicated and more difficult to maontain

maleghast10:10:14

I am so going to watch that later on @magnars simple_smile

tcrayford10:10:50

@ska typically you'd wrap the "get a var and invoke it" in some java stuff I think.

ska11:10:38

@tcrayford: that is actually what I am looking for. I'd like to find a lib doing just that so that I can have a look at the rough structure and how to build it in the end.

Alex Miller (Clojure team)12:10:09

@ska the other other way to do it is to create a Java interface and implement it on the Clojure side - in some ways this provides the highest quality Java API (java doc, types, etc)

ska13:10:20

@alexmiller: I am aware of that way, too. But thanks for pointing out simple_smile. Still the question remains: are there any libraries where I could study how others have done it before?

Alex Miller (Clojure team)13:10:35

@ska I can't think of a good example to point to, I've mostly done it in closed-source projects

Alex Miller (Clojure team)13:10:48

Storm was a Clojure project with a Java API, not sure if it still is

Alex Miller (Clojure team)13:10:01

prob a pretty complicated example

thheller13:10:48

@ska does it count if I call a java function from clojure with a deftype that implements a java interface

thheller13:10:04

technically that java function invokes clojure 😉

abp14:10:14

@ska here is a video of rich hickey giving a lightning talk on building shims to call clojure from java: https://skillsmatter.com/skillscasts/3864-impromptu-rich-hickey-lightning-talk

ska14:10:21

@thheller: I'd take a look at it if you point me to it. @abp: thanks, will take a look

ul15:10:51

is there a way to type hint array of floats?

pbostrom15:10:25

@ul: try ^floats

ul16:10:58

seems to be working! thanks a lot!

ul16:10:59

and another stupid question about arrays

ul16:10:09

how to get subarray quickly?

ul16:10:37

without conversion back and forth to clojure collection

ul16:10:51

iterate in a loop?

ul16:10:00

or some function exists?

sarcilav16:10:30

@ul you can use (subvec v start end)

sarcilav16:10:38

where v is your array

ul16:10:02

wow, it's great. i love Clojure more and more! thank you for help!

ul16:10:31

doesn't work =(

ul16:10:51

ClassCastException [F cannot be cast to clojure.lang.IPersistentVector

ul16:10:05

okay, no problem, i will do my own function

sarcilav16:10:28

@ul

user=> (subvec [1 2 3 4 5 6] 3 5)
[4 5]
user=> (subvec (apply vector (range 100)) 3 50)
[3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49]

ul16:10:50

it's vector, i'm speaking about arrays

ul16:10:56

like produced by float-array

ghadi16:10:15

ul: java doesn't have array views/slices

ul16:10:44

i will just iterate then

ghadi16:10:52

System/arraycopy

ericnormand20:10:16

anyone familiar with leiningen and repo mirrors?

ericnormand20:10:29

I'm trying to get mirrors to work with plugin-repositories

bensu21:10:19

@ericnormand: you mean like s3-wagon?

ericnormand21:10:57

I mean I'm using :plugins [[lein-immutant "2.0.1"]]

ericnormand21:10:11

and it's downloading it and all of its dependencies from clojars and maven central

ericnormand21:10:23

but all of the other dependencies are being downloaded from my mirror

ericnormand21:10:27

:mirrors
                 {#"clojars" {:name "Artifactory Clojars", :url ""},
                  #"central" {:name "Artifactory Central", :url ""}}

bensu21:10:59

ahhh get it. lein treats the :plugins differently. Sorry, no idea

ericnormand21:10:10

if I move the :mirrors into the project, it works!

ericnormand21:10:17

i had it in the profiles before

ericnormand21:10:29

well, that's less than ideal but I can live with it

bensu21:10:15

cool, no debugging needed

ericnormand21:10:31

well, debugging's been done

ericnormand21:10:40

I've been trying to get this working for a few hours now

bensu21:10:14

edit: cool, at least no leiningen debugging needed 😐

roberto22:10:55

finally starting to understand how to use component parrot

joelkuiper22:10:02

eehm, I have a weird problem. I’m on a OS X El Capitan hackintosh, just did a fresh install with brew install boot-clj

Exception in thread "main" org.sonatype.aether.resolution.DependencyResolutionException: Failed to collect dependencies for [#<Dependency org.clojure:clojure:jar:1.7.0 (compile)> #<Dependency boot:boot:jar:RELEASE (compile)>]
	at org.sonatype.aether.impl.internal.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:371)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
….
Caused by: javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:992)
	at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375)
	at sun.security.ssl.SSLSocketImpl.writeRecord(SSLSocketImpl.java:747)
	at sun.security.ssl.AppOutputStream.write(AppOutputStream.java:123)
	at org.apache.http.impl.io.AbstractSessionOutputBuffer.flushBuffer(AbstractSessionOutputBuffer.java:131)
	at org.apache.http.impl.io.AbstractSessionOutputBuffer.flush(AbstractSessionOutputBuffer.java:138)
	at org.apache.http.impl.AbstractHttpClientConnection.doFlush(AbstractHttpClientConnection.java:270)
	at org.apache.http.impl.AbstractHttpClientConnection.flush(AbstractHttpClientConnection.java:275)
	at org.apache.http.impl.conn.AbstractClientConnAdapter.flush(AbstractClientConnAdapter.java:197)
	at org.apache.http.protocol.HttpRequestExecutor.doSendRequest(HttpRequestExecutor.java:258)
	at org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)
	at org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:645)
	at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:464)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:820)
	at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:754)
	at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.execute(AbstractHttpClientWagon.java:674)
	at org.apache.maven.wagon.shared.http4.AbstractHttpClientWagon.fillInputData(AbstractHttpClientWagon.java:793)
	... 8 more
Caused by: java.io.EOFException: SSL peer shut down incorrectly
	at sun.security.ssl.InputRecord.read(InputRecord.java:505)
	at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:973)
	... 24 more

joelkuiper23:10:06

looks like it was a poorly timed maven central issue