beginners

Getting started with Clojure/ClojureScript? Welcome! Also try: https://ask.clojure.org. Check out resources at https://gist.github.com/yogthos/be323be0361c589570a6da4ccc85f58f.
zackteo 2021-05-04T03:14:06.023800Z

Hello, asking this in attempts to get a Java library working in 100% clojure. Is there a way to do type hinting to specify something like List<Room> or java.util.List<optaplanner_clj.data.Room>

zackteo 2021-05-04T03:20:24.024800Z

Like I need to return a property as a typed Collection. Or are generics indeed being erased at runtime

FHE 2021-05-04T04:01:28.029300Z

2 quick questions: I'm trying to decide whether to try figwheel-main or shadow-cljs, and I'm leaning toward shadow because supposedly if I want to do mobile down the road (after getting decent at web, or to make the web things I make also work on mobile) shadow is supposed to make that easy. 1. How much truth is there to that? 2. Why is Java a dependency of shadow-cljs?? (Is it because it handles not just ClojureScript, but also Clojure (for the server side of things)? ...but if it uses Node.js, doesn't that mean the server side would be in JS (CLJS)??)

wilkerlucio 2021-05-04T04:09:25.029400Z

hello, the way in which Shadow will make a lot of things easier than Figwheel is related to NPM deps, with Shadow you can add almost any NPM dependency directly, this don't work this way out of the box with Figwheel. About the Java dep, that's because Clojurescript is written in Clojure, which requires the JVM, both Shadow and Figwheel will require Java to compile

raspasov 2021-05-04T04:17:08.029600Z

@wilkerlucio that’s not true anymore, at least for React Native development (haven’t tried browser in a while) it does work out of the box as of last year

raspasov 2021-05-04T04:17:39.029800Z

(talking about adding NPM dependencies)

raspasov 2021-05-04T04:20:20.030100Z

That’s pretty neat.

wilkerlucio 2021-05-04T04:24:48.030300Z

I know CLJS add the bundle version option, that requires an external bundler like Webpack, did this changed on the Figwheel side?

wilkerlucio 2021-05-04T04:25:42.030500Z

ah, for React Native you are running in the Node environment, so require just works there, I guess that's why you can use figwheel + NPM there

wilkerlucio 2021-05-04T04:26:04.030700Z

but for browser, no luck on Figwheel afaik for npm deps

raspasov 2021-05-04T04:29:33.031Z

Also with React Native you must still use the metro bundler which is part of the “regular” RN workflow. If you’re doing browser dev, shadow-cljs would actually save you from using an extra bundler, so that’s nice there.

FHE 2021-05-04T04:35:27.031400Z

Must still use the metro bundler...for which? figwheel or shadow? Sorry, lost track there.

FHE 2021-05-04T04:36:02.031600Z

...but it essence if I want to do web for sure and mobile probably, then shadow-cljs sounds best (for a noob)?

FHE 2021-05-04T04:37:53.031800Z

@wilkerlucio I did do the first part of the ClojureScript Quick Guide, and that ran. I had installed Java (started following the Clojure Getting Started page and then thought "no wait...don't need this since CLJS based on JS). I was wrong, obviously, but I never got to the point of setting the JAVA_HOME variable but the CLJS quick guide part I did still worked. Is it important to set it anyway?

FHE 2021-05-04T04:38:05.032Z

(Not sure how to do that. Conflicting accounts on the web.)

wilkerlucio 2021-05-04T04:40:48.034200Z

the metro thing @raspasov said is something specific for React Native develop, unless you are doing that, no need to worry about it

👍 1
wilkerlucio 2021-05-04T04:41:04.034700Z

I never set JAVA_HOME too, if you OS can find java and compile without it, its fine

FHE 2021-05-04T04:41:05.034900Z

@seancorfield I guess you are referring to the yarn alternative to npm, which is listed in the shadow-cljs write-up as such (a viable alternative). I'm just about to start setting up shadow-cljs, and looking at that option now.

Eric Ihli 2021-05-04T04:41:25.035Z

This might be a little bit outdated now, but it's about a minimal fully-functioning React Native app that's well-documented. https://github.com/eihli/cljs-react-native-starter/blob/master/src/example/core.cljs

FHE 2021-05-04T04:42:07.035400Z

OK, great (about the variable). Even though I think it's right near the top of the Clojure Getting Started write-up! 😛

FHE 2021-05-04T04:44:01.035600Z

As far as React Native, well I'm 90% sure I'll want to do mobile soon enough. Just trying to pick the best option (shadow.cljs vs figwheel-main) knowing that in advance. Based on minimizing/easing whatever slew of extra tools I would have to learn at that point with for each option.

raspasov 2021-05-04T04:45:55.035800Z

@factorhengineering I haven’t used shadow-cljs, but many people are happy with it so I assume it’s a pretty good option.

raspasov 2021-05-04T04:46:50.036Z

metro is specific to React Native, nothing to do with figwheel or shadow-cljs, yes

FHE 2021-05-04T04:47:31.036300Z

OK. Good to know. So no reason to think either option is better from your perspective?

FHE 2021-05-04T04:48:39.036500Z

That shadow easing mobile thing must have been a dumb rumour.

FHE 2021-05-04T04:49:52.036700Z

I'm still going to try it only because I tried it on my previous (failed/abandoned 😞 ) go-around months ago when I tried setting everything up for dev entirely from Windows (no WSL2).

FHE 2021-05-04T04:50:52.036900Z

I want to see if switching to WSL2 makes it any easier for me to get going with shadow-cljs. ...change one variable at a time, you know? 🧪

wilkerlucio 2021-05-04T04:53:11.037300Z

the maintainer of Shadow uses Windows, so its likely it works good there because he is on top of it 🙂 but I guess both should work fine

alexmiller 2021-05-04T04:53:24.037700Z

They are erased and there is no way to say that in Clojure

wilkerlucio 2021-05-04T04:54:14.037900Z

I used figwheel a long time ago, but since I switched to Shadow I never looked back, there are many small things that are nice about Shadow, but the biggest and easiest selling point is easy NPM integration on the browser, just that would be enough to keep on it for me

zackteo 2021-05-04T04:54:51.038100Z

Alright! Thanks! Shall see if there's another way around it :thinking_face:

FHE 2021-05-04T04:55:49.038300Z

Whoa. That gives me a sinking feeling, actually. 😟 Not that I think it will be worse on Linux, but that now I have no reason to think I'll be any better at figuring it out. lol

FHE 2021-05-04T04:56:06.038500Z

Oh well...installing node now, then taking on shadow again...

wilkerlucio 2021-05-04T04:58:04.038700Z

but from a friend that was using windows before, its usually the hardest place for dev environments these days

wilkerlucio 2021-05-04T04:58:16.038900Z

the others usually have a few command lines you run and everything gets working

FHE 2021-05-04T04:59:42.039100Z

It is taking me days and days to put everything together, but I am taking super-detailed notes so if I ever have to set things up again I can not have to look things up in 300 different places again.

FHE 2021-05-04T05:00:19.039300Z

The actual steps, though, do seem maybe a bit shorter on the Linux side.

FHE 2021-05-04T05:05:55.039500Z

Wha-a-at. I remember node taking way-y-y longer to install on Windows. If it's really properly installed then this is a difference.

FHE 2021-05-04T05:15:55.043300Z

Trying to install shadow-cljs on WSL2 Ubuntu 20.04. Dependencies Java OpenJDK and Node.JS already installed. No mention (that I can find) on the shadow-cljs github page of how to actually install it, but found, on https://docs.cider.mx/cider/cljs/shadow-cljs.html the command npm install -g shadow-cljs. Permission errors so tried sudo npm install -g shadow-cljs. Now I get npm ERR! cb() never called! npm ERR! This is an error with npm itself. Please report this error at: npm ERR! &lt;<https://npm.community>&gt; npm ERR! A complete log of this run can be found in: npm ERR! /root/.npm/_logs/2021-05-04T05_10_49_170Z-debug.log e

FHE 2021-05-04T05:15:59.043500Z

Yikes.

FHE 2021-05-04T05:19:18.044800Z

OK, well after checking the log file and seeing nothing helpful to me, I just tried running the exact same sudo installation command again, and this time it worked. Go figure!

raspasov 2021-05-04T05:21:00.045200Z

@factorhengineering have you seen the shadow-cljs guide? https://shadow-cljs.github.io/docs/UsersGuide.html

raspasov 2021-05-04T05:22:19.045600Z

I guess that’s the same guide at http://cider.mx

FHE 2021-05-04T05:23:31.046800Z

I'm reading it now. I did a web search for the http://cider.mx comment about installing it globally because I vaguely remembered that text from when I installed it on Windows months back.

Aron 2021-05-04T05:25:06.048400Z

doing everything sudo might make it look like its working, but it's defnitely not necessary

FHE 2021-05-04T05:25:13.048900Z

It seems really strange that the github page for shadow-cljs didn't mention how to install or point to the guide...not even in the 'Guides' section.

Aron 2021-05-04T05:26:40.051300Z

I am using shadow-cljs in wsl2 ubuntu and all i did was (apart from following the guide and asking help here a lot!) that I installed shadow-cljs and then always start with shadow-clj restart (start expects clean shutdown, which with wsl is not going to happen, restart ignores previous garbage), then I use the web interface after.

FHE 2021-05-04T05:26:59.051800Z

I did it without sudo first and it said (among other errors) npm WARN checkPermissions Missing write access to /usr/lib/node_modules and npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.

Aron 2021-05-04T05:27:23.052200Z

yeah, so did you check the permissions?

FHE 2021-05-04T05:27:50.052700Z

sudo is the only approach I know in that department. lol

Aron 2021-05-04T05:27:56.052900Z

that's not a check

Aron 2021-05-04T05:28:03.053300Z

ls -la usually works for me

Aron 2021-05-04T05:28:17.054200Z

and you use chown and chmod to change it

FHE 2021-05-04T05:28:19.054400Z

In that folder it mentioned?

Aron 2021-05-04T05:28:25.054700Z

everywhere

Aron 2021-05-04T05:28:39.055300Z

I would say that keeping permissions in order is the absolute must

Aron 2021-05-04T05:28:56.055800Z

don't use linux or wsl if you are not doing it, that's just my opinion of course

FHE 2021-05-04T05:29:45.056500Z

All new to me.

Aron 2021-05-04T05:29:56.057Z

to be clear, I check it automatically when I list directory content, and in my experience you only rarely need to actually change anything

Aron 2021-05-04T05:31:20.059300Z

but since everything constantly depends on them being in order, I don't see how one can avoid it. doing everything sudo is not just that now you are constantly in superuser mode, but also everything you start will be running like that too

FHE 2021-05-04T05:31:23.059500Z

I just tried navigating to the parent folder (/usr/lib/) and running ls -la. In the giant list of folders I see node_modules has drwxr-xr-x beside it.

Aron 2021-05-04T05:31:54.060400Z

could be some package you installed or you ran npm install in that folder earlier

FHE 2021-05-04T05:32:02.060700Z

I'm guessing that's the permissions?

Aron 2021-05-04T05:32:10.061100Z

yes

FHE 2021-05-04T05:32:25.061800Z

1st ever attempt at installing it.

raspasov 2021-05-04T05:32:32.062100Z

@ashnur come on, I mean I get where you’re coming from but he’s just trying to get his Clojure(Script) running 🙂 You can figure out how to do perfect Linux administration later…

FHE 2021-05-04T05:32:36.062300Z

Folder wouldn't have even existed before.

Aron 2021-05-04T05:33:15.063600Z

@raspasov please do not misrepresent what I am saying, nothing 'perfect' or 'linux administration'

FHE 2021-05-04T05:33:24.064Z

Would really hope I wouldn't have to run an installation, have it break on a brand new folder's permissions, need me to fix the permissions somehow, and then run the installation again.

raspasov 2021-05-04T05:33:58.064700Z

@ashnur Apologies.

Aron 2021-05-04T05:33:59.064800Z

you don't have to fix them, just clear up and try again imho

FHE 2021-05-04T05:34:32.065900Z

Not sure what you mean by 'clear up' vs 'fix'.

Aron 2021-05-04T05:34:50.066300Z

no need for apologies, not about my ego, i don't want anyone to waste time, being able to see things that can be trivial to avoid if one is knowledgeable about them is a big help.

👌 1
Aron 2021-05-04T05:35:23.067200Z

@factorhengineering a fix would be to change the permissions of the files. but that requires intimate knowledge of everything you touch

Aron 2021-05-04T05:36:00.068Z

a clear up is when you remove what you recently added and redo the things you did, but with more foresight (or hindsight :D)

Aron 2021-05-04T05:36:38.069Z

presumably avoiding mistakes, because, and I apologize too for the assumption, but you do seem to be rushing into this whole thing 🙂

FHE 2021-05-04T05:37:14.069600Z

So in this case that would be...deleting the folder the installation complained about (and that it added itself) and trying again?

Aron 2021-05-04T05:37:35.070300Z

I could only confirm this if I knew better what you were doing.

FHE 2021-05-04T05:38:29.071200Z

I mean I guess that could work. Even the sudo version needed two tries (with no intervening actions by me in between). Ha ha.

FHE 2021-05-04T05:38:59.072Z

All I'm doing is installing shadow-cljs with the commands above.

Aron 2021-05-04T05:39:24.072700Z

well, try the guide 🙂 that's what worked for me

FHE 2021-05-04T05:40:56.075Z

Updated Windows, installed WSL2, got Ubuntu 20.04 from Windows Store, and just installed Emacs, Doom, Java, and a few of their stated dependencies and maybe a thing or two more. Pretty fresh OS.

FHE 2021-05-04T05:41:15.075400Z

Definitely. Going to the guide next. 🙂

FHE 2021-05-04T05:41:19.075600Z

By the way...

raspasov 2021-05-04T05:41:53.076300Z

@factorhengineering try the steps here in order https://shadow-cljs.github.io/docs/UsersGuide.html#_installation

raspasov 2021-05-04T05:42:20.077Z

I recommend “yarn” but that’s just my experience (more reliable than “npm”)

FHE 2021-05-04T05:42:40.077400Z

Since you're in WSL2 Ubuntu, do you know how to change the font colour the CLI uses for folders and paths (and comments in vim). I'm dying trying to read the horrible dark blue text on a black background.

Aron 2021-05-04T05:42:57.077700Z

ugh

FHE 2021-05-04T05:43:34.078800Z

I tried this, which is supposed to change the actual "blue" and/or "dark blue", but it did not work: https://askubuntu.com/questions/147462/how-can-i-change-the-tty-colors

FHE 2021-05-04T05:44:37.079700Z

I think maybe the reason it didn't work is because the WSL2 Ubuntu 20.04 CLI isn't 'tty' but maybe something else?

Aron 2021-05-04T05:45:36.081100Z

i know what I am doing, but I don't recommend. I start this https://sourceforge.net/projects/vcxsrv/ and use gui, then start https://sw.kovidgoyal.net/kitty/https://sw.kovidgoyal.net/kitty/ and everything looks exactly the same anywhere in kitty because I have the same config copied everywhere

FHE 2021-05-04T05:46:17.082300Z

I have my monitor way brighter than I want it at this time of night and I can still barely read it. I think I'm up for something drastic. HOW can this be the default???

Aron 2021-05-04T05:46:27.082600Z

no one uses the default

Aron 2021-05-04T05:46:32.082800Z

😄

FHE 2021-05-04T05:46:46.083200Z

Ha ha ha. Helpless noobs do! It's a trap!!

Aron 2021-05-04T05:47:26.084400Z

btw, what cli you are using? the new Terminal app?

FHE 2021-05-04T05:47:28.084500Z

I do have vcxsrv set up. That was one of those 'other things' I installed.

FHE 2021-05-04T05:47:46.084900Z

Just whatever CLI you get thrown into when you launch Ubuntu 20.04.

FHE 2021-05-04T05:48:45.086100Z

OH YEAH...and another thing! I have the Terminal app, but it will not serve up WSL2 tabs. I'm almost certain it did right after I installed it, but it just doesn't feel like it anymore.

FHE 2021-05-04T05:50:51.087Z

Solving that might solve the colour issue. With any luck the default CLI colours of WSL2 are sane in Terminal.

FHE 2021-05-04T05:52:15.087900Z

I'm looking at this kitty thing, but I'm sad if I can't just change a pre-existing Ubuntu config file. 😔

FHE 2021-05-04T05:54:32.089700Z

Welp. I just ran Terminal yet again on a whim, and today it does feel like saying Ubuntu-20.04 tabs can exist. All this flakiness... lol

Aron 2021-05-04T05:54:37.090Z

yeah

FHE 2021-05-04T05:54:48.090300Z

The blue in Terminal is much better. Yay!

seancorfield 2021-05-04T06:02:20.092500Z

@factorhengineering As discussed in that thread the other day, the lack of WSL2 distros in Terminal is a known bug but it’s a timing bug: it is most likely to happen if you try to start Terminal either immediately after a reboot, while Windows is still “busy” starting things up, or if you’re system is under heavy load. As noted, I also encountered that bug but only if I try to start Terminal immediately after a reboot.

seancorfield 2021-05-04T06:03:40.093400Z

(and, yeah, I changed the default Terminal color scheme — can’t remember what I changed it to or whether it’s specific to the Insider builds I’m running, just FYI)

FHE 2021-05-04T06:04:05.093500Z

@wilkerlucio @raspasov Thank you both. It almost seems like I might be actually writing code sometime somewhat soon. 🙂

😃 3
FHE 2021-05-04T06:05:36.094700Z

Do you happen to know the name of the default CLI you get if you just run (WSL2) Ubuntu 20.04 (straight from the Start menu, not in Terminal?

FHE 2021-05-04T06:06:56.096200Z

It's great that Terminal is finally working again (after multiple attempts throughout the day yesterday and the day before), but it would be nice to know if I can salvage the readability of the text in the CLI that reliably starts up. Ha ha.

seancorfield 2021-05-04T06:07:28.097100Z

@factorhengineering it’s just a bash shell (running in a regular window).

FHE 2021-05-04T06:07:35.097300Z

That http://askubuntu.com solution I found was for tty (and did not work for me).

seancorfield 2021-05-04T06:08:42.097700Z

(apparently I’m using the Campbell color scheme in Terminal)

FHE 2021-05-04T06:12:31.098800Z

I'm OK with the colour scheme in the Terminal CLI...though the vim comments are the same terrible blue as the default CLI and the vim in that.

seancorfield 2021-05-04T16:10:38.128700Z

In the Settings menu item.

seancorfield 2021-05-04T16:11:14.128900Z

(in Terminal — I do not start Ubuntu directly from the Start Menu and I’ve no idea whether you can control the colors there)

FHE 2021-05-04T21:04:36.135900Z

A colour picker! Yay!

seancorfield 2021-05-04T06:20:50.099700Z

Code looks pretty nice in vim in Terminal with the Campbell color scheme selected, if that helps.

FHE 2021-05-04T06:21:41.099900Z

How do you change the colour scheme?

FHE 2021-05-04T06:21:53.100100Z

If you run Ubuntu 20.04 from the Start menu, what is that CLI called.

FHE 2021-05-04T06:22:30.100800Z

If I knew how to change the colour scheme in Terminal and that fixes the vim in Terminal, as you say, that would be great.

FHE 2021-05-04T06:23:32.102100Z

Greater still would be fixing the colours (really just 'blue' and possibly 'dark blue') in the default CLI that you get when you run from the start menu. I can't do a proper search for how, though, because I don't even know what it's called. 😞

FHE 2021-05-04T06:26:41.104700Z

@ashnur thanks for the help earlier. @seancorfield it's very late again so I'll have to revisit this tomorrow. Thanks to you too! If you or anyone here knows the name of the default WSL2 Ubuntu 20.04 CLI I'll read it tomorrow and scour the net for a way to add some red and green to that blue and make it readable in the CLI and in vim! 🙂

seancorfield 2021-05-04T16:11:48.129100Z

As I said above “it’s just a bash shell (running in a regular window)“.

2021-05-04T08:51:00.107700Z

Can someone help me out please. I have a function

(defn macro-expand-code [code macros]
  (map (partial macro-expand-line macros) code))
macro-expand-line returns either something like: A single string:
"mov :a 2"
Or a list of strings:
("mul :a :a" "mul  :b  :b" "add :a  :b")
So I end up with
'("mov :a 2" "mov :b 5" ("mul :a :a" "mul  :b  :b" "add :a  :b") ("add :a 10"))
But I dont want the inner nesting. I thought I could use mapcat rather than map , but then I end up with:
("m" "o" "v" " " ":" "a" " " "2" "m" "o" "v" " " ":" "b" " " "5" "mul :a :a" "mul  :b  :b" "add :a  :b" "add :a 10")
The single strings get expanded out to individual string per character...

2021-05-04T08:51:29.108100Z

Nevrmind, got it! This works

(defn macro-expand-code [code macros]
  (-&gt;&gt; (map (partial macro-expand-line macros) code)
       (flatten)))

Darin Douglass 2021-05-04T10:46:41.113200Z

If you wanted to use mapcat, you would need to make macro-expand-line always return a coll (which I'd recommend over using flatten).

2021-05-04T10:52:27.114800Z

Oh yeah! That works. I just changed macro-expand-line to

(defn macro-expand-line [macros line]
  (let [macro-call (is-macro-call? (keys macros) line)]
    (if macro-call
      (expand line (macros macro-call))
      (list line)))) ; made this a list.
And now this works:
(defn macro-expand-code [code macros]
  (mapcat (partial macro-expand-line macros) code))
Thanks!

2021-05-04T10:53:56.116500Z

I do vaguely remember reading something about avoid flatten if possible

Santiago 2021-05-04T10:54:10.117Z

I’m working more extensively with atoms for the first time. I’m using them as a sort of in-mem database for a prototype to hold a map. I had lots of functions deref ing atoms to get their state. I was doing this at different points in a pipeline but then I thought this is bad because the state could change between steps. Instead, I started doing (let [current-vals @db]) at the very top and then always working with this. Now, is current-vals in this example still blocking db , or did it make a copy (a snapshot if you will) and moved on so that other threads can continue reading and writing to db ?

Darin Douglass 2021-05-04T11:01:55.119900Z

Ya I’m almost all situations you don’t need flatten. I think the biggest problem is it delazies everything you give it, where mapcat won’t. In your situation mapcat works better IMO because it necessitates getting rid of a bug/unexpected behavior caused macro-expand-line not returning the same type all the time.

NoahTheDuke 2021-05-04T11:38:23.121300Z

A copy. Deref ing an atom gets the persistent data structure contained inside

👍 1
Santiago 2021-05-05T07:21:15.150400Z

hehe be pedant away @chepprey 😄 thanks! I

🤓 1
yiorgos 2021-05-04T11:52:56.122300Z

Is it possible to install Java libraries from https://mvnrepository.com using tools-deps ?

2021-05-04T11:54:41.122900Z

what do you mean under “install”?

yiorgos 2021-05-04T11:55:23.123100Z

for example, I would like to use this library https://mvnrepository.com/artifact/org.geotools/gt-swing in my Clojure project

2021-05-04T11:55:43.123300Z

normally you don’t need to “install” a library. The way to start using it is to describe that you need it in some form (normally dictated by you build tool)

yiorgos 2021-05-04T11:56:12.123500Z

If I add this line under the deps alias org.geotools/gt-swing {:mvn/version "25.0"}

yiorgos 2021-05-04T11:56:23.123700Z

I am getting this error Error building classpath. Could not find artifact org.geotools:gt-shapefile:jar:25.0 in central (<https://repo1.maven.org/maven2/>)

yiorgos 2021-05-04T11:57:20.124Z

so next step is to add :mvn/repos {"mvn" {:url "<https://mvnrepository.com>"}}

2021-05-04T11:57:28.124200Z

org.geotools:gt-shapefile this artifact is not a part of maven central, I think

yiorgos 2021-05-04T11:57:36.124400Z

but I get a 403

2021-05-04T11:58:03.124800Z

there is a Note

2021-05-04T11:58:36.125200Z

so you need to add that repository instead of http://mvnrepositories.com

yiorgos 2021-05-04T11:58:55.125400Z

where did you see that note 🙂

2021-05-04T11:59:28.125800Z

I clicked on a version

yiorgos 2021-05-04T11:59:47.126Z

oh ,I see

yiorgos 2021-05-04T12:00:06.126400Z

super! thank you very much!!!

Endre Bakken Stovner 2021-05-04T15:50:17.127900Z

Does anybody want to take a stab at guessing what https://gist.github.com/endrebak/ac84a7a8a44e57bd7f14d0251a688e64 might be due to?

Endre Bakken Stovner 2021-05-04T15:52:13.128500Z

I'm trying to set up a Clojure development on my new M1 Mac. That is the error I get when I try to lein run the code I'm currently working on.

2021-05-04T16:23:43.129300Z

you have a user.clj file that is calling everclear.dag.core/file-to-map which is calling slurp on nil

2021-05-04T16:24:20.129500Z

% clj
Clojure 1.10.2
user=&gt; (slurp nil)
Execution error (IllegalArgumentException) at user/eval1 (REPL:1).
Cannot open &lt;nil&gt; as a Reader.
user=&gt;
%

GGfpc 2021-05-04T18:56:42.130800Z

So I'm having some trouble making an HTTP GET to the IMDB API due to an SSL problem. I have no idea how to fix this, can someone give me a hand?

(let [url "<https://v2.sg.media-imdb.com/suggestion/a/a_vida_e_bela.json>"]
    @(http/get url ))
=&gt;
{:opts {:method :get, :url "<https://v2.sg.media-imdb.com/suggestion/a/a_vida_e_bela.json>"},
 :error #error{:cause "Unrecognized record version (D)TLS-0.0 , plaintext connection?",
               :via [{:type javax.net.ssl.SSLException,
                      :message "Unrecognized record version (D)TLS-0.0 , plaintext connection?",
                      :at [sun.security.ssl.SSLEngineInputRecord bytesInCompletePacket "SSLEngineInputRecord.java" 98]}],
               :trace [[sun.security.ssl.SSLEngineInputRecord bytesInCompletePacket "SSLEngineInputRecord.java" 98]
                       [sun.security.ssl.SSLEngineInputRecord bytesInCompletePacket "SSLEngineInputRecord.java" 64]
                       [sun.security.ssl.SSLEngineImpl readRecord "SSLEngineImpl.java" 605]
                       [sun.security.ssl.SSLEngineImpl unwrap "SSLEngineImpl.java" 499]
                       [sun.security.ssl.SSLEngineImpl unwrap "SSLEngineImpl.java" 475]
                       [javax.net.ssl.SSLEngine unwrap "SSLEngine.java" 634]
                       [org.httpkit.client.HttpsRequest doHandshake "HttpsRequest.java" 98]
                       [org.httpkit.client.HttpClient doRead "HttpClient.java" 193]
                       [org.httpkit.client.HttpClient run "HttpClient.java" 494]
                       [java.lang.Thread run "Thread.java" 830]]}}

borkdude 2021-05-04T18:57:02.131Z

@ggfpc12495 Are you using the SNI client?

borkdude 2021-05-04T18:57:37.131700Z

I think this should be enabled by default, there is an issue for this

Karo 2021-05-04T19:04:32.133100Z

Hello team, it seems that it is not possible to convert string into json if there is a string in the string as shown below, is there any way to convert this string into json?

(json/read-str "{\"testing this \"hhh\" next\" :1,     \"b\" :2}")

dpsutton 2021-05-04T19:08:09.133400Z

(json/generate-string {:key "value contains a \"string\""}) check what valid JSON looks like if it contains a string

👍 1
GGfpc 2021-05-04T19:30:47.133600Z

(alter-var-root #'org.httpkit.client/*default-client* (fn [_] sni-client/default-client))
I have this line in my file, but the result is the same

GGfpc 2021-05-04T19:30:57.133800Z

Should it be somewhere in specific?

borkdude 2021-05-04T19:34:14.134Z

@ggfpc12495 Can you try it with bb maybe?

bb -e '(:body @(org.httpkit.client/get "<https://v2.sg.media-imdb.com/suggestion/a/a_vida_e_bela.json>"))'

borkdude 2021-05-04T19:34:17.134200Z

that works for me

GGfpc 2021-05-04T19:36:56.134400Z

works for me too

GGfpc 2021-05-04T19:36:58.134600Z

that's weird

GGfpc 2021-05-04T19:37:35.134800Z

of figured it out

GGfpc 2021-05-04T19:37:50.135Z

I had a java property that disabled SNI from a previous experiment, so the SNI client wasn't doing anything

GGfpc 2021-05-04T19:37:54.135200Z

Thanks!

borkdude 2021-05-04T19:46:44.135400Z

:thumbsup:

chepprey 2021-05-04T23:05:15.136100Z

(To be a bit pedantic for beginners) you don't get a copy because no copy is created. Deref ing an atom gives you whatever immutable value is referenced by the atom at that time.

chepprey 2021-05-04T23:06:47.136300Z

( @slack.jcpsantiago )