Fork me on GitHub
#clojure
<
2016-05-15
>
akjetma00:05:05

Should specifying a value for the :eof option to clojure.edn/read-string prevent these exceptions and return the provided value here, or am I misunderstanding the purpose of that option?

jungle.receiver> (edn/read-string "(")
RuntimeException EOF while reading  clojure.lang.Util.runtimeException (Util.java:221)
jungle.receiver> (edn/read-string {:eof nil} "(")
RuntimeException EOF while reading  clojure.lang.Util.runtimeException (Util.java:221)

richiardiandrea01:05:22

@dpsutton: resources are always re-rooted to the / of you uberjar file, it is confusing sometimes I know. For instance if you put resources/css in your resource-paths the content (no css/) will be accessible with (io/resource yourfile.css).

ghadi02:05:49

@akjetma: you're getting the exception because of an incomplete form (the open paren without contents or closeparen). The :eof option is a way for read-string to give you back a special marker value when you hit a non-erroneous end of stream:

user=> (edn/read-string {:eof :END} " ")
:END

ghadi02:05:55

it's more useful when repeatedly calling edn/read on a large stream

akjetma02:05:10

Ahhh, okay, thank you. I read :eof - value to return on end-of-file. When not supplied, eof throws an exception. in the docstring for edn/read and failed to notice that read-string passes an options map with :eof nil by default

ghadi03:05:45

"sentinel value"

risto03:05:01

what happened to defadt?

jarodzz03:05:39

@danipov thanks. found your reply in gmail after dropped. I do not agree though.

jarodzz03:05:00

our app talks to different services including jdbc, http/rest. we always choose async for http, but never for jdbc. 'coz jdbc request blocks a connection, but http request doesn't. The http protocol itself supports async request.

jarodzz03:05:47

Sure we can use Future to make a JDBC request act like async, but back end, it always cause a thread to be stuck and wait for the results.

jarodzz03:05:12

As for http/rest service, the server can provide async mode or not, I am wandering if i have a service owned by some one else, what i can do to verify whether it is supporting async mode or not

prozz07:05:37

hello, whats the current recommended choice of libs for simple crud web app? any up to date articles or blog posts please?

artiavis07:05:12

@prozz: generally see Luminus for the bundle of libs which currently best give a starter CRUD app. There isn't anything approximating Rails or Django currently maintained.

prozz07:05:50

thanks, i dont really need a framework, separate libs are fine too. im just worried im not up to date and may miss something valuable.

jonas07:05:03

If you want to compose libs you can get pretty far with a ring + ring-defaults and a routing library (like compojure or bidi)

prozz07:05:00

duct seem like a nice starter, thanks 😉

jonas07:05:12

@prozz: Duct is really nice. The configuration handling is a bit confusing at first (at least for me) but once you understand that part the rest is pretty straight forward

prozz07:05:08

thanks all for help 🙂

Shantanu Kumar08:05:23

Can anybody point me to a resource on using Clojure 1.8 Socket-server (instead of nREPL) with Emacs CIDER? Is this supported?

hiredman08:05:14

cider uses nrepl which is a more complicated protocol than just a repl on a socket

hiredman08:05:02

https://github.com/clojure/tools.nrepl has an nrepl client and server, if you want to embed an nrepl server in your app so cider can connect to it

hiredman08:05:07

you may be able to rig up something with netcat and inferior-lisp mode if you care to fiddle with emacs

josh.freckleton14:05:58

I just added a schema channel, and asked a question there, anybody know anything about this problem? : https://clojurians.slack.com/archives/schema/p1463320925000010

arrdem20:05:42

With schema is there a good way to say "any keyword in this set" ?

lfn320:05:36

@arrdem: s/enum? or if you mean as keys in a map just (into {} (map (fn [key] [key s/Any]) keyset))?