Fork me on GitHub
#beginners
<
2018-07-02
>
dpmontero10:07:28

The problem was Dropbox

orestis11:07:50

I’m drawing a blank, and google doesn’t help — I have a data structure, that I want to convert to JSON in UTF-8 and get the byte length so I can put that in a “Content-Length” header. I’m using Cheshire and Pedestal, but I’m not sure if the String I get back with cheshire/generate-string is in UTF-8 or not — or how I should convert that or count its bytes?

Charles Fourdrignier12:07:06

I plan to work on some OpenCV code soonly. I hope Clojure could help me in this job. I see a lot of mentions around “connect a REPL to a running program” and I’m looking for good references on the subject. There is my idea : - Writing a simple “infinite loop” which capture the webcam and send frames to an analysis function. - Launch the program. - Connect (?) to the program via REPL - Update (?) the analysis function and check the results until I get what I want Is it realistic ? Or did I misundertand the concept ?

andre.stylianos12:07:13

@charles.fourdrignier There's a great guide on using the REPL on the clojure site: https://clojure.org/guides/repl/introduction

andre.stylianos12:07:48

You're correct in your interpretation of how it can be used 🙂

cristibalan12:07:49

Hi. Is there a neater way to write this anon fn? It does what I want (remove optional list wrapping around some elements) but I find it quite ugly.

(def hic [:p {:moo 123} '("pew" "dew") [:b "oops"]])
(apply concat (map #(if (list? %) (vec %) (vector %)) hic))

andre.stylianos12:07:52

I can't see a way to make that anon fn neater, but you can also do the same with a reduce:

(reduce (fn [acc e] (if (list? e) (into acc e) (conj acc e))) [] hic)

👍 1
cristibalan12:07:49

Thanks. Your version is nicer cos it returns a vector instead of a list. Also just noticed that in mine, mapcat can replace the apply concat map 🙂

✌️ 1
andre.stylianos12:07:51

True! I always forget that mapcat exists 😛

Charles Fourdrignier12:07:54

@andre.stylianos Thanks ! I’ll try this and get back when hitting too much walls.

✌️ 1
SoV416:07:07

I want to do some machine learning and/or neural nets with clojure today. aside from Cortex what can I use?

matan16:07:13

Check out Neanderthal

matan16:07:38

But basically why use clojure for that?

matan16:07:58

You have it all in scikit, pytorch, etc

dpsutton16:07:05

Follow Carin Meier on Twitter and find her giggasquid blog. She's very big into this I believe

✔️ 1
matan16:07:28

Something else ... Where does the clojure ecosystem have anything that implements so called back-pressure??

SoV416:07:28

@matan you mean back prop? (backwards propagation) i'm not sure what back-pressure is.

noisesmith16:07:13

@sova backpressure is a behavior in an asynchronous system which intentionally slows a producer down when a consumer is overloaded, it leads to better failure and degradation behaviors

🐝 1
noisesmith16:07:37

@matan core.async and manifold both implement good backpressure when used properly

matan17:07:21

Thanks @noisesmith! Long time :-))

matan17:07:35

I was just asked by some Scala devs

matan17:07:06

They have Akka

noisesmith17:07:52

right, but backpressure is just one behavior of a distributed processing system, and clojure doesn't have something all tied up with a bow and ready to go like akka

matan17:07:27

Yes sure, core.async is only infrastructure for things like Akka I guess

noisesmith17:07:36

core.async only works inside one vm, akka works across vms / hosts iirc

Mario C.20:07:29

Quick question. What is the correct way of using the clojure.java.jdbc/get-by-id function? I am doing this.

(sql/get-by-id @url
                   (keyword (:my-table-name table-names))
                   id
                   :guid))
But I get an error that states: PSQLException ERROR: operator does not exist: uuid = character varying

Mario C.20:07:19

I am assuming here that :guid is telling the jdbc wrapper that :guid is the primary key.

Mario C.20:07:11

The id I am passing is generated by java.util.UUID/randomUUID and it is of type string

Mario C.20:07:29

It doesn't like that I am passing a string representation of a UUID. So I think I need to find a way to convert that string into a UUID and then send that over.

Karol Wójcik21:07:06

Does anybody have a problem with running the compojure example? I tried:

lein new compojure new-app
cd new-app
lein ring server
and poof:
Could not transfer artifact org.eclipse.jetty.orbit:javax.servlet:jar:2.5.0.v201103041518 from/to central (): Read timed out
Could not find artifact org.eclipse.jetty.orbit:javax.servlet:jar:2.5.0.v201103041518 in clojars ()
Could not find artifact org.eclipse.jetty.orbit:javax.servlet:jar:2.5.0.v201103041518 in  ()
Could not find artifact org.eclipse.jetty.orbit:javax.servlet:jar:2.5.0.v201103041518 in sonatype ()
Could not find artifact org.eclipse.jetty.orbit:javax.servlet:jar:2.5.0.v201103041518 in redhat ()
Could not transfer artifact org.eclipse.jetty.orbit:javax.servlet:pom:2.5.0.v201103041518 from/to central (): Read timed out
This could be due to a typo in :dependencies, file system permissions, or network issues.
If you are behind a proxy, try setting the 'http_proxy' environment variable.

hiredman21:07:21

works fine here, I would check all the things it mentions there (network, permissions, proxies)

Karol Wójcik21:07:19

ok that's problem with my network

Karol Wójcik21:07:18

😕 has anybody had a similar issue?

dpsutton21:07:40

is it repeatable? it says there "Read timed out". Possible its just a transient thing?

Karol Wójcik21:07:43

It's repeatable. It seems that's something wrong with my router. I am able to surf the net without any problems but when I try to download the jar manually then chrome says that this jar can harm my computer https://repo1.maven.org/maven2/javax/servlet/servlet-api/2.5/.

Karol Wójcik22:07:03

What is funny it;s not a problem with the antivirus. 😛 Tried with mobile network and it worked perfectly.