[racket-users] handin server error
Hi, I'm trying to set up a handin server for a class this semester, and I'm getting the weirdest error message from the client side. Here it is: submit error: Error in your code -- file-exists?: `exists' access denied for libobj.so This seems tied to the fact that the submission file requires another file (precisely, it requires 2htdp/image as `(require 2htdp/image)`), and when I remove that it works fine (though obviously inhibits the assignment). Attached are the checker and configuration. Any help would mean a lot! Thanks, Cameron Swords -- 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. checker.rkt Description: Binary data config.rktd Description: Binary data
[racket-users] Re: Sending a file via HTML request.
You could base64 encode the file bytes and stick that into a field in the JSON you send. Why not just send the file directly though? For instance, instead of sending this: POST /somewhere Content-Type: application/json { filename: "foo" content: "Zm9vLGJhcixiYXoNCjEsMSwxDQoyLDIsMg0KMywzLDM=" } Send this: POST /somewhere Content-Type: text/csv foo,bar,baz 1,1,1 2,2,2 3,3,3 -- 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: linespacing in scribble with superscripts
Thanks very much. Very clear answer. I am talking about HTML, indeed. I certainly will try your code. Thanks again, Jos -Original Message- From: Dupéron Georges [mailto:jahvascriptman...@gmail.com] Sent: martes, 23 de agosto de 2016 12:56 To: Racket Users Cc: jos.k...@gmail.com Subject: Re: linespacing in scribble with superscripts Le jeudi 18 août 2016 22:21:37 UTC+2, jos.koot a écrit : > #lang scribble/manual > bla blah blah@(linebreak) > blah blah bla @superscript{blah blah bah}@(linebreak) > bla blah blah > > the linespacing between the first 2 lines is larger > than between the last 2 lines. I suppose you are talking about the HTML output, as LaTeX (used for the PDF output) handles this correctly, unless you start stacking many superscripts, as you noted. I used a quick hack to collapse the element's vertical height in HTML, with `margin-top` and `margin-bottom` set to an arbitrary, large, negative value, and `display: inline-block;` so that the margin is taken into account. Unfortunately, scribble doesn't apply a CSS class to superscript elements, and instead it uses some hard-coded `style="…"` attribute on the element. I therefore suggest overriding the `superscript` function with your own definition. The code below renders as the attached screenshot, and allows you to use the `@original-superscript{…}` if you need. #lang scribble/manual @(require scribble/core scribble/html-properties scribble/latex-properties (only-in scribble/manual [superscript original-superscript])) @(define thin-superscript-css (string->bytes/utf-8 #
Re: [racket-users] Sending a file via HTML request.
Hi, JSON (require json-parsing) see https://docs.racket-lang.org/json-parsing/index.html I've cribbed the HTML below from http://www.w3schools.com/tags/att_input_accept.asp On the web server side this SO response seems to answer, http://stackoverflow.com/questions/20588641/in-racket-how-do-you-allow-file-upload-to-the-web-server #lang web-server/insta (require web-server/formlets) ; start: request -> doesn't return (define (start request) (show-page request)) ; show-page: request -> doesn't return (define (show-page request) ; Response generator (define (response-generator embed/url) (response/xexpr `(html (head (title "File upload example")) (body (h1 "File upload example")) (form ([action ,(embed/url upload-handler)] [method "POST"] [enctype "multipart/form-data"]) ,@(formlet-display file-upload-formlet) (input ([type "submit"] [value "Upload"])) (define (upload-handler request) (define-values (fname fcontents) (formlet-process file-upload-formlet request)) (define save-name (string-append "!uploaded-" fname)) (current-directory WORKINGDIR) (display-to-file fcontents save-name #:exists 'replace) (response/xexpr `(html (head (title "File Uploaded")) (body (h2 "File uploaded") (p ,fname) (h2 "File size (bytes)") (p ,(number->string (file-size save-name))) (send/suspend/dispatch response-generator)) ; file-upload-formlet: formlet (binding?) (define file-upload-formlet (formlet (div ,{(file-upload) . => . binds}) ; (formlet-process file-upload-formlet request) ; returns the file name and contents: (let ([fname (bytes->string/utf-8 (binding:file-filename binds))] [fcontents (binding:file-content binds)]) (values fname fcontents (I've not tried this - I'm not sure it is correct) Note: The accept attribute of the input tag is not supported in Internet Explorer 9 (and earlier versions), and Safari 5 (and earlier). Note: Because of security issues, this example will not allow you to upload files. HTH Stephen On Tuesday, August 23, 2016 at 3:47:05 PM UTC+1, Normal Loone wrote: > No, I don't have it in JSON yet. How do I load a file into JSON in racket? > > It's only a text file, although I like to get it zipped first. -- 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] Sending a file via HTML request.
No, I don't have it in JSON yet. How do I load a file into JSON in racket? It's only a text file, although I like to get it zipped first. -- 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] Sending a file via HTML request.
If the file is in JSON, just read-json and then write-json to the port. > On Aug 23, 2016, at 5:09 AM, Normal Loonewrote: > > Yeah, my main problem is how do I pack the file into a JSON Object and then > send it? > > With (require net/http-client) I could already establish a connection with > (http-conn-sendrecv! hc uri), but All I can send is the empty header of the > http request. > > How do I add the HTML code or the file in the json object within it? > > -- > 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] Re: linespacing in scribble with superscripts
Le jeudi 18 août 2016 22:21:37 UTC+2, jos.koot a écrit : > #lang scribble/manual > bla blah blah@(linebreak) > blah blah bla @superscript{blah blah bah}@(linebreak) > bla blah blah > > the linespacing between the first 2 lines is larger > than between the last 2 lines. I suppose you are talking about the HTML output, as LaTeX (used for the PDF output) handles this correctly, unless you start stacking many superscripts, as you noted. I used a quick hack to collapse the element's vertical height in HTML, with `margin-top` and `margin-bottom` set to an arbitrary, large, negative value, and `display: inline-block;` so that the margin is taken into account. Unfortunately, scribble doesn't apply a CSS class to superscript elements, and instead it uses some hard-coded `style="…"` attribute on the element. I therefore suggest overriding the `superscript` function with your own definition. The code below renders as the attached screenshot, and allows you to use the `@original-superscript{…}` if you need. #lang scribble/manual @(require scribble/core scribble/html-properties scribble/latex-properties (only-in scribble/manual [superscript original-superscript])) @(define thin-superscript-css (string->bytes/utf-8 #
Re: [racket-users] Sending a file via HTML request.
Yeah, my main problem is how do I pack the file into a JSON Object and then send it? With (require net/http-client) I could already establish a connection with (http-conn-sendrecv! hc uri), but All I can send is the empty header of the http request. How do I add the HTML code or the file in the json object within it? -- 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] Racket Shell
> On Aug 22, 2016, at 13:18, Vincent St-Amour> wrote: > > On Mon, 22 Aug 2016 11:38:37 -0500, > Andrew Gwozdziewycz wrote: >> >> This discussion has reminded of SHILL >> (https://www.usenix.org/system/files/conference/osdi14/osdi14-paper-moore.pdf) >> which is less user focused, and more security / capabilities focused, >> but the prototype (in Racket) utilizes contracts to enforce >> capabilities checks. > > Yes, that's really cool work! > > For those interested, Scott will be speaking about Shill at RacketCon[1] > next month. Oh, rad! I will watch out for the video. Sadly, I won't be attending. -- 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.