Fork me on GitHub
#beginners
<
2017-05-25
>
lepistane12:05:55

People say "go do some internships" but i feel like internship really depends on the team you are in. I've had bad experience and i feel reluctant to do it again unless i feel the team is great. What is your opinion? Should you rush and go as fast as you can to work in teams change as much as you can before landing in a good one or develop alone then when the time is right join good team?

agile_geek12:05:22

@lepistane almost all software of significance is developed by a team, working in any team teaches you how to interact even if it's what not to do.

agile_geek12:05:33

also every situation is different and not all practices are translatable to other teams so a 'good' team in one organisation can't always be transplanted to another org.

agile_geek12:05:17

Personally, I've learned a lot more from my and my fellow team members mistakes over the years than I have the successes.

joshkh14:05:10

i'm getting a spec error saying that my namespace doesn't conform. i'm getting this error on 1.9.0-alpha16, but not on alpha13 where it compiles just fine. any thoughts?

(ns 
  (:require-macros [cljs.core.async.macros :refer [go go-loop]])
  (:require [cljs.core.async :refer [put! chan <! >! timeout close!]]
            #?(:cljs [cljs-http.client :refer [post get delete]])
            [imcljs.internal.utils :refer [scrub-url]]
            [imcljs.internal.defaults :refer [url wrap-get-defaults wrap-request-defaults
                                              wrap-post-defaults wrap-auth wrap-accept
                                              wrap-delete-defaults]]))

joshkh14:05:55

it definitely has something to do with the #? conditional which i just added

fingertoe17:05:17

So what are some common approaches to database caching? If I run a SQL query and then do a bunch of operations on it for example, It probably won’t change, and I usually won’t want to fetch fresh (unless I do). Memoize seems too permanent, (because I might want to refresh). Atom?

curlyfry17:05:02

@fingertoe Perhaps https://github.com/clojure/core.cache or a more dedicated solution such as Memcached or Redis

mtkp17:05:15

also https://github.com/clojure/core.memoize (which uses core.cache internally)

fingertoe17:05:36

I’ll look those over, thanks!

ssansovich18:05:04

Is there a reason to use the thread-first macro vs get-in for retrieving values in a nested map or vice-versa, e.g. (-> m :profile :name) vs (get-in m [:profile :name])? Is one considered more idiomatic?

noisesmith18:05:49

only use -> if you need to use functions as part of lookup, if it’s only a series of keys always use get-in

noisesmith18:05:58

use the least powerful tool

ssansovich18:05:23

very helpful, thanks

alexmiller18:05:30

I would say both are ok and are frequently used. personally, in this case I would probably use get-in as it communicates more, but I would not complain if someone used ->.

mobileink18:05:42

fwiw, i find -> much more useful during dev, because it makes it very easy to inject functions (like meta) that help me figure out why my code doesn't work.

fedreg19:05:34

Hi all, brand new to Clojure. LOVE the language but know nothing of the ecosystem. Where should I start for a REST api? Is there a simple Express or Sinatra like framework to use? Some particular library to look at? thx!

akiroz19:05:01

Hi @fedreg ~! we use Ring for building HTTP services

fedreg20:05:27

@akiroz Looks very promising. Will take a look, thanks for the tip!

akiroz20:05:50

@fedreg do note that Ring is really just a common spec that most libraries follow, it defines handlers, middleware and request / response maps

fedreg20:05:09

@akiroz. Yup, gives me a good starting point. Exactly what I was looking for. Did not want something that wired everything up for me

akiroz20:05:15

I'd suggest using http-kit as the Ring server for simplicity

fedreg20:05:55

@akiroz. Will take a look at that as well. Much to learn but wow what an expressive language

akiroz20:05:57

the default Ring server is based on netty / jetty / java servlets IIRC

mobileink20:05:41

@akiroz sorry, not following. what is a "ring server"?

mobileink20:05:01

ring is middleware, no? use whatever server you like.

akiroz20:05:03

@mobileink I should probably say "ring-compatiable server"

akiroz20:05:31

A webserver that calls ring handlers on each HTTP req

mobileink20:05:49

never thought of it before, but this little bit of terminological confusion could be a prob for noobs. i know it took me a while to understand just what ring is/does.

akiroz20:05:30

more like a spec really, it defines how handlers / middleware should behave and what req / response maps look like. (the ring library also comes with a bunch of default middlewares and handlers)

akiroz20:05:21

yeah.... the term "Ring" by itself is super overloaded. It refers to the spec, the library and all the other libs compatible with the spec

mobileink20:05:55

fwiw i think of ring as "cgi for clojure"

noisesmith20:05:57

isn’t ring a protocol or set of protocols?

noisesmith20:05:04

or is it something slightly weirder?

sb20:05:35

Hello guys, could you help me, how can I implement this in Clojure? (HMAC(HMAC(HMAC(HMAC("AWS4" + "BAIIZQiU7ee4secrettokenkeyLZs3TNsRgTd","20170525"),"us-east-1"),"s3"),"aws4_request"))

sb20:05:04

I would like to create an amazon (aws) signature for rest api

mobileink20:05:26

@noisesmith: you can think of it (i think) as an intermediate protocol, between http and the app. so the app does not have to dirty its hands with http details.

donaldball20:05:11

More of a data contract than a protocol. A ring server will call your registered handler with a request data structure that looks like this and expects a response data structure that looks like that.

mobileink20:05:24

technically http is an application protocol. but what does that mean?

noisesmith20:05:18

@mobileink oh I meant like literally the ring library defines a clojure protocol

noisesmith20:05:25

I’ll just check the source

mobileink20:05:26

@donaldball smells like a protocol to me. 😉

noisesmith20:05:04

@mobileink I was talking about this - what each http server you can use via ring must implement https://github.com/ring-clojure/ring/blob/master/ring-core/src/ring/core/protocols.clj

donaldball20:05:06

Heh. I tend to think of protocols in clojure as defprotocols

noisesmith20:05:32

@donaldball yup the protocols are in that file I just linked

mobileink20:05:52

i'm thinking more generally, i guess. you could write a ring-like protocol without defprotocol. that's implementation detail. cgi is a kind of protocol.

mobileink20:05:21

once upon a time the server-side protocols of ring would have been called an SPI - "Service Provider Interface". exactly like HW driver SPIs.

noisesmith20:05:09

@mobileink to be clear, I was the one who dropped “protocol” into this convo, and it’s cool that you free associated and linked in the concept of a network protocol but I distinctly meant the kind of protocol that defprotocol creates

mobileink20:05:51

cool. i loves defprotocol. but it's implementation. you have to have a protocol already before you can start thinking about defprotocol.

akiroz20:05:36

@sb that looks like a reduce operation to me

mobileink20:05:37

then there's the dynamic bit. there are really at least 2 notions of protocol. defprotocol is really just like treating a class interface in oo is a kind of protocol - "signature" might be a better term. i tend to think of protocols as inherently involving interactivity.

sb20:05:01

@akiroz Yes, I created/ implemented the method.. with pandect/sha256-hmac (a few mins ago)

sb20:05:28

(just a draft solution, but still something wrong at the authentication..)

sb20:05:28

Maybe I need to write the full signin protocoll.. just little bit painful

mobileink20:05:54

(fun. there's making it work, then there's "but what is it, really?")