[REBOL] Some niggley things Re:(5)

2000-03-09 Thread icimjs

Hi Donald,

you wrote:
What I really wanted to know was how to use a set-word!. The reason is that,
if the program has an error and stops, the console is still set for a changed
directory path. This is very annoying, since, to re-run the program, I
have to
change-dir again and again:

  list-path: %/drive/folder/folder/
  list: READ path

with "list" containing the dir-list block. I didn't get this working yet.

I must be missing something! This wouldn't work for you, right?

 set 'path %/d/temp/
== %/d/temp/
 list: read path
== [%save_NewFrames/ %funky/ %tcl-v7/ %snapshots/ %lynx_w32_2_8_2rel_1.zip
%yikes131.zip...

BTW, here you see how my temp file has changed since the last test ;-)

If you're using words that referece the directory names:

 drive: 'd
== d
 folder-1: 'temp
== temp
 folder-2: 'funky
== funky

 set 'path to file! reduce ["/" drive folder-1 folder-2]
== %/d/temp/funky
 append :path #"/"
== %/d/temp/funky/
 read path
== [%schema.DAT %LATEST.LOG %DECISION_TAB.LOG]

Hope this REALLY helps,


;- Elan  [: - )]



[REBOL] Some niggley things Re:(2)

2000-03-09 Thread VoToNi

In einer eMail vom 09.03.00 06:33:20 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

 
  #2
  "files" (above) will, eventually, be a block of about 300 file names. I 
 need
  to know how to take five file names at a time and make a string that is:
  "name+name+name+name+name", to add to a URL.
  
  One possibility would be:
  
   files: [%a %b %c %d %e %f %g %h %i %j]
   foreach [f-1 f-2 f-3 f-4 f-5] files [ 
print mold to string! 
   reduce [f-1 "+" f-2 "+" f-3 "+" f-4 "+" f-5] ]
  
  which results in:
  
  "a+b+c+d+e"
  "f+g+h+i+j"
  
  ;- Elan  [: - )]
  
with 
files: [%a %b %c %d %e %f %g %h %i %j %k] ; ( 11 // 5  0)
gives
"a+b+c+d+e"
"f+g+h+i+j"
"k+none+none+none+none"

Volker



[REBOL] Some niggley things Re:(3)

2000-03-09 Thread ddalley


On 09-Mar-00, [EMAIL PROTECTED] wrote:
 In einer eMail vom 09.03.00 06:33:20 (MEZ) Mitteleuropäische Zeit schreibt 
 [EMAIL PROTECTED]:

 with 
 files: [%a %b %c %d %e %f %g %h %i %j %k] ; ( 11 // 5  0)
 gives
 "a+b+c+d+e"
 "f+g+h+i+j"
 "k+none+none+none+none"

A good point, but "none" is handled by the server.

-- 

---===///||| Donald Dalley |||\\\===---
 The World of AmiBroker Support
  http://webhome.idirect.com/~ddalley
  UIN/ICQ#: 65203020



[REBOL] Some niggley things Re:(2)

2000-03-09 Thread ddalley


Hello, Elan:

On 09-Mar-00, [EMAIL PROTECTED] wrote:

 One possibility would be:

  files: [%a %b %c %d %e %f %g %h %i %j]
  foreach [f-1 f-2 f-3 f-4 f-5] files [ 
   print mold to string! 
  reduce [f-1 "+" f-2 "+" f-3 "+" f-4 "+" f-5] ]

 which results in:

 "a+b+c+d+e"
 "f+g+h+i+j"

 Hope this helps,

What I ended up using was:

   FOREACH [f-1 f-2 f-3 f-4 f-5] files [ 
 portfolio: MOLD TO STRING!
 REDUCE [f-1 "+" f-2 "+" f-3 "+" f-4 "+" f-5]

When I do it this way, I get a string. That's what I told it to do.

This causes an error, and the page is returned minus the first and last (f-1 
f-5) entries. When the quote marks are removed after copying the completed URL
into the brower, it works fine, so the quote marks are the problem.

   tmp: READ JOIN QAN-URL [ "?tick=" portfolio decimals ]

Hmm, this is the *same line* used elswhere in the program, which worked last
night. Am I missing something?

In what form can I get the above "string" without quotes, so that I can build
the URL properly?

-- 

---===///||| Donald Dalley |||\\\===---
 The World of AmiBroker Support
  http://webhome.idirect.com/~ddalley
  UIN/ICQ#: 65203020



[REBOL] Some niggley things Re:(3)

2000-03-09 Thread icimjs

At 06:15 PM 3/9/00 +, you wrote:

Hello, Elan:

On 09-Mar-00, [EMAIL PROTECTED] wrote:

 One possibility would be:

  files: [%a %b %c %d %e %f %g %h %i %j]
  foreach [f-1 f-2 f-3 f-4 f-5] files [ 
   print mold to string! 
  reduce [f-1 "+" f-2 "+" f-3 "+" f-4 "+" f-5] ]

 which results in:

 "a+b+c+d+e"
 "f+g+h+i+j"

 Hope this helps,

What I ended up using was:

   FOREACH [f-1 f-2 f-3 f-4 f-5] files [ 
 portfolio: MOLD TO STRING!
 REDUCE [f-1 "+" f-2 "+" f-3 "+" f-4 "+" f-5]

When I do it this way, I get a string. That's what I told it to do.

This causes an error, 

Which error? A REBOL error?

and the page is returned 

which page returned where?

minus the first and last (f-1 
f-5) entries. 

If it causes an error, how is anything returned? Oh, it's not a REBOL error?

When the quote marks are removed after copying the completed URL
into the brower, it works fine, so the quote marks are the problem.

   tmp: READ JOIN QAN-URL [ "?tick=" portfolio decimals ]

note that I used the "print mold " expression only for demonstration
purposes: so that you can see exactly what is being returned, namely a
string "..." containing the file values %x and plus signs.

If you want to use the stuff somehow (I don't know what the URL you are
returning has to look like, you will need to join the stuff with the url,
and the final result should be one value, including all information, of
type url!. As in

read join http://www.some-site.com/ [""]. See, I don't know whether you
plan to read the files and report the contents of those files to the URL
you are addressing, or whether you want to send a list of file names to the
url, in which case you possibly do not want to include the leading percent
sign, if the server side program does not know that % is REBOL's way of
saying literal file! type.


Hmm, this is the *same line* used elswhere in the program, which worked last
night. Am I missing something?

I guess it is. 


In what form can I get the above "string" without quotes, so that I can build
the URL properly?

 join http://www.some-site.com/ ["a+b+c+d+e"]
== http://www.some-site.com/a+b+c+d+e


 type? join http://www.some-site.com/ ["a+b+c+d+e"]
== url!

Hope this helps,



;- Elan  [: - )]



[REBOL] Some niggley things Re:(3)

2000-03-09 Thread VoToNi

In einer eMail vom 10.03.00 00:35:31 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

 What I ended up using was:
  
 FOREACH [f-1 f-2 f-3 f-4 f-5] files [ 
   portfolio: MOLD TO STRING!
   REDUCE [f-1 "+" f-2 "+" f-3 "+" f-4 "+" f-5]
  
  When I do it this way, I get a string. That's what I told it to do.
  
  This causes an error, and the page is returned minus the first and last 
(f-1 
 
  f-5) entries. When the quote marks are removed after copying the completed 
 URL
  into the brower, it works fine, so the quote marks are the problem.
  
 tmp: READ JOIN QAN-URL [ "?tick=" portfolio decimals ]
  
  Hmm, this is the *same line* used elswhere in the program, which worked 
last
  night. Am I missing something?
  
  In what form can I get the above "string" without quotes, so that I can 
 build
  the URL properly?
  
  
maybe probe some values for us?!
Note,
 print to-string [1 2]
12
 print mold to-string [1 2]
"12"
Maybe simply no mold (which says "make rebol-code from it, quote strings") ?

Volker



[REBOL] Some niggley things Re:(6)

2000-03-09 Thread ddalley


On 09-Mar-00, [EMAIL PROTECTED] wrote:

   list-path: %/drive/folder/folder/
   list: READ list-path
 with "list" containing the dir-list block. I didn't get this working yet.

Elan:

I had left the "/" off the tail, and REBOL chewed it up.
I believe that was what fixed it; regardless, it is working.

 Hope this REALLY helps,

I'd be still lost, without people like you, Jan, Bo and many others on the
list.  =8^{)

-- 

---===///||| Donald Dalley |||\\\===---
 The World of AmiBroker Support
  http://webhome.idirect.com/~ddalley
  UIN/ICQ#: 65203020



[REBOL] Some niggley things Re:

2000-03-08 Thread VoToNi

In einer eMail vom 09.03.00 02:48:04 (MEZ) Mitteleuropäische Zeit schreibt 
[EMAIL PROTECTED]:

 
  Hello, Rebols:
  
  #1
  files: READ %. gets the current directory, but how do we do it with a
  set-word? Example:
  
 directory: %/partition/drawer/drawer
 files: READ %directory(how to deal with "."?)
  
  doesn't work because (among a few things) it tries to read the current
  directory. I don't want to use CHANGE-DIR because then REBOL persists to 
 look
  at that drawer, which is *very* annoying when trying to re-run the program.

files: READ directory; no %! type? directory is file..
maybe use %path/ to say you mean directories (at least here(windows)).

  
  #2
  "files" (above) will, eventually, be a block of about 300 file names. I 
need
  to know how to take five file names at a time and make a string that is:
  "name+name+name+name+name", to add to a URL.
  
  I didn't see an example of how to parse a string in this way (take five
  elements at a time until the end of block), nor did I see how to 
efficiently
  make a string using a repeated separator.
  
  Do I need to deal with the end of the block or is it automatic?
  
print "..the c way"
a: [ 1 2 3 4 5 6 7 ]
until[
n: min length? a 2
for i 1 n 1 [
prin first a
a: next a
]
print []
tail? a
]
print "..the rebol way?"
a: head a
until[
b: copy/part a 2
foreach i b [ prin i ]
print []
a: skip a 2
tail? a
]


  -- 
  
  ---===///||| Donald Dalley |||\\\===---
  


Volker



[REBOL] Some niggley things Re:

2000-03-08 Thread icimjs

Hi Donald,

perhaps I'm misunderstanding something. But ...
#1
files: READ %. gets the current directory, but how do we do it with a
set-word? Example:

   directory: %/partition/drawer/drawer
   files: READ %directory(how to deal with "."?)

doesn't work because (among a few things) it tries to read the current
directory. I don't want to use CHANGE-DIR because then REBOL persists to look
at that drawer, which is *very* annoying when trying to re-run the program.

It appears to me that you are trying to read the directory located at
%/partition/drawer/drawer ?

Under windows I can read the directory saying:

files: read /drive/folder/folder/

such as in

 directory: %/d/temp/
== %/d/temp/
 files: read directory
== [%save_NewFrames/ %funky/ %tcl-v7/ %snapshots/ %lynx_w32_2_8_2 ...



#2
"files" (above) will, eventually, be a block of about 300 file names. I need
to know how to take five file names at a time and make a string that is:
"name+name+name+name+name", to add to a URL.

One possibility would be:

 files: [%a %b %c %d %e %f %g %h %i %j]
 foreach [f-1 f-2 f-3 f-4 f-5] files [ 
  print mold to string! 
 reduce [f-1 "+" f-2 "+" f-3 "+" f-4 "+" f-5] ]

which results in:

"a+b+c+d+e"
"f+g+h+i+j"


Hope this helps,


;- Elan  [: - )]



[REBOL] Some niggley things Re:(2)

2000-03-08 Thread ddalley


Hello, Elan:

On 09-Mar-00, [EMAIL PROTECTED] wrote:

 perhaps I'm misunderstanding something. But ...

 It appears to me that you are trying to read the directory located at
 %/partition/drawer/drawer ?

Yes

 Under windows I can read the directory saying:
 files: read /drive/folder/folder/

I tried using it directly, but...

** Script Error: READ expected source argument of type: file url object block.
** Where: files: READ /Data2 /Stocks /Data

Notice the spaces. They were not in the path.


 #2
 One possibility would be:

   files: [%a %b %c %d %e %f %g %h %i %j]
   foreach [f-1 f-2 f-3 f-4 f-5] files [ 
  print mold to string! 
  reduce [f-1 "+" f-2 "+" f-3 "+" f-4 "+" f-5] ]

 which results in:

 "a+b+c+d+e"
 "f+g+h+i+j"

 Hope this helps,

This looks very interesting, and it was useful tonight. I got the program
working (by cheating - I used the strings directly), so I will give it another
try after I get some sleep. Thanks!

(One of my data sources changed their access method, in some way, so I had to
jury-rig quick access to a slower back-up site. yeuch!)

-- 

---===///||| Donald Dalley |||\\\===---
 The World of AmiBroker Support
  http://webhome.idirect.com/~ddalley
  UIN/ICQ#: 65203020



[REBOL] Some niggley things Re:(3)

2000-03-08 Thread icimjs

Hi Donald,

 Under windows I can read the directory saying:
 files: read /drive/folder/folder/

I tried using it directly, but...

** Script Error: READ expected source argument of type: file url object
block.
** Where: files: READ /Data2 /Stocks /Data

You need a % character (In the prototype I skipped it because - in the back
of mind - I thought it was understood, sorry):

read %/drive/folder/folder/

Example:
 read /d/temp/
** Script Error: read expected source argument of type: file url object block.
** Where: read /d /temp /

Compare to:

 read %/d/temp/
== [%save_NewFrames/ %funky/ %tcl-v7/ %snapshots/ %lynx_w32_2_8_2rel_1.zip...

Hope this helps,


;- Elan  [: - )]



[REBOL] Some niggley things Re:(4)

2000-03-08 Thread ddalley


Hi, Elan:

On 09-Mar-00, [EMAIL PROTECTED] wrote:

 read %/drive/folder/folder/

 Compare to:

  read %/d/temp/
 == [%save_NewFrames/ %funky/ %tcl-v7/ %snapshots/
%lynx_w32_2_8_2rel_1.zip...

 Hope this helps,

What I really wanted to know was how to use a set-word!. The reason is that,
if the program has an error and stops, the console is still set for a changed
directory path. This is very annoying, since, to re-run the program, I have to
change-dir again and again:

  list-path: %/drive/folder/folder/
  list: READ path

with "list" containing the dir-list block. I didn't get this working yet.

-- 

---===///||| Donald Dalley |||\\\===---
 The World of AmiBroker Support
  http://webhome.idirect.com/~ddalley
  UIN/ICQ#: 65203020