This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-25
Channels
- # beginners (27)
- # boot (49)
- # cider (51)
- # cljs-dev (29)
- # cljsjs (1)
- # cljsrn (19)
- # clojure (59)
- # clojure-austin (2)
- # clojure-belgium (19)
- # clojure-china (1)
- # clojure-dev (14)
- # clojure-dusseldorf (7)
- # clojure-russia (8)
- # clojure-spec (115)
- # clojure-uk (45)
- # clojurescript (118)
- # css (6)
- # cursive (8)
- # datascript (20)
- # datomic (32)
- # emacs (5)
- # events (2)
- # flambo (21)
- # hoplon (58)
- # incanter (8)
- # jobs-rus (1)
- # jobs_rus (1)
- # off-topic (3)
- # om (22)
- # om-next (9)
- # onyx (5)
- # other-languages (79)
- # re-frame (126)
- # reagent (6)
- # ring (7)
- # specter (1)
- # untangled (119)
- # yada (38)
say I have a clojure-application that I distribute as a uberjar, and run with java -jar foo-standalone.jar
How would I go about to make it possible to connect to a repl within this application?
so I could say lein repl :connect localhost:1337
and inspect/modify the state of the app?
seems like -Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}”
would do the trick
@slipset: and note that nrepl is not the same as the socket repl available since clojure 1.8
Hello all, why (name (keyword "10.12.0.0/16")) => 16? Is there any way to get full string keyword?
try (name (keyword nil "10.12.0.0/16")) if you want the keyword to have that all as the name
I might be hopelessly lagging, but still using schema (despite clojure.spec) 😉 anyone knows how if there is a type for anonymous functions?
note that the reader won't read it that way, but it's fine to programmatically create and use keywords that way
@alexmiller: thanks, it worked
Is there a separate Clojure 1.9 release notes floating around somewhere? Or is spec the only addition in this release
@tap thanks!
@reitzensteinm: as we move into other stuff I will start updating the changes.md file again for subsequent releases
@firstclassfunc: what is it that you're trying to do ?
fantastic, thanks!
@lmergen this is reading from an SSH ChannelInputStream.. The stream needs to remain open so I am just looking to retrieve the buffer
ok, so all that is available ? what do you want to do when there is no more data available ?
Well I move onto the next sequence of write->read, write->read.. close..
@lmergen: yea but it depends on the overloaded class.. it does not always seem to work
so, your issue is that your read blocks, even when available returns a non-zero value ?
it eventually blocks yes because I have no way of knowing what is left in the buffer.
i think this is something that has more to do with the underlying socket implementation rather than clojure, but: you should set your socket to read in non-blocking mode. i vaguely recall, from my days as a C coder that reading from a socket might sometimes block if there is still data left to fill in the socket. as in: nobody guarantees it immediately returns if data is available!
@lmergen true but that is dealt with within the SSH library. I really just want to inspect the results of the buffer and move on to the next sequence.
if you want to do non-blocking io, the way to do that is with nio channels, if you are trying to do it with inputsreams you are fighting uphill
i personally think you should do something different: skip the whole .available() part
just read in non-blocking mode, and only enter recursion if the return value n == length of buf
and yes, nio channels like @hiredman suggests is the best abstraction here, you're reinventing the wheel
I would suggest not bothing with whatever non-blocking async whatever you are trying to do, you will almost certainly be fine spinning up threads and having them block doing io
but if you must, the way to do it is with nio channels, or netty channels, and the name of the inputstream class you reading from suggests that somewhere this is a channel you should being using instead
Tke for advice. Its not using NIO/NETTY but I get this is non-trivial. Tks.
once you find the way to get the channel instead of the inputstream you'll want to use https://github.com/ztellman/byte-streams
in which case, the library is built on blocking io, so trying to use it to do non-blocking io in someway is going uphill
Why not just use a function? (pad-fn "25px" {:color "blue"})
— macros don’t compose so functions are nearly always preferable.
idea is i may have a variable number of style items in that map, and I want to just have that function/macro/whatever expand the 4 values in place
(see my expanded answer in #C053AK3F9 )
(pad-fn "25px" {:any "arbitrary" :style "attributes" :go "here"})
yeah I’m just using this to simplify notation so while that works^ it doesn’t really help my needs etc - i’m guessing the type of transformation I want to do just isn’t possible in clojure though from everything I’ve read
It looks like you want something similar to the splice reader #?@
but a) I don't think is going to work anyways b) why not a macro including the "father" of pad-macro?
@richiardiandrea: I was thinking of potentially doing something with the “parent” but have no idea what that’d look like or if it’d allow the sort of convenience notation I was hoping for
You could get pretty creative with splice but as Sean said usually you prefer functions for composability, what if at some point you want to insert pad AND margin in the hiccup? The two macros won't work together but two functions can be composed