Fork me on GitHub
#clojure
<
2016-02-14
>
euwyn01:02:53

hi all, new to clojure! i’m using "clj-http.client” in a project. how would i use the results of one api request in another? is there a concept of callbacks?

akiva01:02:25

@euwyn: no, not really. It’s not required. Look into promises. http://dev.clojure.org/display/design/Promises

akiva01:02:40

There might be better links than that one but it came first for me.

shriphani03:02:04

hi, has the http://clojuredocs.org/ domain expired ?

solicode03:02:50

@shriphani: Doesn’t look like it. Why? What do you see?

solicode03:02:34

Hmm, strange. I’m able to access it fine

seancorfield03:02:00

I can't get to it...

shriphani03:02:22

only nanjing, China can pick it up as per whatsmydns

seancorfield03:02:14

Interesting... Long-lived DNS?

seancorfield03:02:51

And St Petersburg, Russia!

solicode03:02:46

I’m in Japan though, so maybe that’s the difference

shriphani03:02:25

do we know who owns that domain? is it cognitect ?

solicode03:02:27

Doing a whois on it, it seems like something was updated today. But it expires in 2017

amacdougall04:02:41

Something just occurred to me... I have some code where I require a namespace as just user. Later, I have a let where I bind user to a user hash. Then I call (user/do-whatever user)... and it works. Clearly this is confusing code to begin with, and I should rename one of the two things. But why does it work at all?

kul04:02:44

Can you try ((ns-resolve 'user 'do-whatever) user)?

kul04:02:01

I am guessing require creates a user/do-whatever var

amacdougall04:02:36

I'm just saying (require '[my.project.users :as user]), but it would make sense if it worked by putting all the user/foo defs into the namespace.

amacdougall04:02:04

I'm actually struck by a different (and non-Clojure-specific) dilemma right now... it has to do with API design.

amacdougall04:02:16

Let's say I have users and videos. I don't want unprivileged users to be able to list all users on the site, because even if I strip out emails, there's trolling potential. It just doesn't seem quite right. But I do want to have a list of videos created by those users, and I want the creator to be a field on each video so people get credit and... since you can look up a user profile if you have the username, we're back where we started. Classic privacy vs connection problem you run into on every community site ever made. I guess I'll prevent the user listing, but if someone really wants to write a script to individually look up each user's profile after finding them on the video or comments lists, so be it.

amacdougall04:02:20

We say "CRUD" is the simplest of all application types... but somehow each one ends up having innumerable layers of complication, each with its own long-term consequences.

lsenta10:02:54

Hi guys, quick question, is there a way to setup a test fixture for a "package"?

lsenta10:02:48

I want all my tests under test.api to setup a test server, and the only solution I found so far is to copy and paste the use-fixtures in every namespace

m10:02:28

Hi people! I got problems transferring the following java line into clojure code: It just hits the limits of my understanding of java's class system: http://DataLine.Info info = new http://DataLine.Info(SourceDataLine.class, audioFormat);

m11:02:31

(the classnames come from javax.sound.sampled)

m11:02:40

The problem is, that I cannot instantiate DataLine itself, it looks like it goes only through Info, but I don't know the right form for this situation. Any suggestions would be highly appreciated .

moxaj11:02:06

@m you could try (let [info (DataLine$Info. SourceDataLine audioFormat)])

moxaj11:02:34

@m not 100% sure though simple_smile

lsenta11:02:50

Maybe that'll help: https://gist.github.com/santamon/1034374#file-audio-clj-L15 (the comments say there's an issue with .open tough)

m11:02:27

cool, thanks for the link. DataLine$Info worked by the way!

onetom12:02:01

im also wondering how to (stuartsierra)componentize the https://github.com/mcohen01/amazonica library, so i can create a mock version of it too. has anyone done such thing yet?

onetom12:02:19

currently the clojure functions in the various amazonica.aws.* namespaces are hardwired to use the corresponding real implementation (`Amazon*Client`)

kaffein18:02:57

Hi people!does anyone know where Euroclojure will be held this year please ?

anmonteiro20:02:30

I don't think it has been announced yet

robahl20:02:20

Is there a function in Clojure that can be used as a HOF and just return itself without acting on the arg? Instead of (fn [v] v)

bridget20:02:48

kaffein: In the Clojure Remote community panel, Alex said they are still working on locations and should know (he hopes) in a few weeks. It will likely be in fall.

robahl20:02:59

dmitrig01: Thanks!

kaffein21:02:21

bridget oh thank you so much for the info ;-)

jbaiter21:02:21

quick question, is there something like yesql that is a bit more mature and/or maintained?

jbaiter21:02:29

i'm currently working through the 'web development with clojure' book and it recommends the library, but I've been playing around with it for my own project for a few hours now and i can't help but feel annoyed, the concept is brilliant, but there's very little documentation, some obvious features like batch-inserts are missing and some features are not working at all, with no reply on the issue for 5 months

jbaiter21:02:20

annoyed is the wrong word, it's more 'bummed'

mikeb22:02:02

@jbaiter probably nothing more mature than yesql, it sort of originated the templated query idea. What do you mean by batch-inserts? Here are 2 similar, but quite new libs. https://github.com/layerware/hugsql https://github.com/mikeball/foundation

jbaiter22:02:34

mike: insert multiple rows with a single statement, like this: https://github.com/krisajenkins/yesql/issues/51

jbaiter22:02:40

thanks for the links!

mikeb22:02:07

jbaiter: no problem. I'm actually the author of foundation, and can say that yes it supports batch inserts transparently, mostly because it uses a dsl for inserts/updates. https://github.com/mikeball/foundation/blob/master/docs/inserting-data.md Be aware it's a really new lib, departs from standard java.jdbc and is postgres specific.

jbaiter22:02:59

mikeb: foundation sounds awesome simple_smile I'm currently trying to stick with an embedded database, though, so it's unfortunately not suited for the current project 😕 but now I know what i'll use for the next bigger project or when I get sick of sqlite or h2 for the current one

mikeb22:02:26

jbaiter: Just looked into hugsql, and it has something called tuple param types which might work for batch inserts. You can always fall back and use good old https://github.com/clojure/java.jdbc and it's insert! function.