Fork me on GitHub
#beginners
<
2017-04-18
>
momofarm10:04:44

hi i'm wondering what's the difference between function "filter" and "take-while", the book "clojure for brave and true" says that take-while won't process every record , but I am not sure how this function could do it without peeking the record or sort it first.......

Sam H10:04:41

try (take-while odd? [1 3 2 5]) and (filter odd? [1 3 2 5])

Sam H10:04:40

take-while will just stop when the predicate returns false

giaosudau12:04:17

Is there anyone using korma for ORM?

giaosudau12:04:06

I have question on join tables. “SELECT DISTINCT v.,count() as cnt FROM pm_videos v JOIN pm_tags vt ON vt.uniq_id = v.uniq_id JOIN pm_tags vt2 ON vt2.safe_tag = vt.safe_tag AND vt2.uniq_id = ‘$uniq_id’ AND vt2.uniq_id != vt.uniq_id GROUP BY v.uniq_id ORDER BY COUNT(*) DESC LIMIT ”

giaosudau12:04:47

I don’t know If I would rather transform using sql to korma orm?

giaosudau12:04:22

I have define entities for pm_videos and pm_tags.

sb13:04:39

I solved the nginx-supervisor issue, therefore I deleted my posts.

timo14:04:56

that is something strange: when I load

6   :dependencies [[org.clojure/clojure  "1.8.0"]                                                                                                                                           
  7                  [org.clojure/data.json  "0.2.6"]                                                                                                                                         
  8                  [com.microsoft.azure/azure  "1.0.0-beta5"]                                                                                                                               
  9                  [com.microsoft.azure/azure-management  "0.8.0"]                                                                                                                          
 10                  [com.fasterxml.jackson.core/jackson-databind "2.8.6"]                                                                                                                    
 11                  [com.taoensso/timbre  "4.10.0"]                                                                                                                                          
 12                  [clj-http  "3.5.0"]]                                                                                                                                                    
then it gives me a CompilerException java.lang.ClassNotFoundException: org.apache.http.conn.ssl.DefaultHostnameVerifier, compiling:(clj_http/conn_mgr.clj:1:1) on (require '[clj-http.client :as client]) but when I do load clj-http in first place it works fine. Why is that?

not-raspberry14:04:44

Run lein deps :treein both configurations and compare what org.apache.http you get (which is closer to the root) in each case.

timo14:04:14

whoa! @not-raspberry that's messy how am I supposed to solve this messy dependencies? always take the latest or just watch out for errors?

not-raspberry14:04:43

the problem seems to me like dependencies authors not specifying the right versions of their dependencies (correct me if i'm wrong)

noisesmith16:04:54

I’d say it’s more that different projects ask for different versions - sometimes you can say it’s because one of them is asking for objectively a wrong version, but that isn’t always the case

not-raspberry14:04:11

you exclude dependencies, like: [io.weft/gregor "0.5.1" :exclusions [log4j/log4j org.slf4j/slf4j-log4j12]]

not-raspberry14:04:32

(that's an entry in the :dependencies vector)

renan15:04:16

Hi guys, have someone already used clojure with thrift? * I have a service in clojure with datomic and I need communicate between this service with other services

timo15:04:25

what means No reader function for tag...

dominicm15:04:31

@timok that means you have code like #foobar and nobody has defined what foobar means as a tag.

timo17:04:51

how would one get the www-authenticate header from a 401-response with clj-http?

timo17:04:27

(defn get-tenant [subscription]                                                                                                                                                           
     (let [response (client/get (str "" subscription "?api-version=2015-01-01") {:accept :json :throw-exceptions false :as :json :coerce     :always})]                                                                                                                                                                               

timo17:04:05

this returns a 401 but there is the www-authenticate-header that I need to process

psalaberria00218:04:48

@timok the headers keyword contains a map of headers, where both the key and the value are strings

timo18:04:02

great! thanks!