[racket-users] Re: Splitting up a GUI source file?

2018-03-24 Thread Alex Harsanyi
The "traditional" way of doing this in other languages and GUI toolkits is 
to
have a separate class for each of your panes (Books, Users and Rentals).  
The
constructor would receive the parent widget and other initialization
parameters (e.g. a database connection). Something like this:

;; books-panel.rkt
(define books-panel%
  (class object%
(init-field parent)

(define books-panel (new vertical-panel% [parent parent]))
(define books-table (new list-view% [parent books-pane]))
(define books-buttons-pane (new horizontal-pane% [parent 
books-panel]))
(define add-button (new button% [parent books-buttons-pane]))
(define remove-button (new button% [parent books-buttons-pane]))
(define rent-button (new button% [parent books-buttons-pane]))

;; other books panel init code and specific callbacks here

))
(provide books-panel%)

;; main.rkt
(require "books-panel.rkt")
(define main-window (new frame% [label "Library"]))
(define main-tab-view (new tab-panel% [parent main-window]))

(define books-panel (new books-panel% [parent main-tab-view]))

I found this approach to work well in Racket.  One big advantage of doing it
like this is that you can work independently on the sub components without
having to recompile / start the entire application -- this becomes important
once your application starts to reach a non trivial size.  For example, if 
you
want to just work on the books-panel% object, you could create a simple
scratch file:

;; scratch.rkt
(require "books-panel.rkt")
(define main-window (new frame% [label "Library"]))
(define books-panel (new books-panel% [parent main-window]))

Which would just load that component, resulting in a faster edit-compile-run
cycle.

Best Regards,
Alex.

-- 
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] Unexpected error when building standalone Racket executable

2018-03-24 Thread Alex Harsanyi


On Saturday, March 24, 2018 at 9:42:02 PM UTC+8, Matthew Flatt wrote:
>
>
> Can you try a recent snapshot from http://pre.racket-lang.org/ and 
> check whether it works for you? 
>

Hi Matthew ,

I installed version 6.90.0.23 and indeed the problem is fixed. I will use 
this version until the next Racket release comes out.

Thanks for looking into this. I spent several hours using git bisect on 
both the plot package and ActivityLog, with no success. I assumed it was 
something I have done, or needed to do to get it to compile.

Best Regards,
Alex.



> Thanks, 
> Matthew 
>
> At Thu, 22 Mar 2018 22:31:11 -0700 (PDT), Alex Harsanyi wrote: 
> > I started getting some unexpected and unexplained errors from Racket 
> when 
> > trying to build a stand alone executable.  The versions is: Racket 6.12 
> > 64bit 
> > on Windows 10. 
> > 
> > If I try to run my application from Racket, it runs with no problems. 
> > 
> > If I build an executable and try to run it, I get the following error (I 
> can 
> > confirm that runtime.rkt does exist at the mentioned location and it is 
> > readable): 
> > 
> > link: namespace mismatch; 
> >  reference to a module that is not available 
> >   reference phase: 1 
> >   referenced module: "C:\Program 
> > Files\Racket\collects\racket\match\runtime.rkt" 
> >   referenced phase level: 0 
> >   reference in module: '#%embedded:g233745:free-variance 
> >   in: match:error 
> > 
> > If I build a distribution (a stand alone executable with all the 
> > dependencies 
> > packed in), I get the following error: 
> > 
> > standard-module-name-resolver: collection not found 
> >   for module path: racket/match/gen-match 
> >   collection: "racket/match" 
> >   in collection directories: 
> >C:\Users\Alex\AppData\Roaming\Racket\6.12\collects 
> > 
> > C:\Users\Alex\Projects\ActivityLog2\dist\lib\plt\ActivityLog2\collects 
> >C:\Users\Alex\AppData\Roaming\Racket\6.12\pkgs\plot 
> >C:\Users\Alex\AppData\Roaming\Racket\6.12\pkgs\plot-doc 
> >C:\Users\Alex\rkt-libs\plot\plot-lib 
> >C:\Users\Alex\rkt-libs\plot\plot-gui-lib 
> > 
> > I tried reinstalling Racket and cleaned up the entire 
> AppData/Roaming/Racket 
> > directory, but the problem persits.  I also tried several previous 
> revisions 
> > of my application (which I know worked fine) and they also fail with the 
> > same 
> > errors.  I'm not sure what change caused the error to happen, as I 
> didn't 
> > make 
> > any changes to my Racket installation in the past few weeks. 
> > 
> > The problem only seems to happen if I use the development version of the 
> > plot 
> > package and not with a clean Racket installation -- however I have used 
> the 
> > development version of the plot package for more than 2 months with no 
> > issues. 
> > 
> > As I mentioned before, this only seems to happen when I create an 
> > executable, 
> > the application works fine if run it from Racket. 
> > 
> > Could someone explain to me what these errors mean and what should I do 
> to 
> > find the root cause, so I can fix this? 
> > 
> > Thanks, 
> > Alex. 
> > 
> > -- 
> > 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 . 
> > 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] sharing an awesome plot - warms the cockles of my heart

2018-03-24 Thread Stephen Chang
For those who don't have drracket handy: http://pasterack.org/pastes/59296

On Mar 24, 2018 4:26 PM, "Jos Koot"  wrote:
>
> Very nice,
> Jos Koot
>
> 
> From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
> Behalf Of Sanjeev Sharma
> Sent: 23 March 2018 22:17
> To: Racket Users
> Subject: [racket-users] sharing an awesome plot - warms the cockles of my 
> heart
>
> I've done no math in 20 years - used to do tons (with the not so great 
> graphics of the time) saw this intriguing plot & banged my head against a 
> wall for a couple of hours.
>
> Then I just settled down & read the manual systematically, pretending it may 
> have some info,  followed the examples and voila
>
> (require plot)(plot-new-window? #t)
> (define(xu u)(*(sin(* 33 u))(cos(* 9 u
> (define(yu u)(*(sin(* 49 u))(sin(* 7 u
> (plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));
>
>
> --
> 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] Splitting up a GUI source file?

2018-03-24 Thread HiPhish
Thank you for the paper. I had come across units several times, but I could 
never figure out *what* their intention was from the documentation. The 
paper has at least made their motivation clear, I still have to figure out 
how to actually use this feature now.

On Friday, March 23, 2018 at 6:33:27 PM UTC+1, Matthias Felleisen wrote:
>
> ...
>

-- 
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] The Nitty Gritty of Pixels, Pens, and Lines example output

2018-03-24 Thread Stephen Smith
Hi Everyone,

When running the following example from the Racket docs section titled 'The 
Nitty Gritty of Pixels, Pens, and Lines':

(define p1 (make-pen "black" 1 "solid" "round" "round"))

(rectangle 20 20 "outline" p1)

instead of a rectangle with all four sides drawn with equal thickness as 
shown in the example output, I get the top and left sides drawn with 1 
pixel and the right and bottom sides are drawn as gray lines. I'm running 
it in DrRacket (v6.12). 

I suspected that DrRacket was cropping the image in the interactions area 
so I did this:

(overlay/align "middle" "middle" (rectangle 20 20 "outline" p1) (rectangle 
40 40 "outline" p1))

and sure enough, the inner rectangle appeared with all four sides having 
equal thickness, as shown in the example.

The cropping of the image in DrRacket might not be obvious to the reader 
working along with the examples (even though that is, in essence, the 
subject of this section :-). Should something be put in the docs to clarify 
this? Perhaps add a snippet similar to what I created with the 
overlay/align function and mention that DrRacket will crop the outer 
rectangle in the interactions area? I know this seems to go against the 
'writing style' used in the docs but I believe most users will be following 
along with DrRacket. Maybe a sidebar mention would be worthwhile to avoid 
initial confusion?

Regards,
Stephen.


-- 
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] sharing an awesome plot - warms the cockles of my heart

2018-03-24 Thread Jos Koot
Very nice,
Jos Koot

  _  

From: racket-users@googlegroups.com [mailto:racket-users@googlegroups.com] On 
Behalf Of Sanjeev Sharma
Sent: 23 March 2018 22:17
To: Racket Users
Subject: [racket-users] sharing an awesome plot - warms the cockles of my heart


I've done no math in 20 years - used to do tons (with the not so great graphics 
of the time) saw this intriguing plot & banged my
head against a wall for a couple of hours.

Then I just settled down & read the manual systematically, pretending it may 
have some info,  followed the examples and voila

(require plot)(plot-new-window? #t)
(define(xu u)(*(sin(* 33 u))(cos(* 9 u
(define(yu u)(*(sin(* 49 u))(sin(* 7 u
(plot(parametric(λ(t)(vector(xu t)(yu t)))0 1));




-- 
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] Unexpected error when building standalone Racket executable

2018-03-24 Thread Matthew Flatt
Hi Alex,

I'm able to replicate the problem using Racket v6.12, the latest "plot"
package, and your https://github.com/alex-hhh/ActivityLog2 repo.

But things seem to work correctly when pairing the latest "plot" with
the current development version of Racket, v6.90.x. It's possible that
the new module and macro-expander implementation in v6.90.x fixes the
problem, since it's related to module instantiation.

Can you try a recent snapshot from http://pre.racket-lang.org/ and
check whether it works for you?

Thanks,
Matthew

At Thu, 22 Mar 2018 22:31:11 -0700 (PDT), Alex Harsanyi wrote:
> I started getting some unexpected and unexplained errors from Racket when
> trying to build a stand alone executable.  The versions is: Racket 6.12 
> 64bit
> on Windows 10.
> 
> If I try to run my application from Racket, it runs with no problems.
> 
> If I build an executable and try to run it, I get the following error (I can
> confirm that runtime.rkt does exist at the mentioned location and it is
> readable):
> 
> link: namespace mismatch;
>  reference to a module that is not available
>   reference phase: 1
>   referenced module: "C:\Program 
> Files\Racket\collects\racket\match\runtime.rkt"
>   referenced phase level: 0
>   reference in module: '#%embedded:g233745:free-variance
>   in: match:error
> 
> If I build a distribution (a stand alone executable with all the 
> dependencies
> packed in), I get the following error:
> 
> standard-module-name-resolver: collection not found
>   for module path: racket/match/gen-match
>   collection: "racket/match"
>   in collection directories:
>C:\Users\Alex\AppData\Roaming\Racket\6.12\collects
>
> C:\Users\Alex\Projects\ActivityLog2\dist\lib\plt\ActivityLog2\collects
>C:\Users\Alex\AppData\Roaming\Racket\6.12\pkgs\plot
>C:\Users\Alex\AppData\Roaming\Racket\6.12\pkgs\plot-doc
>C:\Users\Alex\rkt-libs\plot\plot-lib
>C:\Users\Alex\rkt-libs\plot\plot-gui-lib
> 
> I tried reinstalling Racket and cleaned up the entire AppData/Roaming/Racket
> directory, but the problem persits.  I also tried several previous revisions
> of my application (which I know worked fine) and they also fail with the 
> same
> errors.  I'm not sure what change caused the error to happen, as I didn't 
> make
> any changes to my Racket installation in the past few weeks.
> 
> The problem only seems to happen if I use the development version of the 
> plot
> package and not with a clean Racket installation -- however I have used the
> development version of the plot package for more than 2 months with no 
> issues.
> 
> As I mentioned before, this only seems to happen when I create an 
> executable,
> the application works fine if run it from Racket.
> 
> Could someone explain to me what these errors mean and what should I do to
> find the root cause, so I can fix this?
> 
> Thanks,
> Alex.
> 
> -- 
> 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.