Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

hard coded somewhere?

 [1/7] from: ammoncooke::yahoo::com at: 28-May-2001 17:35


Hi, Using the foreach line example from Core.pdf I get this: jobfile: request-file/filter "*.jbs" /file "jobs.jbs" file-jobs: read/lines file jobfile foreach line file-jobs [ append jobs/data copy line ] fix-slider jobs show jobs it always gives me the same data in 'jobs' (which happens to be a text-list) no matter what file I tell it to open. Why?? Thanks!! Ammon

 [2/7] from: gjones05:mail:orion at: 28-May-2001 19:19


From: "Ammon Cooke"
> Hi, > Using the foreach line example from Core.pdf I get this:
<<quoted lines omitted: 10>>
> Thanks!! > Ammon
Depending the sequence of your code (I don't believe all of it was in your message), you will want to clear the data store for the list before reusing it. The simplist course may be to: ... jobs/data: copy [] ;add this line to clear this buffer foreach line file-jobs [ append jobs/data copy line ] Hopefully that will fix the problem. :-) --Scott Jones

 [3/7] from: ammoncooke::yahoo at: 28-May-2001 18:33


Nope. That left me with nothing in the list! Here is the complete source code, it is kinda long though: REBOL[ title: "Job Giver" Author: "Ammon Cooke" Date: "5-21-01" Purpose: "To randomly pass out jobs." ] fix-slider: func [faces [object! block!]] [ foreach list to-block faces [ list/sld/redrag list/lc / max 1 length? head list/lines ] ] creation: layout[ style lab label 100 right ;offset 100x100 across backdrop effect [gradient 0x1 gray] at 30x30 box 115x115 effect [gradient 2x2 50.0.12.123.53.12] at 10x10 box 115x115 effect [gradient 2x2 200.0.0 0.0.100] at 12x10 banner "Job Giver" at 15x40 vh4 bold italic 125 {Random Job Giving!!} at 100x15 lab "Jobs:" jobs: text-list 200x105 'default.txt' at 147x35 button "Save" 50x25 at 147x65 button "Get" 50x25 [ jobfile: request-file/filter "*.jbs" /file "jobs.jbs" file-jobs: read/lines file jobfile foreach line file-jobs [ append jobs/data line ] fix-slider jobs show jobs ] at 147x95 button "Del" 50x25 [ remove find jobs/data jobs/picked jobs/data: head jobs/data fix-slider jobs show jobs ] at 10x235 box 310x35 effect [gradient 2x2 blue] at -50x240 lab "Jobs:" jobadd: field 200x25 at 263x240 button "Add" 50x25 [ if not jobadd/data = ""[ append jobs/data copy jobadd/data fix-slider jobs show jobs ] ] at 100x125 lab "People:" ppl: text-list 200x107 at 147x145 button "Save" 50x25 at 147x175 button "Get" 50x25 [ pplfile: request-file/filter "*.ppl" /file "people.ppl" fileppl: read/lines file pplfile ppl/data: copy[] foreach pplline fileppl [ append ppl/data copy pplline ] fix-slider ppl show ppl ] at 147x205 button "Del" 50x25 [ remove find ppl/data ppl/picked ppl/data: head ppl/data fix-slider ppl show ppl ] at 10x275 box 323x35 effect [gradient 2x2 blue] at -37x280 lab "People:" ppladd: field 200x25 at 275x280 button "Add" 50x25 [ if not ppladd/data = ""[ append ppl/data copy ppladd/data fix-slider ppl show ppl ] ] at 400x15 lab "Generated:" gen: list 400X210 [ origin 0 across text 200 text 200 ] at 423x35 button "Generate" 75x25 [ numjobs: jobs/text: to-integer length? jobs/data numppl: ppl/text: to-integer length? ppl/data data: [ [theppl thejob] ] either numjobs <= numppl [ for i 0 numjobs 1 [ theppl: ppl/text: random/only ppl/data thejob: jobs/text: random/only jobs/data append gen/data copy data remove ppl/lines theppl ;append gen/lines thejob remove jobs/lines thejob ] fix-slider jobs fix-slider ppl fix-slider gen show jobs show ppl show gen ][ for i 0 numppl 1 [ theppl: ppl/text: random/only ppl/data thejob: jobs/text: random/only jobs/data append gen/lines copy theppl remove ppl/lines theppl append gen/lines copy thejob remove jobs/lines thejob ] fix-slider jobs fix-slider ppl fix-slider gen show jobs show ppl show gen ] ] at 423x65 button "Multi-Gen" 75x25 at 423x95 button "Print" 75x25 at 423x125 button "Save" 75x25 ] view/offset: creation 100x100 Thanks!! Ammon

 [4/7] from: agem:crosswinds at: 29-May-2001 2:29


>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<
Am 28.05.01, 10:35:39, schrieb "Ammon Cooke" <[ammoncooke--yahoo--com]> zum Thema [REBOL] hard coded somewhere?:
> Hi, > Using the foreach line example from Core.pdf I get this:
<<quoted lines omitted: 6>>
> show jobs > it always gives me the same data in 'jobs' (which happens to be a
text-list) no matter what file I tell it to open. Why?? ;we check probe jobfile: request-file/filter/file "*.jbs" "jobs.jbs" ; (/file this way) request-file returns a block of files, so jobfile: first request-file/filter/file "*.jbs" "jobs.jbs" but then the result can be too [] if file-fields is empty and window closed none if cancel-button, so you should check that before selection: request-file/filter/file "*.jbs" "jobs.jbs" either all[not none? Selection not empty? Selection][ jobfile: first selection ;work with it request/ok mold jobfile ][request/ok "oops, you didnt like my files?"] bit complicated.. (all[selection selection/1] ;works too ;-)
> Thanks!! > Ammon
have fun :) -volker

 [5/7] from: agem:crosswinds at: 29-May-2001 6:25


>>>>>>>>>>>>>>>>>> Ursprüngliche Nachricht <<<<<<<<<<<<<<<<<<
Am 29.05.01, 01:19:07, schrieb "GS Jones" <[gjones05--mail--orion--org]> zum Thema [REBOL] Re: hard coded somewhere?:
> From: "Ammon Cooke" > > Hi,
<<quoted lines omitted: 17>>
> Depending the sequence of your code (I don't believe all of it was in > your message), you will want to clear the data store for the list
before
> reusing it. The simplist course may be to: > ...
<<quoted lines omitted: 3>>
> ] > Hopefully that will fix the problem. :-)
I think it will continue to fail :) my previous post showed, that request-file returns a block. But then this line should throw an error, not read data..:
> > file-jobs: read/lines file jobfile
hehe.
> > file-jobs: read/lines jobfile
this would throw the error ;-) Hi Ammon, you are allways reading the same 'FILE, not the one you request-file'd. Rebol reads it (file-jobs: read/lines file) jobfile and throws jobfile away. Congratulation! You caught me! ;-)
> --Scott Jones
-Volker

 [6/7] from: gjones05:mail:orion at: 29-May-2001 5:50


From: "Volker Nitsch"
> Ursprüngliche Nachricht <
I kept meaning to look this up. This time I took it to the deBabelizer and discovered that this mysterious phrase should have been 'obvious': Ursprüngliche Nachricht = "Original message" As we say, inquiring minds want to know.
> > From: "Ammon Cooke" > > > Using the foreach line example from Core.pdf I get this:
<<quoted lines omitted: 10>>
> > > happens to be a text-list) no matter what file I tell > > > it to open. Why??
From: "Volker Nitsch"
> I think it will continue to fail :) > my previous post showed, that request-file returns a block.
<<quoted lines omitted: 9>>
> and throws jobfile away. > Congratulation! You caught me! ;-)
Yes, sometimes the simplest of 'bugs' can be the hardest to see. Not with standing the more obvious error, I do believe that Ammon will need to clear the data block in order to get rid of the original data, and copying a fresh empty block seems the simpliest way to do it. Thanks, Volker! --Scott Jones

 [7/7] from: ammoncooke:ya:hoo at: 29-May-2001 17:45


Thanks!! This list is very helpful! I have fixed my problem by changing: file-data: read/lines file data to: file-data: read/lines file: data The colon almost isn't noticeable. ;) Ammon ----- Original MessagHie -----

Notes
  • Quoted lines have been omitted from some messages.
    View the message alone to see the lines that have been omitted