This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-01-12
Channels
- # adventofcode (6)
- # announcements (10)
- # beginners (70)
- # boot (55)
- # calva (15)
- # cljs-dev (18)
- # clojure (32)
- # clojure-europe (4)
- # clojure-nl (2)
- # clojure-spec (20)
- # clojure-uk (6)
- # clojurescript (14)
- # cursive (11)
- # datomic (31)
- # figwheel-main (7)
- # fulcro (1)
- # incanter (1)
- # jobs-discuss (3)
- # juxt (1)
- # off-topic (17)
- # onyx (5)
- # pathom (3)
- # pedestal (2)
- # quil (20)
- # re-frame (6)
- # reitit (1)
- # ring (2)
- # rum (5)
- # shadow-cljs (73)
- # spacemacs (5)
- # tools-deps (11)
- # uncomplicate (1)
- # unrepl (1)
- # yada (11)
hi ppl, I am trying to use stuart's component to setup my compojure/ring webapp and inject the database to be available to any incoming request
(defn create-new-system []
(component/system-map
:database (new-mysql-db)
:platform-http (component/using (new-platform-http)
{:db :database})))
@iagwanderson That looks right, when you start the system you should have access to the db inside the platform-http
component.
so I'm following the simple instructions here: https://www.reddit.com/r/Clojure/comments/abcd5a/new_clojurians_ask_anything/ed0zfg2/
to explore cljs and figwheel, etc. I always get to this part in the figwheel processing: Prompt will show when Figwheel connects to your application
and then nothing happens. I've had this happen when exploring other tools like shadow-cljs too. My localhost:3449 says site can't be reached either. what am I doing wrong?
figwheel had the following message for me: > Figwheel: Starting server at http://0.0.0.0:3449 does your output include this? it should tell you where the app is being served
That doesn't work either. Here is my full terminal output. I remember the same thing happening when trying out shadow-cljs using a beginner tutorial. It just never connected. Here is my full terminal output, not sure if the warnings are relevant:
chaselambert@penguin:~/projects/cljs-demo$ lein figwheel
Warning: implicit middleware found: cider-nrepl.plugin/middleware
Please declare all middleware in :middleware as implicit loading is deprecated.
Warning: implicit middleware found: refactor-nrepl.plugin/middleware
Please declare all middleware in :middleware as implicit loading is deprecated.
Warning: implicit hook found: lein-environ.plugin/hooks
Hooks are deprecated and will be removed in a future version.
Figwheel: Cutting some fruit, just a sec ...
Figwheel: Validating the configuration found in project.clj
Figwheel: Configuration Valid ;)
Figwheel: Starting server at
Figwheel: Watching build - app
Compiling build :app to "target/cljsbuild/public/js/app.js" from ["src/cljs" "src/cljc" "env/dev/cljs"]...
Successfully compiled build :app to "target/cljsbuild/public/js/app.js" in 0.867 seconds.
Figwheel: Starting CSS Watcher for paths ["resources/public/css"]
Figwheel: Starting nREPL server on port: 7002
Launching ClojureScript REPL for build: app
Figwheel Controls:
(stop-autobuild) ;; stops Figwheel autobuilder
(start-autobuild id ...) ;; starts autobuilder focused on optional ids
(switch-to-build id ...) ;; switches autobuilder to different build
(reset-autobuild) ;; stops, cleans, and starts autobuilder
(reload-config) ;; reloads build config and resets autobuild
(build-once id ...) ;; builds source one time
(clean-builds id ..) ;; deletes compiled cljs target files
(print-config id ...) ;; prints out build configurations
(fig-status) ;; displays current state of system
(figwheel.client/set-autoload false) ;; will turn autoloading off
(figwheel.client/set-repl-pprint false) ;; will turn pretty printing off
Switch REPL build focus:
:cljs/quit ;; allows you to switch REPL to another build
Docs: (doc function-name-here)
Exit: :cljs/quit
Results: Stored in vars *1, *2, *3, *e holds last exception object
Prompt will show when Figwheel connects to your application
[Rebel readline] Type :repl/help for online help info
couple things. check your profiles.clj for outdated stuff. probably remove everything in there to be honest. Then, what is your lein version
and get rid of this as well > Warning: implicit hook found: lein-environ.plugin/hooks
hmmm? so i created this using lein new reagent cljs-demo +cider
like those beginner instructions said. it created the project.clj file for me. I should just delete the whole thing?
Yeah, this is a completely fresh install of everything because I haven't figured this out. I don't even have a .lein/profiles.clj file
it's been a frustrating problem. As I said, a similar thing happened when trying to use shadow-cljs. Not sure what I'm doing wrong. I just want to interact with these things with my sweet emacs/cider goodness!
i hear you. i can't replicate your experience though. it sounds like something is funky with your machine
HTTP/1.1 405 Method Not Allowed Cache-Control: no-cache Content-Length: 0 Server: http-kit Date: Sat, 12 Jan 2019 16:28:00 GMT
what does the browser say when you open http://localhost:3449?
do you have a proxy configured? or some browser extension that may be blocking local connections?
try "cheating" via http://lvh.me:3449/
Doesn't work. What is weird is figwheel is saying things are successful, it just never completes that final step.
I've tried the luminus tutorial and that connects to my localhost just fine. Could it be a cljs specific thing?
something seems to prevent you from loading that page. so CLJS isn't even loaded yet.
interesting question actually. i'm on a pixelbook (chromebook) running their crostini linux capability which is sort of containerized I think. It's debian stretch.
But I've had other things connect to my localhost fine. Things like luminus and things like Rust's rocket web framework.
This figwheel runs smoothly right until the very last part and just hangs there. But it gives me no errors or anything during the build process
right. it is waiting for a browser to connect to it to serve as the js engine of the app. What is happening is that a simple webserver is not seeing any connections on 3449. that's the fundamental problem
and we have lift off! Yay! Ok. so usually things inside crostini can jump out to my chromeos chrome browser. but i installed firefox inside the linux distribution and tried the localhost there and it connected!
thank you so much folks. My apologies for not being clear on my os setup. this has been killing me! To the point where I was blaming clojure and it's "brittle" tools and questioning my sanity. of course it was user error the whole time.
yeah you just have multiple computers in your computer. so localhost is a bit ambiguous
yup. it's weird how clojure (not clojurescript) and rust and others use my chromeos localhost and cljs uses the debian one.
that was a super smart question about docker though. I couldn't have done it without you! Awesome tech communities are awesome!
Hey all, looking for suggestions on a better way to my data structure. I am updating columns in my db. Normally, all columns (in my case) that require updating are pk
or fk
columns. So I can safely do an update-map like:
{1 5 55 68 8 47}
However, one table i have is "polymorphic" in that there is 1 column on the table telling you the type of resource it refers to and another column telling you the specific id of the resource. Think: https://hashrocket.com/blog/posts/modeling-polymorphic-associations-in-a-relational-database
This poses a problem because unlike an fk
column, for the plymorphic table if multiple columns have 1
as a value, it does not not mean that they are all referring to the same resource. So now, my update-map above won't work for all tables. I am trying to think of alternative way to handle this. some thoughts:
{:file/1 5 :folder/55 68 :other-resource/8 47}
Another thought is maybe attaching meta_data? Thoughts?your second example is not so clear what you’re trying to do either. what are the namespaces supposed to help with?
Hi @lilactown, it's a map. The odd items are keys, even items are respective values.
Some people put a comma after each pair. Comma is optional (it's a whitespace). {1 5, 55 68, 8 47}
Lol @peter.kehl I appreciate the info but I'm asking him about the semantics of the problem
Access by key: ({1 5, 55 68, 8 47} 55) ;=> 68
Ah, I see, you followed up on a previous question...
Hi team.
Imagine you have a macro that would be run at the top level only. It doesn't seem to be able to inject (def ...)
. Can it somehow create new def
variables in the consumer's namespace, please?