Fork me on GitHub
#clojure
<
2016-05-14
>
josh_tackett03:05:52

Anyone ever use fatcow for hosting?

jarodzz07:05:42

hi, guys. not sure if this is the right channel. when i use core.async to call a http service, how do i know this service supports async call

jarodzz07:05:35

is it possible that the http/rest service doesn't enable async, so it looks like i am doing some performance improvement, but actually not?

jarodzz07:05:10

my point is, we can async all http/web cause it is supported from protocol and server side, right? we can't do it to jdbc calls, 'coz they don't support it.

danipov09:05:10

@thug.nasty: if you want to implement session storing in a web app/API for authentication or authorisation. Try a lightweight library like Buddy. They also have great documentation!

danipov10:05:46

@jarodzz: no experience with core.async, yet. If I understood you correctly then I think your question is more of a design question. So you want to make asynchronous calls so you/user doesn't need to wait for the result and you don't block the whole program with the call. So if you ask me it doesn't matter if your backend supports async calls or not because you implement async calls on your client so the app doesn't get stuck waiting for the result of the call. Don't get me wrong the backend CAN implement async calls but often it's just to divide the load on the procession of calls and not so it can go hand-in-hand with your client. Hope it helps.

lewix13:05:50

@stunami: you're welcome

dpsutton19:05:57

I'm using clojurewerkz/propertied to load db connection strings. When i'm running in the repl, i can find the file just fine. However, when i build the jar, i'm getting an illegalargumentexception: not a file ...standalone-jar!/config.properties

dpsutton19:05:09

however, the config.properties file is indeed in the jar file

dpsutton19:05:28

does anyone have any idea why this file, which seems to be present in the jar, is being reported as not found?

hiredman19:05:06

dpsutton: hard to say where the error is, but it is pretty common

arrdem19:05:22

dpsutton: looks like you're using on something that's a classpath resource not a file.

dpsutton19:05:33

hmm. i don't know much about java

hiredman19:05:37

people try to treat resources as files, which sort of works in development, but as soon as you actually package something as a jar it doesn't

dpsutton19:05:41

not sure of the difference between resource/file

hiredman19:05:05

a resource is a stream of bytes with a name that you can read from a classloader

hiredman19:05:41

a file is a thing on a filesystem

hiredman19:05:13

the key point here is, your properties "file" isn't a file when it is part of a jar

dpsutton19:05:25

haha well that's subtle

dpsutton19:05:42

(let [props (p/load-from (-> "config.properties" io/resource))] works when i remove the io/file

dpsutton19:05:47

what a strange distinction

dpsutton19:05:06

did it remove file header information and just store the bytes?

hiredman19:05:08

can you run cat on a "file" in a jar?

hiredman19:05:55

no, look, people refer to a "file" as being in a zipfile, but as far as your filesystem is concerned, a zip file is a file, and the contents are not

dpsutton19:05:07

ah fair point

arrdem19:05:11

A jar is just a zipfile, and the zip file structure doesn't have the concept of directories. It's actually a bunch of key/zipped byte pairs, where the keys are strings that happen to map to paths.

dpsutton19:05:21

that makes more sense

hiredman19:05:55

and resources are loaded via a classloader, which can get the bytes from anywhere, it can even just make them up

dpsutton19:05:27

well thank you very much for your help

vinnyataide19:05:41

hello, I'm doing the brave and true chapter 10 about refs, can I say that's like a transaction from the java world when you open one and close with a commit?

nha19:05:54

in Clojure how can I pass a String[] argument to a Java function ?

vinnyataide19:05:26

you can cast as ^String[] not sure if it works tho

vinnyataide19:05:37

I saw some code with it in cloj droid

nha19:05:07

I tried but I don't think it changes anything

nha19:05:16

It is just a hint I think

vinnyataide19:05:26

hm, ok I'm a begginner πŸ˜›

nha19:05:33

We alls are πŸ˜›

nha19:05:16

(type ^String []) yields clojure.lang.PersistentVector

vinnyataide19:05:09

why the space between

nha19:05:47

It is the same

nha19:05:09

(As far as I know)

slipset19:05:11

(into-array [β€œfoo” β€œbar” β€œbaz”])

nha19:05:45

Oh could work ! Let me try πŸ™‚

nha19:05:17

Looks OK (at least no exception at this point). Thanks !

nha19:05:09

Also I did create a question just before you replied so it you want to make an answer there I'll accept it. Otherwise I will put your answer there http://stackoverflow.com/q/37231094/1327651

nha19:05:37

I have to wait a bit to accept. But I will ! πŸ™‚ Thanks.

slipset19:05:29

No worries, have fun with Clojure simple_smile

richiardiandrea22:05:54

@dpsutton: an example of what I do in lambone (a project template) in order to address both files and jarred resources: https://github.com/Lambda-X/lambone/blob/master/resources/leiningen/new/lambone/common/src/backend/system.clj#L16

dpsutton22:05:54

Oh thanks. I'm gonna look at this

dpsutton22:05:35

I when I changed the resources path in my project clj file it broke serving my css and image files. Really not sure about what's a file vs what's a byte stream