abmclin
2020-8-18 14:02:37

It’s worth checking to make sure the server software handling the http requests isn’t truncating the POSTed payload if its size exceeds a limit.

PHP for example will truncate if the data exceeds a limit of 8MB in its default config.

This may explain the errors you’re seeing.


skyler.griffith
2020-8-18 16:31:36

mornin yall, I’m still quite new to this language and am trying to do something along the lines of if(condition) { return; }


skyler.griffith
2020-8-18 16:32:08

always forget you have to shift enter in slack sorry


laurent.orseau
2020-8-18 16:33:43

The return should jump out of the function?


skyler.griffith
2020-8-18 16:33:55

correct


skyler.griffith
2020-8-18 16:34:23

looking through the docs I couldn’t immidiately find anything that did that


samth
2020-8-18 16:35:18

@jestarray you can use a different (and thus fewer-dependency) image manipulation library (perhaps pict or racket/draw). However, the executable is likely to be relatively large regardless of what you do.


laurent.orseau
2020-8-18 16:35:25

The the way I write it myself is with let/ec: #lang racket (define (foo x) (let/ec abort (for/last ([n (in-range 10)]) (if (= x n) (abort n) n)))) (foo 3) ; -> 3 (foo 100) ; -> 9


samth
2020-8-18 16:36:20

Yes, that’s reasonable. Unfortunately that longer-term might be quite long.


laurent.orseau
2020-8-18 16:36:29

But most of the time you can write your program to avoid let/ec and just pass values around and return the value at the end


laurent.orseau
2020-8-18 16:37:29

If you’re new, I’d advise against let/ec


skyler.griffith
2020-8-18 16:38:47

Alright thank you, that helps


jestarray
2020-8-18 16:56:19

@samth regardless of what I do?! why is it so large..


samth
2020-8-18 16:57:26

It includes the full racket executable and associated shared libraries (such as pango and cairo for graphics), as well as the compiled code for all the Racket libraries you use.


jestarray
2020-8-18 17:20:22

checked the lib folder and one of the linked ones is openssl … libeay32.dll, how do i know what dependencies link to what dll ?


jestarray
2020-8-18 18:22:21

how do i run racket file wtih cli arguments in drracket? Language -> Choose Language -> Command-line arguments as a vector of strings, in read syntax doesn’t save and work


spdegabrielle
2020-8-18 18:23:21

I did that this morning


spdegabrielle
2020-8-18 18:25:15

(require racket/cmdline) (define who (box "world")) (command-line #:program "my-program" #:once-each [("-n" "--name") name "Who to say hello to" (set-box! who name)] #:args () (printf "hello ~a~n" (unbox who)))


spdegabrielle
2020-8-18 18:26:01

spdegabrielle
2020-8-18 18:26:49

gets me Welcome to DrRacket, version 7.8 [cs]. Language: racket/base, with debugging [custom]; memory limit: 128 MB. hello Stephen


jestarray
2020-8-18 18:27:49

ohhh, youre supposed to tick “Always use the same #lang line” ?


spdegabrielle
2020-8-18 18:28:54

I dotn think that has an impact. it just prepopulates when oyu do file new


soegaard2
2020-8-18 18:29:14

Yeah, the vector field is the important one.


jestarray
2020-8-18 18:29:22

huh… welp, i had no idea what was going on then… it works now


jestarray
2020-8-18 18:29:35

but tried 5 times populating the vector field and it kept resetting


jestarray
2020-8-18 18:29:41

now it doesnt …


spdegabrielle
2020-8-18 18:30:53

That is weird> can you make it do it again? What did you change?

BTW this example gets created when you type raco pkg new


sorawee
2020-8-18 18:33:13

@jestarray: you may be interested in https://docs.racket-lang.org/drracket-cmdline-args/


jestarray
2020-8-18 18:34:24

ahh, #("D:\Programs\TOOLS\base.png") kept resetting it.. i had to escape the backslashes


samdphillips
2020-8-18 18:36:19

Is it a bug that an improper value in that field doesn’t make an error dialog?


jestarray
2020-8-18 18:37:03

seems so, it just kept resetting it silently and i had no idea why lol…


sorawee
2020-8-18 18:39:17

FWIW, in drracket-cmdline-args, any error will be reported immediately via the background color


jestarray
2020-8-18 18:41:01

(define optimize-level (make-parameter 0)) (define file-to-compile (command-line #:once-any [("-o" "--optimize-1") "Compile with optimization level 1" (optimize-level 1)] ["--optimize-2" (; show help on separate lines "Compile with optimization level 2," "which includes all of level 1") (optimize-level 2)] ) ; this here is never 2 even if I run the cli with --optimize-2 (cond ([(= (optimize-level) 2) (print "opt at level 2"])) when i run my cli with --optimize-2 , and check optimize-level with the cond below later, the optimize-level is still 0.. how do i fix this?


sorawee
2020-8-18 18:43:14

After fixing paren mismatch in the above code, it seems to work fine?


sorawee
2020-8-18 18:43:15

#lang racket/base (require racket/cmdline) (define optimize-level (make-parameter 0)) (define file-to-compile (command-line #:once-any [("-o" "--optimize-1") "Compile with optimization level 1" (optimize-level 1)] ["--optimize-2" (; show help on separate lines "Compile with optimization level 2," "which includes all of level 1") (optimize-level 2)] )) ; this here is never 2 even if I run the cli with --optimize-2 (cond [(= (optimize-level) 2) (print "opt at level 2")])


sorawee
2020-8-18 18:43:30

prints "opt at level 2" when (current-command-line-arguments) is #("--optimize-2")


samdphillips
2020-8-18 18:46:04

Nice!


jestarray
2020-8-18 18:51:25

ahhh, flags have to go first before args


samdphillips
2020-8-18 18:53:27

jestarray
2020-8-18 19:06:50

[("-l" "--link-flags") lf ; flag takes one argument "Add a flag <lf> for the linker" (link-flags (cons lf (link-flags)))] so this only takes 1 argument , e.g cli.exe -l "one" "two" , “two” will be ignored. How do i make it so it takes an N number of arguments?


soegaard2
2020-8-18 19:08:57

They are in the same order as you normally pass them at the command line.


sorawee
2020-8-18 19:10:00

[("-l" "--link-flags") lf lf2 ; flag takes two arguments "Add a flag <lf> for the linker" (link-flags (cons lf (link-flags)))] I think?



soegaard2
2020-8-18 19:10:31

(recently featured on https://racket-stories.com )


soegaard2
2020-8-18 19:12:42

For an answer to the “n arguments” look at #:args.


jestarray
2020-8-18 19:13:21

how do i expand it infinitely though? because i don’t know the size of -l


sorawee
2020-8-18 19:15:14

That doesn’t make sense: it would make parsing ambiguous.


jestarray
2020-8-18 19:15:54

ahhh ok


spdegabrielle
2020-8-18 19:16:04

@sorawee great plugin!


sorawee
2020-8-18 19:16:04

Consider having a flag taking arbitrary number of arguments, and also having #:args, then how do you know which one should be in args and which one should be in flag?


sorawee
2020-8-18 19:17:10

So if you truly want to take arbitrary number of arguments, use #:args for that.


soegaard2
2020-8-18 19:17:52

If I remember correctly, commands like gcc (the C compiler) also requires the user to write -l before each lib.


jestarray
2020-8-18 21:30:37

welp, if anyone knows a significantly lighter 2htdp/image for cropping pngs, ping me


laurent.orseau
2020-8-18 21:36:37

(system* "convert" ...) ? ;)


alexharsanyi
2020-8-18 22:24:08

may I ask why is this important? 34Mb is not that big when looking at the disk sizes, and also it can be downloaded quickly over pretty much any Internet connection…

Anyway, if you are looking for the smallest possible executable, you will need to write a C program that uses libpng directly. Sure, this is more complex that the Racket solution, but it will definitely be very small.

Also consider this: • your program is 34 Mb • shipping it as a script and telling your users to install Racket will use 469Mb • telling your users to install ImageMagick and giving them a batch script to crop images would tale 100Mb.


spdegabrielle
2020-8-18 22:56:58

I got jealous that dot net has dotnet new with lots of templates so I made a GitHub template for a cli command https://github.com/spdegabrielle/cli-command\|https://github.com/spdegabrielle/cli-command

If you have an idea for a template you should make one!


spdegabrielle
2020-8-18 23:06:22

After ignoring google groups for years google has just https://support.google.com/groups/answer/9718200?hl=en\|deprecated the ability to post from a mobile device :face_with_symbols_on_mouth:


spdegabrielle
2020-8-18 23:09:50

> Allowing user who aren’t signed in to a Google Account to view Groups > s planned for deprecation :face_with_symbols_on_mouth:


jestarray
2020-8-18 23:20:16

interesting! I didn’t know how it compares to other solutions


jestarray
2020-8-18 23:20:52

and no reason other than it just “feels wrong” to force my users to download a 34MB file that just crops and sorts sprite sheets in a particular way


jestarray
2020-8-18 23:22:20

not used to big executable sizes coming from buliding stuff in rust


jestarray
2020-8-18 23:26:08

we could jump racket discussions from google groups to discourse https://www.discourse.org/ ! I’m unsure who of the racket team can claim it but they give out free instances to open source projects with more than 10 contributors https://blog.discourse.org/2018/11/free-hosting-for-open-source-v2/


jestarray
2020-8-18 23:26:47

google groups is a sloggy experience on both desktop and mobile in my experience …


sorawee
2020-8-18 23:34:28

Oooh. I am not aware of this v2 plan. And I really like discourse.


jestarray
2020-8-18 23:42:55

https://free.discourse.group/ , still available! whoever is incharge of the mailing list and stuff please consider applying!


spdegabrielle
2020-8-19 00:06:01

Intersting: • it can be used as a web forum or a mailing list • Local logins are the default (some racketeers are uncomfortable with google login etc.) • social logins (google, github, etc.) can be enabled • not a walled garden - can be searched even shows up on wayback https://web.archive.org/web/20200218120823/https://meta.discourse.org/t/importing-mailing-lists-mbox-listserv-google-groups-emails/79773


spdegabrielle
2020-8-19 00:20:37

Mailing list functionality varied reports - on a wikipmedia page from 2018 indicated it was less than good.


wanpeebaw
2020-8-19 02:28:28

Can you provide more context of the origin problem?


bensisva
2020-8-19 05:31:30

@bensisva has joined the channel


laurent.orseau
2020-8-19 06:29:49

All this would be solved if racket was (assumed to he) installed by default like python