[racket-users] custom input ports and specials

2021-04-12 Thread je...@lisp.sh
I'm implementing a tokenizer as a custom input port using 
`make-input-port`. My thinking is that `peek-char-or-special` and 
`read-char-or-special` will be the primary interface to the tokenizer; port 
locations will also be used. In this case, the input port should emitting 
characters as well as special values. It's not just bytes/characters.

Here's a simplified form of what I'm trying to accomplish. Imagine a 
language consisting of sequences (possibly empty) of ASCII letters 
(lowercase and uppercase). If you see a non-X (capital X), just emit that. 
(When I say "emit", what I mean is "value that should be returned by 
`peek-char-or-special` and `read-char-or-special`.) If you see an X and 
it's the last character of the input, emit #\X. If you see a capital X 
followed by any character, emit that character as a symbol. That's the 
special value. Thus:

  a b c ==> a b c

  X ==> X

  a X b ==> a 'b

I realize that this example could easily be done with regular expressions 
or just straightforward processing of byte strings using `port->bytes`. But 
I'd like to attack this problem using custom input ports. It feels like the 
right thing to do. With a custom input port, I can even do validation by 
logging errors. For example, if I'm given a byte that represents a 
non-ASCII letter, I can log an error and advance the port by one byte and 
try again.

I find the documentation for `make-input-port` rather heavy going. There 
are some examples there, which are a good start, but I'm still a bit lost. 
In the discussion of the peek and read procedures that are supplied as 
arguments to `make-input-port` (see `peek!` and `read!` below), I don't 
understand the byte strings that are being passed. It seems that this 
procedures are always given a mutable byte string, and the examples in the 
docs suggest that the byte string could/should indeed be modified. But in 
the input I have in mind, where peek and read might emit specials, it's 
unclear to me what I should stuff into the byte string. For example, if I'm 
peeking `Xm` (capital X and lowercase m), that should eventually get turned 
into `'m` (symbol whose name is "m"), so in my thinking, I'm looking at two 
bytes, not 1. But it seems that the peek and read procedures are always (?) 
given a byte string of length 1.

Anyway, this is perhaps all a long way of saying that I'm rather lost with 
my custom input port approach to the issue. Any advice would be 
appreciated. Maybe custom input ports are not the way to go about what I'm 
doing, but I'm not ready to abandon them just yet. Below you can read (ha!) 
the current status of where I am with this project.

Jesse


#lang racket/base

(require racket/match
 racket/format
 racket/port)

; Input strings are intended to be sequences of ASCII letters,
; uppercase and lowercase. Capital X followed by another letter
; should get turned into a symbol whose name is the one-character
; string consisting of that letter.
(define (make-cool-port in)
  (define (peek! bstr skip event)
(sleep 1)
(define bs (peek-bytes 2 skip in))
(cond [(eof-object? bs)
   eof]
  [else
   (match (bytes->list bs)
 [(list 88 a) ; 88 = X
  (lambda args 2)]
 [_ 1])]))
  (define (read! bstr)
(define peeked (peek! bstr 0 #f))
(cond [(eof-object? peeked)
   eof]
  [(procedure? peeked)
   (define bs (bytes->list (read-bytes (peeked) in)))
   (define a (cadr bs))
   (lambda args (string->symbol (~a (integer->char a]
  [else
   (read-byte in)
   peeked]))
  (make-input-port
   'xs
   read!
   peek!
   (lambda () (close-input-port

(define (read-it-all)
  (define t (peek-char-or-special))
  (log-error "peeked ~a" t)
  (unless (eof-object? t)
(read-char-or-special)
(read-it-all)))

(module+ main
  (call-with-input-string
   "Xaw"
   (lambda (in)
 (define p (make-cool-port in))
 (parameterize ([current-input-port p])
   (read-it-all)


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/a26f3849-5bec-4d41-bfb9-0f1127e8748cn%40googlegroups.com.


Re: [racket-users] Polished 3D package for some simulations

2021-04-12 Thread Stephen Foster
Hehe.  Yeah, we were discussing resyntax.

On Mon, Apr 12, 2021, 11:01 AM Dominik Pantůček <
dominik.pantu...@trustica.cz wrote:

> One clicks on your Twitch and the first thing coming from the speakers
> is "Do you remember Jack? Jack Firth?"
>
> Everyone does, of course ;-)
>
> On 12. 04. 21 17:31, Stephen Foster wrote:
> > In the CodeSpells project, we are using Racket + Unreal Engine.  This
> > combo would be my recommendation for doing "3D stuff" and also anything
> > with physics.  As you can see from the first few seconds of this video,
> > we are spawning in Twitch users as 3D physical objects:
> >
> > https://www.youtube.com/watch?v=wq8aau-fHbs
> >
> > On Monday, April 12, 2021 at 4:46:56 AM UTC-7 hen...@topoi.pooq.com
> wrote:
> >
> > On Sun, Apr 11, 2021 at 09:25:48PM -0500, Nathaniel W Griswold wrote:
> > > Thanks all, i’m just going to see if Pict3D works out. I didn’t
> > know about it before. I don’t really need textures for this project
> > as i am starting with just particles moving around and wave
> > superposition.
> >
> > It might work for you then. It didn't for me. And I spent a while
> > trying to
> > figure out how to attach textures, but the internals of Pict3d were
> too
> > much for me. Not enough internal documentation. It was easier to use
> > sgl
> > directly, but I may someday have to go to serious solid modelling.
> >
> > -- hendrik
> >
> > >
> > > Nate
> > >
> > > > On Apr 8, 2021, at 2:59 PM, Hendrik Boom 
> > wrote:
> > > >
> > > > On Thu, Apr 08, 2021 at 11:22:10AM -0700, kamist...@gmail.com
> > wrote:
> > > >> Have you tried out Pict3D [1]?
> > > >
> > > > Two significant flaws with Pict3D:
> > > >
> > > > * It does not have a mechanism for attaching a texture to an
> > object.
> > > >
> > > > * It does not allow one to cut one #D object out of another.
> > > > (such as using a cylinder to drill a round hole in a block of
> wood)
> > > >
> > > > Otherwise it's an impressive peve of work.
> > > >
> > > >> There is also a library from Matthew Flatt that can create 3D
> > Text /
> > > >> extruded pathes: [2]
> > > >>
> > > >> Personally I currently use opengl [3], these bindings support
> > higher opengl
> > > >> versions than the [4]
> > > >> (which only support opengl 1.5 according to its documentation)
> > > >>
> > > >> I can't say exactly up to which opengl version [3] has working
> > bindings,
> > > >> these bindings were automatically generated, but that stopped
> > working at
> > > >> some point.
> > > >> (Apparantly the input that was used for the generation isn't
> > provided for
> > > >> recent opengl versions anymore, so the generator has to be
> > fixed or
> > > >> replaced to work with a different input/description)
> > > >
> > > > Exactly. I've been struggling with this last year, and I sort of
> > gave up.
> > > > I'm thinking of looking at it again.
> > > >
> > > > What happened to the spec is that the entire thing has been
> > recoded from a
> > > > completely ad-hoc formalism to a slightly less ad-hoc XML-based
> > formalism.
> > > > Everything is different. And the new one is somewhat
> > inconsistent about
> > > > the placement of asterisks in the XML phrases that form function
> > prototypes.
> > > >
> > > > I've been using sgl for my own work. I suspect it to be largely
> > > > hand-coded, but it seems to work.
> > > >
> > > > There's also a binding for Vulkan, which I don't think has been
> > used vary
> > > > much, and so may still pose surprises.
> > > >
> > > > https://docs.racket-lang.org/vulkan/index.html
> > 
> > > >
> > > > I don't know how well any of this works on a Mac, which I gather
> > is going
> > > > its own way for graphics, perhaps in the cause of
> incompatibility.
> > > >
> > > > -- hendrik
> > > >
> > > >>
> > > >> [1] https://docs.racket-lang.org/pict3d/index.html
> > 
> > > >> [2] https://docs.racket-lang.org/pict3d-die-cut/index.html
> > 
> > > >> [3] https://docs.racket-lang.org/opengl/index.html
> > 
> > > >> [4]
> > > >>
> >
> https://docs.racket-lang.org/sgl/index.html?q=opengl#%28idx._%28gentag._0._%28lib._sgl%2Fscribblings%2Fsgl..scrbl%29%29%29
> > <
> https://docs.racket-lang.org/sgl/index.html?q=opengl#%28idx._%28gentag._0._%28lib._sgl%2Fscribblings%2Fsgl..scrbl%29%29%29
> >
> >
> > > >>
> > > >> --
> > > >> You received this message because you are subscribed to the
> > Google Groups "Racket Users" group.
> > > >> To unsubscribe from this group a

Re: [racket-users] Polished 3D package for some simulations

2021-04-12 Thread Dominik Pantůček
One clicks on your Twitch and the first thing coming from the speakers
is "Do you remember Jack? Jack Firth?"

Everyone does, of course ;-)

On 12. 04. 21 17:31, Stephen Foster wrote:
> In the CodeSpells project, we are using Racket + Unreal Engine.  This
> combo would be my recommendation for doing "3D stuff" and also anything
> with physics.  As you can see from the first few seconds of this video,
> we are spawning in Twitch users as 3D physical objects:
> 
> https://www.youtube.com/watch?v=wq8aau-fHbs
> 
> On Monday, April 12, 2021 at 4:46:56 AM UTC-7 hen...@topoi.pooq.com wrote:
> 
> On Sun, Apr 11, 2021 at 09:25:48PM -0500, Nathaniel W Griswold wrote:
> > Thanks all, i’m just going to see if Pict3D works out. I didn’t
> know about it before. I don’t really need textures for this project
> as i am starting with just particles moving around and wave
> superposition.
> 
> It might work for you then. It didn't for me. And I spent a while
> trying to
> figure out how to attach textures, but the internals of Pict3d were too
> much for me. Not enough internal documentation. It was easier to use
> sgl
> directly, but I may someday have to go to serious solid modelling.
> 
> -- hendrik
> 
> >
> > Nate
> >
> > > On Apr 8, 2021, at 2:59 PM, Hendrik Boom 
> wrote:
> > >
> > > On Thu, Apr 08, 2021 at 11:22:10AM -0700, kamist...@gmail.com
> wrote:
> > >> Have you tried out Pict3D [1]?
> > >
> > > Two significant flaws with Pict3D:
> > >
> > > * It does not have a mechanism for attaching a texture to an
> object.
> > >
> > > * It does not allow one to cut one #D object out of another.
> > > (such as using a cylinder to drill a round hole in a block of wood)
> > >
> > > Otherwise it's an impressive peve of work.
> > >
> > >> There is also a library from Matthew Flatt that can create 3D
> Text /
> > >> extruded pathes: [2]
> > >>
> > >> Personally I currently use opengl [3], these bindings support
> higher opengl
> > >> versions than the [4]
> > >> (which only support opengl 1.5 according to its documentation)
> > >>
> > >> I can't say exactly up to which opengl version [3] has working
> bindings,
> > >> these bindings were automatically generated, but that stopped
> working at
> > >> some point.
> > >> (Apparantly the input that was used for the generation isn't
> provided for
> > >> recent opengl versions anymore, so the generator has to be
> fixed or
> > >> replaced to work with a different input/description)
> > >
> > > Exactly. I've been struggling with this last year, and I sort of
> gave up.
> > > I'm thinking of looking at it again.
> > >
> > > What happened to the spec is that the entire thing has been
> recoded from a
> > > completely ad-hoc formalism to a slightly less ad-hoc XML-based
> formalism.
> > > Everything is different. And the new one is somewhat
> inconsistent about
> > > the placement of asterisks in the XML phrases that form function
> prototypes.
> > >
> > > I've been using sgl for my own work. I suspect it to be largely
> > > hand-coded, but it seems to work.
> > >
> > > There's also a binding for Vulkan, which I don't think has been
> used vary
> > > much, and so may still pose surprises.
> > >
> > > https://docs.racket-lang.org/vulkan/index.html
> 
> > >
> > > I don't know how well any of this works on a Mac, which I gather
> is going
> > > its own way for graphics, perhaps in the cause of incompatibility.
> > >
> > > -- hendrik
> > >
> > >>
> > >> [1] https://docs.racket-lang.org/pict3d/index.html
> 
> > >> [2] https://docs.racket-lang.org/pict3d-die-cut/index.html
> 
> > >> [3] https://docs.racket-lang.org/opengl/index.html
> 
> > >> [4]
> > >>
> 
> https://docs.racket-lang.org/sgl/index.html?q=opengl#%28idx._%28gentag._0._%28lib._sgl%2Fscribblings%2Fsgl..scrbl%29%29%29
> 
> 
> 
> > >>
> > >> --
> > >> You received this message because you are subscribed to the
> Google Groups "Racket Users" group.
> > >> To unsubscribe from this group and stop receiving emails from
> it, send an email to racket-users...@googlegroups.com.
> > >> To view this discussion on the web visit
> 
> https://groups.google.com/d/msgid/racket-users/67072c79-aac7-40a1-8774-2d684c7476d1n%40googlegroups.com
> 
> 

Re: [racket-users] Polished 3D package for some simulations

2021-04-12 Thread Stephen Foster
In the CodeSpells project, we are using Racket + Unreal Engine.  This combo 
would be my recommendation for doing "3D stuff" and also anything with 
physics.  As you can see from the first few seconds of this video, we are 
spawning in Twitch users as 3D physical objects:

https://www.youtube.com/watch?v=wq8aau-fHbs

On Monday, April 12, 2021 at 4:46:56 AM UTC-7 hen...@topoi.pooq.com wrote:

> On Sun, Apr 11, 2021 at 09:25:48PM -0500, Nathaniel W Griswold wrote:
> > Thanks all, i’m just going to see if Pict3D works out. I didn’t know 
> about it before. I don’t really need textures for this project as i am 
> starting with just particles moving around and wave superposition.
>
> It might work for you then. It didn't for me. And I spent a while trying 
> to 
> figure out how to attach textures, but the internals of Pict3d were too 
> much for me. Not enough internal documentation. It was easier to use sgl 
> directly, but I may someday have to go to serious solid modelling.
>
> -- hendrik
>
> > 
> > Nate
> > 
> > > On Apr 8, 2021, at 2:59 PM, Hendrik Boom  
> wrote:
> > > 
> > > On Thu, Apr 08, 2021 at 11:22:10AM -0700, kamist...@gmail.com wrote:
> > >> Have you tried out Pict3D [1]?
> > > 
> > > Two significant flaws with Pict3D:
> > > 
> > > * It does not have a mechanism for attaching a texture to an object.
> > > 
> > > * It does not allow one to cut one #D object out of another.
> > > (such as using a cylinder to drill a round hole in a block of wood)
> > > 
> > > Otherwise it's an impressive peve of work.
> > > 
> > >> There is also a library from Matthew Flatt that can create 3D Text / 
> > >> extruded pathes: [2]
> > >> 
> > >> Personally I currently use opengl [3], these bindings support higher 
> opengl 
> > >> versions than the [4]
> > >> (which only support opengl 1.5 according to its documentation)
> > >> 
> > >> I can't say exactly up to which opengl version [3] has working 
> bindings, 
> > >> these bindings were automatically generated, but that stopped working 
> at 
> > >> some point.
> > >> (Apparantly the input that was used for the generation isn't provided 
> for 
> > >> recent opengl versions anymore, so the generator has to be fixed or 
> > >> replaced to work with a different input/description)
> > > 
> > > Exactly. I've been struggling with this last year, and I sort of gave 
> up.
> > > I'm thinking of looking at it again.
> > > 
> > > What happened to the spec is that the entire thing has been recoded 
> from a 
> > > completely ad-hoc formalism to a slightly less ad-hoc XML-based 
> formalism.
> > > Everything is different. And the new one is somewhat inconsistent 
> about 
> > > the placement of asterisks in the XML phrases that form function 
> prototypes.
> > > 
> > > I've been using sgl for my own work. I suspect it to be largely 
> > > hand-coded, but it seems to work.
> > > 
> > > There's also a binding for Vulkan, which I don't think has been used 
> vary 
> > > much, and so may still pose surprises.
> > > 
> > > https://docs.racket-lang.org/vulkan/index.html
> > > 
> > > I don't know how well any of this works on a Mac, which I gather is 
> going 
> > > its own way for graphics, perhaps in the cause of incompatibility.
> > > 
> > > -- hendrik
> > > 
> > >> 
> > >> [1] https://docs.racket-lang.org/pict3d/index.html
> > >> [2] https://docs.racket-lang.org/pict3d-die-cut/index.html
> > >> [3] https://docs.racket-lang.org/opengl/index.html
> > >> [4] 
> > >> 
> https://docs.racket-lang.org/sgl/index.html?q=opengl#%28idx._%28gentag._0._%28lib._sgl%2Fscribblings%2Fsgl..scrbl%29%29%29
> > >> 
> > >> -- 
> > >> You received this message because you are subscribed to the Google 
> Groups "Racket Users" group.
> > >> To unsubscribe from this group and stop receiving emails from it, 
> send an email to racket-users...@googlegroups.com.
> > >> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/67072c79-aac7-40a1-8774-2d684c7476d1n%40googlegroups.com
> .
> > > 
> > > -- 
> > > You received this message because you are subscribed to the Google 
> Groups "Racket Users" group.
> > > To unsubscribe from this group and stop receiving emails from it, send 
> an email to racket-users...@googlegroups.com.
> > > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/racket-users/20210408195922.zdq5ruhr4ufvqgc4%40topoi.pooq.com
> .
> > 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/0d79ce2f-433d-4fff-9e06-8025963fb45fn%40googlegroups.com.


[racket-users] Re: Judgement not holding

2021-04-12 Thread Beatriz Moreira

Thank you, I did just that! :D
4. Checking for membership in an environment sounds like a (very) decidable 
problem. It maybe simpler to just write a judgment form for the positive 
case, and simply defining the negative case as “when the judgment doesn’t 
hold”.

A sexta-feira, 9 de abril de 2021 à(s) 01:20:32 UTC+1, philngu...@gmail.com 
escreveu:

> It’s difficult without seeing the definitions, but here are a few general 
> comments:
>
> 1. Cases in judgment forms are not run in order. If multiple cases match, 
> they’ll all hold. For example, in this case, if (anotin ((a -> b ...)) a 
> #t) holds, (anotin ((a_0 -> b ...)) a #f) will also hold.
>
> 2. If your environment looks something like ((a_1 -> b_1) (a_2 -> b_2) 
> (a_3 -> b_3)), the pattern for the second case should be (_ ... (a -> b) 
> _ ...). The ellipses after b as it currently is means a sequence of zero 
> or more b’s.
>
> 3. The relation is being named “not in”, but it seems like it’s computing 
> both “in” and “not in” cases, which is confusing.
>
> 4. Checking for membership in an environment sounds like a (very) 
> decidable problem. It maybe simpler to just write a judgment form for the 
> positive case, and simply defining the negative case as “when the judgment 
> doesn’t hold”.
>
> On Wednesday, April 7, 2021 at 9:57:15 AM UTC-7 beatriz@gmail.com 
> wrote:
>
>> Hello,
>> I'm trying to write a side condition to a function, where it checks if a 
>> is in an environment ß. I tried this judgement by adding (judgment-holds 
>> (anotin (ß-v ...) a #f)) at the end of the function but it is not 
>> working :(
>> Thank you!
>> --Beatriz
>>
>> (define-judgment-form Flint
>>   #:mode (anotin I I O)
>>   #:contract (anotin env-ß a boolean)
>>   [-
>>(anotin () a #f)]
>>   [-
>>(anotin ((a -> b ...)) a #t)]
>>   [-
>>(anotin ((a_0 -> b ...)) a #f)]
>>   [-
>>(anotin (ß-v_0 ... (a -> b ...)) a #t)]
>>   [(anotin (ß-v ...) a boolean)
>>-
>>(anotin (ß-v ... (a_0 -> b ...) ) a boolean)]
>>   )
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/684893ee-9383-43bf-848a-dd217eb0b405n%40googlegroups.com.


Re: [racket-users] How do I, a client, get a copy of an untrusted server certificate?

2021-04-12 Thread Sage Gerard
Ok, much appreciated. For those reading, I'm pivoting to this phrasing.

--

Could not connect to example.com due to an unverified certificate.

You can address this by downloading the certificate from a source your 
operating system trusts (to mitigate man-in-the-middle attacks), then adding 
the certificate to XIDEN_TRUST_CERTIFICATES. Original exception follows: ...

On 4/12/21 10:43 AM, Ryan Culpepper wrote:

> Yes, that's right.
>
> Ryan
>
> On Mon, Apr 12, 2021 at 4:23 PM Sage Gerard  wrote:
>
>> Understood, thank you. By "trusted location," do you mean a server with a 
>> certificate that operating systems already trust?
>>
>> On 4/12/21 10:15 AM, Ryan Culpepper wrote:
>>
>>> Racket does not provide a way to do that.
>>>
>>> You can use `openssl s_client -showcerts -connect host:port < /dev/null` to 
>>> get the server's certificate chain in PEM form (with other logs around it). 
>>> Of course, an attacker could intercept the connection and send you their CA 
>>> certificate instead. It would be safer if example.com published their 
>>> certificate in a (standardly) trusted location.
>>>
>>> If you do something like this, consider mitigating the danger by having the 
>>> user add the certificate to a separate location managed by your application 
>>> rather than the OS trust store. You can extend the 
>>> `ssl-default-verify-sources` parameter to point to a file containing 
>>> additional root certificates.
>>>
>>> Ryan
>>>
>>> On Mon, Apr 12, 2021 at 3:20 PM Sage Gerard  wrote:
>>>
 When ssl-connect fails due to an untrusted certificate, this error is
 raised:

 ssl-connect: connect failed (error:1416F086:SSL
 routines:tls_process_server_certificate:certificate verify failed)

 I'd like to give the user a more helpful error, like this:

 Could not connect due to an untrusted certificate. In many cases, it is
 not advisable to proceed. However, if you trust the server at
 example.com, add /tmp/example.com.cert to your trusted certificates
 using this guide: 

 How can I get a copy of the offending certificate so that I can do this?

 --
 ~slg

 --
 You received this message because you are subscribed to the Google Groups 
 "Racket Users" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to 
 [racket-users+unsubscr...@googlegroups.com](mailto:racket-users%2bunsubscr...@googlegroups.com).
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/racket-users/8a55256d-71ed-b47f-5b92-c958438c5659%40sagegerard.com.
>>
>> --
>> ~slg
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> [https://groups.google.com/d/msgid/racket-users/8edbd1fd-715d-a730-5659-3731518c5fba%40sagegerard.com](https://groups.google.com/d/msgid/racket-users/8edbd1fd-715d-a730-5659-3731518c5fba%40sagegerard.com?utm_medium=email&utm_source=footer).

--
~slg

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/b2afc3a5-876e-61d8-a475-f078306dfccd%40sagegerard.com.


Re: [racket-users] How do I, a client, get a copy of an untrusted server certificate?

2021-04-12 Thread Ryan Culpepper
Yes, that's right.

Ryan


On Mon, Apr 12, 2021 at 4:23 PM Sage Gerard  wrote:

> Understood, thank you. By "trusted location," do you mean a server with a
> certificate that operating systems already trust?
> On 4/12/21 10:15 AM, Ryan Culpepper wrote:
>
> Racket does not provide a way to do that.
>
> You can use `openssl s_client -showcerts -connect host:port < /dev/null`
> to get the server's certificate chain in PEM form (with other logs around
> it). Of course, an attacker could intercept the connection and send you
> their CA certificate instead. It would be safer if example.com published
> their certificate in a (standardly) trusted location.
>
> If you do something like this, consider mitigating the danger by having
> the user add the certificate to a separate location managed by your
> application rather than the OS trust store. You can extend the
> `ssl-default-verify-sources` parameter to point to a file containing
> additional root certificates.
>
> Ryan
>
>
> On Mon, Apr 12, 2021 at 3:20 PM Sage Gerard  wrote:
>
>> When ssl-connect fails due to an untrusted certificate, this error is
>> raised:
>>
>> ssl-connect: connect failed (error:1416F086:SSL
>> routines:tls_process_server_certificate:certificate verify failed)
>>
>> I'd like to give the user a more helpful error, like this:
>>
>> Could not connect due to an untrusted certificate. In many cases, it is
>> not advisable to proceed. However, if you trust the server at
>> example.com, add /tmp/example.com.cert to your trusted certificates
>> using this guide: 
>>
>> How can I get a copy of the offending certificate so that I can do this?
>>
>> --
>> ~slg
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/racket-users/8a55256d-71ed-b47f-5b92-c958438c5659%40sagegerard.com
>> .
>>
> --
> ~slg
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/8edbd1fd-715d-a730-5659-3731518c5fba%40sagegerard.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CANy33qm0ZGX4MviFJZVq9x8Ax7Cx7yW9nNTZbWu2ha2r72LPRg%40mail.gmail.com.


Re: [racket-users] How do I, a client, get a copy of an untrusted server certificate?

2021-04-12 Thread Sage Gerard
Understood, thank you. By "trusted location," do you mean a server with a 
certificate that operating systems already trust?

On 4/12/21 10:15 AM, Ryan Culpepper wrote:

> Racket does not provide a way to do that.
>
> You can use `openssl s_client -showcerts -connect host:port < /dev/null` to 
> get the server's certificate chain in PEM form (with other logs around it). 
> Of course, an attacker could intercept the connection and send you their CA 
> certificate instead. It would be safer if example.com published their 
> certificate in a (standardly) trusted location.
>
> If you do something like this, consider mitigating the danger by having the 
> user add the certificate to a separate location managed by your application 
> rather than the OS trust store. You can extend the 
> `ssl-default-verify-sources` parameter to point to a file containing 
> additional root certificates.
>
> Ryan
>
> On Mon, Apr 12, 2021 at 3:20 PM Sage Gerard  wrote:
>
>> When ssl-connect fails due to an untrusted certificate, this error is
>> raised:
>>
>> ssl-connect: connect failed (error:1416F086:SSL
>> routines:tls_process_server_certificate:certificate verify failed)
>>
>> I'd like to give the user a more helpful error, like this:
>>
>> Could not connect due to an untrusted certificate. In many cases, it is
>> not advisable to proceed. However, if you trust the server at
>> example.com, add /tmp/example.com.cert to your trusted certificates
>> using this guide: 
>>
>> How can I get a copy of the offending certificate so that I can do this?
>>
>> --
>> ~slg
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to 
>> [racket-users+unsubscr...@googlegroups.com](mailto:racket-users%2bunsubscr...@googlegroups.com).
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/8a55256d-71ed-b47f-5b92-c958438c5659%40sagegerard.com.

--
~slg

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/8edbd1fd-715d-a730-5659-3731518c5fba%40sagegerard.com.


Re: [racket-users] How do I, a client, get a copy of an untrusted server certificate?

2021-04-12 Thread Ryan Culpepper
Racket does not provide a way to do that.

You can use `openssl s_client -showcerts -connect host:port < /dev/null` to
get the server's certificate chain in PEM form (with other logs around it).
Of course, an attacker could intercept the connection and send you their CA
certificate instead. It would be safer if example.com published their
certificate in a (standardly) trusted location.

If you do something like this, consider mitigating the danger by having the
user add the certificate to a separate location managed by your application
rather than the OS trust store. You can extend the
`ssl-default-verify-sources` parameter to point to a file containing
additional root certificates.

Ryan


On Mon, Apr 12, 2021 at 3:20 PM Sage Gerard  wrote:

> When ssl-connect fails due to an untrusted certificate, this error is
> raised:
>
> ssl-connect: connect failed (error:1416F086:SSL
> routines:tls_process_server_certificate:certificate verify failed)
>
> I'd like to give the user a more helpful error, like this:
>
> Could not connect due to an untrusted certificate. In many cases, it is
> not advisable to proceed. However, if you trust the server at
> example.com, add /tmp/example.com.cert to your trusted certificates
> using this guide: 
>
> How can I get a copy of the offending certificate so that I can do this?
>
> --
> ~slg
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/racket-users/8a55256d-71ed-b47f-5b92-c958438c5659%40sagegerard.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/CANy33qnnqy9HFW3UyOZ%3DiqO_Xz%3DSuVJ%2BZ%2Bv_paOFSKD7M%3Dgqpw%40mail.gmail.com.


[racket-users] How do I, a client, get a copy of an untrusted server certificate?

2021-04-12 Thread Sage Gerard
When ssl-connect fails due to an untrusted certificate, this error is
raised:

ssl-connect: connect failed (error:1416F086:SSL
routines:tls_process_server_certificate:certificate verify failed)

I'd like to give the user a more helpful error, like this:

Could not connect due to an untrusted certificate. In many cases, it is
not advisable to proceed. However, if you trust the server at
example.com, add /tmp/example.com.cert to your trusted certificates
using this guide: 

How can I get a copy of the offending certificate so that I can do this?

--
~slg


-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/8a55256d-71ed-b47f-5b92-c958438c5659%40sagegerard.com.


Re: [racket-users] Polished 3D package for some simulations

2021-04-12 Thread Hendrik Boom
On Sun, Apr 11, 2021 at 09:25:48PM -0500, Nathaniel W Griswold wrote:
> Thanks all, i’m just going to see if Pict3D works out. I didn’t know about it 
> before. I don’t really need textures for this project as i am starting with 
> just particles moving around and wave superposition.

It might work for you then.  It didn't for me.  And I spent a while trying to 
figure out how to attach textures, but the internals of Pict3d were too 
much for me.  Not enough internal documentation.  It was easier to use sgl 
directly, but I may someday have to go to serious solid modelling.

-- hendrik

> 
> Nate
> 
> > On Apr 8, 2021, at 2:59 PM, Hendrik Boom  wrote:
> > 
> > On Thu, Apr 08, 2021 at 11:22:10AM -0700, kamist...@gmail.com wrote:
> >> Have you tried out Pict3D [1]?
> > 
> > Two significant flaws with Pict3D:
> > 
> > * It does not have a mechanism for attaching a texture to an object.
> > 
> > * It does not allow one to cut one #D object out of another.
> >  (such as using a cylinder to drill a round hole in a block of wood)
> > 
> > Otherwise it's an impressive peve of work.
> > 
> >> There is also a library from Matthew Flatt that can create 3D Text / 
> >> extruded pathes: [2]
> >> 
> >> Personally I currently use opengl [3], these bindings support higher 
> >> opengl 
> >> versions than the [4]
> >> (which only support opengl 1.5 according to its documentation)
> >> 
> >> I can't say exactly up to which opengl version [3] has working bindings, 
> >> these bindings were automatically generated, but that stopped working at 
> >> some point.
> >> (Apparantly the input that was used for the generation isn't provided for 
> >> recent opengl versions anymore, so the generator has to be fixed or 
> >> replaced to work with a different input/description)
> > 
> > Exactly.  I've been struggling with this last year, and I sort of gave up.
> > I'm thinking of looking at it again.
> > 
> > What happened to the spec is that the entire thing has been recoded from a 
> > completely ad-hoc formalism to a slightly less ad-hoc XML-based formalism.
> > Everything is different.  And the new one is somewhat inconsistent about 
> > the placement of asterisks in the XML phrases that form function prototypes.
> > 
> > I've been using sgl for my own work.  I suspect it to be largely 
> > hand-coded, but it seems to work.
> > 
> > There's also a binding for Vulkan, which I don't think has been used vary 
> > much, and so may still pose surprises.
> > 
> >https://docs.racket-lang.org/vulkan/index.html
> > 
> > I don't know how well any of this works on a Mac, which I gather is going 
> > its own way for graphics, perhaps in the cause of incompatibility.
> > 
> > -- hendrik
> > 
> >> 
> >> [1] https://docs.racket-lang.org/pict3d/index.html
> >> [2] https://docs.racket-lang.org/pict3d-die-cut/index.html
> >> [3] https://docs.racket-lang.org/opengl/index.html
> >> [4] 
> >> https://docs.racket-lang.org/sgl/index.html?q=opengl#%28idx._%28gentag._0._%28lib._sgl%2Fscribblings%2Fsgl..scrbl%29%29%29
> >> 
> >> -- 
> >> You received this message because you are subscribed to the Google Groups 
> >> "Racket Users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send an 
> >> email to racket-users+unsubscr...@googlegroups.com.
> >> To view this discussion on the web visit 
> >> https://groups.google.com/d/msgid/racket-users/67072c79-aac7-40a1-8774-2d684c7476d1n%40googlegroups.com.
> > 
> > -- 
> > You received this message because you are subscribed to the Google Groups 
> > "Racket Users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an 
> > email to racket-users+unsubscr...@googlegroups.com.
> > To view this discussion on the web visit 
> > https://groups.google.com/d/msgid/racket-users/20210408195922.zdq5ruhr4ufvqgc4%40topoi.pooq.com.
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/20210412114648.hdgyxenl747epbhp%40topoi.pooq.com.


[racket-users] Wheel / touchpad / trackpoint accuracy/speed scrolling fix for DrRacket

2021-04-12 Thread Dexter Lagan
  I started a new thread as the original topic no longer matched.
I installed 8.1.0.2 x64 CS and enabled logging in gen-wheels. Matt was 
right: wheel-steps-mode is indeed set to 'integer while gen-wheels runs in 
DrRacket's editor. The only two changes required to get smooth/accurate 
scrolling on touchpad gestures and trackpoint are therefore:

In share\pkgs\gui-lib\mred\private\wx\win32\window.rkt's gen-wheels private 
method:

(let loop ([amt (* wheel-scale amt)])
to
(let loop ([amt amt])

and reduce WHEEL_DELTA by a factor of 4, such as gen-wheels looks like:

  (define/private (gen-wheels w msg lParam amt down up)
(define WHEEL_DELTA_S (/ WHEEL_DELTA 4))
(let loop ([amt amt])
  (cond
[((abs amt) . < . WHEEL_DELTA_S)
 (case wheel-steps-mode
   [(one integer) amt]
   [(fraction)
(unless (zero? amt)
  (do-key w msg down lParam #f #f void (/ amt (exact->inexact 
WHEEL_DELTA_S
0.0])]
[(negative? amt)
 (case wheel-steps-mode
   [(one)
(do-key w msg down lParam #f #f void 1.0)
(loop (+ amt WHEEL_DELTA_S))]
   [(integer)
(define steps (quotient (- amt) WHEEL_DELTA_S))
(do-key w msg down lParam #f #f void (exact->inexact steps))
(loop (+ amt (* steps WHEEL_DELTA_S)))]
   [else
(do-key w msg down lParam #f #f void (/ (- amt) (exact->inexact 
WHEEL_DELTA_S)))
0.0])]
[else
 (case wheel-steps-mode
   [(one)
(do-key w msg up lParam #f #f void 1.0)
(loop (- amt WHEEL_DELTA_S))]
   [(integer)
(define steps (quotient amt WHEEL_DELTA_S))
(do-key w msg up lParam #f #f void (exact->inexact steps))
(loop (- amt (* steps WHEEL_DELTA_S)))]
   [else
(do-key w msg up lParam #f #f void (/ amt (exact->inexact 
WHEEL_DELTA_S)))
0.0])])))

Happy Monday,

Dex

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/28e13460-c86d-4967-aa25-5527d672e711n%40googlegroups.com.


[racket-users] Incorrect value/typo in write-resource procedure documentation

2021-04-12 Thread Dexter Lagan
https://docs.racket-lang.org/file/resource.html

For the proc write-resource, 
type : (or/c 

 'string 'bytes 'integer) = 'string
should read
type : (or/c 

 'string 'bytes 'dword) = 'string

As the 'integer value is not supported. Attempting to use the 'integer 
value returns the following error:
write-resource: expected argument of type <'string, 'bytes, or 'dword>; 
given: 'integer

Cheers,

Dex

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/racket-users/3a88a91a-864d-4b63-a7f1-db25798a708bn%40googlegroups.com.