Re: [racket-users] Web server + authentication

2020-01-23 Thread Jens Axel Søgaard
Den tor. 23. jan. 2020 kl. 01.47 skrev Matthew Butterick :

> I concur on Postmark. For 2+ yrs I've used it with the Racket web server
> for mbtype.com. I pass the server settings to `smtp-send-message` from `
> net/smtp`.
>
> On 22 Jan 20, at 3:00 AM, Bogdan Popa  wrote:
>
> I like using Postmark[0] for this.  Their free plan lets you send up to
> 100 e-mails a month, their paid plans come at a reasonable price and
> they have helpful docs and validators to help you set up SPF, DMARC and
> DKIM.
>
> Two recommendations!

I took a second look at Postmark and was impressed by their service,
so I went ahead and added password recovery emails via Postmark.

Some nice features:
- don't need to setup and maintain a mail server
- weekly report on the "spam status" of your domain
- email templates (html mails are hard)
- an ios app to track mails
- 100 mails free pr month (which for Racket Stories is plenty)

Thanks for the push.


Stephen, I think, password resets were what you originally asked for (see
latest commit).

 https://github.com/soegaard/racket-stories

The code hasn't been deployed yet - it'll happen sometime tomorrow.

Philip: I'll keep your solution in mind, if I for some reason need to
change it.

/Jens Axel

-- 
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/CABefVgzNd2ZF1fpChjPKu9uYP1JambVJNzONUqKeTquPR-v2Lg%40mail.gmail.com.


[racket-users] My bug or Racket's? Macro + srcdoc = confusion

2020-01-23 Thread Stephen Foster
I ran into a series of confusing Racket things today.  Although I've fixed 
my code, I'm looking for insight.  Clearly there are things I don't 
understand about scribble/srcdoc, and maybe macros in general.

I have a macro called define/contract/doc.  It lets me do things like this:

(define/contract/doc (test #:number [number 75.2])

  (->i ()

   (#:number [number number?])

   [returns any/c])


  @{Returns what you pass in for #:number.  Defaults to 75.2}


  number)


It has worked fine for almost a year.  But today, I discovered that when I 
define a function with a default parameter value that happens to include a 
decimal number (i.e. 75.2 above), I get a cryptic error when requiring in 
the srcdoc submodule.

I'll post the macro definition in a moment, but first let me mention that 
on the Windows machine where my co-worker first discovered this bug, the 
error was presented without a stacktrace.  This was it:

-: contract violation

  expected: number?

  given: #f

  argument position: 1st

  other arguments...:

   2

  context...:

*Puzzle #1.  *I don't usually develop on Windows, so can someone tell me if 
there's something special I'm supposed to do to get more context to print 
out?  Note: Even in the Racket REPL, I couldn't get a backtrace.  Using 
errortrace changed nothing.  I'm on Racket 7.4, btw.

It was only after poking, prodding, and simplifying for an hour that we 
extracted a minimal reproduction of the bug and figured out that the 
decimal number was causing the problem.  The lack of stacktrace led to a 
lot of guesswork.

I would have been at a loss, but I happened to switch to my Mac, where 
(luckily!) the error printed with a better stacktrace:

-: contract violation

  expected: number?

  given: #f

  argument position: 1st

  other arguments...:

   2

  context...:

   /Applications/Racket 
v7.4/share/pkgs/scribble-lib/scribble/racket.rkt:227:2: typeset-atom

   /Applications/Racket 
v7.4/share/pkgs/scribble-lib/scribble/racket.rkt:471:8

   /Applications/Racket 
v7.4/share/pkgs/scribble-lib/scribble/racket.rkt:322:2: gen-typeset

   /Applications/Racket 
v7.4/share/pkgs/scribble-lib/scribble/private/manual-proc.rkt:549:6

   /Applications/Racket v7.4/collects/racket/private/map.rkt:259:4: loop

   /Applications/Racket v7.4/collects/racket/list.rkt:586:2: append-map

   /Applications/Racket 
v7.4/share/pkgs/scribble-lib/scribble/private/manual-proc.rkt:316:2: do-one

   /Applications/Racket v7.4/collects/racket/private/map.rkt:259:4: loop

   /Applications/Racket v7.4/collects/racket/list.rkt:586:2: append-map

   /Applications/Racket 
v7.4/share/pkgs/scribble-lib/scribble/private/manual-proc.rkt:212:0: 
*defproc13

   (submod "/Users/thoughtstem/Dev/test/test.rkt" srcdoc): [running body]

   temp37_0

   for-loop

   run-module-instance!125

   perform-require!78

   for-loop

   ...

This informed me that the problem was related to typeset-atom, which in 
turn helped me to make slightly more educated guesses about how to fix the 
problem.

*Puzzle #2*.  If you save the snippet below into a file called test.rkt, you 
can reproduce the error and/or my fixes with something like racket -e 
"(require (submod \"./test.rkt\" srcdoc))".  Why does the datum->syntax fix 
the problem?  After skimming the srcdoc code, I suspect some line-number 
information needs to be present on the syntax being typeset  Why this 
only matters for numbers with decimals is still a mystery.

#lang at-exp racket


(require (for-syntax syntax/parse))


(define-syntax (define/contract/doc stx)

  (define defaults 

'(75) ;Works

#;

'(75.2) ;Breaks


#;

(datum->syntax stx '(75.2) stx) ;Works, and is essentially the way we 
fixed it.


#;

(datum->syntax stx '(75.2)) ;Breaks, and is roughly what we had in 
production -- without the hardcoded 75.2, obviously.

)


  (define ret

(syntax-parse stx

  ([_ (f-name args ... ) contract doc body ...]

   #`(begin

   (require scribble/srcdoc)

   (provide (proc-doc

  f-name

  contract

  #,defaults 

  doc)) 

   (define (f-name args ...)

 body ...)


  ret)


(define/contract/doc (test #:number [number 75.2])

  (->i ()

   (#:number [number number?])

   [returns any/c])


  @{Returns what you pass in for #:number.  Defaults to 75.2}


  number)


*Puzzle #3*.  What's the appropriate code to "blame" here?  Is this some 
kind of noob mistake on my part (i.e. advanced Racket macrologists would 
have known to use datum->syntax appropriately and never would have run into 
the problem in the first place)?  Is this a bug in srcdoc?  Is it both?

*(Bonus) **Puzzle #4.*  How would you have debugged this?  Was there 
anything I could have done to localize the problem more quickly? 



-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" 

Re: [racket-users] how to reinstall a broken package?

2020-01-23 Thread Eric Griffis
Hi Hendrick,

There's always --force.

raco pkg remove --force glm

This works fine when I know I'm going to reinstall the package before
using its dependents.

Eric

On Thu, Jan 23, 2020 at 6:34 AM Hendrik Boom  wrote:
>
> My installation of OpenGL Mathematics (GLM) for Racket is defective
> in that the installed manual has tha complete table of contents but does not
> have any content past section 2.1.1.
> This may be because of running out of disk space during installation.
>
> Asking raco pkg to install it does not work because it thinks it is already
> installed and up-to-date.
>
> Asking raco pkg to remove it just gives ma complaints that other packages
> depend on it - other packages that I don't want to uninstall.
>
> Is there a convenient way to ask raco to reinstall a package?
>
> -- hendrik
>
>
> --
> 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/20200123143402.3gsduqfndq6rer3n%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/CAORuSUxo8f9%2B2sSEa9LXEFzcuOmfGFy9yZrxX2MNoBnzX3Dusg%40mail.gmail.com.


Re: [racket-users] keyboard shortcuts in a popup menu

2020-01-23 Thread James Platt
Thanks.  I guess the point of having keyboard shortcuts in popup menus is just 
to display them to remind the user what they are.  At this point, I plan to 
follow the practice of having everything from the popups also in a main menu 
bar in every platform.  So really, the glitch failing to display a 
'#\backspace' shortcut in Linux is the serious one in terms of practicality.  


On Jan 22, 2020, at 5:42 PM, George Neuner wrote:

> 
> On 1/22/2020 4:44 PM, James Platt wrote:
>> I'm working on some GUI code and I am seeing some glitches with keyboard 
>> shortcuts in popup menus.  I wonder if others are seeing the same things.
>> 
>> In Racket 7.5 on macOS 10.11.6 "El Captian":
>> Shortcuts defined in a menu-item% in a popup menu don't work unless the 
>> popup menu is displayed. In other words, you have to right click first and 
>> then the shortcut will work while the menu is open.  This isn't a big deal 
>> if you are working according to Apple's human interface guidelines because 
>> all items in popup menus are also supposed to be in the main menu bar [1].   
>> Still, it seems like this should work on it's own.
> 
> It's pretty standard across platforms for popup windows (any kind) to become 
> inactive when they are hidden.  In most windowing systems it is possible to 
> override that behavior and keep a window active even when not shown, but I 
> haven't worked with Macs since MultiFinder so I can't guide you as to how to 
> do it there.
> 
> 
>> In Racket 7.5 on Linux Mint 19.1 (Racket installed with the Ubuntu PPA):
>> The shortcuts don't work at all, whether the popup is displayed or not.  
>> Also a keyboard shortcut defined with '#\backspace'  does not display in the 
>> popup.  This  is supposed to be ctl-backspace on Linux and Windows and 
>> command-delete on macOS.  The macOS version works but not the Linux version. 
>>  I haven't tested with Windows.
> 
> This sounds like a bug.
> 
> 
>> James
>> 
>> [1] 
>> https://developer.apple.com/design/human-interface-guidelines/macos/menus/contextual-menus/
> 
> George
> 

-- 
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/DD9915CE-FF87-4782-9DEF-EF07C5B2EB50%40biomantica.com.


Re: [racket-users] Web server + authentication

2020-01-23 Thread Stephen Foster
Philip -- My general thinking is: the more Racket examples in the world, 
the better.  I'd certainly be interested to see how you used continuations 
to do your one-time-use links.

Bogdan --  Lack of examples is also my main blocker when it comes to Koyo.  
The API docs are good, but I'm one of those developers who needs to see 
examples either in the docs or in a repo somewhere.  I ended up rolling my 
own session management system yesterday instead of using Koyo.  (I'll note, 
however, that I've fully embraced your Deta package because the docs are 
filled with examples.  Great stuff!)


On Wednesday, January 22, 2020 at 5:57:07 PM UTC-8, Philip McGrath wrote:
>
> I configure Postfix to send external mail via Amazon's "Simple Email 
> Service," then use `net/sendmail`. Having a working mail-transfer agent 
> means you can easily send yourself mail from other tools on the system, 
> too, like a cron job to renew the TLS certificates. (I haven't looked at 
> Postmark, so I can't compare.)
>
> As far as managing users generally, the website code for 
> digitalricoeur.org isn't (yet!) public, but I could provide access if it 
> would be useful as an example. We use a passwordless approach based on 
> emailing one-time-use links, which continuations make especially pleasant.
>
> -Philip
>
> On Wed, Jan 22, 2020 at 7:47 PM Matthew Butterick  > wrote:
>
>> I concur on Postmark. For 2+ yrs I've used it with the Racket web server 
>> for mbtype.com. I pass the server settings to `smtp-send-message` from `
>> net/smtp`.
>>
>>
>> On 22 Jan 20, at 3:00 AM, Bogdan Popa > 
>> wrote:
>>
>> I like using Postmark[0] for this.  Their free plan lets you send up to
>> 100 e-mails a month, their paid plans come at a reasonable price and
>> they have helpful docs and validators to help you set up SPF, DMARC and
>> DKIM.
>>
>>
>> -- 
>> 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...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/racket-users/9CBD358C-6A8A-4203-A395-61AF69D44C65%40mbtype.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/958d1098-d29e-4dcd-93f6-5e346913954a%40googlegroups.com.


Re: [racket-users] Create an identifier in syntax

2020-01-23 Thread Sean Kemplay
Hi Ryan,

Thank you SO much for that explenation! Everything now clicks!!

Sean

On Thursday, January 23, 2020 at 4:12:44 PM UTC, Ryan Culpepper wrote:
>
> On 1/23/20 3:59 PM, Sean Kemplay wrote: 
> > Hello, 
> > 
> > I am exploring macros and am trying to define a variable at the top 
> > level (with the goal in mind to dynamically define a group of functions 
> > from a macro). 
> > 
> > with-syntax works fine however I was just wondering if it is possible to 
> > directly inject an identifier as syntax within syntax - something like 
> > the following which does not work! 
> > 
> > (define-syntax x 
> >  (lambda (x) 
> >#`(define ,#'y "y val"))) 
> > 
> > (x) 
> > y => y: undefined; 
> >   cannot reference an identifier before its definition 
>
> First, to escape a quasisyntax (#`) template you need to use unsyntax 
> (#,), not unquote (,). 
>
> Second, due to hygiene the y from the macro has an extra scope, so you 
> can't refer to it by typing y at the top level. But you can do this, for 
> example: 
>
>(define-syntax (x2 stx) 
>  #`(begin (define #,#'y "y val") y)) 
>
> Or you can write a macro that defines a y with the lexical context of 
> the macro use: 
>
>(define-syntax (x3 stx) 
>  #`(define #,(datum->syntax stx 'y) "y val")) 
>
> You could also write this macro with with-syntax instead. The way that 
> you insert an identifier into a syntax template (quasisyntax/unsyntax vs 
> with-syntax) is independent of the way you create the identifier. 
>
> (Note: using the lexical context of the macro use works here, but it's 
> not always the right answer. Unhygienic macros are complicated.) 
>
> Ryan 
>

-- 
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/ceaef6ec-8bca-428f-af8c-cfb71eddd08f%40googlegroups.com.


Re: [racket-users] Create an identifier in syntax

2020-01-23 Thread Ryan Culpepper

On 1/23/20 3:59 PM, Sean Kemplay wrote:

Hello,

I am exploring macros and am trying to define a variable at the top 
level (with the goal in mind to dynamically define a group of functions 
from a macro).


with-syntax works fine however I was just wondering if it is possible to 
directly inject an identifier as syntax within syntax - something like 
the following which does not work!


(define-syntax x
     (lambda (x)
   #`(define ,#'y "y val")))

(x)
y => y: undefined;
  cannot reference an identifier before its definition


First, to escape a quasisyntax (#`) template you need to use unsyntax 
(#,), not unquote (,).


Second, due to hygiene the y from the macro has an extra scope, so you 
can't refer to it by typing y at the top level. But you can do this, for 
example:


  (define-syntax (x2 stx)
#`(begin (define #,#'y "y val") y))

Or you can write a macro that defines a y with the lexical context of 
the macro use:


  (define-syntax (x3 stx)
#`(define #,(datum->syntax stx 'y) "y val"))

You could also write this macro with with-syntax instead. The way that 
you insert an identifier into a syntax template (quasisyntax/unsyntax vs 
with-syntax) is independent of the way you create the identifier.


(Note: using the lexical context of the macro use works here, but it's 
not always the right answer. Unhygienic macros are complicated.)


Ryan

--
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/4b02bc1c-cd8a-feed-2c1c-0025209ffab3%40ccs.neu.edu.


[racket-users] Create an identifier in syntax

2020-01-23 Thread Sean Kemplay
Hello,

I am exploring macros and am trying to define a variable at the top level 
(with the goal in mind to dynamically define a group of functions from a 
macro).

with-syntax works fine however I was just wondering if it is possible to 
directly inject an identifier as syntax within syntax - something like the 
following which does not work!

(define-syntax x
(lambda (x)
  #`(define ,#'y "y val")))

(x)
y => y: undefined;
 cannot reference an identifier before its definition

this is just to satisfy my own curiosity :-)

Cheers,
Sean

-- 
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/5836fddb-fbc4-464c-87b8-68cff47b69f2%40googlegroups.com.


Re: [racket-users] how to reinstall a broken package?

2020-01-23 Thread Sorawee Porncharoenwase
I usually do

raco setup --pkgs 

On Thu, Jan 23, 2020 at 8:34 AM Hendrik Boom  wrote:

> My installation of OpenGL Mathematics (GLM) for Racket is defective
> in that the installed manual has tha complete table of contents but does
> not
> have any content past section 2.1.1.
> This may be because of running out of disk space during installation.
>
> Asking raco pkg to install it does not work because it thinks it is already
> installed and up-to-date.
>
> Asking raco pkg to remove it just gives ma complaints that other packages
> depend on it - other packages that I don't want to uninstall.
>
> Is there a convenient way to ask raco to reinstall a package?
>
> -- hendrik
>
>
> --
> 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/20200123143402.3gsduqfndq6rer3n%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/CADcuegsExxWStHvqBnd0pNg7uyvXPEz9vWMK3OVL9yNAri9eBA%40mail.gmail.com.


[racket-users] how to reinstall a broken package?

2020-01-23 Thread Hendrik Boom
My installation of OpenGL Mathematics (GLM) for Racket is defective
in that the installed manual has tha complete table of contents but does not 
have any content past section 2.1.1.
This may be because of running out of disk space during installation.

Asking raco pkg to install it does not work because it thinks it is already
installed and up-to-date.

Asking raco pkg to remove it just gives ma complaints that other packages 
depend on it - other packages that I don't want to uninstall.

Is there a convenient way to ask raco to reinstall a package?

-- hendrik
 

-- 
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/20200123143402.3gsduqfndq6rer3n%40topoi.pooq.com.