Fork me on GitHub
#beginners
<
2019-02-08
>
slack.jcpsantiago10:02:49

day for first timers eh πŸ˜„ I also "finished" my first thing https://agile-bayou-45422.herokuapp.com/ now working on merging the buttons into just one with all three functions, animated timer and a table of the last five events plus plot with Oz uff

its.ramzi11:02:17

I've been trying to follow a tutorial and get a Github project to build, with no luck. Could someone work with me in PM? Thanks.

janis.urbis11:02:23

Hello, what is the best way to get more clojure experience for a newbie? Currently I'm pretty comfortable with the language (1.5 books & easy/medium 4clojure problems completed) but developing the app from scratch is still challenging. I was able to setup simple shop app with bidi, ring, hiccup, monger (mongodb atlas) but when I get to authentication part there was a bug I couldn't wrap my head around. And also the absence of pleasant workflow was really frustrating. After googling I found out the there is a notion of a reloaded workflow. Somebody recommended to look into juxt/edge where the integrant is the dependency. I watched 4 talks by James Reeves & today I tried to setup project with duct... ...and I couldn't do anything unfortunately. It still looks too complicated & I genuinely don't know how to work with it. Thank you for reading to the end. The question remains the same. How to continue getting more experience. What would you do? Thank you.

cybersapiens9713:02:25

I have somewhat similar question, anyone knows how to setup 'lein ring server' to start the server on a LAN mode, so it can be accessible for anyone on my network instead of localhost ?

victorbjelkholm42913:02:48

@cybersapiens97 change the bind address to 0.0.0.0 (warning: it makes the service public)

victorbjelkholm42913:02:22

@cybersapiens97 seems you can specify :ring {:host "0.0.0.0"} in your project.clj for doing that

cybersapiens9713:02:29

by public you mean accessible by others on the same network

victorbjelkholm42913:02:13

@cybersapiens97 no, 0.0.0.0 would mean anyone who can reach you

victorbjelkholm42913:02:29

if you want just the local lan, you would have to bind to your local lan address (usually something like 192.168.x.x)

cybersapiens9713:02:12

oh right, but how would one reach me on 0.0.0.0? trough my IP ?

victorbjelkholm42913:02:36

through any IP your network cards are listening on

victorbjelkholm42913:02:55

if external hosts can't reach your computer, it's only reachable via the local lan, won't be a problem to listen on 0.0.0.0 but normally good practice to only bind to addresses you actually care about. 0.0.0.0 is a nice shorthand for public services

cybersapiens9713:02:04

btw, 'lein ring server-headless 3000' automatically starts on 0.0.0.0

victorbjelkholm42914:02:47

Yeah? Seems like a really bad default

sy_borg15:02:42

is there any way to extend (doc xx) functionality to also show examples (e.g. from clojuredocs) in REPL? any extra libraries? like man xx -Examples in Powershell.

dpsutton15:02:16

if you are using CIDER you can hit C-c C-d r and see examples from http://conj.io. This is a great feature

sy_borg15:02:02

I'm on Cursive

ville15:02:54

Hey, what's the best ide (and easiest to setup) when using arch? i triend IntelliJ with cursive but couldn't get it fully working.

leonoel15:02:35

I have a intellij + cursive setup on my arch, works fine

leonoel15:02:00

I unpacked the archive from jetbrains directly in a local folder in my ~ and symlinked the launcher

leonoel15:02:33

if your java setup is correct it should work out of the box

ville15:02:36

Thanks! I had problems with run configurations, Like I couldn't get lein run work with trampoline etc. Can you give me screenshots of your run configurations?

leonoel15:02:51

that's default setup. I don't use leiningen anymore but I've successfully made it work in the past

ville15:02:19

Cool cool, thank you very much!

leonoel15:02:21

I recommend you install clojure-related tools manually instead of pacman as they tend not to be updated frequently

sbr18:02:13

I have good experience with VS Code and clojure plug-ins. Vs code is available via pacman

sy_borg15:02:52

what is arch?

ville15:02:12

it's a linux distribution

cybersapiens9719:02:22

would you guys say that a minimal clojure web application is good enough with just 3 libs, Ring, Compojure and a DB lib? (i'm going to build a simple web app for training my back end skills) and also, what is a easy to use and simple lib for a simple DB ?

lilactown19:02:13

I'd say so; I like hiccup as well for building HTML

cybersapiens9719:02:55

oh nice, thanks

tom.sanders19:02:15

For DB I like https://www.hugsql.org/ It will stop you going to SQL hell in the early days

seancorfield19:02:08

HugSQL relies on clojure.java.jdbc under the hood (as do nearly all SQL libs).

cybersapiens9719:02:40

oh yeah, i kinda remember this, i asked the same question 2 months ago, but i had to stop my studies and now i'm back

tom.sanders19:02:47

Certainly, yes. I'm recommending it as much from a structure point of view

cybersapiens9719:02:54

and now i remember about clojure java jdbc

seancorfield19:02:36

If you like a DSL for SQL and want to compose queries from fragments, look at HoneySQL (I maintain that as well as the Contrib java.jdbc lib).

seancorfield19:02:51

If you like your SQL external to your code, HugSQL looks great.

chase-lambert20:02:48

so would you recommend this hugsql for complete beginners? I ultimately want to make full stack apps but not sure when I should go for it. I don't know anything about sql or databases. I was planning on using luminus and the creator's book on web development when the time just so I can focus on one thing. not sure if he emphasizes one db over the other though.

chase-lambert20:02:44

i'm finding most beginner tutorials just mention you have multiple db options, they never assume I don't know a thing about databases

djzurawski20:02:22

I think having a basic understanding of SQL, doing queries, insert, update, and joins is really important

chase-lambert20:02:21

any recommendations for learning sql from the beginning?

dmytro.bunin20:02:04

just get db running locally with few tables and try doing everything with it

borkdude20:02:23

hugsql is good for beginners and experts that just want to write SQL

chase-lambert20:02:42

so SQL will be a whole new language I have to learn? And it's a language for writing databases? And those db's contain all the saved info from my app? What is edn? Is that clojure's database language? is that what datomic uses instead of sql?

lennart.buit20:02:54

SQL is a domain specific language for querying data from a database

lennart.buit20:02:35

so, for example, SELECT * FROM users WHERE id=12 would be SQL for β€˜Give me all information you have about a user with id 12’

chase-lambert20:02:06

and so hugsql is a way to take that and bring it into the clojure world?

seancorfield20:02:47

HugSQL lets you write that SQL in separate .sql files and it wraps that SQL in Clojure functions that it generates for you.

seancorfield20:02:01

And it uses clojure.java.jdbc to run the SQL against a database.

seancorfield20:02:48

Without HugSQL, you still have to write SQL. You would just write it in a string in your Clojure code instead. HugSQL is like having those strings in a separate file instead.

seancorfield20:02:16

(jdbc/query db-spec ["SELECT * FROM users WHERE id = ?" 12])

lennart.buit20:02:26

And then to complete your questions, EDN is a data notation that is like JSON, but more specific to clojure. Just like JSON is a subset of JavaScript, EDN is a subset of Clojure and is focussed on data instead of code

chase-lambert20:02:56

ok, ok. nice. I'm basically wanting to have the ability to create web apps like the folks who recently posted on the jobs board. I want to get there in a couple of years if possible. Is luminus and hugsql/sql a good way to get there

seancorfield20:02:49

Luminus is definitely a "batteries included" approach but it involves a lot of code and libraries and config combined so it can be pretty overwhelming.

chase-lambert20:02:04

re-frame sounds like the path I want to take, just not sure when to jump all the way to that from right now basically going through various clojure books and learning programming as a whole.

lennart.buit20:02:26

well, writing webapps comes in several varieties

seancorfield20:02:30

I think it's much better for beginners to get a simple server-side "Hello, World!" up and running with Ring and Compojure first.

seancorfield20:02:09

Then learn some SQL and experiment with clojure.java.jdbc -- so you can learn that independently of your basic web app stuff.

lennart.buit20:02:12

re-frame is a clientside framework for making single page applications. Like @ is suggesting, first have a serverside rendering of some plain HTML

chase-lambert20:02:13

ok! I think I've been told that before too. Ring and Compojure. So that's the back end doing server rendering? old school web app approach right?

seancorfield20:02:31

Yup. Simple HTTP request/response handling.

lennart.buit20:02:35

yeah pretty oldschool, but I think very valuable information

chase-lambert20:02:38

and then maybe throw some hiccup in there? That's the clojure way to generate html from the server?

seancorfield20:02:58

Ring is the core lib. Compojure helps you write "routes" in your request handling (mapping URIs to handler functions).

chase-lambert20:02:01

or did I just complicate it again? I want clojure all things basically. I've drank the kool aid

lennart.buit20:02:16

first things first ^^ start small, expand from there

seancorfield20:02:18

Hiccup is another layer, and one way to generate HTML from data.

chase-lambert20:02:19

perfect. I think I get that.

seancorfield20:02:41

At work, we use Selmer, because we like working with external HTML files that our designers can also work on.

chase-lambert20:02:49

Compojure and Ring, just get something small on the browser. And that's something I would be able to show my family and friends pretty easily?

seancorfield20:02:55

Selmer is like Django in terms of templates.

lennart.buit20:02:11

oh thats cool sean!

seancorfield20:02:12

Yes, Ring/Compojure will get you a small, interactive web app.

lennart.buit20:02:35

is it a direct port of Jinja uhh that other django templating language?

chase-lambert20:02:48

perfect! And eventually if I use things like luminus or rum or whatever, they use Ring and Compojure anyways right? So thats the perfect first steps

seancorfield20:02:02

I'm not sure if it will help or not, but here's a simple example of a Ring / Compojure / Selmer / Component web app that uses a database https://github.com/framework-one/fw1-clj/tree/master/examples/usermanager

seancorfield20:02:04

(Component may well make it too complex to learn from but it's also another piece of the puzzle when you start building systems that include things that have some sort of start/stop lifecycle, such as database connections, web server startup, etc)

seancorfield20:02:28

@chase-lambert What's your background prior to Clojure?

chase-lambert20:02:49

I'll bookmark it. I'm sticking to this compojure/ring advice first.

chase-lambert20:02:04

started with a little javascript with freecodecamp, read way too much language war garbage, played around with elm, haskall, rust, racket, and then clojure. finally told myself to stop hopping and focus as clojure really clicked pretty quickly. so I know clojure most of all (and I don't know much clojure yet)

lennart.buit20:02:33

exciting, learning to program is the best thing I ever did ^^!

seancorfield20:02:24

Cool. SQL will definitely be something you'll need to learn if you want to write non-trivial programs -- and it's a useful skill, to be able to query and manipulate data from other people's databases when you're on a team.

chase-lambert20:02:28

it's so fun! I wish I had taking more of a liking to it years ago. I remember doing Basic and such but it never took hold. Now I'm 38 and falling for it hard.

seancorfield20:02:04

My dad bought me a programmable calculator when I was a young teen and that got me hooked! πŸ™‚

lennart.buit20:02:22

hah, I remember writing code in highschool on my TI-84

lennart.buit20:02:26

that was basic too!

lennart.buit20:02:00

we should applaude Texas Instruments for inspiring young people to start programming

lennart.buit20:02:50

@ how does a β€œprogram” on that calculator look?

seancorfield20:02:29

I "graduated" to this http://www.datamath.org/Sci/WEDGE/TI-58.htm a year or two after the Sinclair.

seancorfield20:02:12

It was basically "assembler". And you had to step through it line by line when entering/editing it. When you ran it, all it could do was display numbers on the screen.

seancorfield20:02:25

My friend and I created an interactive solo version of "battleships" for the TI-58 that did "animated" sonar pings in the numeric display when you were looking for enemy ships to blow up πŸ™‚

lennart.buit20:02:25

did it have (non-volatile) memory to store the programs, or was it like ad-hoc procedures?

seancorfield20:02:03

The Sinclair was all in-memory and not persistent. The TI-58 let you save programs to magnetic card strips and read them back in.

seancorfield20:02:54

We thought that was luxurious at the time!

seancorfield20:02:23

At university, we "backed up" our programs to rolls of punched tape πŸ™‚

lennart.buit20:02:34

haha yeah! I am sometimes envious in that I didn’t really experience such fundamental β€œyou can understand it all” programming

lennart.buit20:02:09

nowadays, code runs inside a vm, and that vm runs on top of cpu that is absurdly complex

lennart.buit20:02:28

there is no way that I can ever understand the full stack

dmytro.bunin20:02:00

code runs in a container in a vm on top of cpu

seancorfield20:02:14

Imagine a job where you wrote COBOL to target a multi-user departmental mini-computer that had just 4MB of RAM πŸ™‚

seancorfield20:02:22

The "good ol' days" πŸ™‚

lennart.buit21:02:02

My dad (still 27 here) prepared me a 8086 computer with a batch script that booted a little game for each letter on the keyboard

lennart.buit21:02:13

my carreer path was basically sealed back then πŸ˜›

borkdude20:02:50

my workflow is usually: first mold the query in pgadmin until it works, then copy it to a .sql file and hook it up with hugsql

tom.sanders20:02:25

Whether you know SQL or not won't affect your choice of Clojure DB lib but you'll obviously need to know enough SQL to write some queries. Sounds like you will have to digress into that first

seancorfield21:02:58

@chase-lambert Feel free to join #sql and ask for help with SQL as needed -- it's a pretty low traffic channel and I keep a close eye on it (also #honeysql if you decide to explore that and there's a #hugsql channel too).

raymond.w.ko21:02:16

For shadow-cljs users, do you know if there is an equivalent of lein-ancient to check which dependencies are out of date?

raymond.w.ko21:02:33

in shadow-cljs.edn?

thheller21:02:06

there is not currently

chase-lambert23:02:47

so with the official cli tools, can you also use that to connect into nrepl through something like emacs/cider? lein repl shows me the nrepl port to connect to but I don't see similar stuff with clj when in a project and not seeing the info about that on the official repl or cli pages

noisesmith23:02:12

by default clj doesn't start a networked repl (nrepl being one of the networked repl implementations)

chase-lambert23:02:38

oh wait, would you manually add the nrepl and assorted info in the deps.edn file?

dpsutton23:02:09

you can. and you could manually start an nrepl server and then connect from emcas

dpsutton23:02:27

however, just try m-x cider-jack-in in a deps.edn project

dpsutton23:02:50

cider tries its best to figure out the type of project and how to get it up and running.

chase-lambert23:02:16

ahhh, cool. that makes sense. I was just curious. I keep playing around with rebel readline too. Some really neat tools out there in this community.

owen.riddy23:02:03

What is the relationship between the Clojure command line tools and clojure.tools.alpha? Are clj or anything related to deps.edn technically still an alpha release?

owen.riddy23:02:32

And were the clojure command line tools introduced in 1.9.0 or did they exist previously?

seancorfield23:02:47

tools.deps is a library for managing classpath stuff based on deps.edn; clojure uses tools.deps under the hood.

noisesmith23:02:56

they were introduced for 1.9, with earlier versions all you needed was a single jar for standalone clojure startup

noisesmith23:02:30

1.9 introduced a non-optional but not bundled dep (spec), so it needed a dep resolution tool for a minimalist test case

seancorfield23:02:48

Technically, tools.deps is still alpha, as is clojure.spec. But Clojure's "alpha" is most languages' "release candidate" to be honest πŸ™‚

seancorfield23:02:09

At work, we've run alpha builds of Clojure and its tooling in production for nearly eight years.