Re: [racket-users] Narrow radix of string->number.

2016-12-27 Thread Matthew Butterick
> On Dec 27, 2016, at 1:57 PM, Robby Findler  
> wrote:
> 
> The main thing I worry about is that there are standard conventions
> that we're missing from other language families. Would someone mind
> investigating a few other, popular languages


FWIW Racket's own `~r` function already accepts radixes (radices? radishes?) up 
to 36.

Personally I'm a fan of base 62 (used in short-URL generators, such as that 
employed by beautifulracket.com ).


[1] 
https://docs.racket-lang.org/reference/strings.html?q=~x#%28def._%28%28lib._racket%2Fformat..rkt%29._~7er%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.
For more options, visit https://groups.google.com/d/optout.


Re: [racket-users] Mobile Friendly HTML in Scribble?

2016-12-27 Thread Matthew Butterick
> On Dec 27, 2016, at 2:23 PM, Philip McGrath  wrote:

> However, when I just tried to simulate a smartphone viewport with the Chrome 
> developer tools, I got the "non-mobile friendly" behavior Michael described. 
> (I don't have my phone on me right now, so I haven't checked that.)


I believe the fix is to add this declaration to the top of each 
Scribble-generated HTML page: 



If someone knows offhand where the main Scribble HTML template lives in 
`racket/scribble`, that would save me some time discovering it.



> While we're on the subject of the narrow-width Scribble CSS, I've 
> occasionally had the thought that it would be nice to have a way to view the 
> table of contents, perhaps as a drop-down sort of thing, from the 
> sidebar-less view. 

True, but IIRC the problem is that the TOC is often longer than one vertical 
screen — and sometimes longer than the content area on the right — so it's hard 
to put it into a drop-down and keep it ergonomic. Better ideas welcome.



> I was wondering if there is a built in way to create mobile friendly HTML in 
> Scribble?  Given Google's current mobile friendly policy 
> (https://webmasters.googleblog.com/2015/04/rolling-out-mobile-friendly-update.html)
>  and the fact that devices with small screens are everywhere now, this seems 
> like something which would not only make the Racket's documentation look 
> better on mobile devices, but for any other HTML generated in Scribble.


Google's policy is coercive and awful. But even if it weren't, the practical 
problem is that code samples don't shrink well because they can't be 
line-wrapped. [1]

[1] https://github.com/racket/scribble/pull/62 



-- 
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] mode-lambda and the gl-backend

2016-12-27 Thread Jay McCarthy
What you have is fine, but you need to give it a DC where
get-gl-context doesn't return false. (Such as by making a canvas with
the 'gl style.) In addition, you do NOT want a legacy context.

I recommend looking at the example code:

https://github.com/jeapostrophe/mode-lambda/blob/master/mode-lambda/examples/one.rkt

On Tue, Dec 27, 2016 at 4:37 PM, Jens Axel Søgaard
 wrote:
> Hi All,
>
> I am experimenting with mode-lambda. The example below
> shows how to draw sprites on different layers using the software backend.
> However I would like to try the gl backend instead.
>
> What is the correct incantation?
>
> /Jens Axel
>
>
> #lang racket
> (require mode-lambda
>  mode-lambda/static
>  mode-lambda/text/static
>  mode-lambda/text/runtime
>  mode-lambda/color
>  ; mode-lambda/backend/gl
>  mode-lambda/backend/software
>  racket/draw
>  racket/gui/base
>  pict
>  pict/flash)
>
> ;;;
> ;;; BITMAPS
> ;;;
> (define fish-bm (pict->bitmap (standard-fish  100 50)))
> (define lantern-bm  (pict->bitmap (jack-o-lantern 100)))
> (define flash-bm(pict->bitmap (colorize (linewidth 5 (outline-flash 100
> 100)) "yellow")))
>
> ;;;
> ;;; SPRITES
> ;;;
>
> (define db (make-sprite-db))
> (add-sprite!/bm db 'fish(λ() fish-bm))
> (add-sprite!/bm db 'lantern (λ() lantern-bm))
> (add-sprite!/bm db 'flash   (λ() flash-bm))
> (define cdb (compile-sprite-db db))
> (define fish-idx(sprite-idx cdb 'fish))
> (define lantern-idx (sprite-idx cdb 'lantern))
> (define flash-idx   (sprite-idx cdb 'flash))
>
> ;;;
> ;;; LAYERS
> ;;;
> (define W 400)
> (define H 400)
> (define W/2 (/ W 2.))
> (define H/2 (/ H 2.))
>
> (define bgl (layer W/2 H/2)); background: layer 0
> (define ml  (layer W/2 H/2)); middle: layer 1
> (define fgl (layer W/2 H/2)); foreground: layer 2
> (define lc (vector bgl ml fgl)) ; layer config
>
> ;;;
> ;;; RUNTIME
> ;;;
>
> (define fish-sprite(sprite 200. 200. fish-idx#:layer 0)) ;
> background
> (define lantern-sprite (sprite 250. 200. lantern-idx #:layer 1)) ; middle
> (define flash-sprite   (sprite 250. 200. flash-idx   #:layer 2)) ;
> foreground
>
> (define rendering-states->draw (stage-draw/dc cdb W H 3)) ; XXX change 3 to
> 2 and get a crash
>
> (define draw (rendering-states->draw lc (list fish-sprite lantern-sprite)
> (list  flash-sprite)))
> (define bm   (make-object bitmap% W H))
> (define dc   (new bitmap-dc% [bitmap bm]))
> (draw W H dc)
> bm
>
> --
> 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.



-- 
Jay McCarthy
Associate Professor
PLT @ CS @ UMass Lowell
http://jeapostrophe.github.io

   "Wherefore, be not weary in well-doing,
  for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
  - D 64:33

-- 
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] Mobile Friendly HTML in Scribble?

2016-12-27 Thread Philip McGrath
Has something changed recently in the CSS for the Racket documentation? I
thought that formerly the phone layout was equivalent to what happens if
you manually resize a desktop/laptop browser window to be quite narrow: the
sidebar / table of contents goes away and a navigation bar appears at the
top of the page (with a search box and "top"/"prev"/"up"/"next"). However,
when I just tried to simulate a smartphone viewport with the Chrome
developer tools, I got the "non-mobile friendly" behavior Michael
described. (I don't have my phone on me right now, so I haven't checked
that.)

While we're on the subject of the narrow-width Scribble CSS, I've
occasionally had the thought that it would be nice to have a way to view
the table of contents, perhaps as a drop-down sort of thing, from the
sidebar-less view. (Currently the only way seems to be to make the window
wider, and I encounter that layout reasonably often when I have the
documentation open next to a Dr. Racket window.)

-Philip

P.S.: As a web designer, I find it curious how the conception of "mobile
friendly" design has changed: I remember Steve Jobs showing off tap-to-zoom
as a feature on the New York Times home page. As a user, I actually prefer
tap-to-zoom as a UI over some bad designs that meet Google's "mobile
friendly" standards.

On Tue, Dec 27, 2016 at 11:25 AM Michael Rossi 
wrote:

> Hi all,
>
> I asked this question over at stackoverflow and this seemed to be the
> place to ask.
>
> I was wondering if there is a built in way to create mobile friendly HTML
> in Scribble?  Given Google's current mobile friendly policy (
> https://webmasters.googleblog.com/2015/04/rolling-out-mobile-friendly-update.html)
> and the fact that devices with small screens are everywhere now, this seems
> like something which would not only make the Racket's documentation look
> better on mobile devices, but for any other HTML generated in Scribble.
>
> I understand I could probably hack on the CSS to create a custom layout
> (which sounds like utter hell), but I was wondering if such a thing already
> exists or is in the works already?  If not, how do we go about making a
> feature request for this?
>
> As an example of what I mean by "non-mobile friendly," if you go to the
> Racket docs on a smartphone, you end up having to zoom in and scroll to the
> right on every page because of the navigation on the left. Sure, it's
> doable, but it's not like going to a page that's like this:
>
>
> https://w3layouts.com/preview/?l=/mr-hotel-hotel-category-flat-bootstrap-responsive-web-template/
>
> Click on the device pictures on the top to see what I'm getting at.
>
> So, am I correct that Scribble cannot currently do this?  If so, who do we
> bug to get this added?
>
> Thanks everyone!
> Michael
>
> --
> 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] Narrow radix of string->number.

2016-12-27 Thread Robby Findler
The main thing I worry about is that there are standard conventions
that we're missing from other language families. Would someone mind
investigating a few other, popular languages to see what they do so
that can be taken into account? And perhaps pointing to the docs or
showing some example code? (If we don't like what they do, we don't
have to do it that way, but gratuitous difference seems unwise.)

Robby


On Tue, Dec 27, 2016 at 3:54 PM, Vincent St-Amour
 wrote:
> I don't see any reason why not, and it doesn't seem (by the discussion)
> that anyone is strongly against.
>
> Would you be interested in submitting a pull request to extend
> `string->number`? You'd probably want to extend `number->string` as
> well, and possibly others.
>
> Vincent
>
>
>
> On Thu, 22 Dec 2016 05:51:06 -0500,
> Dmitry Igrishin wrote:
>>
>> >> Why restricting it to 36?
>> >
>> >
>> > I guess that the original poster implied 10 digits + 26 Latin letters for
>> > notation.
>> True. And this notation is used in standard numeric conversion
>> functions in C, C++ and Common Lisp. So, I think it's reasonable to
>> use it in Racket.
>>
>> --
>> 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.

-- 
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] Narrow radix of string->number.

2016-12-27 Thread Vincent St-Amour
I don't see any reason why not, and it doesn't seem (by the discussion)
that anyone is strongly against.

Would you be interested in submitting a pull request to extend
`string->number`? You'd probably want to extend `number->string` as
well, and possibly others.

Vincent



On Thu, 22 Dec 2016 05:51:06 -0500,
Dmitry Igrishin wrote:
> 
> >> Why restricting it to 36?
> >
> >
> > I guess that the original poster implied 10 digits + 26 Latin letters for
> > notation.
> True. And this notation is used in standard numeric conversion
> functions in C, C++ and Common Lisp. So, I think it's reasonable to
> use it in Racket.
> 
> -- 
> 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] mode-lambda and the gl-backend

2016-12-27 Thread Jens Axel Søgaard
Hi All,

I am experimenting with mode-lambda. The example below
shows how to draw sprites on different layers using the software backend.
However I would like to try the gl backend instead.

What is the correct incantation?

/Jens Axel


#lang racket
(require mode-lambda
 mode-lambda/static
 mode-lambda/text/static
 mode-lambda/text/runtime
 mode-lambda/color
 ; mode-lambda/backend/gl
 mode-lambda/backend/software
 racket/draw
 racket/gui/base
 pict
 pict/flash)

;;;
;;; BITMAPS
;;;
(define fish-bm (pict->bitmap (standard-fish  100 50)))
(define lantern-bm  (pict->bitmap (jack-o-lantern 100)))
(define flash-bm(pict->bitmap (colorize (linewidth 5 (outline-flash 100
100)) "yellow")))

;;;
;;; SPRITES
;;;

(define db (make-sprite-db))
(add-sprite!/bm db 'fish(λ() fish-bm))
(add-sprite!/bm db 'lantern (λ() lantern-bm))
(add-sprite!/bm db 'flash   (λ() flash-bm))
(define cdb (compile-sprite-db db))
(define fish-idx(sprite-idx cdb 'fish))
(define lantern-idx (sprite-idx cdb 'lantern))
(define flash-idx   (sprite-idx cdb 'flash))

;;;
;;; LAYERS
;;;
(define W 400)
(define H 400)
(define W/2 (/ W 2.))
(define H/2 (/ H 2.))

(define bgl (layer W/2 H/2)); background: layer 0
(define ml  (layer W/2 H/2)); middle: layer 1
(define fgl (layer W/2 H/2)); foreground: layer 2
(define lc (vector bgl ml fgl)) ; layer config

;;;
;;; RUNTIME
;;;

(define fish-sprite(sprite 200. 200. fish-idx#:layer 0)) ;
background
(define lantern-sprite (sprite 250. 200. lantern-idx #:layer 1)) ; middle
(define flash-sprite   (sprite 250. 200. flash-idx   #:layer 2)) ;
foreground

(define rendering-states->draw (stage-draw/dc cdb W H 3)) ; XXX change 3 to
2 and get a crash

(define draw (rendering-states->draw lc (list fish-sprite lantern-sprite)
(list  flash-sprite)))
(define bm   (make-object bitmap% W H))
(define dc   (new bitmap-dc% [bitmap bm]))
(draw W H dc)
bm

-- 
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] Mobile Friendly HTML in Scribble?

2016-12-27 Thread Michael Rossi
Hi all,

I asked this question over at stackoverflow and this seemed to be the place to 
ask.

I was wondering if there is a built in way to create mobile friendly HTML in 
Scribble?  Given Google's current mobile friendly policy 
(https://webmasters.googleblog.com/2015/04/rolling-out-mobile-friendly-update.html)
 and the fact that devices with small screens are everywhere now, this seems 
like something which would not only make the Racket's documentation look better 
on mobile devices, but for any other HTML generated in Scribble.

I understand I could probably hack on the CSS to create a custom layout (which 
sounds like utter hell), but I was wondering if such a thing already exists or 
is in the works already?  If not, how do we go about making a feature request 
for this?

As an example of what I mean by "non-mobile friendly," if you go to the Racket 
docs on a smartphone, you end up having to zoom in and scroll to the right on 
every page because of the navigation on the left. Sure, it's doable, but it's 
not like going to a page that's like this:

https://w3layouts.com/preview/?l=/mr-hotel-hotel-category-flat-bootstrap-responsive-web-template/

Click on the device pictures on the top to see what I'm getting at.

So, am I correct that Scribble cannot currently do this?  If so, who do we bug 
to get this added?

Thanks everyone!
Michael

-- 
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] IMAP with racket

2016-12-27 Thread Tim Hanson
Thanks for both answers! I'll report back when I've made some progress!

Cheers,

Tim

-- 
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] IMAP with racket

2016-12-27 Thread Matthias Felleisen

> On Dec 27, 2016, at 2:32 AM, Tim Hanson  wrote:
> 
> Hi, I think I'd like to try using racket as a way to explore relatively 
> simple ways of getting a grip on some mail accounts that have gotten out of 
> hand. Specifically I'd like to be able to
> - compute some statistics, such as number of mails from various addresses
> - reorganize / clean-up, say by moving mails into folders according to rules 
> or deleting mails from specific senders older than a given amount
> 
> I have done similar things in the past using built-in functions in mail 
> clients such as outlook or entourage. (If thunderbird supports such functions 
> I could use that now, but I haven't found clues that it does; I even looked 
> at AppleScript and began using it to explore, but quickly got pretty 
> frustrated with the language and its documentation.)
> 
> I like racket, though, and it would seem to be great to be able to try out 
> functions interactively in the REPL.
> 
> My impression on first glance though, was that the built-in IMAP support 
> would require quite a bit of assembly and additions. I also found SirMail, 
> which looks like more than what I need, though presumably I could make use of 
> its foundation parts if I could figure out which and how.
> 
> Might it be appropriate to build something between the IMAP basics and 
> SirMail? Alternatively, is there a brief how-to for SirMail? I found the 
> sources on github and they seemed to work immediately, but I have some 
> questions about set-up. Perhaps I could even help write a brief "how to" with 
> input from the authors?
> 
> (Maybe there are more appropriate, "easier" ways of doing what I want to do 
> that others think of immediately, in which case clues would be appreciated.)


I recently had to download, parse, and pre-grade IMAP folders. Other than 
fiddling with a bunch of flags, it turned out to be a relatively 
straightforward scripting task. What you’re asking for is a scrip that will 
sooner or later turn into an application. Once you have that, I bet it will be 
easy to factor out a library that you can package up and deposit at 
pkgs.racket-lang.org . 

I am appending the module that connected my script to the IMAP server. 

(The script was used by a number of colleagues here, which uncovered a weakness 
in the encoding step of IMAP. If you are using ‘unusual’ passwords, work with 
GIT HEAD instead of 6.7.) 



#lang racket

(provide
 ;; type Message = (list String String String [Listof String])
 
 ;; String String String -> [Listof Message]
 ;; retrieves messages from user's Zimbra CCS email at folder
 retrieve-messages)

;; 
---
;; dependencies

(require net/imap)
(require net/head)

;; 
---
;; implementation 

(define ZIMBRA “…")
(define TLS-1? #true)

(define (retrieve-messages user password folder)
  (define flags '(header body))
  (define-values (imap-connection messages# nu)
(imap-connect ZIMBRA user password folder #:try-tls? TLS-1?))

  (define messages (imap-get-messages imap-connection (build-list messages# 
add1) flags))

  (for/list ((s messages))
(define head (first s))
(define to(bytes->string/utf-8 (extract-field #"to" head)))
(define from  (bytes->string/utf-8 (extract-field #"from" head)))
(define subject   (bytes->string/utf-8 (extract-field #"subject" head)))
(list to from subject (bytes->strings (second s)

;; [Listof Bytes] -> [Listof String]
(define (bytes->strings b)
  (for/list ((l (port->bytes-lines (open-input-bytes b
(bytes->string/utf-8 l)))

-- 
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: New website design feedback

2016-12-27 Thread Dupéron Georges
One small point: I think it was good in the old site to have a link to the 
documentation right at the top, where now there are just "Packages" and 
"Download". We have great documentation (with a great design, thanks to 
Matthew!), better put it forward :)

> 2. Greyed out code snippets - I am not a fan of too much greyed out text or 
> code. It causes unnecessary eye strain. If this has to stay maybe make it not 
> AS GREY as it is right now.

I second that, and the drawings for the first 6 boxes could probably be darker 
too, I find them a bit hard on the eye. Also, I didn't notice the [click for 
more] text at first, maybe make it stand out a bit more?

Finally, is the new design accessible? I think the opacity:0 should still allow 
screen readers to process the hidden text without "hovering", but I'm not 100% 
sure.

-- 
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] mirror.racket-lang.org seems down, and, 301 or 302?

2016-12-27 Thread Dupéron Georges
Greg, maybe you could push a commit to travis-racket, changing the URL to the 
currently-working one, and revert that after the maintenance?

That way the repos which fetch travis-racket on the fly would still build while 
mirror.racket-lang.org is down.

-- 
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: IMAP with racket

2016-12-27 Thread George Neuner
On Mon, 26 Dec 2016 23:32:48 -0800 (PST), Tim Hanson
 wrote:

>Hi, I think I'd like to try using racket as a way to explore 
>relatively simple ways of getting a grip on some mail accounts
>that have gotten out of hand. Specifically I'd like to be able
>to
>- compute some statistics, such as number of mails from various
>  addresses
>- reorganize / clean-up, say by moving mails into folders 
>  according to rules or deleting mails from specific senders 
>  older than a given amount
>
>I have done similar things in the past using built-in functions
>in mail clients such as outlook or entourage. (If thunderbird 
>supports such functions I could use that now, but I haven't found
>clues that it does; I even looked at AppleScript and began using 
>it to explore, but quickly got pretty frustrated with the language
>and its documentation.)

Thunderbird has quite good message filtering (look in the tools menu).
https://support.mozilla.org/en-US/kb/organize-your-messages-using-filters

It won't give you statistics , but it certainly can handle your
organizational needs.


>I like racket, though, and it would seem to be great to be able to
>try out functions interactively in the REPL.
>
>My impression on first glance though, was that the built-in IMAP
>support would require quite a bit of assembly and additions.

Well ... yeah.  Racket's IMAP library does *not* give you a mail
client - it gives you the means to build a mail client.


>I also found SirMail, which looks like more than what I need,
>though presumably I could make use of its foundation parts if I 
>could figure out which and how.
>
>Might it be appropriate to build something between the IMAP basics
>and SirMail? 

It is *always* appropiate to build something new in Racket. 


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