Fork me on GitHub
#hoplon
<
2016-01-29
>
levitanong08:01:17

hey @laforge49 I’m printing session whenever I login in the castra-chat demo (not castra-notify-chat) and I’m seeing a session-id in session . Could you clue me in on where session-id is being set? I can’t find any real instance of “session-id” in castra-chat or castra itself. So I’m at a bit of a loss.

laforge4912:01:31

No idea who is putting that in there. But as castra-chat ignores it, you can too.

laforge4912:01:21

Oh wait, I've got it. I suspect that at one point a while back you ran castra-notify-chat or castra-notify-random. Since all these programs use the same url, localhost:8000, they share the same session cookie. Try deleting your cookies in the web browser or changing browsers.

levitanong15:01:04

... @laforge49 I feel like a fool. That's exactly what it was! Thanks again!

laforge4918:01:23

Now I'm back with my own stupid errors. Here's the project: https://github.com/aatree/aademos/tree/master/w3c-worker

laforge4918:01:30

Here's the error:

laforge4918:01:56

Compiling Hoplon pages... ò count\index.cljs.hl Compiling ClojureScript... ò index.html.js adzerk.boot_cljs.util.proxy$clojure.lang.ExceptionInfo$ff19274a: ERROR: Wrong number of args (1) passed to: core/eval7844/defc--7985 at file hoplon\app_pages\indexDOT_html.cljs, line 5, column 1 data: {:file "hoplon\\app_pages\\indexDOT_html.cljs", :line 5, :column 1, :tag :cljs/analysis-error, :from :boot-cljs} adzerk.boot_cljs.util.proxy$clojure.lang.ExceptionInfo$ff19274a: Wrong number of args (1) passed to

laforge4918:01:19

This should be just a very very simple hoplon page right now. 😞

laforge4918:01:37

Fixed. (defc counter) threw this error. Changed it to (defc counter 1) and now everything is fine.

laforge4918:01:12

@micha Here is my complaint: How do I get to see the indexDOT_html.cljs file containing the error????

laforge4918:01:22

OK, I do see that the line number in the error message matches up with the line in the .hl file causing the error.

laforge4918:01:54

And I also now see that the error message mentioned the call to defc.

laforge4918:01:30

But we're a long way from clarity here!

laforge4919:01:31

First attempt at converting js to cljs. Here's the js if(typeof(w) == "undefined") { w = new Worker("demo_workers.js"); } w.onmessage = function(event) { document.getElementById("result").innerHTML = event.data; }; And here is what I have, which does not seem to do anything: (defc counter nil) (def w (atom nil)) (defn start-worker [] (if (not @w) (reset! w (js/Worker. "demo_workers.js"))) (set! (.-onmessage w) #(reset! counter (.event %)))) Now I have confirmed that the webworker IS created. I've also confirmed that the demo_workers.js file works. So I think there is something wrong with my call to set! Any ideas? Thanks!

laforge4919:01:33

This was unexpectedly easy! Here's the code that works: (defc counter nil) (def w (atom nil)) (defn start-worker [] (if (not @w) (reset! w (js/Worker. "demo_workers.js"))) (set! (.-onmessage @w) #(reset! counter (.-data %))))

micha19:01:56

@laforge49: you should be able to click on the error in your browser

micha19:01:07

and that will take you to the line in the hl file

micha19:01:31

or you can expand a stack trace in the js console and go to a line corresponding to some other stack frame

laforge4919:01:55

yes, but I had no idea what the line should be. and it was just not doing anything. no error. First time converting js.

micha19:01:20

i'm saying if you see an error in the js console

micha19:01:25

you can expand the stack trace

laforge4919:01:32

Oh, you're talking about the previous error. Well, that was not a js console error.

micha19:01:34

and there will be links to the hl file

micha19:01:53

if there isn't a runtime error i'm not sure what can be done

micha20:01:08

the cljs compiler will issue warnings when it can

laforge4920:01:11

Anyway, I looked very closely at the error and realized the line numbers match the .hl file

micha20:01:17

yes they do

laforge4920:01:05

It just takes time to be able to read them messages. First glance and it really threw me 'cause it was talking about a file I didn't have.

laforge4920:01:28

--getting there!

micha20:01:29

that file is the same as your hl file

micha20:01:42

the only difference is the ns declaration

micha20:01:53

you wrote the wiki page about that simple_smile

laforge4920:01:40

Throw a few unfamiliar things into the mix and my confidence goes out the window.

laforge4920:01:00

But somehow I'm managing. 😄

laforge4920:01:43

I am happy to report that my w3c-worker demo now works and uses hoplon. I just need to convert the worker js code to cljs. (only!)