This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-02
Channels
- # beginners (61)
- # boot (84)
- # cider (43)
- # cljsrn (2)
- # clojure (99)
- # clojure-android (3)
- # clojure-austin (2)
- # clojure-italy (5)
- # clojure-russia (43)
- # clojure-spec (93)
- # clojure-uk (41)
- # clojurescript (94)
- # clojutre (1)
- # cloverage (8)
- # core-async (31)
- # cursive (3)
- # datomic (14)
- # defnpodcast (1)
- # editors-rus (7)
- # events (1)
- # hoplon (15)
- # leiningen (3)
- # luminus (6)
- # om (142)
- # onyx (86)
- # other-languages (4)
- # pedestal (1)
- # planck (1)
- # portland-or (5)
- # re-frame (96)
- # reagent (16)
- # ring-swagger (17)
- # rum (73)
- # specter (25)
- # untangled (14)
- # yada (142)
@kingoftheknoll Bit late to this, but an alternative I read about on Steve Klabnik's blog (http://blog.steveklabnik.com/posts/2011-07-03-nobody-understands-rest-or-http) was that you should be updating an attribute of the resource, e.g.:
POST /instance/2 {:status "restarting"}
And then it's up to your application to detect that the status has changed, and react to that (e.g. send the restart command)
@dominicm i think that is a hateoas approach, and it makes sense, but it’s quite different from what people consider “normal”. it’s a kind of inverted logic that feels almost algebraic
@lmergen My understanding is that it's REST. And that HATEOAS is just the hypermedia part of REST.
I'd be interested to know if there's a preferred way to refer to a group of resources in strict REST. Although, I did read in Roy Fielding's dissertation that a resource can be a grouping resource, so it may be acceptable to have
POST /instance?q=1&q=2&q=3 {:status "restarting"}
But I wouldn't swear to it
@lmergen RE the normal consideration, in the grand scheme I agree it's outside that, whether that's for a good reason is questionable. I'm not sure my suggestion is outside that in the specific domain though. I'm fairly certain that's how one server management API I've interacted with works. I remember finding it a real pleasure to work.
Looks like digital ocean works by interacting with an action resource. So you would create a "restart" action resource, with the target id. That's the other option that I think would be fairly REST.
@dominicm Correct. No hypermedia, no REST. From October 2008(!): http://roy.gbiv.com/untangled/2008/rest-apis-must-be-hypertext-driven
@dominicm: that's an interesting idea and had a nice declarative "make the resource look like this" feel. However I wonder how a factor of time would work into something like this. For example, stop all servers or stop all servers at 8pm. An extension of that thought is working with a cloud API I don't "own" the state. So you're always in a state of partial staleness and every mutation is actually an intent to mutation with a later harvest confirmation that it worked.
@frozenlock: I've been looking at your yada/url-for problem (returning nil). Are you wrapping these routes in yada/swaggered? If you are, and tagging this resource grouping with bidi/tag, the resulting TaggedMatch record 'steals' the call to unresolve-handler and fails to delegate to the resources below it. Hence, path-for returns nil. I've fixed this and released a new version of bidi today
@kingoftheknoll: I think you could POST an action into a calendar. When that time occurs, the action is enacted.
Amazing, thanks!
That's a clever way of thinking about it
Essentially all unsafe methods are manipulating state somehow. All state manipulation can be reduced into adding to, modifying, or removing elements from that state. So all state manipulation can be reduced to CRUD. But that doesn't mean we expose db tables as resources one-to-one, rather we create metaphors, logical resources
@kingoftheknoll that said, there's nothing to stop you defining your own methods along with custom semantics. Yada fully supports that. You can create methods like BREW. See WebDav for examples.
made a little type hinting PR for Boyer-Moore-Horspool namespace, made quick the difference for my uploading. Pretty sure it's legit as well! 🙂
@tcoupland: Awesome!
I'll be merging that
perhaps a stupid question, but what is the best way to add a response header in Yada resource?
so far I've settled on adding an interceptor that does (assoc-in ctx [:response :headers "header"] "value")
but I'm sure there's a better way
because right now the handler is as simple as {:get {... :response (fn [ctx] "foobar")}}
@mishok13 https://github.com/juxt/yada/blob/5122743794141970eb0005704600b4d4d67dafa8/dev/src/yada/dev/security.clj#L76
:response (fn [ctx] (assoc (:response ctx) :headers {"header" "value"} :body "foobar"))
@dominicm so I'm pretty much the only fool trying to develop Clojure apps on Windows is what you're saying in #beginners ? 😛
I know it's my fault it just irks me that I can't just... have something functional I can tear apart. Both Edge and Hoblon failing and then Luminus' how-to just not giving me a functional project, now I remember the annoyance from last time I tried this.
luckyevie : edge looks a little heavy if you are just getting your toes wet. (especially with 'components')
How about just bidi/yada/aleph?
I just looked at yada... Thing is the smaller projects don't have the "I am a noobish noob, feed me a readme that makes this work" sort of thing.
I don't have a base project so "just add http-kit in there and you're gtg" doesn't cut it - I don't know clojure yet enough to understand where.
Yes, that's why I was suggesting going minimal 😛
I come from nodejs so it's like.. npm install X
, copy this script, node file.js
and go 🙂
Running aleph would be the first step.
(And possibly bidi)
I think that's the biggest issue I've been having with clojure : it feels like the first baby steps are climbing a beanstalk to get to the treasure at the top 😛
I think this is why I was just asking for... a base project on lein or git that "just works". aleph still isn't that, it requires a tiny bit of pre-comprehension of project structures.
I must say that's the feeling I had a few years back when I learned clojure. But back then it was pretty new. Hopefully things are better now for noobs 😉
What are you looking to make?
Don't think they are too much unfortunately! And especially not the plebs like me on windows
I have a plan for a webapp that, while not exceptionally unique, is much better than the tools I've seen. The experience I have in the software domain related to the project will help
I mean I don't think anyone would steal this idea but... Let's stick to "it's a responsive, data-driven webapp"
Do you intend to use clojurescript as well?
Ultimately clojurescript, re-frame for the front-end at least
aka "I don't want to write html direct anymore" :P\
Ah great, so Reagent. Then I would suggest you start with https://github.com/reagent-project/reagent-template
It doesn't use bidi/yada/aleph, but those can be switched later.
This is what I always start with.
Alright let's see if I can get this up before finishing my coffee and heading to work ^_^
Oh... bravo reagent-template doesn't start I get a stack trace the size of Atlanta.
I should seriously think about at least a linux VM.
@eslachance do that, or you will be fighting something you don't really want to fight while you are in noobland
Ah yes, noobland. The murky depths I escaped quickly while doing node because of my past experiences with JS, and attempt to help other newer noobs traverse on... discord. I don't want to be in Noobland for too long. Noobland sucks.
Definitely linux VM to start with
@eslachance we develop clojure webapps on windows
Some of us can be forced to heh.
My friend and colleague did a very nice thing for work in clojure, all in Windows, and with boot
The issue is I'm still a noob and I can't troubleshoot stuff yet.
Actually that friend hangs around here too, but generally too busy to teach me
@eslachance: edge should let you start on windows. The fact it didn't give exceptions is positive. One year ago I was hapi.js all loaded up with Babel, so I understand the shock, its totally a bullet worth biting. 😃
When you say it was giving 404s, can you give the exact URLs you tried, and 404 page you got? 😃 Copy paste is better @eslachance
The only issue in Edge is that it failed the first time I ran it, and then yeah I got 404 on all the resources (Except the html itself)
It was almost there I guess 😛
installs boot at work
I did actually see that page =D I waited a few minutes and reloaded with the same issue though
Could you search your target directory? Look for edge.js or app.css I think the CSS is called
currently grabbing deps... please stand by...
So the first boot, this is what I get (please forgive the ugly output and french errors):
12:05:40.519 [clojure-agent-send-off-pool-0] INFO edge.web-server - Started web
-server on port 3000
clojure.lang.ExceptionInfo: C:\Users\lachance\.boot\cache\tmp\data\devel\
edge\dq0\-rcsl8f\edge\selmer.clj: Le processus ne peut pas accÚder au fichier ca
r ce fichier est utilisÚ par un autre processus.
data: {:file
"C:\\Users\\lachance\\AppData\\Local\\Temp\\boot.user3118914793701141
329.clj",
:line 31}
java.nio.file.FileSystemException: C:\Users\lachance\.boot\cache\tmp\data\devel\
edge\dq0\-rcsl8f\edge\selmer.clj: Le processus ne peut pas accÚder au fichier ca
r ce fichier est utilisÚ par un autre processus.
file: "C:\\Users\\lachance\\.boot\\cache\\tmp\\data\\devel\\edge\\dq0\\-rc
sl8f\\edge\\selmer.clj"
reason: "Le processus ne peut pas accÚder au fichier car ce fichier est util
isÚ par un autre processus.\r\n"
the error is "the process cannot access the file because it's used by another process"
No it did the same thing on the other machine, the first time
starting it the second time does not bring up this error
(so maybe it doesn't "compile" the second time?)
The resources might not get built, if files that look like they are built are in the cache. Also, could you click onto one of those urls? The 404 page it gives will be very informative
We might need to do an initial clearing of the cache, but I'll clear up my first idea first 😃
{status: 404, message: "Not Found", id: "d8dcd569-4a47-4faf-bc1f-da73f909f3ed",…}
error
{error: "clojure.lang.ExceptionInfo: {:status 404}", data: "{:status 404}"}
data
"{:status 404}"
error
"clojure.lang.ExceptionInfo: {:status 404}"
id
"d8dcd569-4a47-4faf-bc1f-da73f909f3ed"
message
"Not Found"
status
404
oh my copying errors from the console isn't pretty heh.
Actually opening the file in the browser instead of looking at network is more informative
clojure.lang.ExceptionInfo: {:status 404}
at clojure.core$ex_info.invoke(core.clj:4593)
at yada.resource$eval26538$fn__26539$fn__26540.invoke(resource.clj:121)
at manifold.deferred$eval7307$chain___7328.invoke(deferred.clj:860)
at manifold.deferred$chain.invoke(deferred.clj:929)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:632)
at yada.handler$handle_request_with_maybe_subresources.invoke(handler.clj:120)
at yada.handler$handle_request.invoke(handler.clj:168)
at yada.handler.Handler.request(handler.clj:223)
at bidi.vhosts$make_handler$fn__20669.invoke(vhosts.clj:160)
at aleph.http.server$handle_request$fn__19056$f__6628__auto____19057.invoke(server.clj:154)
at clojure.lang.AFn.run(AFn.java:22)
at io.aleph.dirigiste.Executor$Worker$1.run(Executor.java:62)
at manifold.executor$thread_factory$reify__6510$f__6511.invoke(executor.clj:36)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:745)
alright, and re-run boot dev
?
oh would you look at that! colors
! fonts
! 🙂
I guess maybe I should report on github as reproducible on 2 machines, and the fix
@eslachance I'd try bothering the guys in #boot first, just to see what they know. Boot is exactly like gulp, and the fact we have a handful of boot-related dependencies makes it hard to know who exactly to blame!
Though, I just realised you may have meant on the edge repo, in which case definitely would be helpful to have it on there actually!
Yep, put it on the edge repo 🙂
If I was my friend oahner I'd probably dig into the issue for an hour and find the exact cause before PRing a fix (like he has done for an issue about boot on windows in the past!) but I'm not that kind of genius 😛
@eslachance When I started clojure I thought like that (the super geniuses fix everything!) Turns out you don't have to be a super genius to help in the Clojure community, I'm not sure if it's the simplicity of the language, the active community, or what. But it's very possible, and definitely not just the super geniuses!
It actually turns out that I'm pretty good with node and the discord.js bot library, and I've been helping people a whole lot in the last 3 months while learning so much more than I thought I would.
That confidence of being called "Proficient" and even writing a gitbook to help other new users (I'm a tech writer by trade) really, really helps. Node was a stepping stone. Now on to the real stuff.
That's pretty similar to what I've dug myself into actually. I think you'll find yourself able to feel proficient in Clojure very quickly, and fixing small bugs here and there for things.
That's the plan. I've just been sitting in front of a mental wall for a while in regards to Clojure. I just gotta get passed that block.
Right now though, happy to take the first steps in here - I really, really hate being a noob and feeling like one. I guess at least I'll never ask to be spoonfed 😛
Once I've wrapped my head around the structure of a project, and understand the basics, I'll most definitely appreciate a google search or a code example in a repo, rather than being given the answer straight-up
@eslachance https://www.youtube.com/watch?v=FihU5JxmnBg is good regardless of the language 🙂
Watching these kind of videos is what got me really, really, really interested in clojure
That and some coffee break conversations with oahner.
I think "Atoms" and other awesome terms and I go "holy shit I wanna use those"
I’m playing a bit with Yada. & now I wonder about what to do with “resource assets”. With bidi I used ResourcesMaybe at some point. Should I use that directly or something in yada?
I made a typo, ignore me. ["assets" (->ResourcesMaybe {:prefix "public/"})] worked fine!
@eslachance: I got a copy of the stack trace on my girlfriend's windows machine so it's definitely reproducible. Gonna try and minimize the case. Might be maven caching related
I got a firewall prompt for Java.exe but that was it
Mind you that's a bit ridiculous because this is a work machine behind a corporate firewall, I shouldn't have a local one 😄
Oh btw I did report it on https://github.com/juxt/edge/issues/18 if you didn't already see that.
oh look, Slack likes to show my face just like Discord. yay. 😒
The Clojure mountain is very hard to climb but the view from the top is worth the hard work. We're trying to help by making Edge a smooth introduction to real-world clojure. I hope the use of 'component' doesn't hurt too much. All feedback on Edge is really helpful. Right now yada isn't as accessible as it should be and your help in improving the upramp is truly appreciated.
@malcolmsparks I have to dig through the examples to really be sure I understand stuff - but the way I see it that build error is very minor. Edge attempts to be a helicopter that gets me partway up the mountain and the only problem is that the control stick jiggles a bit on takeoff 😉
Yes. I've never tried but I understand helicopters are hard to fly :)
Not in GTA V 😂
@eslachance Did you get edge working eventually?
I think Edge is a really good base. I've stripped out some things related to cljs and we're pretty much using that as a base for our microservices.
@lmergen Yes, similar goals. Stripping it of things you don't need is the point
Great to hear it's helped provide a foundation for you
It's good, and provided a lot of sane defaults for structuring services. The whole component / aero / boot integration is absolute gold.
Not that it's difficult to do yourself, but rather as a "this is how it's done" guidance.
It's deceptively difficult actually. Edge was in the making for over a year
But there's lots of improvements in the pipeline