beginners

Getting started with Clojure/ClojureScript? Welcome! Also try: https://ask.clojure.org. Check out resources at https://gist.github.com/yogthos/be323be0361c589570a6da4ccc85f58f.
NoahTheDuke 2021-05-02T00:39:30.398600Z

i have some text files that have invalid utf-8 in them. i'd like to write the contents of the files to new files. is that possible?

NoahTheDuke 2021-05-02T00:40:18.399400Z

using slurp converts the invalid utf-8 to be valid by changing the actual bytes

2021-05-02T00:51:59.399800Z

Yes, don't use slurp

2021-05-02T00:52:54.399900Z

Input and output streams read and write uninterpreted bytes

2021-05-02T00:53:59.400Z

Readers, writers, and anything with strings or characters do not deal in uninterpreted bytes, instead need an encoding (like utf8)

NoahTheDuke 2021-05-02T02:21:04.400400Z

cool, thanks

yuhan 2021-05-02T02:47:20.400500Z

(map (fn [x y] [x y]) 
     [1 2 3 4 5] 
     [2 3 4 5])
Is this any clearer? Check out the clojuredocs on map if you're not familiar with what it does for variable args :)

FHE 2021-05-02T04:57:09.404300Z

Hey all. Quick Q: Which version of adoptopenjdk OpenJDK to install? 8 or 11?

FHE 2021-05-02T05:00:08.405900Z

...and wow, for once the installation in Linux seems way more complicated than it does in Windows. Yikes. https://adoptopenjdk.net/installation.html#linux-pkg

Jonas-Daima 2021-05-02T18:46:25.442900Z

I recommend using https://sdkman.io/! for your JDKs. It is so easy to install the right jdk on there and switch between them on a later stage, if it should become necessary.

FHE 2021-05-02T05:06:37.407100Z

This is (primarily?) for ClojureScript if it matters. Following this (for the 2nd time, now on WSL2 instead of Windows alone): https://clojurescript.org/guides/quick-start

FHE 2021-05-02T05:20:53.407700Z

I guess I'll choose 11, but I'm totally lost with what to do with this step:

FHE 2021-05-02T05:20:56.407900Z

Configure AdoptOpenJDK's apt repository by replacing the values in angle brackets:

FHE 2021-05-02T05:21:20.408200Z

`

echo "deb <https://adoptopenjdk.jfrog.io/adoptopenjdk/deb> &lt;codename&gt; main" | sudo tee /etc/apt/sources.list.d/adoptopenjdk.list
`

seancorfield 2021-05-02T05:21:57.409100Z

Any reason to avoid the default openjdk11 version?

FHE 2021-05-02T05:22:12.409800Z

What on Earth do I put in place of &lt;codename&gt;?

seancorfield 2021-05-02T05:22:28.410400Z

Pretty sure I just did apt-get install openjdk11 when I stuck Java on my Ubuntu setup…?

seancorfield 2021-05-02T05:22:40.410800Z

(well, I think I’m on openjdk15 now)

FHE 2021-05-02T05:22:47.411Z

I'm not trying to avoid anything. Just trying to follow the instructions here: https://adoptopenjdk.net/installation.html#linux-pkg

FHE 2021-05-02T05:23:48.412700Z

As for my version question, the ClojureScript Quick Start Guide calls for Version 8 or Version 11. Is that not correct? Outdated?

sb 2021-05-02T05:24:10.413Z

In the documentation I see “You need the codename of your Debian or Ubuntu version. It is usually recorded in /etc/os-release and can be extracted on Debian by running cat /etc/os-release | grep VERSION_CODENAME | cut -d = -f 2 and on Ubuntu by running cat /etc/os-release | grep UBUNTU..”

seancorfield 2021-05-02T05:24:47.413800Z

https://otodiginet.com/software/how-to-install-java-openjdk-11-on-ubuntu-20-04-lts/ says sudo apt update and then sudo apt install openjdk-11-jdk — ISTR it was harder on Ubuntu 18?

seancorfield 2021-05-02T05:25:10.414300Z

11 is the most recent LTS version so it’s a solid choice.

FHE 2021-05-02T05:25:36.415100Z

Good enough for me! Thanks!

seancorfield 2021-05-02T05:25:46.415400Z

17 will be the next LTS version. I was testing against 14 for ages but recently moved up to testing against 16 on my desktop and 15 on my laptop

FHE 2021-05-02T05:27:31.415900Z

What's the benefit to you to trying to be on something newer than the latest LTS.

FHE 2021-05-02T05:28:20.416900Z

? Affects whether your programs can be used by people who have newer JRE's installed? ...or maybe not...everything is baked into the program?

seancorfield 2021-05-02T05:29:33.418100Z

It just means that Oracle is providing Long Term Support so bug fixes are more likely to be provided over a longer period of time (given that non-LTS releases are only “current” for six months each).

seancorfield 2021-05-02T05:30:09.418800Z

The various non-Oracle groups are providing their own support/fixes/maintenance but it’s easier for LTS versions that are more long-lived.

FHE 2021-05-02T05:30:45.419900Z

Right, but what's the advantage of trying use something newer and non-LTS?

seancorfield 2021-05-02T05:30:50.420100Z

I test against recent versions so that it’s easier to move to the next LTS version when it drops (Early Access builds of 17 are already available and I test some of my projects against those already).

FHE 2021-05-02T05:31:52.421700Z

I mean I guess the next question is why move to the newest LTS version if the one you developed in originally is still supported?

seancorfield 2021-05-02T05:32:01.422Z

Right now, a useful thing is the handling of “illegal reflective access” — for several releases, that’s been a warning by default. With 16, the default is to prohibit it, so you have to opt-in if your code (or the libs you use) depend on that feature.

seancorfield 2021-05-02T05:32:28.422400Z

Improved GC is the most common reason folks move to newer JVM versions.

seancorfield 2021-05-02T05:34:00.423800Z

(at work we are fairly proactive about using alpha/beta builds of stuff, at least for testing, so we can evaluate new features and — with Clojure at least — we’re nearly always on the very latest prerelease build in production: Clojure 1.11.0 Alpha 1 right now)

seancorfield 2021-05-02T05:36:51.425200Z

Re: Illegal Reflective Access — in 17 that will be an error with no opt-out, which is why testing against 16 is useful to flush out any instances of that. New Relic’s monitoring agent still relies on it (just just committed to fix it a few months back). Crux, the Clojure database, relies on it too.

FHE 2021-05-02T05:37:54.425800Z

OK. Maybe for ClojureScript being at the cutting edge is less valuable (just because of all the other bits that have to work with it?)

FHE 2021-05-02T05:38:02.426100Z

Anyway, V11 for me. 🙂

FHE 2021-05-02T05:42:50.427400Z

Oh...end still not quite in sight: "The Clojure tools require that either the java command is on the path or that the JAVA_HOME environment variable is set." <--- Important in Linux/Ubuntu?

FHE 2021-05-02T05:56:19.428200Z

I've only ever dealt with environment variables in Windows.

FHE 2021-05-02T05:56:31.428600Z

Bedtime here, but I'll check back here tomorrow. 🙂

seancorfield 2021-05-02T06:00:10.429700Z

I tend to have JAVA_HOME set ~/.profile but mostly because I have several JDKs installed and have env vars for all of those too so it makes sense to set JAVA_HOME there to whatever is my current default choice.

FHE 2021-05-02T06:13:05.431400Z

One more thing I'm running into. I need an X11 display...thing...for my browser within WSL2. You mentioned VcXsrv, but I ran across a (seemingly easier to install and possibly more secure) alternative called X410. VcXsrv still better? ...and downloading from SourceForge trustworthy?

FHE 2021-05-02T06:14:17.432400Z

As for the JAVA_HOME, I'll have to look into how to set it (as well as where to point it to).

FHE 2021-05-02T06:14:51.433100Z

OK. REALLY bedtime now. Thanks for the help so far. Will act on those two questions above tomorrow!

Edward Ciafardini 2021-05-02T13:09:19.438100Z

Hello - I have been stuck on this for a bit and was hoping to gain some insight. I'm trying to implement bi-directional data binding in Reagent. When the user types in the fahrenheit input field, it should update with its own value and the celsius field should update with a conversion function. As of now, the fields do not update - they are static. Using Reagent for this - and my state for temps is in a separate file: https://gist.github.com/esciafardini/eb24ac1e30403943a24c18d883b9e50d

2021-05-02T13:30:08.438900Z

I think you need swap! to update your atom.

2021-05-02T13:32:20.439300Z

You are also missing a closing paren for (def temps

borkdude 2021-05-02T16:11:01.441100Z

Might be better to use a gist or pastebin if you want to share long code

Edward Ciafardini 2021-05-02T16:33:15.441300Z

noted & updated

Edward Ciafardini 2021-05-02T16:38:08.441500Z

closing paren missing was a copy/paste error. I've tried using swap! but kept getting error messages. Maybe I will try again. Thanks for the input.

Karo 2021-05-02T17:50:04.442600Z

Hi team, any useful materials on how to integrate Summologic Open Telemetry with clojure project?

Grzegorz Smajdor 2021-05-02T19:10:19.445700Z

Hi, I want to learn my kids pronunciation so I’m thinking about writing some small cljs site that would show the word / number and call google translate for pronunciation - how to call this page in background https://translate.google.com/translate_tts?ie=UTF-8&amp;q=67&amp;tl=en&amp;client=tw-ob?

walterl 2021-05-02T19:32:17.446200Z

Not sure if this will help, but you reminded me of this recent announcement: https://clojurians.slack.com/archives/C06MAR553/p1619112778011000

Grzegorz Smajdor 2021-05-02T19:33:27.446500Z

right, I’ve seen that but just wondering if this also play it ?

walterl 2021-05-02T19:33:36.446700Z

🤷

Grzegorz Smajdor 2021-05-02T20:16:33.447600Z

Another question, what changes needs to be done in order to deploy reagent template to heroku ? Is there an easy tutorial (or need to follow the heroku guide ?

✅ 1
Grzegorz Smajdor 2021-05-02T21:05:35.448Z

Found https://github.com/kliph/figwheel-heroku and modified my project to fit into this one 🙂

👍 1
FHE 2021-05-02T23:59:04.449300Z

Hello. Is there anyone here who has installed VcXsrv for used with WSL2 Ubuntu (20.04) for ClojureScript programming with Emacs CIDER (not sure if that matters)?