This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-10-27
Channels
- # aleph (2)
- # beginners (19)
- # boot (15)
- # cider (1)
- # cljsrn (1)
- # clojure (68)
- # clojure-austin (12)
- # clojure-dev (2)
- # clojure-france (6)
- # clojure-italy (46)
- # clojure-russia (45)
- # clojure-spec (55)
- # clojure-uk (41)
- # clojurescript (117)
- # component (15)
- # cursive (54)
- # datomic (24)
- # events (2)
- # funcool (1)
- # instaparse (4)
- # klipse (30)
- # lein-figwheel (3)
- # leiningen (4)
- # luminus (4)
- # om (10)
- # onyx (13)
- # parinfer (36)
- # proton (1)
- # reagent (1)
- # ring (2)
- # ring-swagger (1)
- # rum (19)
- # test-check (6)
- # testing (9)
- # untangled (1)
If you want that you have to invoke tools.reader yourself
thanks @shaun-mahood !
@jrheard core.logic
is not compatible with self-hosted ClojureScript. (FWIW, work has been done recently for core.match
: http://blog.klipse.tech/clojure/2016/10/25/core-match.html)
I was trying to integrate my cljs-project with quickbooks api. should any one done please give me a suggestions?
Are there any downsides on using cookies for auth for an API only service?
@darwin For the record, I think anything but using <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
is really asking for trouble. May be worth emphasizing it in the docs.
@pupeno i don’t see why not, this is how every rails application does authentication by default. the session information is encrypted and stored as a cookie in the client. checkout https://funcool.github.io/buddy-auth/latest/#signed-jwt
and a few SMS endpoint services i’ve used just simply have some small token they put in the URL or headers that identify your app
@naomarik isn’t jwt an alternative to using the session and thus, cookies?
@pupeno from my understanding sessions use cookies to track user state. i haven’t implemented anything in clojure quite yet but at least in rails this is how it works
all i need to login as someone else is their cookie for that domain that includes all the session info
@naomarik yes, that’s how it works. jwt uses a non-cookie token to track users.
yes this example i sent seems to just include the token in the authorization headers.. i don’t see why you wouldn’t be able to put it in a cookie though and be able to sign/unsign the data
the advantage to setting it on cookie is that in browser you don't need to hadle that headers manually 😛
@darwin In fact, it seems even worse than that. OOTB tomcat (need it) serves HTML setting ISO-8859-1 encoding header. And that even supercedes the meta header in the document.
https://github.com/funcool/buddy-auth/blob/master/examples/session/src/authexample/web.clj this example here seems closest to what i’m saying but i feel like it’s storing everything as plaintext, not sure how that info is being saved on the client
okay https://github.com/ring-clojure/ring/wiki/Sessions#session-stores the session middleware allows you to put your key there
@darwin I may have missed something, but I think it may really be worth mentioning so other people don't run into similar issues.
I think better time investment would be to check popular project templates and make sure meta charset it present there
@darwin ... and ring serving HTML using utf-8 response headers as well. People may be crazy enough run uberwars on tomcat.
@denik I discovered that last night. I've been working hard at trying to fix a number problems. It's been difficult.
is there a way to get some code prepended to the start of a generated js file from clojurescript ? I want to add the importScripts() line for webworkers
i mean, i could post-process the generated js files, but i was wondering if there's a hack or feature in clojurescript
Hey everyone, quick question, with the new 1.9.293 are we still not able to do :refer :all
would it be better to do use
?
@flyboarder: :refer :all
isn't supported and may not ever be. use
must be used with :only
so you have to list everything you want to refer to anyway
Hey guys I am pretty new to ClojureScript, and I am really amazed by figwheel!
Are there any React wrappers for CLJS that support the context feature? I’ve looked at a bunch, but I didn’t see anything super-obvious.
@teslanick not aware of anything but I have done it manually and it isn't fun 😛
has anyone out there tried to use the closure library for matrix math? I can't even figure out how to initialize a matrix. The API docs say that it's a class ( https://google.github.io/closure-library/api/goog.math.Matrix.html ), the actual code looks like a function ( https://github.com/google/closure-library/blob/master/closure/goog/math/matrix.js#L57 ) and regardless of how I call it, I get a type error. Viz:
(require '[goog.math :as math])
(.log js/console (math/Matrix (clj->js [[1 2 3][4 5 6]])))
;; type error: goog.math.Matrix is not a function
(.log js/console (math/Matrix. (clj->js [[1 2 3][4 5 6]])))
;; type error: goog.math.Matrix is not a constructor
(.log js/console (new math/Matrix (clj->js [[1 2 3][4 5 6]])))
;; ditto, not a constructor
well, then, what in blue blazes is it, if it isn't a constructor or a function?Uff. That’s annoying. It seems like the cljs wrappers [for React] out there a lot ‘thicker’ than I want. 😕
well technically the goog.math.Matrix
is used to find the FILE that contains the source
Hi. I'am trying to solve this, rather tricky problem with Reagent. However, it looks like an architectural problem in React based apps. Correct me if I'am wrong. We have a map component. That would be a parent component in Reagent
var mymap = L.map('mapid').setView([51.505, -0.09], 13);
We build up a Reagent component using life cycle methods.
Then, we have a lot of subcomponents, like popups and shapes that bind to a parent like this
var marker = L.marker([51.5, -0.09]).addTo(mymap);
If we build each of them as a reagent component then how do we add them to our map?
React renders children first. So, every :component-did-mount on children will not work(because parent hasn't been initialized yet)
We can try to work around passing "yet to be rendered" atom down to children, then subscribe to it and wait for
parent's component-did-mount call. But it looks hackish to me. Any ideas how to simplify this?@mik hehe welcome to the club https://github.com/facebook/react/issues/2763
but the official answer is do not build stuff like that via components but in your state instead
@thheller ComponentWillMount will work before rendering. So we can't initialize map on '#mapid' (it doesn't exist yet). Having a
mymap
in a state is kind of a hack nonetheless. (We can't compose/recycle it without additional code). Or I don't understand something?@thheller I am using state approach right now. It works, but, I am looking for better ways. Thanks
dunno do the children that try to add things to the map have to be react components?
should be enough to get a div into the page and then generate the map instance on it
dunno but be careful with componentWillMount
as componentWillUnmount
is the wrong order again 😛
@anmonteiro: thanks!
Hi! I'm having some issues with compiling my project with :optimizations
set to anything. Is this a suitable channel to ask in? 🙂
Great!
My build is, and has been, working fine all day. But just now I decided to try compiling using :optimizations :advanced
, and Google Closure throws the error:
>Oct 27, 2016 11:36:12 PM com.google.javascript.jscomp.LoggerErrorManager println
>SEVERE: $HOME/flask-cljs/flask_cljs/target/cljsbuild-compiler-1/flask_cljs/core.js:6:
>ERROR - required "flask_cljs.core.components.sidebar" namespace never provided
>goog.require('flask_cljs.core.components.sidebar');
And the same for the only other file in the "components" folder, and thus the ns flask-cljs.core.components
.
My only dependecy is reagent
.
Also, compiling with any :optimizations
, even :whitespace
, throws the same error, aaaand I'm quite new to Clojure and Clojurescript 😊
@wielderofmjolnir hrm so your project is named flask-cljs
right?
what's your folder called?
flask_cljs
Supposed to have underscores for the filenames and hyphens for ns, yeah?
that's right
can you paste the NS form of one of those files that are erroring out?
>(ns flask-cljs.core.components.sidebar > (:require [flask-cljs.state :refer [app-state]]))
hrm looks right to me as well
your project folders are also structured according to the NS structure right?
i.e. you have flask_cljs/core/components/sidebar.cljs
Yeah 🙂
>{:id "min" > :source-paths ["src"] > :compiler {:output-to "../resources/public/js/compiled/flask_cljs.js" > :main flask-cljs.core > :optimizations :advanced > :pretty-print false}}]}
That's my build
config
(it's supposed to output to parent-dir, which has been working fine without optimization)
right
you can probably remove the ../
and have the same effect
Yeah, just tried it and got the same error..
@wielderofmjolnir hrm one last hunch, do you have a flask-cljs.core.components
namespace?
Hah, I actually don't!
Is that it?
no...
the problem would be if you had one which declared a sidebar
var
Aww.. I got excited there for a second 😄
hrm, one thing though, is that your output-to
seems to differ from the path of the error
I figured the target
folder was a temporary folder or something.
For compilation
try specifying a concrete output-dir
Also, I was def wrong earlier. :whitespace
of course works.
Trying, a sec
Same error 😒
Different folder though
>flask-cljs/flask_cljs/../resources/public/js/compiled/out2/flask_cljs/core.js
can't say more without having a look at the project
also heading to bed. Probably something about those namespaces, but could be a compiler edge case
I'm trying to merge them all into core.cljs
and see what I get then
Thanks though! Really grateful for your help @anmonteiro 😊
That worked!
Though it's not a very good solution..