Re: [racket] Reading drracket files into text%

2010-08-31 Thread Eli Barzilay
One way to get things done "properly" is to submit the file through the server, then on the server you get it in exactly the same format that all files are saved. You could maybe even arrange this to happen automatically, using symlinks to the file from the published name to the one that you submi

Re: [racket] Reading drracket files into text%

2010-08-31 Thread Robby Findler
On Tue, Aug 31, 2010 at 2:14 PM, Matthias Felleisen wrote: > > Would this help: > > ;; String (instance Text%) -> Void > ;; load the content of file f into text editor t, > ;; strip meta-data in first three lines > (define (load f t) >  (send t load-file f) >  (define txt (send t get-text)) >  (de

Re: [racket] Reading drracket files into text%

2010-08-31 Thread Robby Findler
Ah. Well, I guess the right thing to do is to just chop the first three lines out of the file. You should probably check for some keyword in the header file to make sure that it really is the header generated by drracket. If the file contains images, then the three lines of header will be encoded

Re: [racket] Reading drracket files into text%

2010-08-31 Thread Matthias Felleisen
p.s. In that case, just read and strip the first three lines. See 'load'. On Aug 31, 2010, at 3:13 PM, Ryan Golbeck wrote: > I'm modifying the handin-server collection to include an option where > our students can retrieve "starter" files for assignments and labs. > Since these files will be s

Re: [racket] Reading drracket files into text%

2010-08-31 Thread Matthias Felleisen
Would this help: ;; String (instance Text%) -> Void ;; load the content of file f into text editor t, ;; strip meta-data in first three lines (define (load f t) (send t load-file f) (define txt (send t get-text)) (define inp (open-input-string txt)) (define fst (read-line inp)) (def

Re: [racket] Reading drracket files into text%

2010-08-31 Thread Ryan Golbeck
I'm modifying the handin-server collection to include an option where our students can retrieve "starter" files for assignments and labs. Since these files will be saved on the server directly from DrRacket, rather than through the handin infrastructure, the files include these three lines of meta

Re: [racket] Reading drracket files into text%

2010-08-31 Thread Robby Findler
You have to specially remove those lines yourself in that case. But if you say a little more about why you want to read something into a text% object, I may give a different answer (it isn't clear what you want to do with this stuff). Robby On Tue, Aug 31, 2010 at 1:49 PM, Ryan Golbeck wrote: >

[racket] Reading drracket files into text%

2010-08-31 Thread Ryan Golbeck
What's the proper way to read a file produced by DrRacket into a text% object? Using load-file produces problems when DrRacket has created a file where the first three lines contain meta data information about the language to use. Thanks, -ryan _