Fork me on GitHub

How can I go from adding an input to the front end, to writing to a database table?


I want there it be a correspondence between pages and tables, and inputs and columns. Is there a reason this is a bad idea?


Then developers can automatically add a column to a database table just by adding a new input.


Clearly I must make an ajax call but how do i catch it on a Clojure back end, verify the user is credentialed, and then add a column to the database?


That sounds very dangerous to me -- it would open you up to all sorts of hacking if the front end could make arbitrary requests that just automatically modified your DB schema...


Alright I actually don't know how to do this. Basically I'm AOT-compiling a project which in the entry point I'm parsing an args using, using the parsed argument I want to read external config file


So I have project.jar and config.edn side by side and I'm using this to try to execute the jar


java -cp ./ -jar project.jar --target config.edn


And it says it doesn't find the resource. I'm using io/resource to get the resource. Nvm, I should've just used io/file instead of io/resource


sean, maybe im not thinking clearly, but i want it to only be for developers


you know how each time figwheel detects a change, it hot deploys?


im saying i want the new database columns to be done on the hot deployment


@seancorfield can you help me make a dummy app that connects an input on the clojurescript front end to a clojure backend and a database?


what database does it write to?


Any you wish. Try out and add in Postgres for example.


How does korma work with Chestnut?


the luminus template has some good docs on how to set up a db with clojure

👍 4

when i code with the repl, sometimes i end up accidentally defining function a after b when b calls a. It works because the repl has it defined, but it doesn't work after restarting cider. does anybody have a workflow that avoids such issues?


@ackerleytng you might be looking for declare


oh you mean use declare to declare everything upfront?


@ackerleytng yes, use it to declare bindings that are defined after the point at which they are invoked

Timo Freiberg07:08:01

@ackerleytng i assume you want to avoid making definition order mistakes and don't actually have circular dependencies?


ah ok that's not what i mean

Timo Freiberg07:08:50

so far i just accept that i make these mistakes from time to time


hah ok thanks

Timo Freiberg07:08:49

i'm not very experienced, but i already noticed that i'm getting used to defining my helper functions above instead of below (like in java)

Timo Freiberg07:08:36

maybe it's just something to get used to and after some time you don't make this mistake anymore


i usually do! usually it's when refactoring that this happens


@henrik Thanks for all the tips!


@ackerleytng @timo.freiberg linter is a tool that analyzes your source code and provides warnings if the code contains errors or other problems, such as using undeclared vars. You can usually hook a linter to your editor to get immediate feedback as you type or save the file. Eastwood is a popular linter for Clojure and it has been around for a long time . Personally I’m using Joker with Emacs bindings


My experience is that setting up tooling is a time-consuming chore but it pays off in better developer experience. You usually also learn something interesting while banging your head against the wall when trying to get the tools to work the way you like. 🙂


Does all the tooling slow down development? Like when you type, or when the file is big


Why did you pick joker over Eastwood?


Sure tooling comes with some kind of overhead but nothing significant in my experience. I try to avoid big files in general. With a relatively modern laptop you won’t probably notice any kind of slowdown.


I initially “chose” Joker because it was the first one I got working with my Emacs setup. 😆


It was very simple to setup and I’ve been very happy with it.


Both Joker and Eastwood are useful. I use both. Joker live via an Atom plugin, Eastwood via the command line.


Also Yagni and another tool I can't remember... just a sec...


Kibit and Bikeshed. Every little helps!


Any news re: environments for beginners in the last year or so, for editing/executing Clojure or Clojurescript (either or both)? My requirements are: simple installation/setup, syntax-aware re-indentation, and *no* required use of paredit or parinfer. I've taught with many over the years but I'm not fully satisfied with any current options that I know about.


@lspector Hi Lee! I assume you've tried NightCode? How did that stack up on your criteria?


And are you looking to teach complete programming beginners? Or do they have some programming experience, just new to Clojure.