This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-08-23
Channels
- # admin-announcements (1)
- # alda (1)
- # bangalore-clj (5)
- # beginners (17)
- # boot (392)
- # capetown (4)
- # cider (16)
- # cljs-dev (24)
- # cljsrn (33)
- # clojure (106)
- # clojure-berlin (1)
- # clojure-nl (1)
- # clojure-russia (168)
- # clojure-spec (85)
- # clojure-uk (137)
- # clojurescript (83)
- # clojutre (4)
- # component (10)
- # cursive (6)
- # datavis (9)
- # datomic (11)
- # defnpodcast (15)
- # dirac (4)
- # docker (1)
- # ethereum (1)
- # hoplon (27)
- # jobs (5)
- # jobs-rus (1)
- # lein-figwheel (2)
- # luminus (5)
- # off-topic (5)
- # om (13)
- # onyx (60)
- # parinfer (2)
- # planck (12)
- # proton (2)
- # re-frame (45)
- # rethinkdb (5)
- # ring-swagger (9)
- # spacemacs (9)
- # specter (49)
- # test-check (1)
- # untangled (104)
- # yada (10)
(ns omni.dal.google.datastore
(:require [st.log :as log])
(:import [com.google.cloud.datastore Entity]))
;; Code elided, stream is a entity retrieved from the datastore.
(-> (Entity/builder stream) (.set "has_comment" true) (.build))
2016-08-23T04:01:51.899861+00:00 app[web.1]: Exception in thread "async-dispatch-1" java.lang.ClassCastException: Cannot cast com.google.cloud.datastore.Entity to [Lcom.google.cloud.datastore.Entity;
at java.lang.Class.cast(Class.java:3369)
at clojure.lang.Reflector.boxArg(Reflector.java:427)
at clojure.lang.Reflector.boxArgs(Reflector.java:460)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:58)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
...
@samedhi Looks like it's expecting an array of Entity? The [L
prefix...?
@seancorfield: ah…. very interesting
Dunno...
You can see the [L
format with (type (into-array String []))
which prints [Ljava.lang.String;
Do you have a link to the javadocs for that Google stuff? Having a hard time finding the right links
I can only see a static method called newBuilder
on Entity
, or a nested Builder
class inside Entity
Found it... I think ... Hmm, so Entity/builder
expects either an Entity
to copy from or a Key
?
@samedhi any luck?
http://googlecloudplatform.github.io/gcloud-java/0.2.7/apidocs/com/google/cloud/datastore/Entity.html (javadocs) https://github.com/GoogleCloudPlatform/gcloud-java/blob/master/gcloud-java-examples/src/main/java/com/google/cloud/examples/datastore/DatastoreExample.java (examples)
Yeah, that is what I am reading as well, but I did replace it per your first suggestion with (into-array [updated-entity])
and now it works.
Thanks @seancorfield !
Yeah, I have to interact with a few Java libraries that use the builder pattern and it's a pain from Clojure sometimes due to overloading and lack of type hint in threaded forms...
Glad you got it working!
im trying to find a versioning system spec. i think i saw it on HN.
you start from 1.1
and you only increment the minor
number with every release.
you only increment the major
when you branch, but keep the minor
incrementing.
1.1 -> 1.2 -> 2.3 -> 2.4 -> 1.5 -> 2.6
what was the name of this scheme?
Where the minor part keeps incrementing even when you change the major part? boggle How does that convey any useful information?
it sounds good to me, semantic versioning never sat will with me for the reasons outlined in the mono write up. but I've never really tried to adhere to either, so I can't give a good compare and contrast
I've generally found semver easier to work with since you get a simple ordering within each major version for when you release updates to older versions... I've sometimes had to maintain two major versions back and it's a lot easier for users if they get 1.2 1.3 1.4 and 2.1 2.2 2.3 etc so they are no gaps
having 2.1 1.2 2.3 2.4 1.5 1.6 seems like a recipe for confusion to me
@hiredman: that's the one i was looking for, thanks! @seancorfield: the minor version just says it's a newer version and gaps in minor version numbers indicate there was also releases on other branches too. im not sure if it's good or bad, i was just having lunch break and that's what i was thinking while i couldn't get @flyboarder's demo running because of versioning issues 🙂
Heh, well, if folks use semver-looking version numbers but don't actually follow semver semantics you're in for some pain.
at my last job, we released every two weeks, and the "version" of the release was the date of release, with a optional patch level
even when you do, the semantics I think are under specified and open to interpretation
Yeah, we tag with a date/time stamp at World Singles because it's just ongoing development on "the web apps" but as we move more toward independent libraries we'll need to adopt semver (or something else).
@hiredman: I have a boot-semver task which you can use in build pipes for versioning
well, there is http://calver.org too to consider
I started there before lein was written, and phil was working there when he started the lein project
that is a fiar point, our other libraries tended to have something vaguely resembling semantic versioning
I think in a single org, where you can define the underdefined stuff inhouse, it can work
expecting to have the same interpretation of semver as someone else on the internet seems like how nodejs library flamewars start
compatibility can be tested to determine if it needs to be incremented for a release (maybe even using clojure.spec)
hey guys, recently I have a problem regarding working with repl. My flow is I often have a big chunks of code in (comment )
as a playground to trying out things in repl. The problem is when ever I evaluate the whole buffer, the whole comment area is being evaluated as well, even it doesn't do anything as expected but it slows down the evaluating process dramatically. Is there any way we can prevent this ? Thanks
@iku000888 I have tried it but it still evaluates the whole thing
it slows down evaluation? that doesn't seem right
how much code do you have in your comments?
@pesterhazy it's about 400 lines
don't think that having this amount of code in a #_
'ed out block should affect eval performance
if I don't have those commented code, it only takes ms. If I do, it takes around 7 8 seconds
my guess is there's something else wrong with your file
or repl environment
maybe the editor is slowing things down?
np I will try cider if it does solve the problem. hmm there is some problem regarding deps while installing cider, I guess I will try this later then.
@nxqd: sounds like there is something outside of your comment expression. maybe you have multiple comment expressions and something in-between them
@onetom not really, there is nearly nothing between those. I try to evaluate the the region without comment, it takes ms.
super enjoyed the latest episode @vijaykiran @raymcdermott
(defmacro defmap
[name f & b]
"apply a function on all of it's arguments?"
`(def name (fn f [email protected])))
Given that docstring doesn’t seem right, I’m not sure what to make of that… I mean it seems to be just another form of defn
…?
(defmap foo [a b c] (println a b c) (+ a b c))
=> (def foo (clojure.core/fn [a b c] (println a b c) (+ a b c)))
It certainly doesn’t do what the docstring says
(and the docstring is in the wrong place)
github found defmap in https://github.com/naleksander/mapreduce
Hey guys, I have a question for you, I am injecting some services to my web application. I would like to destruct these services only once and define my routes after so I came up with something like that :
The let function only returns the last element of the sequence. is there another method such as let that will return every element of the sequence ?
No problem. 🙂 If you (macroexpand-1 '(defroutes foo (GET “/“ [] “bar”)))
you’ll see that’s all defroutes
really is underneath, too.
so I am playing with spec
and I thought of doing:
(def event-fields [::type ::timestamp ::payload])
(s/def ::event (s/keys :req event-fields))
but I have a java.lang.IllegalArgumentException: Don't know how to create ISeq from: clojure.lang.Symbol
I am in alpha10
(cannot updgrade because of a dependency not updated from the dreaded ns
error) so maybe it has been solved...has anybody faced this problem?
@richiardiandrea: event-fields
should be in a seq, I believe
mmm...ok, I am trying, but event-fields
is a vector itself
right - the “args” to the :req
key need to be a seq, as you can have many required keys - let me find a link
yeah 😉
your option works, but I am trying now to see what it validates
I think the problem is that keys
is implemented as a macro; it doesn't evaluate its arguments. So you have to pass it sequences, not symbols that evaluate to sequences.
yes I was suspecting that
ok, good to know, I was trying to refactor the spec as in plumatic.schema
where schemas are data and you can play that trick
and this is especially useful in order to avoid duplication if you are using a http://clojure.org/guides/spec#_multi_spec
I am stuck with some compojure/jetty problems Id like to parse the body of a POST request to get as json. I use the ring.middleware.json/wrap-json-body tu parse it. if I do : (POST "/" request (-> request (get-in [:body])))) I get the body as a HttpInputOverHttp type. I would like to get a map but nothing seems to work. I use the ring.adapter.jetty as my server.
@abolduc, how do you set up the middleware?
did you restart your repl?
better safe than sorry!
you probably can, but restart the repl nonetheless, just to be sure
https://github.com/johnwayner/lein-datomic can't run lein datomic start on Windows OS because windows run "bin\transactor" instead of "bin/transactor"
hi is this the right place to ask a clojure question ? ( has to do with reflection of java methods )