Re: [racket-users] Using schemas with the 'db' module

2016-10-06 Thread David Storrs
That works perfectly.  Thanks, Ryan.

On Thu, Oct 6, 2016 at 6:42 PM, Ryan Culpepper  wrote:

> In PostgreSQL, clusters contain databases contain schemas.
>
> I think the answer is to use "SET SCHEMA" or the more general "SET
> search_path". See
>
>   https://www.postgresql.org/docs/current/static/ddl-schemas.html
>   https://www.postgresql.org/docs/current/static/sql-set.html
>
> Ryan
>
> On 10/06/2016 06:21 PM, Jon Zeppieri wrote:
>
>> Isn't the #:database parameter in postgresql-connect what you're looking
>> for?
>>
>> On Oct 6, 2016, at 6:12 PM, David Storrs > > wrote:
>>
>> Is it possible to connect to a specific schema in a Postgres database,
>>> or to set the current schema of an existing connection?
>>>
>>> The 'postgresql-connect' function has no parameter for schema...in
>>> fact, the only mention of schemas in the docs for db is in the
>>> Database Catalog section
>>> (https://docs.racket-lang.org/db/query-api.html#%28part._.Da
>>> tabase_.Catalog_.Information%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.
>>>
>>
>> --
>> 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] Using schemas with the 'db' module

2016-10-06 Thread Jon Zeppieri
Ah, my mistake. Thanks!

> On Oct 6, 2016, at 6:42 PM, Ryan Culpepper  wrote:
> 
> In PostgreSQL, clusters contain databases contain schemas.
> 
> I think the answer is to use "SET SCHEMA" or the more general "SET 
> search_path". See
> 
>  https://www.postgresql.org/docs/current/static/ddl-schemas.html
>  https://www.postgresql.org/docs/current/static/sql-set.html
> 
> Ryan
> 
>> On 10/06/2016 06:21 PM, Jon Zeppieri wrote:
>> Isn't the #:database parameter in postgresql-connect what you're looking
>> for?
>> 
>> On Oct 6, 2016, at 6:12 PM, David Storrs > > wrote:
>> 
>>> Is it possible to connect to a specific schema in a Postgres database,
>>> or to set the current schema of an existing connection?
>>> 
>>> The 'postgresql-connect' function has no parameter for schema...in
>>> fact, the only mention of schemas in the docs for db is in the
>>> Database Catalog section
>>> (https://docs.racket-lang.org/db/query-api.html#%28part._.Database_.Catalog_.Information%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.
>> 
>> --
>> 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] Using schemas with the 'db' module

2016-10-06 Thread Ryan Culpepper

In PostgreSQL, clusters contain databases contain schemas.

I think the answer is to use "SET SCHEMA" or the more general "SET 
search_path". See


  https://www.postgresql.org/docs/current/static/ddl-schemas.html
  https://www.postgresql.org/docs/current/static/sql-set.html

Ryan

On 10/06/2016 06:21 PM, Jon Zeppieri wrote:

Isn't the #:database parameter in postgresql-connect what you're looking
for?

On Oct 6, 2016, at 6:12 PM, David Storrs mailto:david.sto...@gmail.com>> wrote:


Is it possible to connect to a specific schema in a Postgres database,
or to set the current schema of an existing connection?

The 'postgresql-connect' function has no parameter for schema...in
fact, the only mention of schemas in the docs for db is in the
Database Catalog section
(https://docs.racket-lang.org/db/query-api.html#%28part._.Database_.Catalog_.Information%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.


--
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] Using schemas with the 'db' module

2016-10-06 Thread Jon Zeppieri
Isn't the #:database parameter in postgresql-connect what you're looking for?

> On Oct 6, 2016, at 6:12 PM, David Storrs  wrote:
> 
> Is it possible to connect to a specific schema in a Postgres database, or to 
> set the current schema of an existing connection?  
> 
> The 'postgresql-connect' function has no parameter for schema...in fact, the 
> only mention of schemas in the docs for db is in the Database Catalog section 
> (https://docs.racket-lang.org/db/query-api.html#%28part._.Database_.Catalog_.Information%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.

-- 
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] Using schemas with the 'db' module

2016-10-06 Thread David Storrs
Is it possible to connect to a specific schema in a Postgres database, or
to set the current schema of an existing connection?

The 'postgresql-connect' function has no parameter for schema...in fact,
the only mention of schemas in the docs for db is in the Database Catalog
section (
https://docs.racket-lang.org/db/query-api.html#%28part._.Database_.Catalog_.Information%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] Scribble, Picts, and Serialize/Deserialize Oddities

2016-10-06 Thread Vincent St-Amour
Wild guess: this may be a bug in record-dc%.

IIRC, DrRacket uses record-dc% when rendering picts, and it would make
sense that serialization would too. But drawing picts directly wouldn't.

The last time I saw that kind of bug (inconsistent pict rendering
between contexts), it turned out that record-dc% was not keeping track
of some properties of the drawing, and so rendering was off when the
recording was rendered.

As a first step, I'd recommend trying to render your pict using a
regular dc and a render-dc, to see if that's where the difference is
coming from. Then, if that's the case, you can see which dc commands
your example runs, and make sure that record-dc records everything about
them faithfully.

Vincent



On Thu, 06 Oct 2016 14:32:19 -0500,
Leif Andersen wrote:
> 
> I have been playing with scribble and serialize/deserialize a bit lately
> in a (somewhat successful) attempt to make my paper build in a
> reasonable amount of time.
> 
> Anyway, I noticed some interesting behavior when Scribble is combined
> with picts and serialize/deserialize. And I'm kind of stumped as to what
> could cause it.
> 
> Take the following file:
> 
> ```
> #lang scribble/manual
> 
> @(require pict
> racket/serialize)
> 
> @(define x
> (vc-append
> (filled-rectangle 30 10 #:color "yellow")
> (filled-rectangle 30 10 #:color "yellow")))
> 
> @x
> 
> @(deserialize (serialize x))
> ```
> 
> This code defines a pict made out of two yellow rectangles stacked on
> top of each other. It makes a document containing these two rectangles,
> followed by the two rectangles after they've been serialized and
> deserialized. Provided that `x` is serializable (which it supposedly
> is), I would imagine that the two pictures would look the same. Instead
> however, it ends up looking like this. (The PDF file is also attached).
> Inline image 1
> Note how after its been serialized and deserialized, the two rectangles,
> appear slightly further apart and have a doubly thick line.
> 
> For what its worth, if I have DrRacket draw the pict it always shows up
> like the bottom rectangle.
> 
> Both of these images make sense (depending on how we intemperate
> border), but I'm a bit confused why it would show up differently after
> being serialized and deserialized. Any ideas?
> 
> Thank you.
> 
> ~Leif Andersen 
> 
> -- 
> 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] Scribble, Picts, and Serialize/Deserialize Oddities

2016-10-06 Thread Leif Andersen
I have been playing with scribble and serialize/deserialize a bit lately in
a (somewhat successful) attempt to make my paper build in a reasonable
amount of time.

Anyway, I noticed some interesting behavior when Scribble is combined with
picts and serialize/deserialize. And I'm kind of stumped as to what could
cause it.

Take the following file:

```
#lang scribble/manual

@(require pict
  racket/serialize)

@(define x
   (vc-append
(filled-rectangle 30 10 #:color "yellow")
(filled-rectangle 30 10 #:color "yellow")))

@x

@(deserialize (serialize x))
```

This code defines a pict made out of two yellow rectangles stacked on top
of each other. It makes a document containing these two rectangles,
followed by the two rectangles after they've been serialized and
deserialized. Provided that `x` is serializable (which it supposedly is), I
would imagine that the two pictures would look the same. Instead however,
it ends up looking like this. (The PDF file is also attached).
[image: Inline image 1]
Note how after its been serialized and deserialized, the two rectangles,
appear slightly further apart and have a doubly thick line.

For what its worth, if I have DrRacket draw the pict it always shows up
like the bottom rectangle.

Both of these images make sense (depending on how we intemperate border),
but I'm a bit confused why it would show up differently after being
serialized and deserialized. Any ideas?

Thank you.

~Leif Andersen

-- 
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.


sertest.pdf
Description: Adobe PDF document


[racket-users] Handin Issues

2016-10-06 Thread mattsap
So, I've been playing around with the handin server these days.

My purposes of the handin require students to submit images using the htdp 
image and universe libraries.

First, I would like to note that for the images, you must turn off 
textualization/create-text in your checker:

(check:
   ; Get timestamp of the submission and add it to header and report
   :language 'racket
   :requires '(bsl-plus-image)  
   
   :create-text? #f
   :textualize? #f

My issues follow:

1) Initially, there is a conflict with one of the image functions and another 
function provided by the language. I fixed this by adding the package as 
suggested in the other thread. We're still waiting to see if the checker 
sandbox has updated in order to see if there's been an update. (see here for 
more detail: https://groups.google.com/forum/#!topic/racket-users/twViz38AL7M)

2) Afterwards, there is a permission denied error:
[2|2016-10-06T09:49:28] ERROR: Error in your code --
[2|2016-10-06T09:49:28] file-exists?: `exists' access denied for libobj.dylib

This can be solved using this hacky solution in this thread:
https://groups.google.com/forum/?fromgroups#!searchin/racket-users/libobj%7Csort:relevance/racket-users/W_-4aN7kPyI/cwgwz2xIBAAJ

As of now, I expose my path. I'm not sure how to create a better solution than 
the one mentioned stating to add the following lines at the top of your 
checker.rkt
(module checker handin-server/checker
  (require handin-server/grading-utils)

  (require handin-server/sandbox)
  (sandbox-path-permissions
   (cons
(list 'read "/")
(sandbox-path-permissions)))

3) Finally, I found a very serious issue in the collection's handin server 
code. students are not able to submit because of the server was trying to write 
to a grading/text.rkt even though I specified not to! I've traced the issue to 
the collection's handin server.

>From (collection-path "handin-server"), 

/Library/Racket/6.6/pkgs/handin/handin-server/checker.rkt:

Starting around line 467 the below code is the culprit!
Essentially, at the bottom of the below segment, regardless if you checked if 
you were creating a text file in your checker.rkt, it will attempt to write the 
text with the below code:
 (when (thread-cell-ref added-lines) (write-text))

Essentially, to fix this issue, you may replace it with
 (when (and (thread-cell-ref added-lines) create-text?) (write-text))

;; 
 ;; convert to text, evaluate, check
 (define (check users submission)
   (define text-file (format "grading/text.~a" suffix))
   (define (prefix-line str)
 (printf "~a~a\n" markup-prefix str))
   (define generic-substs `(("submission" . ,submission-dir)))
   (define (prefix-line/substs str)
 (prefix-line (subst str generic-substs)))
   (define (write-text)
 (set-run-status "creating text file")
 (with-output-to-file text-file #:exists 'truncate
   (lambda ()
 (for ([user (in-list users)])
   (prefix-line (user-substs user student-line)))
 (for-each prefix-line/substs extra-lines)
 (for-each prefix-line/substs
   (cond [(thread-cell-ref added-lines)
  => unbox]
 [else '()]))
 (display submission-text
   (define submission-text
 (and create-text?
  (begin (set-run-status "reading submission")
 ((if multi-file
(unpack-multifile-submission
 names-checker output-file)
submission->bytes)
  submission maxwidth textualize? untabify?
  markup-prefix prefix-re
   (define (uem-handler e)
 (let ([m (if (exn? e) (exn-message e) (format "~a" e))])
   (cond
 [(procedure? uem) (uem m)]
 [(not (string? uem))
  (error* "badly configured user-error-message")]
 [(regexp-match? #rx"~[aesvAESV]" uem) (error* uem m)]
 [else (error* "~a" uem)])))
   (when create-text? (make-directory "grading") (write-text))
   (when value-printer (current-value-printer value-printer))
   (when coverage? (sandbox-coverage-enabled #t))
   (set-run-status "checking submission")
   (cond
 [(not eval?) (let () body ...)]