This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-01
Channels
- # adventofcode (170)
- # announcements (3)
- # babashka (1)
- # beginners (25)
- # cherry (1)
- # cider (3)
- # clj-kondo (5)
- # cljsrn (9)
- # clojure (27)
- # clojure-art (2)
- # clojure-europe (11)
- # clojure-nl (1)
- # clojure-norway (26)
- # clojure-sweden (2)
- # clojure-uk (5)
- # code-reviews (12)
- # component (8)
- # conjure (1)
- # data-science (2)
- # hyperfiddle (6)
- # malli (5)
- # off-topic (65)
- # overtone (34)
- # polylith (3)
- # re-frame (2)
- # reagent (2)
- # releases (3)
- # rum (1)
- # shadow-cljs (2)
- # slack-help (8)
- # sql (8)
- # squint (100)
- # thejaloniki (3)
- # tools-build (16)
- # vim (7)
- # yamlscript (1)
Bit of a conceptual question about cljfx. I'm building a game, it's going to end up being relatively complex. In particular, I want it to eventually be able to allow network play, so atom
s seem like exactly what I need.
So I created a *game
atom that holds a map with all the game data. But it seems that cljfx recommends you have a *state
atom as well. So now, I have a list of the forces in this game (the teams, if you will). That ought to be part of the *game
atom. But when I put it there, then I don't know how to get the display listing all the forces to update when I add one.
I feel certain that I should not mix the GUI state and the game state into the same atom, because if I do that then I can't use that atom to share game state between different clients. But how do I tell the GUI that the variable has updated if it isn't in the one that it's watching?
Is this the wrong channel to ask in? I don't mind moving somewhere else if this conversation is beyond "beginner"
Aha, still remembering how to interact with Slack. Forgot about channel searching.
I suggest multiple games should contained within the cljfx application state atom, e.g. using a unique game-id as the top level key for each game state. The game data and application state is data about the game and the functions define how the UI is rendered, so there is separation. Specific info can easily be extracted from a hash-map (and nested hash-maps with get-in or threading macro)
Sharing a specific game state over the net would be a matter of pulling out that data out of the application state (assuming not all state is to be sent)
So within the single *state
atom, I would have a :game
key which has the game's state in it.
Or even just merge the two previously separate maps and not nest them
Having a single map in an atom is the approach I've taken with reagent. I pull only the relevant part of the state (hash-map) and send it to the relevant function
If the starting state become a very large amount of data, it could be separate for convenience of development, but using multiple states does make more cognitive work for the developer (remembering which state has what data)
Yeah, that's why I was basically just trying to say "This atom is the save game, the other atom is anything else."
At any rate, this'll work and we'll see how far I get till we get stuck.
Hey, guys
I'm working in a new project from the company I work for and there is this uberjar file I'm trying to run but it doesnt work on my machine, so I thought it could be specific from the Java version I was using
Things I've tried already to solve it
1. uninstall and install clojure again
The aplication was built on this java version: openjdk 11.0.21 (wich I'm currently using) and I am using this clojure version: Clojure CLI version 1.11.1.1413
So, everytime I try to run clj -T:build uberjar :project project-name
I receive the following error
WARNING: random-uuid already refers to: #'clojure.core/random-uuid in namespace: monger.util, being replaced by: #'monger.util/random-uuid
Building uberjar target/project-name.jar...
Execution error (NullPointerException) at clojure.tools.build.tasks.uber/copy-stream! (uber.clj:50).
null
I couldn't find references on dealing with this error in specific
Does anyone know what could try next?You've probably got an alias in your deps.edn file called build
that points to a build script in your project that is calling copy-stream!
with something that's null ... maybe you've missed a step in project setup, like creating a config file that's not checked in to git or something?
https://clojure.org/guides/tools_build#_compiled_uberjar_application_build ... this is the guide that describes how to set up this tooling ... maybe what you have to that will give you some pointers?
which version of tools.build are you using?
you would find this in your deps.edn under the :build alias
v0.9.4 fixes a case where ephemeral files (in particular editor backup files) that exist on your disk could cause this issue, so if you are are on something older, I would definitely update to latest (v0.9.6)
the other thing it could be is a symlink (see https://clojure.atlassian.net/browse/TBUILD-36) which is an open issue
@U064X3EF3 I was using the version 0.9.3 and that was causing the problem, thank you so much for the suggestion, it solved the problem We've updated our application to the version 0.9.6 of tools.build too
Heads up for beginners. Iām doing Christmas YouTube series on web dev in clojurescript, the first episode is already out https://youtu.be/w5CCZQBNFSc Also make sure to check out the intro episode to learn more about the project https://youtu.be/_2PBcVv210g
might also want to x-post these in #C8NUSGWG6 so they get picked up for Deref
Makes sense, thank you