This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-02-26
Channels
- # babashka (5)
- # beginners (7)
- # biff (34)
- # calva (2)
- # cider (1)
- # clj-commons (1)
- # clj-yaml (4)
- # clojure (18)
- # clojure-europe (8)
- # clr (1)
- # conjure (3)
- # core-async (1)
- # data-science (1)
- # datalevin (9)
- # emacs (3)
- # helix (1)
- # honeysql (11)
- # hyperfiddle (18)
- # introduce-yourself (1)
- # music (1)
- # pathom (2)
- # polylith (2)
- # remote-jobs (1)
- # scittle (20)
- # shadow-cljs (8)
- # spacemacs (1)
- # xtdb (12)
Hi @foo, a noob question. How do i run the project in Cider REPL ? after jacking in, i'm not sure which namespace to load and what the starting point is. I've trying out the chatapp as an example. If I run start() in chatapp namespace, it errors out saying config.edn not found
I assume you've cloned the chat app repo? For that to work, you'll need to add a config.edn file, since that file isn't tracked by git. I should add a config.edn.TEMPLATE file that you can rename. this won't be a problem if you create a new project, since in that case the config.edn file will be created for you.
start
is the right function to call. however, instead of jacking in the usual way, I generally recommend starting up the app with bb dev
, and then connect to the nrepl server that gets started by that command.
(if you did want to add a config.edn file to the cloned repo, easiest way is to start a new project and use com.eelchat as the main namespace, then copy over the config.edn file that gets generated)
also if you prefer to continue jacking in the usual way, that's fine as well--but you'll need to do a couple extra things that bb dev does for you, like setting the BIFF_ENV=dev environment variable.
> I can live with starting the repl with bb dev and then connecting it with cider connect.
create .dir-locals.el
file with the following content:
((nil . ((cider-preferred-build-tool . babashka)
(cider-babashka-parameters . "dev"))))
and jack-in as usualthanks 👍:skin-tone-3:
I assume i would still have to run bb dev
first
you may have to run hack-dir-local-variables
, kill project buffers and re-open them for Emacs to pick up the directory local changes. Just check that those variables are being set to the values indicated before running jack-in. Or simply restart Emacs. When you open the project, Emacs will prompt you, asking if you want to store these values for future sessions in custom.el.
> I assume i would still have to run bb dev first No. That's the whole point of that file, so you don't have to
ah got it
thanks 🙂
@foo btw, I wanted to submit a few sentences to the documentation about this thing, but I couldn't find the repo.
:clojure.main/message
"Execution error (IllegalArgumentException) at java.util.Base64$Decoder/decode0 (Base64.java:746).\nIllegal base64 character 5f\n",
:clojure.main/triage
{:clojure.error/class java.lang.IllegalArgumentException,
:clojure.error/line 746,
:clojure.error/cause "Illegal base64 character 5f",
:clojure.error/symbol java.util.Base64$Decoder/decode0,
:clojure.error/source "Base64.java",
:clojure.error/phase :execution},
:clojure.main/trace
{:via
[{:type java.lang.IllegalArgumentException,
:message "Illegal base64 character 5f",
:at [java.util.Base64$Decoder decode0 "Base64.java" 746]}],
:trace
[[java.util.Base64$Decoder decode0 "Base64.java" 746]
[java.util.Base64$Decoder decode "Base64.java" 538]
[java.util.Base64$Decoder decode "Base64.java" 561]
[jdk.internal.reflect.NativeMethodAccessorImpl
invoke0
"NativeMethodAccessorImpl.java"
-2]
[jdk.internal.reflect.NativeMethodAccessorImpl
invoke
"NativeMethodAccessorImpl.java"
62]
[jdk.internal.reflect.DelegatingMethodAccessorImpl
invoke
"DelegatingMethodAccessorImpl.java"
43]
[java.lang.reflect.Method invoke "Method.java" 566]
[clojure.lang.Reflector invokeMatchingMethod "Reflector.java" 167]
[clojure.lang.Reflector invokeInstanceMethod "Reflector.java" 102]
[com.biffweb.impl.util$base64_decode invokeStatic "util.clj" 57]
[com.biffweb.impl.util$base64_decode invoke "util.clj" 56]
[com.biffweb.impl.middleware$wrap_ring_defaults
invokeStatic
"middleware.clj"
88]
[com.biffweb.impl.middleware$wrap_ring_defaults
invoke
"middleware.clj"
80]
[com.biffweb.impl.middleware$wrap_outer_defaults
invokeStatic
"middleware.clj"
125]
[com.biffweb.impl.middleware$wrap_outer_defaults
invoke
"middleware.clj"
123]
[clojure.core$update invokeStatic "core.clj" 6233]
[clojure.core$update invoke "core.clj" 6223]
[com.biffweb$use_outer_default_middleware
invokeStatic
"biffweb.clj"
333]
[com.biffweb$use_outer_default_middleware invoke "biffweb.clj" 328]
[com.biffweb.impl.util$start_system invokeStatic "util.clj" 28]
[com.biffweb.impl.util$start_system invoke "util.clj" 23]
[com.biffweb$start_system invokeStatic "biffweb.clj" 30]
[com.biffweb$start_system invoke "biffweb.clj" 24]
[com.technolunatic.chatapp$start invokeStatic "chatapp.clj" 57]
[com.technolunatic.chatapp$start invoke "chatapp.clj" 56]
[com.technolunatic.chatapp$_main invokeStatic "chatapp.clj" 71]
[com.technolunatic.chatapp$_main doInvoke "chatapp.clj" 70]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.lang.Var applyTo "Var.java" 705]
[clojure.core$apply invokeStatic "core.clj" 667]
[clojure.main$main_opt invokeStatic "main.clj" 514]
[clojure.main$main_opt invoke "main.clj" 510]
[clojure.main$main invokeStatic "main.clj" 664]
[clojure.main$main doInvoke "main.clj" 616]
[clojure.lang.RestFn applyTo "RestFn.java" 137]
[clojure.lang.Var applyTo "Var.java" 705]
[clojure.main main "main.java" 40]],
:cause "Illegal base64 character 5f"}}
that's the error message i get when i try to invoke cider jack-in
not sure what's going on
i guess i'll start with a fresh project instead of trying to use an existing one
make sure that the vars are properly set. run M-x describe-variable
(while you're in the directory).
the logs in *nrepl-server*
buffer, should be pretty much the same as when you run bb dev
in the terminal
thanks. It works with a new project.
how do i restart the system ? there is no reset
or stop
command
oh, just remembered that a config.edn file from a new project won't be backwards compatible with the eelchat project (specifically, the way secrets are stored has changed). on the first or second page of the tutorial it has you run the new project script with an additional argument that'll base the project off the same biff version that I used for the tutorial. you would need to make a new project with that command and copy the config.edn file from there. (or just stick with a new project). call (biff/refresh) to restart. in most cases (e.g. updating routes or schema) it isn't necessary, but it is needed sometimes of course docs are in a separate repo. bit of a mess currently. I'll post a link in a minute
thanks @foo, you are doing an amazing job with this project
i am just trying to learn and see if I can use biff for a couple of starter projects
i appreciate your quick responses here.. always a pleasure when developer responds to quickly 😄
cause i'm a total noob
Hi @foo, the docs mention Rum
. but I also saw htmx
on the webpage. Which one is being used for the UI part right now ?
both. rum renders the html on the server, and htmx swaps it into the dom client-side
got it
i was wondering why Rum on the server instead of something like Selmer ?
coming from CMS background, i like the templating capability of Selmer
I use rum in Biff since I personally prefer hiccup syntax, as do a lot of Clojure developers I believe. I like the succinctness, and being able to use plain Clojure instead of a custom templating language. But biff isn't tied to rum; you can use Selmer instead if you like. you'd just need to write your own version of biff/base-html, and replace the biff/wrap-render-rum (I think that's what it's called anyway...)middleware with a Selmer version (or just have all your html-returning routes call Selmer explicitly)
ah I see. thanks for the explanation. Good to know that things can be swapped out if required