This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-02-16
Channels
- # announcements (2)
- # aws (2)
- # babashka (29)
- # beginners (69)
- # calva (6)
- # chlorine-clover (2)
- # cider (1)
- # cljs-dev (4)
- # clojure (44)
- # clojure-israel (1)
- # clojure-spec (3)
- # clojure-uk (31)
- # clojured (2)
- # clojurescript (6)
- # code-reviews (22)
- # core-typed (133)
- # cryogen (6)
- # cursive (7)
- # datomic (25)
- # emacs (19)
- # fulcro (69)
- # graalvm (1)
- # graphql (7)
- # lumo (1)
- # off-topic (92)
- # parinfer (2)
- # pedestal (6)
- # reagent (5)
- # remote-jobs (1)
- # shadow-cljs (11)
- # tools-deps (20)
- # tree-sitter (1)
- # vim (4)
- # vscode (6)
Hey
I am trying to use amazonica
on AWS lambda but library is too large.
The recommendation is to exclude some SDKs like this:
:dependencies [[org.clojure/clojure "1.7.0"]
[amazonica "0.3.48" :exclusions [com.amazonaws/aws-java-sdk
com.amazonaws/amazon-kinesis-client]]
[com.amazonaws/aws-java-sdk-core "1.10.49"]
[com.amazonaws/aws-java-sdk-s3 "1.10.49"]]
But that looks like leiningen to me.
Does anyone know how I can do that with clj-tools
using the deps.edn
file? I've been reading the wrong page.
https://clojure.org/reference/deps_and_cli
The reference mentions that :exclusions
is supported
Also, if you don't really need some more or less advanced features of the full AWS SDK, maybe you could use a much more lean and sensible https://github.com/cognitect-labs/aws-api/
I only now saw your message, thank you looks very promising 🙂
I'm working on a clojure tool, what do you think? https://twitter.com/v1aaad/status/1229021375249240065
No, it's a separate window that is integrated into jvm — you will get the same window no matter the editor
Even better. I'm guessing you can tap>
values into it? The video might show it, but it's a bit hard to tell because it's a bit small. 🙂
Question on file/line metadata attached to forms (not vars) by macros, see thread
The output forms of a macro may not look at all like the input forms, but I notice that exceptions for code using macros like ->
have accurate file/line numbers in the stack trace. So I'm trying to figure out how to make my own macros do the same.
The answer seems obvious when I look at the ->
macro. It's copying the metadata of the input form to the output form like this:
(with-meta `(~(first form) ~x ~@(next form)) (meta form))
So I assume that line/file metadata is present, during compilation anyway, on every form. But by searching I can't find any confirmation or doc on this.
Is this true and do you see any problem with using the same approach in my own macros?Yes, file/line number is present in metadata on forms passed to macros. I don't know how well documented that is.
Thanks for confirming Sean.
So, yes, if you want to pass the macro invocation's metadata into the result, that's reasonable I think .
Testing libraries deal with this explicitly -- look at the source of clojure.test
for example (or my expectations.clojure.test
).
Thank you!
IF someone is going to dive into ASM generation in clojure, should we use the raw asm.ow2 interfaces or the clojure.asm namespaces? I guess more specifically are the clojure.asm.*
interfaces considered private?
Then there is https://github.com/jgpc42/insn
is there an easy way to apply a function to all the elements between {}
in a string?
lets say I want to prefix foo to (or anything really) all occurrences like
"/math/plus/{parameter-x}/{parameter-y}" -> "/math/plus/{foo-parameter-x}/{foo-parameter-y}"
I'm trying to find something I know I've seen before but I'm unable to find: I'm writing a tiny HTTP=>(S)CGI translation layer; Ring of course does a great job of turning HTTP into Ring requests which is easy enough to turn into SCGI, but SCGI means the underlying app produces a complete HTTP request byte stream that I want to return verbatim, so I want to tell ring (well, I guess technically jetty or whatever the underlying server is) "no, don't serialize a response, literally just whistle these bytes into the socket"
I'm pretty sure I've seen exactly this API but I can't tell if I'm misremembering or if it was in aleph or maybe http-kit or something else
maybe the easier way to do this is to use aleph, start from tcp, and see if I can do the http parsing bits a la carte
ring accepts an InputStream as a body, so whatever you have, you can wrap in something like a ByteArrayInputStream @U07QKGF9P
Unfortunately the CGI response is the entire HTTP response including headers, so I’d still need to parse that
But I don’t like to write software that will earn me honorary mentions in CVEs a few years from now :)
I don't have a helpful solution, but there is a http parser kicking around for java that's pretty lightweight. It operates on a stream I think.
❓ Does anyone know whether I can get string content back (rather than exception thrown or from the exception object) when (cheshire.core/parse-stream reader)
fails because the content being parsed is not valid JSON? (I could convert reader to string and then use parse-string
, but supposedly parse-stream
is faster)
wdyt of this logic?
(try
(parse x)
(catch Exception _
(str x)))
The only concern would be performance; i.e. you cannot catch many exceptions per secondI do not know whether something like the TeeInputStream
class mentioned on this page would let you have two different readers for the same data source, one being cheshire.core/parse-stream, the other being a reader that puts the result into a string: https://stackoverflow.com/questions/5034311/multiple-readers-for-inputstream-in-java
@U45T93RA6 I think (str x) won’t work if x is a reader/stream. @U0CMVHBL2 This might slow down overall performance if 98% is happy case where we do not need access to the string when json parsing is successful. But this sounds quite valid approach and I can’t think of any other approach unless rewrite aother json parser.
there's StringReader
...
between that and TeeInputStream or some other logic you might be able to achieve a working try/catch