Re: [racket-users] Web server catch exceptions, print stack trace to error-logs, display simple page to user

2016-03-20 Thread WarGrey Gyoudmon Ju
I just use the log facility that operating system uses, say, rsyslog.
rsyslog is configured to forward all logs via UDP, and there is another
racket UDP server that displays these logs on the terminal or sends to
other dev-ops. (rsyslog can be run as a normal user, then you can setup
your own log management strategy.)


On Fri, Mar 18, 2016 at 8:37 AM, Marc Kaufmann 
wrote:

> Hm, it sounded like I needed sudo rights to run daemontools if I want to
> use it to start racket as sudo (I may be wrong). Either way, the admins
> told me no, so no it is. Either supervisord or daemontools are of course
> several steps up from my previous way of doing things (which may justify
> their reasons for not giving me said sudo rights in the first place...).
>
> On Thu, Mar 17, 2016 at 8:29 PM, John Clements 
> wrote:
>
>>
>> > On Mar 17, 2016, at 4:48 PM, Marc Kaufmann 
>> wrote:
>> >
>> > Yep, printing that out is indeed all I want. I hadn't thought about the
>> fact that 'print and 'display will show up in standard output.
>> >
>> > John, how do you use drrackt's log handlers, are you running the server
>> via Drracket or did you mean something different.
>>
>> Forgive me, of course I didn’t mean “DrRacket’s log handlers,” but rather
>> “racket’s log handlers”, specifically those created by `define-logger`. My
>> mistake.
>> >
>> > I can't use daemontools for reasons to do with permissions, but I will
>> have access to supervisord, which seems to be doing the same type of tasks.
>>
>> ??
>>
>> I claim you can run daemontools (specifically, svscan) without any
>> permissions at all. Regardless, AFAIK supervisord does in fact achieve
>> similar ends.
>>
>> John
>>
>> >
>> > On Thu, Mar 17, 2016 at 4:46 PM, John Clements <
>> cleme...@brinckerhoff.org> wrote:
>> >
>> > > On Mar 17, 2016, at 11:50 AM, Marc Kaufmann <
>> marc.kaufman...@gmail.com> wrote:
>> > >
>> > > Hi all,
>> > >
>> > > I do not want people to see "Contract violation: massive stack trace
>> documenting my brilliance as a programmer" every time they hit a bug on my
>> website.
>> > >
>> > > Currently I show them simply an error page and redirect the trace to
>> stderr (see code below). But this doesn't track time of the error, and so
>> on. Is there a simple way to do this (seems like it should be a common
>> problem), or at least how to easily get the time-stamp from
>> servlet-error-response without having to manually pipe everything to stderr?
>> >
>> > I think this problem is one of the ones that falls into the “Lisp
>> crack”: specifically, implementing your own solution is sufficiently easy
>> that building a general-purpose solution winds up being more trouble than
>> it’s worth, and never quite covers all of the various users’ requirements.
>> Of course, this leads to lack of standardization.
>> >
>> > For me, I use drracket’s log handlers, make sure that everything winds
>> up on stdout, and then use ‘multilog’ from ‘daemontools’ to take care of
>> timestamps, partitioning (if desired) and log rotation.
>> >
>> > John
>> >
>> >
>> >
>> >
>>
>>
>>
>>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: custom keybindings (AltGr)

2016-03-20 Thread Bert De Ketelaere
Everything works as expected.  Thanks!


Van: racket-users@googlegroups.com  namens 
Matthew Flatt 
Verzonden: vrijdag 18 maart 2016 2:09
Aan: Bert De Ketelaere
CC: us...@racket-lang.org
Onderwerp: Re: [racket-users] Re: custom keybindings (AltGr)

I think the issue with Control-Alt-a is that Control-a is mapped to
"beginning-of-line" as "c:a". Probably that should be ":c:a".

A "c:a" binding doesn't show up in the keybindings dialog for Windows,
but it does for OS X. My guess is that the keybindings list is filtered
to omit combinations that are shadowed by menu shortcuts (even though I
have menu shortcuts disabled on Windows). The menu shortcut for "Select
All" is actually ":c:a", so that shortcut only partly shadows "c:a".
Then again, the "c:u" and "c:n" combinations do show up in the
keybindings dialog, so maybe my guess isn't quite right.

In any case, I've pushed the changes. When you start using the latest
(e.g., with the next snapshot build or later), you could go to
"Editing" -> "General Editing" in the preferences dialog, select "Treat
Control-Alt combination as AltGr", and then make sure things work as
expected.

At Thu, 17 Mar 2016 08:58:01 +, Bert De Ketelaere wrote:
> Hello,
>
> this does everything I want.
> The only difference is between your implementation and what I previously had
> done is that Ctrl+Alt+q is treated the same as AltGr+q (with the latter being
> a custom keybinding defined with "g:q").  I don't really care about this, but
> I thought it was nice that they were two distinct events.
>
> Looking deeper into this, there is some other weirdness, using your file (I've
> abandoned mine):
> for Ctrl+Alt+a, u or n doesn't produce anything
>   Ctrl+Alt+z, m  just prints z or m
>   Ctrl+Alt+t l ... opens menu Tabs, Language etc...
> It's the difference between the first two that surprises me.
> But defining "g:u" "g:n" "g:z" "g:t" ... as keybindings to some other letter
> works fine (with AltGr or Ctrl+Alt)
> Except for "g:a" or "c:m:a".  I can't find any reason why "a" is treated
> differently (if I look in the keybindings menu it doesn't seem different from
> for example "z".  Both have only one binding "c:z" for undo and "c:a" for
> select all.)
>
> The difference between these letters was also there when using the old key.rkt
>
> I'm using latest snapshot ( version 6.4.0.14--2016-03-16(d27bf66/a) [3m]) and
> following keybindings
> #lang s-exp framework/keybinding-lang
> (keybinding "g:q" (λ (x y) (send x insert #\◊)))
> (keybinding "g:a" (λ (x y) (send x insert #\A)))
>
> to test different keybindings.
> I also noticed that a "c:m:q" always trumps a "g:q" binding regardless of
> order.
> and a "g:q" always trumps "c:m:~g:q" (regardless of Ctrl+Alt or AltGr
> combination)
>
> Thanks for the file.  For what I want, it works just fine.
> Kind regards,
> Bert
> 
> Van: racket-users@googlegroups.com  namens
> Matthew Flatt 
> Verzonden: donderdag 17 maart 2016 1:34
> Aan: Bert De Ketelaere
> CC: us...@racket-lang.org
> Onderwerp: Re: [racket-users] Re: custom keybindings (AltGr)
>
> Thanks for the helpful table!
>
> The problem with Control combinations was a mistake in my code, fixed
> in the enclosed "key.rkt".
>
> The problem with dead keys was harder. It seems that ToUnicode() has
> the same effect as TranslateEvent() for dead-key combinations, so using
> ToUnicode() multiple times and in addition to TranslateEvent() triggers
> the extra accents in your experiments. My new attempt uses ToUnicode()
> only when it's in a position to cancel a TranslateEvent() call ---
> which is always the case when we first want to get its result  and
> records the result instead of calling ToUnicode() again later.
>
> At Wed, 16 Mar 2016 08:53:48 +, Bert De Ketelaere wrote:
> > Thanks for looking into this!  My implementation worked somewhat, but I was
> > indeed not happy with the way I solved it. (State and losing the key release
> > events)
> > Just to be sure, I updated my patch a week ago for some errors I found in my
> > handling of key-events, the table below is based on that revision.
> >
> >
> > ​   ​   ​old
> > bdeket​ mflat​  desired​​
> > ​AltGr+qcustom keybinding​ ​​  ​◊  ​◊  ​◊  
> > ​
> > ​Ctrl+Alt+q ​q  ​q  ​◊  ​q  ​(normal is nothing)
> >
> > ​AltGr+ > ​Ctrl+Alt+< ​<  ​\  \​  ​\
> > ​AltGr+ù​keyboard layout
> > ​dead key
> > ​   ​  ù​  ​´´ ​  ​ ​ ​(my patch does 
> > this ok
> if
> > ù without modifier is used before ù with modifier, so it deserves some
> points,
> > but probably negative ones, because of its inconsistency)
> > ​followed by space
> > ​´  ​ù´ ​´´´​´
> > ​followed 

Re: [racket-users] Racket -> HTML+JavaScript using Urlang and Ractive

2016-03-20 Thread Andrew Gwozdziewycz
On Wed, Mar 16, 2016 at 5:56 AM, Daniel Prager 
wrote:

> Awesomely, Jens has been working on Urlang: a Racket-ish syntax for
> JavaScript, using the nanopass compiler infrastructure:
>
> https://github.com/soegaard/urlang
>
> and more ambitiously, a Racket (subset) ->JavaScript compiler (rjs),
> taking a distinct approach from Whalesong.
>
> * * *
>
> Just using plain Urlang together with sxml, Bootstrap (for css), and
> notably Ractive.js  for templating and data-binding I
> made the following demo / proof-of-concept:
>
>
> http://htmlpreview.github.io/?https://github.com/danprager/urlang/blob/master/urlang-examples/ractive/ractive-bootstrap-example.html
>
> Note: no heavyweight js runtime required: actually no runtime at all.
>
>
> Racket source:
> https://github.com/danprager/urlang/blob/master/urlang-examples/ractive/ractive-bootstrap-example.rkt
>
> HTML output (including embedded JavaScript):
> https://github.com/danprager/urlang/blob/master/urlang-examples/ractive/ractive-bootstrap-example.html
>
> The abstractions are a bit leaky, but I'm quietly excited about where this
> sort of approach could lead.
>
> What do you think?
>

Very neat! I had to make some changes to it before I could see it. This is
mostly around "mixed-content" due to mixing HTTPS with HTTP for assets.
Otherwise, all this is *very* promising.



-- 
http://www.apgwoz.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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Re: Changing DrRacket preferences with keybindings?

2016-03-20 Thread brendan
Outstanding, thank you.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Changing DrRacket preferences with keybindings?

2016-03-20 Thread Robby Findler
To turn it on:

(preferences:set 'drracket:online-compilation-default-on #t)

and to turn it off:

(preferences:set 'drracket:online-compilation-default-on #f)

Robby


On Sun, Mar 20, 2016 at 6:44 AM, brendan  wrote:
> I would like to bind a key to toggle background expansion, but I can't find 
> an applicable command in the API docs. Is there any way to do this? Thanks 
> for your help.
>
> --
> 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.
> For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


[racket-users] Changing DrRacket preferences with keybindings?

2016-03-20 Thread brendan
I would like to bind a key to toggle background expansion, but I can't find an 
applicable command in the API docs. Is there any way to do this? Thanks for 
your help.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Re: Racket -> HTML+JavaScript using Urlang and Ractive

2016-03-20 Thread Greg Trzeciak
On Wednesday, March 16, 2016 at 10:54:50 PM UTC+1, Jens Axel Søgaard wrote:
> 2016-03-16 22:50 GMT+01:00 Greg Trzeciak :
> "Urlang is a Racket flavoured S-expression syntax for Javascript"
> 
> 
> 
> Can I steal that for a tag-line?
>  

Feel free!

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] dynamic-require

2016-03-20 Thread Scott Moore
If the definitions are saved as “test.rkt”, the following works: 

#lang racket 

(module a racket/base (displayln "hello")) 
(dynamic-require '(submod "test.rkt" a) #f) 

On March 16, 2016 at 12:13:46 PM, Jos Koot (jos.k...@gmail.com) wrote:

Hi,
 
The following example of dynamic-require in the reference manual works in the 
interactions window of DrRacket, but not in its definitions window:
 
(module a racket/base (displayln "hello"))
(dynamic-require ''a #f)
 
How do I do this in the definitions window?
 
The reason I use dynamic-require is that I want to set some parameters before 
submod a is executed.
 
I found out I can do the following:
 
#lang racket
(module a racket/base (displayln "hello"))
(module b racket/base (current-output-port (open-output-file ...)))
(require 'b)
(require 'a)
 
To me this seems an ugly trick.
In addition I am not sure this is guaranteed to work consistently.
How can I dynamically require a submod in the same source as it is defined?
 
Jos
--
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.
For more options, visit https://groups.google.com/d/optout.

-- 
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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] string-join vs string-append

2016-03-20 Thread Vincent St-Amour
On Thu, 17 Mar 2016 13:08:44 -0500,
Arnel wrote:
> 
> Hi,
> 
> How does 'string-join' differ from 'string-append'? More specifically, why 
> does
> the following code:
> 
> (let ([z ""]
>   [y "b"])
>   (string-join '(z y) "\n"))
> 
> result in a contract violation, yet the following:
> 
> (let ([z ""]
>   [y "b"])
>   (string-append z y))
> 
> works without any issues. (It's not necessarily the result I wanted, but I can
> work around it.) Isn't '(z y) essentially a list of strings?

'(z y) is not a list of strings. It's a list with two symbols, 'z and 'y.
(list z y) will be a list with the two strings you want.

The quote form does create a list in this case, but it does not evaluate
any of its subforms. Hence why you get symbols, as opposed to the values
of your variables.

Vincent

-- 
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.
For more options, visit https://groups.google.com/d/optout.