This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-03-19
Channels
- # beginners (15)
- # boot (99)
- # braid-chat (1)
- # business (1)
- # cider (109)
- # cljs-dev (1)
- # cljsrn (3)
- # clojure (249)
- # clojure-brasil (2)
- # clojure-canada (2)
- # clojure-madison (4)
- # clojure-russia (3)
- # clojure-sanfrancisco (1)
- # clojure-taiwan (1)
- # clojure-uk (1)
- # clojurebridge (1)
- # clojured (1)
- # clojurescript (15)
- # clojurewest (1)
- # cursive (9)
- # datomic (12)
- # editors (16)
- # euroclojure (1)
- # hoplon (45)
- # off-topic (22)
- # om (181)
- # onyx (2)
- # parinfer (3)
- # pedestal (17)
- # re-frame (2)
- # ring-swagger (1)
- # spacemacs (34)
- # testing (2)
- # untangled (2)
- # yada (1)
I solved that looking through the ring-swagger logs
Does anybody remember an article about extreme macro optimization? Think it had yellow text on a black background
https://gist.github.com/munro/df5191d998befdb8acdc <-- anyone know of a nicer way to dynamically generate N levels of (fn [a] (fn [b] (fn [c] [a b c])))
? I didn't use a macro because I wasn't sure if it would work with clojurescript. my solution is hard to understand, and it was hard to write!
@tomjack: š® awesome! ty! should I use assert
instead of deftest
? doesn't seem to integrate with cursive though
In https://www.4clojure.com/problem/63 my solution fails the second test - why? See here:
@ptrwldn: just tried that but I got an error as the Ā«Ā ALERTĀ Ā» exchange is not found (the exchange I used is Ā«Ā dataĀ Ā»)
clojure.lang.Compiler$CompilerException: sun.security.provider.certpath.SunCertPathBuilderException unable to find valid certification path to requested target, compiling:(form-init2418347235443421362.clj:1:8
@swizzard: it is not clj-http
issue, it is a commonly known jvm exception that is raised when no CA certificates found
This is a jdk problem and you will receive that exception on every java app/lib that will try to use https or anything related to ssl/tls
Cannot have the Clojure client receiving messages http://pastebin.com/mA8UbAxq
hi, I'm learning clojure (I'm a scala developer and write the equivalent of CIDER). I've hit this problem when setting up Emacs, can somebody please help? https://t.co/mvvM3zHyMu
@fommil: you might try #C0617A8PQ
@codonnell: I already have cider
I mean, ask in the #C0617A8PQ channel
what is the idiomatic way of loading runtime configuration into a clojure application? Do people use HOCON?
@fommil: I'm using edn files for that, I have one file with default files and other (not tracked by the repo where the user can overwrite the default settings called local.edn
(defn deep-merge
[& maps]
(if (every? map? maps)
(apply merge-with deep-merge maps)
(last maps)))
(def ^:const +default-config+
"config/default.edn")
(defn read-config
[]
(let [defaults (edn/read-string (slurp (io/resource +default-config+)))
local (io/resource (:local-config env "config/local.edn"))]
(if local
(deep-merge defaults (edn/read-string (slurp local)))
defaults)))
@swizzard: have you tried clj-http-lite (or perhaps clj-http 3.0.0-SNAPSHOT)
I've ran into a similar problem with clj-http and that time it could be tracked down to how apache http client (that clj-http uses) worked with some particular certificates. That issue is fixed in the 4.x versions of the apache client, however clj-http 2.x still uses an older version. Back when I had the problem, I was forced to use clj-http-lite. It uses a plain HttpURLConnection which worked.
I find using packages better than copy and pasting because then we can develop the ecosystem
@apviitanen: i tried clj-http 3.0.0-SNAPSHOT & got the same error
has anybody here used clj-oauth
? I don't understand what the verifier
is supposed to be https://github.com/mattrepl/clj-oauth
I don't see how the test can even run https://github.com/mattrepl/clj-oauth/blob/master/test/oauth/client_twitter_test.clj#L28
@apviitanen clj-http-lite gave me javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_failure
I am trying to start two go blocks - one would produce values to a channel and one would consume. Hereās the code:
(ns cljnoob.utils.async
(:require [clojure.core.async :refer [go chan alts! >! >!! <! <!!]]))
(defn produce [ch]
(println "Produce")
(>!! ch "hello")
(Thread/sleep 1000))
(defn consume [ch]
(println "Consume")
(println (<!! ch))
(Thread/sleep 1000))
(defn start-producing [ch]
(go (while true (produce ch))))
(defn start-consuming [ch]
(go (while true (consume ch))))
(defn make-chan
[]
(chan))
And my main function:
(ns cljnoob.core
(:require [cljnoob.utils.async :refer :all]))
(defn foo
"I don't do a whole lot."
[x]
(println x "Hello, World!"))
(defn -main
[]
(let [ch (make-chan)]
(do
(start-producing ch)
(start-consuming ch))))
When I am executing lein run
- nothing happens.
~/Projects/cljnoob ā® lein run
~/Projects/cljnoob ā® lein run
Interestingly, if I manually put a message to the channel instead of the start-producing
function, I do see a message printed.
I am pretty sure somewhere thereās a very simple noob mistake. I just started learning clojure.I think I understand why - my work is being done in go blocks so the main thread is no longer running. That might be the reason why I donāt get any output.
can somebody please let me know why this code (which is my first clojure code) is returning an authentication error?
I can confirm that the tokens all work when I use Twitter's OAuth tool, which produces a curl
command for me to run.
I'm starting to think this library is just broken. I've been told https://github.com/cemerick/friend is the standard, but I can't find any docs on how to use it to do something this simple
@fommil No idea, perhaps change the http/get to hit your local machine and check what are the params being sent
I've filed a ticket at https://github.com/mattrepl/clj-oauth/issues/49
this is the end of my exploration of clojure unfortunately, as I can't really build any of the demos I had in mind if authentication and GET/POST doesn't work
@swizzard: ok, then itās most likely a case of missing CA certificates
@apviitanen: yeah, i figured
it doesnāt seem like /Library/Java/JavaVirtualMachines/jdk1.8.0_74.jdk/Contents/Home/jre/lib/security/cacerts
is correct
@thiagofm: I can't find anything else. The only other OAuth than I could find is Friend, which has no documentation or examples for OAuth 1.0A and has been dormant for years
@thiagofm: this is my first attempt to write some clojure, I think what you're suggesting is beyond what I'm capable of at this point.
Isn't oauth just a http request? You discover how the protocol works, implement something that builds up some params and send a http request
I'm pretty sure you can learn much from it and this seems easier as a first project than relying on other people libs(I still have much difficult in that, clojure doc for most libs suck)
You could learn a bit about clojure interop with java and perhaps use a stable java lib to do it for you instead
I've already specced out the demo app I want to write, I'm am not interested in going into rabbit holes like implementing OAuth
I have had the same experience as you for like 5 years with clojure, but I always go back and saddened by the fact I wasn't improving much my clojure-fu
I only have one day to do this, and I've basically wasted it. I don't know when I'll get another chance to investigate clojure again.
nope, I have too many obligations in scala open source. I gave myself one day to explore clojure, and it's gone.
Hi, any idea why my langohr clients does not receive message from my RabbitMQ ? http://pastebin.com/mA8UbAxq ?
@fommil: I can usually be 1283928x more productive in a ruby/java/?? because of the tooling, the docs and stuff in general, but if you can go step by step with a problem, take your time and try to do it in clojure, you'll learn a lot
@fommil: I'm not clearly understand that you pretend constantly saying that you have wasted your time...
@fommil: I don't think you can get a real impression about anything in life in just one day. Instead of writing clojure, I would spend sometime watching some talks of what people are building with clojure and see if it makes sense for what you want to do. If they are working in the same kind of problems you want, you join the community, learn the language and prepare yourself to "lose" a lot of hours debugging.
basically I read several books on learning clojure, I've got 10+ years of lisp experience, I'm a JVM professional, and I gave myself a day of hacking around with clojure to see what it feels like.
@fommil: you're passing empty strings as +twitter_access_token+ and +twitter_access_token_secret+ ?
@fommil: I'm not asking about your credentials. It's also okay to get frustrated by losing a day with something, but I'm pretty sure that in "10+ years of lisp experience" you've probably had at least one full year of this experience.
@tomjack: they are being picked up ok because a C-x C-e
on the credentials
definition or something has content in it
@jethroksy: yup, and been through all the src and tests
@jethroksy: well in OAuth there is a mechanism for going from your application keys to get the user to log in and approve the app, which will give you the access token (and secret)
but because I am developer and user, I can just get the access tokens directly from
... that bits fine, I don't want to faff around with that bit since I just want to get something working for myself
@jethroksy yes, I already have the access token and secret, I'm not using the library to do that bit
@jethroksy: yeah, so that last bit is the bit that's failing
so the call to oauth/credentials
is wrong, or that function is broken, or I'm calling http/request
incorrectly
I don't want to use them directly because that would defeat the point of writing a OAuth / REST demo
I couldn't work out what needed to happen in there. The README basically waves its hands at that point
the thing is that when I use these exact tokens to generate a query for curl using https://dev.twitter.com/oauth/tools/signature-generator/9530038?nid=731 it all works
@fommil: It might be quicker to just try this lib: https://github.com/r0man/oauth-clj
@tomjack: I'm passing the full credentials object, yes, as per the README of clj-oauth
. Do you spot something wrong there?
@rauh I'll try this lib you found, it's more recent, it has a better chance of working
@fommil: I've used that library once from the twitter-api library. Maybe it's helpful: https://github.com/adamwynne/twitter-api/blob/master/src/twitter/oauth.clj
@fommil: also it helps to experiment from the REPL. It's the first thing you should learn when doing Clojure, if you haven't realized it already
@fommil: oh. really your problem is that you're not passing screen_name in the actual request
@tomjack yeah I thought about that and added it to the payload (with a :merge
), but then I get a different auth error. Is this just twitter having crappy error messages?
in https://github.com/r0man/oauth-clj the author doesn't seem to be showing the import statements, is there anything obvious missing from that demo?
no, your code doesn't pass screen_name in the actual request. but with that modification, yes
I'll push my code before I forget what I did. Now I can write a little macro around this
@fommil: First rule of macro club is don't write a macro when a function (or data structure containing functions, etc) suffices (which is 99% of the time), but for educational purposes it's perfectly fine
@fommil: One of the reasons is that macros don't compose (i.e., you can't pass the value of a macro)
it would be nice if there was an easier way of going from the app tokens to the user's access tokens, that is a nice feature of https://github.com/r0man/oauth-clj
@borkdude yeah, I know I've done elisp for a long time. I'm just keen to try out the language features.
@fommil: Cool. I see you are also active in the Scala community. I've just started with that, so maybe we can help each other š
we should add a "Learning Scala" page soon, because more people are coming to us first
I don't know the slack etiquette. But I would have thought for a channel that's been dead most of the day, pretty much anything goes
@fommil: well, some people catch up with the history so too many off topic remarks aren't appreciated I think
@fommil: I say this only because I've written way too many off topic remarks here in the past š
here's something on topic: i have been trying to DRY up some damp parts of my stack, which for these purposes consts of boot, system, component and schema. I'm trying, in short, to add schema sanity checks to my components in a standard way
so i end up with systems that look like https://gist.github.com/colliderwriter/f6e70b73d45268a0c1eb
where 'options' is a function that decomposes the component's schema and returns the keyword names
does this seem reasonable as a standard practice? it's DRY and it works but aesthetically i'm not sold
What would be a good tool to format my clojure code? (Something like go fmt
for golang)
@masnun: I never used it, but saw it on twitter recently. Normally I just use this function in emacs: (defun iwb () "Indent whole buffer." (interactive) (delete-trailing-whitespace) (indent-region (point-min) (point-max) nil) (untabify (point-min) (point-max))) (global-set-key (kbd "s-<f2>") 'iwb)
@masnun almost the same function, but then in coffeescript instead of elisp: https://github.com/griiin/atom-auto-indent/blob/master/lib/auto-indent.coffee
Atwood's Law: If it can be written in JavaScript (CoffeeScript included), it will be written in JavaScript.
Incidentally, cljfmt has a clojurescript version, so it can be run under node. Could probably be integrated into Atom without too much difficulty.
I read through āClojure for the Brave and Trueā last night and Iām loving Clojure so far. I wish the error messages were a bit more easy to understand sometimes.
someone should make a clojure-clippy plugin (like this https://softwaremill.com/scala-clippy-helping-understand-compiler-errors/ but for clojure)
masnun: The error messages are sometimes quite cryptic, unfortunately.
Theyāre probably better than they were. I know that last yearās Clojure survey rated them as the top problem in Clojure, so thereās certainly attention there.
Part of the problem is that in a dynamically typed language, better error messages tend to cost performance.
I guess it would be nice if more assertions were used, or something else that could be turned off and on.
@borkdude: yes, thatās what I am doing right now, first doing things in the repl and then putting them in the code
One other problem is that Clojure is a hosted language. That + dynamic means errors will sometimes come from a distant source and in terms of the hosting environment
Yes, and once the error is thrown, it doesnāt retain an exact position in the source code. Just the line number, if Iām not mistaken.
Aviso.Pretty does a great job to help you visualise the stacktrace https://github.com/AvisoNovate/pretty
Also improves repl exprience and improved stacktraces thanks to the already mentioned AvisoNovate/pretty
one question about core.async, i understand that go
blocks are lightweight threads, which is great. i am trying to figure out how to best wrap around, for example, a synchronous database library. would these green threads be the best way to wrap around these calls, or is there a move clever solution hidden in core.async
?
hey @lmergen if your db client library uses blocking IO to communicate with the db server, you're going to need to allocate a thread for each active connection