This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-02-25
Channels
- # announcements (5)
- # beginners (74)
- # boot (5)
- # cider (57)
- # cljdoc (5)
- # cljs-dev (45)
- # clojure (37)
- # clojure-dev (6)
- # clojure-europe (4)
- # clojure-italy (17)
- # clojure-nl (11)
- # clojure-spec (48)
- # clojure-uk (96)
- # clojurescript (79)
- # cursive (17)
- # data-science (1)
- # datomic (27)
- # emacs (2)
- # fulcro (22)
- # immutant (1)
- # java (62)
- # juxt (4)
- # kaocha (4)
- # lein-figwheel (5)
- # leiningen (6)
- # midje (1)
- # mount (1)
- # music (3)
- # nrepl (6)
- # off-topic (49)
- # pathom (10)
- # pedestal (2)
- # re-frame (43)
- # reagent (2)
- # ring (2)
- # shadow-cljs (78)
- # spacemacs (6)
- # test-check (2)
- # tools-deps (4)
@grzegorzrynkowski_clo At first I was going to suggest getting rid of the as->
threader, but after looking at it, I think the following is most straightforward:
(let [b (ServerBuilder/forPort port)]
(doseq [h handlers]
(.addService b h))
(.start (.build b)))
make sense, thanks
(let [b (ServerBuilder/forPort port)
srvr (do (doseq [h handlers]
(.addService b h))
(.start (.build b)))]
(println "gRPC server started listening on port" port)
srvr)
One thing I've found useful to build into functions like these is a promise that is delivered once the service has started. It can either be passed in by the caller, or returned as part of a map that wraps the server object. This makes it possible for tests to use it to ensure the service is ready for requests before the test starts hitting it.
Anyone has an experience with Multi-part uploads with Amazonica ? Context: I am trying the merge 30K+ files into a single file in a Lambda function.
Why does transit-cljs
allow you to read/write directly from/to strings, but transit-clj
require the construction of ByteArrayInputStream
/`ByteArrayOutputStream`? Is there a way to read and write strings directly in the Clojure version?
@dts.siedel because String is the right abstraction in a js runtime, but not in the java runtime. It's simple to call the String constructor on a byte-array, but you end up doing a bunch of pointless work in common use cases if you convert to string (because often your target isn't a String in memory, it's an output destination like a File or socket which provides and OutputStream to write to directly). Similarly for input, the thing that you get the transit data from will almost always offer an input-stream, getting a String first then translating reduces flexibility and adds pointless layers of work.
That's fair. It just seemed very non-Clojurey to be creating and mutating this odd Java object, but it makes sense in that context. I'll just make a wrapper for my purposes that dumps to an in-memory string.
Thanks for the response @U051SS2EU
yeah - it's very easy to convert a byte-array to string or string to byte-array
I think there's a good comparison to the various collection operations here - it would be trivial to provide a function that scans a collection for a matching key, but it's not provided in order to make using a set or hash-map the low-friction path
(compare to common-lisp or scheme which have sets/hash-maps but many programs use lists instead with O(n) access because it has less friction with a normal coding style)
is that even doable for a highly dynamic and flexible thing like spec?
Is there a Markdown parser in Clojure (or Java) than can parse Markdown with GH extensions?
google found me this: https://github.com/atlassian/commonmark-java
@U4YGF4NGM That's what I'm playing with (via commonmark-hiccup
), though it does not seem to be handling tables in my test files even after adding an extension ta parse them.
I'm pondering what best to do with a vanilla java.util.concurrent.Future
I'm getting from the Firebase API. trying to .get()
it seems to be blocking my REPL thread forever? not sure.
is there a way to wrap it into a Clojure future that will play nicer?
the functions that work on a clojure future also work on that object
realized?
, deref
(with optional time-out arg), future-cancel
oh, I didn't think I could deref it.
deref will block the same way .get will, except you can optionally provide that time-out arg
I was wrong about realized?
, but deref
will work
egret.run=> (doto (java.util.concurrent.FutureTask. #(+ 1 1)) (.run))
#object[java.util.concurrent.FutureTask 0x2fa829be "java.util.concurrent.FutureTask@2fa829be"]
egret.run=> (def f *1)
#'egret.run/f
egret.run=> (realized? f)
ClassCastException java.util.concurrent.FutureTask cannot be cast to clojure.lang.IPending clojure.core/realized? (core.clj:7453)
egret.run=> @f
2
Hi, I am trying to use DynamoDB (dockerized local) with com.cognitect.aws/api. I am struggling to override the endpoint to match the local one. I am doing this:
(def db (aws/client {:api :dynamodb :endpoint-override "local" }))
(aws/invoke db {:op :ListTables})
But I get:
=> #:cognitect.anomalies{:category :cognitect.anomalies/not-found, :message "local"}
(meta *1)
=>
{:http-request {:request-method :post,
:scheme :https,
:server-port 443,
:uri "/",
:headers {"x-amz-date" "20190225T205047Z",
"x-amz-target" "DynamoDB_20120810.ListTables",
"content-type" "application/x-amz-json-1.0",
"host" "local",
"authorization" "AWS4-HMAC-SHA256 Credential=AKIAIEJE6SPXIMLB7VRA/20190225/us-east-1/dynamodb/aws4_request, SignedHeaders=content-type;host;x-amz-date;x-amz-target, Signature=2099f67eb5a11b49446bf3cbcf89202d94f3d0cf9973d1d6f5c37e85db202e63"},
:body "{}",
:server-name "local"},
:http-response {:cognitect.anomalies/category :cognitect.anomalies/not-found,
:cognitect.anomalies/message "local",
:body nil}}
is "local" a placeholder here? I'd expect at least a valid name like "localhost" otherwise
and the credential pointing to something on us-east-1 is suspicious
I have tried "http://localhost:8000" but it gets interpreted as a IPv6. I am suing "local"due to an entry on https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-core/src/main/resources/com/amazonaws/partitions/endpoints.json
"dynamodb" : {
"defaults" : {
"protocols" : [ "http", "https" ]
},
"endpoints" : {
"local" : {
"credentialScope" : {
"region" : "us-east-1"
},
"hostname" : "localhost:8000",
"protocols" : [ "http" ]
},
I believe this is a known issue
Thanks @U064X3EF3