This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-02-18
Channels
- # admin-announcements (3)
- # announcements (7)
- # aws (1)
- # beginners (76)
- # boot (340)
- # cider (9)
- # clara (35)
- # cljs-dev (7)
- # cljsjs (16)
- # cljsrn (11)
- # clojars (1)
- # clojure (192)
- # clojure-dev (6)
- # clojure-madison (8)
- # clojure-russia (373)
- # clojurebridge (1)
- # clojured (9)
- # clojurescript (172)
- # community-development (1)
- # core-async (2)
- # cursive (7)
- # data-science (2)
- # datomic (12)
- # devcards (1)
- # dirac (63)
- # emacs (3)
- # events (10)
- # gsoc (3)
- # hoplon (1)
- # jobs (1)
- # juxt (20)
- # ldnclj (4)
- # lein-figwheel (12)
- # leiningen (1)
- # off-topic (21)
- # om (232)
- # onyx (64)
- # parinfer (8)
- # proton (21)
- # re-frame (8)
- # reagent (1)
- # ring (3)
- # ring-swagger (3)
- # slack-help (4)
- # spacemacs (6)
- # testing (3)
This looks much better now. Thanks micha! C:\Users\Bill\Documents\aatree\durable-cells>boot dev Compiling ClojureScript... ò dcells.js Sifting output files... ??? dcells.cljs.edn ??? durable_cells ? ??? core.cljs ? ??? dc_api.cljs ??? resources ? ??? dcells.js ??? dcells.out ??? aaworker ? ??? api.cljs ? ??? api.js ??? boot ? ??? cljs ? ??? main682.js ??? cljs ? ??? core.cljs ? ??? core.js ? ??? reader.cljs ? ??? reader.js ??? durable_cells ??? dc_api.js Writing pom.xml and pom.properties... Writing durable-cells-0.1.0.jar... Installing durable-cells-0.1.0.jar... Writing target dir(s)... C:\Users\Bill\Documents\aatree\durable-cells>
@laforge49: ah sorry, missed the notification 😜 glad it’s sorted
Well, the jar file is looking like I want it. Progress at least, but isn't that all we can ask for?
I thought the resources directory of a library jar would be on the classpath of the application. Obviously wrong.
you probably only have :move
the contents of the jar will be on the classpath of any clasloader that jar is added to
@laforge49: are you trying to serve the js file?
when I had a dcells.cljs.edn in the application, the Worker constructor could find it, no problemo.
I would make sure your app can serve the static files as well as resources
this might avoid the issue
I'm using (serve :port 8000 :init-params {"org.eclipse.jetty.servlet.Default.useFileMappedBuffer" "false"}))
should be part of your handler def
using ring?
boot-http?
(deftask dev "Build for local development." [] (comp (watch) (speak) (hoplon) (cljs :optimizations :simple) (target) (show :fileset true) (serve :port 8000 :init-params {"org.eclipse.jetty.servlet.Default.useFileMappedBuffer" "false"})))
@laforge49: i believe the serve task creates a default handler when you do not pass one in
when I put the dcells.cljs.edn file back in the application, the dcells.js shows like this: ??? dcells.cljs.edn ??? index.html.js ??? dcells.js
OK, so the problem with getting a defauld is that you need an example for how to override it, y?
so you should be able to add resource-root
i believe so, micha’s suggestion should work if you used the actual compiled jar
Anyway, I can experiment. So thanks @flyboarder
@laforge49: I would suggest moving to an actual ring handler, you dont need to use castra, compojure will return a handler for routes, which you pass though your middleware setting resource and file defaults
Veddy interesting. I tried this: https://github.com/pandeiro/boot-http/blob/master/src/pandeiro/boot_http.clj#L35
Specifically, r resource-root ROOT str "The root prefix when serving resources from classpath"
Here's my dev tase: (deftask dev "Build for local development." [] (comp (watch) (speak) (hoplon) (cljs :optimizations :simple) (show :fileset true) (serve :port 8000 :init-params {"org.eclipse.jetty.servlet.Default.useFileMappedBuffer" "false"} :resource-root "/resource")))
I'll note that I am using init-params, not init as specified for the serve task of boot-http.
So perhaps what you were saying @flyboarder is that I should be using boot-http in place of boot-jetty?
@laforge49: yes sorry, I thought you were using a different task, not sure how micha has his serve task working
(require '[adzerk.boot-cljs :refer [cljs]] '[hoplon.boot-hoplon :refer [hoplon prerender]] '[tailrecursion.boot-jetty :refer [serve]])
Yeah, boot-jetty only has limited options. My next step will be to work on getting boot-http to work in place of boot-jetty. And I see now how I can add a handler.
OTOH I am thinking this project is dead. The whole point was to ask less of app devs, not more.
So if there is no easy way to get boot-jetty to serve files from a library jar, then I might as well ask the app dev to include a .cljs.end file in their build task.
@laforge49: you can easily serve files from jar, remember boot serve tasks are for dev mostly, is your project an app or lib?
I am writing a lib. Trying to make the existence of the worker .js file transparent to the app.
That seems simple enough for devs
true. but as the worker is not shared, the .js file could be compiled ahead of time. But it looks like it is not worth it, as it creates more work for the app dev.
If the file is in an uberjar then the app dev just needs to serve files from class path
And the app server should be able to handle it
The other advantage of separate compile is that you can use separate compiler options. Turns out worker .js files will not run when optimization is none.
Interesting
When optimization is none, there is a reference in the .js file to Window, which does not exist in a web worker.
Could you write a shim?
Like fake it
Fake the reference
The faking would need to be done in a js file. If I could get that file to load in the worker, then why not load the file I actually want? One that is compiled independently like the shim would need to be.
I'm close to giving up, though the advantage of allowing an app to be compiled with optimization none gives me a renewed sense of purpose. 😄
Just need to be able to load it. Perhaps by using an uberjar or perhaps by switching the app to http-boot.
boot-jetty lacks the configuration options I need to be able to load a file from a lib jar.
I was originally thinking that I would not require the app dev to change their ways. Indeed, there is no point if I am just trying to hide the .cljs.edn file.
But if I am trying to give the app dev the option of compiling with optimization none, it becomes worth it.
Has anyone ever had the following exception with boot cider dev
?
ERROR: Unhandled REPL handler exception processing message {:op init-debugger, :print-level 10, :print-length 10, :session d878999b-80cb-4b9c-9ca8-df58d53de495, :id 7}
java.lang.IllegalStateException: Can't set!: *data-readers* from non-binding thread
at clojure.lang.Var.set(Var.java:218)
at boot.core$load_data_readers_BANG_.invoke(core.clj:185)
at cider.nrepl.middleware.debug$initialize.invoke(debug.clj:432)
at cider.nrepl.middleware.debug$wrap_debug$fn__24143.invoke(debug.clj:462)
at clojure.tools.nrepl.middleware$wrap_conj_descriptor$fn__3093.invoke(middleware.clj:22)
yeah...but can this be possible? I have the classic:
let [options (options :dev)]
(apply set-env! (reduce #(into %2 %1) [] (:env options)))
(comp (serve)
(watch)
(cljs-repl)
(version-file)
(apply cljs (reduce #(into %2 %1) [] (:cljs :dev)))
(reload :on-jsload 'cljs-repl-web.core/main))
apart from the reduces everything is standard no?
actually maybe reload
should go before
possibly related: https://github.com/clojure/tools.nrepl/blob/master/src/main/clojure/clojure/tools/nrepl/middleware/interruptible_eval.clj#L68-L69
very weird in another project of mine, same version of boot
related stuff, everything works
without cider
does not work as well, start-repl
hangs
What are the rules for task definition? I'm seeing strange behavior when I write one like I write a function. For example, (if something (core/with-pre-wrap ...) (core/with-pre-wrap ...)). Of course the obvious thing to do is move the if-then inside of the pre-wrap, but then other problems arise. Sometimes println statements stop printing for no apparent reason. I'm looking for general rules, like "with-pre-wrap may only occur once in a task" or whaterer.
@mobileink: if the jvm exits before the thread your println is in flushes its buffers, you won't see output
@jethroksy: right, I understand the pattern, but there be macros involved - deftask does not behave exactly like defn, there are evidently some things you should not do in deftask
yep, wouldn't work for me - I had to move the if-then stuff inside the wrapper. also had to have only one "pod/with-eval-in". I'll see if I can recreate what didn't work
the middleware factory returns the middleware that will be composed to form the pipeline
(core/deftask bar [c component VAR str "component to extract. Must be namespace qualified." n ns-str NS str "namespace from which to extract commponents"] (let [pod (-> (core/get-env) pod/make-pod future)] (if ns-str (let [ns-sym (symbol ns-str)] (core/with-pre-wrap [fileset] (pod/with-eval-in @pod (println "FOO")) fileset))) (if component (core/with-pre-wrap [fileset] (pod/with-eval-in @pod (println "BAR")) fileset))))
but anyway deftask is just defining a normal function. the only thing it does is set up the command line arguments and add some metadata to the var so that boot can know about which functions are tasks
@mobileink: i have a recommendatation for the boot-gae task
you should use a file in tehe fileset with a distinct extension as the place to hold the configuration, like myproject.gae.edn
for example
or put it in a library
the fileset is managed, in that when the pipeline restarts, like if the watch task is used, for example, any changes to files in the fileset by subsequent tasks in the pipeline are not visible to tasks that come before them in the pipeline
which is not so for a var, because vars don't "rewind" their state each time the pipeline runs
@micha: boot mrj/bar -n foo.bar wait -t 2000 - still no output. Adding (flush) didn't work either. But I think the problem is I need to study pods a bit more.
@micha: @alandipert re: boot-gae config file, thanks, I will do that.
I did look at web
. it's a good candidate for extending boot-gae. when i get the time i'll figure out how to integrate it - maybe it works is, just haven't tested it yet.
but also perhaps gae could operate on an existing web.xml created by the web task if one exists
excellent idea. I'd better add a "roadmap" section to the readme with planned enhancements. Or if you feel like it feel free to create an issue. maybe that's what I'll do instead of a roadmap.
when you have a big config map you need to add more keys to the map with branching logic in the one monolothic task
actually i have given some thought to breaking up the config map. most of it is only needed for the config task, but some of it must be shared with the servlets task as well
in boot there are separate, orthogonal tasks for compilation, live reload, repl, and incremental compilation
those are great suggestions. now that I've got something working (I actually need it for another project), I can make such refactoring etc. a goal for the next version.
if you use the reload task, it actually modifies the .cljs.edn file, adding the reload client etc
part of the problem is that i think i still have not completely grokked the fileset model. i had several smaller tasks but could not figure out how to pipeline them - e.g. one task would end up removing something needed by the next task.
I will definitely look more closely at the strategy used by boot-cljs. looked at it briefly but didn't really understand .cljs.edn. next task is to add some Clojurescript to the sample gae webapp using boot-cljs, so I'll be studying that.
yeah the main concept there is to devise a high level model for what a gae application is
I'm glad I asked you folks to take a look before announcing it - now I'm thinking I'll make some of the mods you've suggested before doing so.
@micha: @alandipert Thanks so much for your help!
so like the jar task can find your pom.xml, and it can then know how to make a friendly name for the jar
once you've devised a really good spec, you can then autogenerate the config in most cases
@mobileink: i hope i didn't come off as sounding critical, i didn't mean it that way
btw, do you know if there is any way to bookmark slack? I want to keep track of your suggestions - is copying the only way?
oops, just notice the little link icon you get on the right when you hover over slack
Seeing some strange behaviour working on Cljs file that could either be Cursive or Boot - probably Cursive, but not sure.
When I call "Load file in REPL” from IntelliJ, I get errors from an older version of my file that lives in the out
folder. I can eval forms directly and they work, but “Load file in REPL” seems to load the corresponding file in the out folder, that is old. Now, that could be that the file isn’t being updated, or that it’s loading the wrong file.
i don't know who's responsible for this team, but my company would be happy to make a small contribution to us having an account with unlimited history. we lose a lot of good info this way
Well, the thing is that Slack costs $6.67/user/month (so $33 000/month for Clojurians) so a small contribution doesn't help
@raywillig: there is the #C0CB40N8K channel where i think conversations are underway for various options
Wasn't it pinned here
There is a bot
That's why we will be kicked out soon :)
Yeah the first pinned item should link to log
@raywillig: Large opensource communities are not the target segment of Slack (apparently)
dealing with the data pipeline to enable search on such a large team would cost them real money
seems a little short sighted, i think those are the kinds of people that will get their companies to adopt
A guy I met a couple of days ago was preaching that Slack will integrate every payment option we know of
He maintained that people don't want to install apps
And showed me that chats are in the tip ten installed by most of the people
@flyboarder How do I write the init function for boot-http to set the jetty parameter useFileMappedBuffer to false? See https://github.com/pandeiro/boot-http/issues/41
@laforge49 Maybe try doing so in a function that you specify as the :init
param?
I'm not sure the exact Java interop code to do such a thing, but you could probably copy it out of wherever boot-jetty implements the handling of that :init-params
?
I think if you wrote a fn like that, but with your property, and passed it to :init
(`boot serve -h`)...
Yeah sorry I don't run web servers on Windows :/ I think @pandeiro is in the correct track
Feel free to close if the solution works @laforge49 , otherwise let's keep it open, someone might know more
hi again. mystified again. why is this giving me ClassNotFound for miraj.markup? doesn't make-pod put it on the cp?
(let [pod (-> (core/get-env) (update-in [:dependencies] conj '[miraj/markup "0.1.0-SNAPSHOT"]) pod/make-pod future)] (core/with-pre-wrap fileset (pod/with-eval-in @pod (if ~ns-str (let [ns-sym (symbol ~ns-str)] (require 'miraj.markup ns-sym) (miraj.markup/foo) ...
it's an issue with the clojure compiler not being able to resolve the name when it compiles the expression
if you put the (require 'miraj.markup)
at the top level of your pod expression it should work
ok, now i know what to do, i've used resolve in that way before. thanks again. i'll add something to the Troubleshooting section. 😉
I'm stuck at clojure.lang.ExceptionInfo: Could not locate boot_http__init.class or boot_http.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
(set-env! :dependencies '[[adzerk/boot-cljs "1.7.228-1"] [hoplon/boot-hoplon "0.1.13"] [hoplon/hoplon "6.0.0-alpha13"] [org.clojure/clojure "1.8.0"] [org.clojure/clojurescript "1.7.228"] [pandeiro/boot-http "0.7.2"] ; [tailrecursion/boot-jetty "0.1.3"] [aatree/durable-cells "0.1.0"]] :source-paths #{"src/client" "src/worker"}) (require '[adzerk.boot-cljs :refer [cljs]] '[hoplon.boot-hoplon :refer [hoplon prerender]] '[pandeiro/boot-http :refer [serve]] ; '[tailrecursion.boot-jetty :refer [serve]] )
(defn jetty-init [] (.put (System/getProperties) "org.eclipse.jetty.servlet.Default.useFileMappedBuffer" "false")) (deftask dev "Build for local development." [] (comp (serve :port 8000 :init 'jetty-init) (watch) (speak) (hoplon) (cljs :optimizations :simple) ; (show :fileset true) #_ (serve :port 8000 :init-params {"org.eclipse.jetty.servlet.Default.useFileMappedBuffer" "false"} :resource-root "/resource") ))
But now I get clojure.lang.ExceptionInfo: java.lang.NullPointerException data: {:file "C:\\Users\\Bill\\AppData\\Local\\Temp\\boot.user3533130444786227273.clj", :line 25} java.util.concurrent.ExecutionException: java.lang.NullPointerException
NPE so is there a symbol not being referenced correctly? One sec let me switch to my laptop
oh you dont need to quote the symbol if it’s defined in build.boot i think
:init jetty-init
If I don't quote it, I get clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException: option :init must be of type sym
im going to test with my project
@laforge49: you want that to be a fully qualified symbol i think
e.g. 'your.ns/jetty-init
and then the serve task will require and resolve
correct
(symbol (str *ns*) "jetty-init")
another cool way
i guess that's only useful if the things are in the same ns
(serve :port 8000 :init boot.user/jetty-init) now gives me clojure.lang.ExceptionInfo: java.lang.IllegalArgumentException: option :init must be of type sym
you still have to quote it
but that will still fail
try moving jetty-init to a different ns one in your project
Yes, with this clojure.lang.ExceptionInfo: java.io.FileNotFoundException: Could not locate boot/user__init.class or boot/user.clj on classpath.
oh, because build.boot isn't in the pod that the serve
task runs in
or rather, boot.user isn't
+1 for moving it to a namespace in sources
Thanks @flyboarder @pandeiro and @alandipert --everything is now running.
FYI added a Troubleshooting item on use of require
in a pod with a detailed explanation of what happens if it isn't top level. I hope I got it right 😉 - anybody concerned is encouraged to check it for accuracy.
Thanks for adding that @laforge49, nice
Veddy interesting, @flyboarder @micha All I did was switch to boot-http from boot-jetty, and configured it for windows, and now the dcells.js is being served. No sift, no routing.
And now, wonder of wonder, the app can now be compiled with optimization :none, since the worker .js file is compiled separately.
Yay!!
Well done @laforge49 !