Fork me on GitHub
#clojure
<
2020-03-09
>
antono15:03:26

Hey, I am havin a problem with wrap-reload of the ring library: It expects a var as argument, but since I am using a component-based approach, the routes are created via a closure. I tried just wrapping the closure with wrap-reload , but it does not really work. Here a short code example:

(defn app-routes [app-component]
    (api
         (GET "/" [] "<h1> Hello, World! </h1>))
(defrecord WebServer [config http-server app-component]
    component/Lifecycle
    (start [this]
        (assoc this :http-server (jetty/run-jetty (app-routes app-component) config))))

lukasz15:03:27

@aoellerer you might need to create a handler component, and then set that as a dependency for the jetty component, something like this here: https://github.com/weavejester/ring-jetty-component/pull/5#issuecomment-301809215

Steven Katz17:03:42

anyone using neanderthal?

quadron17:03:26

there is a neanderthal thread you know

Steven Katz17:03:13

nope didnt know that, do you mean channel?

Steven Katz17:03:56

nothing showed up when i searched

quadron17:03:44

ah, I see you found it

quadron17:03:21

see the sample projects. also you need mkl installed separately

Steven Katz17:03:01

I installed mkl via intel installer and set the value in proj.cli…same error

quadron17:03:58

what os are you using?

quadron17:03:10

you might want to use the os package manager instead of the mkl instructions in some cases

Steven Katz17:03:11

i’m on macos, no package manager

quadron18:03:17

i'm also a user here, so i'm afraid i can't help you further :thinking_face:

Steven Katz18:03:53

Thanks anyway…I think I might have gotten it to work, environment variable problem

datran21:03:33

Does anybody know of a clojure wrapper for Google's Text-to-speech platform?

datran21:03:27

My search hasn't turned anything up, but I thought I'd check here before giving up

lukasz21:03:07

@datran I use Google's Java SDK for their translate API, it's pretty easy to use from Clojure, I'd say a wrapper is unnecessary

datran21:03:31

You're right, but it's not working out of the box for me so I thought I'd cast a desperate plea into the wind.

datran21:03:46

Now I'll have to actually read documentation, I suppose

lukasz21:03:10

that always helps ;-) Word about credentials - Google is particular about where you store them and how. It's easier if you're running on GCP, as the SDK can pull the credentials for you, assuming all service accounts and permission scopes are wired correctly

datran21:03:14

I'm not running on GCP, unfortunately (?) in this case

datran21:03:03

I think once I clear up authentication and dependencies the actual api seems very simple, but auth and deps are making my day not go smoothly : /

datran21:03:22

And I'd have to deal with that with a clojure wrapper anyways...

datran22:03:28

fyi, the problem was an out-of-date com.google.protobuf/protobuf-java dep, bumping that fixed the current error

didibus22:03:39

I might be going overboard. But I often have cases where I'm threading stuff, and I need to branch. Like A->B->CONDITION->cOR->d

didibus22:03:14

What do people do in that case? introduce a let?

seancorfield23:03:05

(-> a
    (b)
    (cond->
      condition (c)
      (not condition) (d)))
Like that you mean @didibus

seancorfield23:03:01

or

(-> a
    (b)
    (as-> v
      (if condition
        (c v)
        (c d))))
maybe that's clearer?

didibus23:03:08

Ya like that

didibus23:03:19

Ya, using as-> is what I do right now

didibus23:03:27

Was curious what others did

seancorfield23:03:01

It really depends on how complex a, b, c, d, and condition are.

didibus23:03:29

I feel I often want something like: (cond x? trim y? uppercase)

didibus23:03:03

Where cond would thread the arg into each condition predicate and condition brancg

didibus23:03:39

And it should short circuit as well

seancorfield23:03:44

We have condp-> and condp->> for that in our ws.clojure.extensions lib (`worldsingles/commons` I think on github)

didibus23:03:56

Oh that's right, I forgot about that

didibus23:03:00

That might be what I want

didibus23:03:03

I encounter this need more and more, so I might bight the bullet on that lib