Fork me on GitHub
#clojure
<
2020-02-18
>
Bobbi Towers04:02:43

I'm attempting to create a knowledge graph of all the concepts necessary for Clojure fluency, for a new interactive learning platform. Does anyone know of any prior art in this space?

Alex Miller (Clojure team)06:02:26

Chas Emerick used to have a Clojure Atlas that was like that http://clojureatlas.cemerick.com

👍 20
jeroenvandijk08:02:37

@porkostomus I guess you know of the technology radar of Thoughtworks (not clojure related, but might be useful) and as for a platform to make the knowledge graph browseable I would recommend https://roamresearch.com/ it makes it easy to link concepts together. And it literally generates a graph. Also clojure toolbox would be related https://www.clojure-toolbox.com/

vikeri09:02:34

Hi! I’d like to make a static site with deps.edn (or possibly lein) and while I could assemble the pieces myself I wonder if anyone has an example? Some things I’d like are: • Hiccup • Asset optimization (renaming of css files for cache busting, minification of css etc) • Live reload support

jeroenvandijk09:02:07

Never tried it, but Bootleg seems to be doing (at least part) of what you want https://github.com/retrogradeorbit/bootleg

vikeri09:02:34

Interesting! Was more looking at deps edn aliases though that just run normal clojure namespaces

jeroenvandijk09:02:51

I find you find something with live reload and asset pipeline features, I would be curious to learn about this

vikeri09:02:18

For sure, I’ve had a setup in boot before that did many of these things and could probably just steal the code from the boot plugins. But would love to see some other examples of state of the art.

kwladyka11:02:42

if you want to have static web page generator probably hugo in go is the best option. I know this is not Clojure, but right tool for the right job.

kwladyka11:02:53

https://clojure.wladyka.eu/ - here is an example of my blog in hugo. I was trying crynogen before but IMO hugo win this game

kwladyka11:02:09

even when it is far away from being perfect

mloughlin11:02:19

I set up and use hugo at work, it is nice if you want to write some markdown and get a website out of the other end

borkdude11:02:25

> it is nice if you want to write some markdown and get a website out of the other end this is what bootleg (written in Clojure, available as native binary) also can do. how does hugo compare to bootleg?

Yehonathan Sharvit11:02:43

Take a look at this this clojurescript react wrapper: https://github.com/Lokeh/helix

Yehonathan Sharvit11:02:52

It’s a different paradigm that reagent

borkdude12:02:31

@viebel Is that related to static HTML generation or are you reacting to something else?

Yehonathan Sharvit12:02:48

I posted in the wrong slack group. My bad!

kwladyka12:02:25

hard to compare hugo vs bootleg, because I didn’t use bootleg. hugo solve almost everything for you, but coding template is a nightmare. Debugging and documentation are pretty bad IMO, but many people think documentation is good. So expect debugging part and doc when coding template hugo is very good.

mloughlin12:02:09

Hugo is a lot more "Rails"-like in that it's very conventions-based. There are pros and cons to this, but it does seem to mean themes work out of the box. You get a set of environmental vars based on TOML config files that can be accessed in your markdown. You have a top level dir with well-known folders and config TOML files: themes, static content, "content" (markdown files in a specific layout) and so on that you run hugo.exe on. If you want to do more than use/minorly edit an off-the-shelf template there's a lot(!) to learn. A divisive feature that sums up the hugo philosophy for me is auto-generating the nav bar for your website by using the dir hierarchy in the content directory. "Easy", not "simple" 🙂

kwladyka12:02:22

I would like to hear more about bootleg and maybe see template / posts

mloughlin12:02:45

Oh yeah, it compiles quickly. Some site generators are super slow.

kwladyka12:02:30

so the downside of hugo is when I code template I feel I use brute force method to guess how it should be written, because errors messages and documentation don’t help. But expect of this, so writing posts, attach images, link structures etc. works pretty good

Bobbi Towers12:02:44

The author of bootleg wrote this recently: https://epiccastle.io/blog/generating-xml-with-bootleg/ (oops, was already posted above ^^^)

vikeri12:02:43

Thanks for the input! I have tried hugo before and it was great for a blog site but I’m making a simple landing page. And I also just think that hiccup is the best thing out there… Oz is also very nice but again more targeted towards blogs etc.

kwladyka13:02:28

why not raw HTML?

kwladyka13:02:45

Does bootleg has sitemap.xml generator and all stuff around?

kwladyka13:02:26

at least I don’t see this

kwladyka13:02:46

they don’t have sitemap.xml

kwladyka13:02:53

so this things are still advantage of hugo

borkdude13:02:08

@retrogradeorbit ^ maybe this is useful feedback

borkdude13:02:26

I guess you can just generate one like it is done for the rss feed, I guess it's more low level and less opiniated

Crispin13:02:33

It does not automatically generate a sitemap.xml, no

Crispin13:02:07

the classic static site generators do a lot of stuff for you, but also require you to learn their way and work within it. A bit like a framework.

Crispin13:02:47

bootleg is lighter. Its a clojure DSL tailored to processing and transcoding markup. There is no "magic" in it. It's up to you to tie it together however you want. It can be used for more than just static site generation for instance.

borkdude13:02:22

I like that

Crispin13:02:29

(although I built it for static site generation...)

Crispin14:02:01

I think if you want the automatic magic you could choose one of the others. There is also a clojure static site generator more in the vein of those others called cryogen https://github.com/cryogen-project/cryogen

kwladyka14:02:36

I was using cryogen before and I found it too limited for my needs. I don’t remember exactly why.

Alex Miller (Clojure team)14:02:27

When I've had the same concerns I found Stasis was a good framework to build on. The https://thestrangeloop.com site is a stasis static site build

vikeri14:02:04

@alexmiller that definitely seems to fit my use case

kwladyka15:02:12

thanks, I didn’t use this one, but found today too. I will take a look.

kwladyka14:02:06

it has this downsides of framework

kwladyka14:02:09

like you mentioned

kwladyka14:02:29

but yes, I definitely don’t want to code things like sitemap.xml, feed etc. myself

kwladyka14:02:47

so I expect from the tool a little “magic”

Crispin14:02:05

@vikeri I noticed above you mentioned asset optimisation. That is something I am going to add to bootleg next. I want to front my site images with a CDN. And I want to minify images for thumbnails inside the code. So some of this will come soon.

👍 4
borkdude14:02:34

I propose we take the static HTML discussion to #off-topic to not bug other Clojure people with this

👍 8
grounded_sage14:02:32

How do I prevent data.csv from creating "\"random-string\"" when a cell item is not a string and others are.

delaguardo14:02:29

data.csv shouldn’t have any logic to replace cell’s value with some arbitrary string by default. Are you sure this string comes from it?

grounded_sage14:02:47

I have a csv file where everything is in a string. But then there are some that aren’t. The result is rows that look like this ["str-1" ... "\"str-2\"" ...]

grounded_sage14:02:08

When I apply read-csv to is

delaguardo14:02:36

sounds like your csv file contains something like this foo,"another foo",bar

grounded_sage14:02:04

Yes that’s it.

grounded_sage14:02:31

How does one usually handle this?

delaguardo14:02:40

in that case data.csv will read "another foo" as a string "\"another foo\"" to keep every bit of information.

grounded_sage14:02:34

The problem I have is converting it to keywords I end up with :"another-foo"

delaguardo14:02:52

one option could be to apply some transformation logic over result of reading as it written here - https://github.com/clojure/data.csv#parsing-into-maps

grounded_sage14:02:43

How would I remove the \" ?

delaguardo14:02:23

(defn normalize [st]
  (clojure.string/replace st #"(^\"|\"$)" ""))

(normalize "\"foo\"")

(normalize "foo")

delaguardo14:02:30

(defn normalize-csv [csv-data]
  (map #(map normalize %) csv-data))

grounded_sage14:02:56

I definitely need to learn more about regex type stuff

grounded_sage15:02:42

Doesn’t seem to work on the actual csv data.

grounded_sage15:02:53

I think I’m just going to have to use strings 😅

p-himik15:02:29

Since your strings can contain spaces (and maybe other characters), going with raw strings and not using keywords sounds just fine.

hindol15:02:03

Yes, if you know all possible values beforehand, and you have a genuine use case, then keywordize.

hindol15:02:02

When you represent an entity as a Clojure map, then it makes most sense to keywordize IMO.

grounded_sage15:02:43

Doing the normalize still gives me this. "\"foo"

grounded_sage15:02:48

It only removes one backslash

hindol15:02:41

The RegEx above will only remove " from the beginning and end of the string. Might it be the other " is not at the end?

hindol15:02:03

^ means beginning and $ means end.

hindol15:02:28

But why not leave it as it is?

grounded_sage15:02:59

Because I can’t do a (get csv-data "foo")

grounded_sage15:02:12

It needs to be normalised

hindol15:02:35

So, these are actually column headers?

hindol15:02:43

Ah, okay. That makes sense.

hindol15:02:33

Replace the RegEx with #"\"" and it will blindly replace all "s.

grounded_sage15:02:37

"�\"foo\"" I’m actually getting this when I copy from the repl to my editor.

hindol15:02:07

Seems to me the detected encoding is incorrect.

hindol15:02:19

Or can it be the byte order mark? There is a section in data.csv README.

hindol15:02:48

And looking at the documentation, it looks like data.csv should remove the quotes for you. Something else is wrong.

grounded_sage15:02:48

I see. That could very well be my problem

grounded_sage16:02:35

I can’t even get the BOMInputStream working 😅

grounded_sage16:02:41

Unable to resolve classname: BOMInputStream
class clojure.lang.Compiler$CompilerException

grounded_sage16:02:58

And when I try to import it with (:import [.input.BOMInputStream]) It fails

grounded_sage16:02:29

I just used clj-bom instead lol

g17:02:19

has anyone had any success with using raw bytes as record keys with jackdaw?

tzzh09:02:45

sorry I can’t help with this but FYI there is #jackdaw so maybe people can help there

seancorfield17:02:52

https://clojurians.slack.com/archives/C06MAR553/p1582039369250600 Our of curiosity, @alexmiller do you use any automation to figure out the version MAJOR.MINOR.COMMITS?

Alex Miller (Clojure team)17:02:34

yes, it's semi-manual in that it requires running script/build/revision to determine the version. I then use that in the jenkins maven release build step. also, it's important that it uses an initial tag "v0.0" on the first commit in the repo.

seancorfield17:02:36

Ah, so the ship has sailed somewhat for Contrib projects that never started that way? Basically, all the ones I maintain.

seancorfield17:02:52

I guess the GitHub UI shows the number of commits so that's a way to seed the version at any point...

Alex Miller (Clojure team)17:02:55

you can tag any commit at any time

seancorfield17:02:24

Right, I just meant a quick way to get the total number of commits at some point in time.

Noah Bogart17:02:40

git rev-list HEAD --count should work

4
Alex Miller (Clojure team)17:02:54

it's been on my todo list for a long time to clean this up and fully automate it, but you know, too many things to do

Eduardo Mata17:02:45

what is the most useful tool or function to collect how long a function took to complete its task? I know about the function time

Eduardo Mata17:02:29

I mean, yeah, but I would like something more detailed than just

"Elapsed time: 100.284772 msecs"

Alex Miller (Clojure team)17:02:12

you mean like a profiler?

Eduardo Mata17:02:39

That would be pretty nice

Alex Miller (Clojure team)18:02:51

Java profilers like YourKit work but that's a big hammer

hindol19:02:54

Don't think it works on Windows or WSL. Something to remember.

Eduardo Mata20:02:48

I tried it but the flamegrapsh aren't explanatory to me

sogaiu23:02:56

there is some explanation of the profiler and its use among one or more posts here, fwiw: http://clojure-goes-fast.com/blog/

markbastian19:02:45

https://github.com/ptaoussanis/tufte is pretty solid and easy to use for profiling.

Eduardo Mata21:02:18

I am looking at this Library and compared with Criterium. this seems to produce what I want. Now, I am having a hard time to understand few things. Could you help me?

markbastian21:02:54

Not sure how much I can help beyond the docs, but feel free to ask me anything.

Eduardo Mata21:02:02

it is more like, getting the pstats from the profiled form. I am getting a map where the numbers are just integers but tufte printed them in seconds.

markbastian23:02:31

Yeah, I always just look at the printed output.

Eduardo Mata20:02:04

What about visualVM?

aisamu20:02:17

Also works fine!

vlaaad22:02:05

Not ready for general announcement yet, but you can try it already: Reveal (Read Eval Visualize Loop) https://github.com/vlaaad/reveal

✔️ 4
🎉 4
andy.fingerhut22:02:37

Any relationship to this project, other than the high level goals? https://clojureverse.org/t/introducing-shadow-cljs-inspect/5012

sogaiu23:02:31

yes, was curious about this too 🙂

sogaiu23:02:00

is it correct that you can use it with either socket repl or nrepl? that sounds pretty neat.

sogaiu23:02:54

@U47G49KHQ minor point, your instructions say main for socket repl, but perhaps you mean -main? the latter worked here to bring up a window successfully 🙂

sogaiu23:02:32

wow, great stuff!

sogaiu23:02:39

(btw, i had some javafx issue with a jdk 8 jvm, but starting a jdk 11 based jvm seemed to fix things)

sogaiu00:02:42

my wife loves the colors and the deref-ing 👏

vemv01:02:34

Taking a look! > Reveal never touches evaluation results, even the metadata. Can you expand on why this is a problem?

sogaiu01:02:41

i was curious about that statement too.

vlaaad06:02:31

@U0CMVHBL2 no relationship other than high level goals :)

vlaaad06:02:01

@UG1C3AD5Z can you tell me what's the issue on javafx?

sogaiu06:02:20

i will try to reproduce and post the error

vlaaad06:02:49

@U45T93RA6 it's a problem because it obscures the values you actually have

👍 4
sogaiu06:02:03

user=> (require '[vlaaad.reveal.prepl :as vrp])
Syntax error (ClassNotFoundException) compiling at (vlaaad/reveal/font.clj:1:1).
com.sun.javafx.tk.Toolkit

sogaiu06:02:10

$ java -version
openjdk version "1.8.0_232"
OpenJDK Runtime Environment (build 1.8.0_232-b07)
OpenJDK 64-Bit Server VM (build 25.232-b07-jvmci-19.3-b06, mixed mode)

vlaaad06:02:05

Thanks, I'll have a look!

👍 4
teodorlu12:02:40

Hey @U47G49KHQ, this looks super interesting! Really excited to see the direction you're taking here 🙂

benny22:02:45

i am using Calva and trying to get back into clojure in general, but vscode/calva can’t seem to resolve defroutes. what do i need to do to make vscode/calva pick it up?

andy.fingerhut22:02:55

Not sure, but in case you do not find an answer here, there is a #calva-dev channel that might be a more target rich environment for knowledgeable people.

benny22:02:39

ah, was thinking that was for contributors, but looks like it is for users too

Eduardo Mata22:02:32

I am using on of the libraries mentioned above (tufte) and the mean is display as 1.286475273E9 how could I evaluate this to an actual number?

Eduardo Mata22:02:07

the type is a double.

Eduardo Mata22:02:22

I answered to myself