
AFAICT GraphQL is actually mostly used to replace resource-oriented (REST-ish) web APIs. Those classic APIs are harder to change casually. Which is great for 3rd party users of the API. But annoying for an in-house team using the API, to make a web or native app.

So maybe GraphQL is a query language. But I am less interested in whether it is mammal or reptile, than the fact it is pooping on my lawn and should get off it. :grin:

I feel like I’ve asked this question before, but: what is the right way to check if a module exists, given a module path? I thought maybe (module-declared? mod-path #t)
was what I was looking for, but that still throws an exception if the module does not exist (and passing #f
for the second argument will return #f
even if the module exists but has not been loaded). Am I supposed to just catch the exception?

There’s not really a way to ask “would this module exist if I tried to load it?” and I don’t know if a better approach than catching the exception.

Is there some fundamental reason for that? Which is to say, is there some reason that checking for such a thing is considered a bad idea? Or should I just embrace calling (current-module-name-resolver)
and catching the exception?

For a little bit of context, I’m writing a function that checks if a submodule exists and loads it if it does, but I want to raise an error (in terms of my function, not the module name resolver) if the base module does not exist.

There are some minor problems with the idea of checking. For example, does a module exists or not if it would be loaded from a particular file, but you don’t have read permissions on the file? Do you care what happens if a file that would implement the module disappears between the time that you check? A module name resolver might take other steps that complicate the question. As a practical matter, the real issue is that the ability to check for a module isn’t part of the API for a module name resolver.

Yes, that makes sense… the race condition certainly came to mind, though the issue of permissions didn’t. Submodules are clearly different, though, in that module-declared?
doesn’t complain if the submodule doesn’t exist, which I guess is what allows things like configure-runtime
and reader
submodules to work? My pattern is similar—if a submodule exists, I want to use it, but if it doesn’t, it isn’t an error—but since the user provides the parent module path and I look up the submodule (and the parent module really does need to exist for this operation to even make any sense), I figured it would be a simple nicety to provide the extra check that the parent module exists in case something else went wrong. I don’t think that check can really hurt here, but maybe it’d be best to attempt to load the parent module but not bother with catching the exception, and I should just let the module name resolver do the error reporting.

Sounds right. As for submodules, there’s a delicate balance that we were able to retrofit into the handlers that makes checking for a submodule possible — but only just.

Huh, that sounds really similar to how URL fragments work

@a.nastaev has joined the channel

Hi guys! I have a question here: Is there a way to make DrRacket code work with git? I mean, I can push everything to the repo, but the way it appears in github is absolutely bizarre. It is not possible to read the code itself. I’ve google it but didn’t find anything helpful. I would appreciate any possible help! Thank you in advance!

@a.nastaev Does your program contain an image?

Yes! I’m following HTDP2 and would love to keep everything on github.

Programs without images directly inserted in the program looks normal.

The solution to your problem must be to save the image next to your rkt-file.

Then use load- ... something ...
to load the image.

I think you want to use, say, (bitmap/file "an image.png")
to load your image.

I’m here following you. Thanks! Did I understand correctly, that without an image I can push any somename.rkt
file to github as I can do it for example with .js
file?

yes

Note that even when the source contains an image you can still push it to Github - but you can’t read the source on Github.

Hmmm… ?! Even without an image, the code appears on github very strangely, means I can’t read it at all

Thanks again for your help!

@a.nastaev It might be that the source file used to contain an image.

I am not sure of the details, but it could be DrRacket switches mode when the first image is inserted.

Try with a brand new file.

Ok! Thanks a lot! Let me try it one more time and I will get back to you if you don’t mind! Thanks again! Appreciate it!

Well, somehow it is not working…


that is my original file

and that is how it appears on github:


The comment box has the same effect. If the source file contains nothing but text, it ought to work.

As you see I don’t have any pictures in my file

Yes. Now the issue is the comment box.

If you use standard comments it works.

you mean this way? :


yes

Ok! Thanks again! Let me try it one more time :slightly_smiling_face:

Also you can test it by opening the rkt file in an text editor on your own computer (it’s not neccessary to upload to Github)

@greg in frog is there a way to access a list of all the available pages to build the index or these need to be hardcoded?

also, is there any magic incantation to get an index.html
generated? I get it to generate my pages, but not an index.html
.

Do you have an index-template.html ?

And are you using raco frog -b
?

yes, I copied post-template.html to index-template.html just for testing.

raco frog -b
not working…

hmm

was actually hoping verbose mode would work but with raco frog -bV
I get: raco frog -bV
Frog 0.29
Very verbose mode

:slightly_smiling_face:

!

… not that verbose.

my pages are generates but index is not. I have no posts…

could it be the lack of posts…let me check.

shame… not that.

Well the verbosity is mostly per blog post because that is mostly what a static blog generator generates :stuck_out_tongue:

ah… explains lack of verbosity.

I have to go AFK in a minute but I will try to look at this with zero blog posts and see if I can repro what you’re seeing.

i added a blog post… draft. still no index.

Was this a fresh raco frog --init
, or something you had from before?

ah, yes…

yes…

that was from a fresh raco frog --init
.

index is not generated if there are no posts.

or if the post is draft.

as soon as i added a non-draft post, it worked.

i guess you policy was… this is for blogs, no posts => no blog => deserved no index. :slightly_smiling_face:

Oh. Right. The draft thing means, don’t generate at all. Sorry that was confusing.

so, to explain. i started a new frog blog. removed example post, copied post-template to index-template and removed footer. added page. no index generated. added post using -N
, no index generated. Removed draft tag from dummy post. It worked!

Frog started as a blog generator that was supposed to be “just works”, Model T, any color so long as the color is black. It’s gotten more configurable over time, but the happy path is definitely a blog. Not a general static site generator.

Yikes, my phone just did a really loud emergency alert about snow squalls coming there. Startled me.

sure… will move my no posts config to a all posts, no pages config. :slightly_smiling_face:

huh, careful with the snow. us storms are all over the news here in germany.

thanks @greg, time to snooze around here. will take a look at this tomorrow and change the configuration of my frog to have posts instead of pages.

It’s been crazy cold out in the U.S. mid-West like Chicago and Minneapolis, –30 F wind chill, etc. Some of that headed to Boston now but not quite as bad.

@pocmatos Sounds good. Good night.

Yikes –34ºC !

yeah it was –6 F here today without wind chill

let’s all stay inside and write code.