[REBOL] Bitwise manipulation Re:(2)

2000-10-11 Thread mdb

What's wrong with

 to-hex 56
== #0038
 to-hex 2037
== #07F5
 to-hex -56
== #FFC8
 to-hex -2037
== #F80B

Mike.

- Original Message -
From: [EMAIL PROTECTED]
Date: Wednesday, October 11, 2000 7:50 am
Subject: [REBOL] Bitwise manipulation Re:

 Hi, Phil...
 
 [EMAIL PROTECTED] wrote:
  
  An interesting one ...
  
  I have a integer value that I must convert to binary:
  
  Nice and easy for values = 127
  
  int1: 56
  
  b1: to-binary to-block int1
  
  HOWEVER, if int1 is greater than 127, say 2037, I have to 
 perform the
  
  following task:
  
  2037 which is equivalent to 11011000 must be split into 
 2 bytes as
  
  follows
  
  b1: - 1000 effectively b1: to-binary to-block 8
  
  b2: - 01011000 effectively b2: to-binary to-block 24
  
  Any suggestions..
  
 
 Two suggestions:
 
 1)  Try using
 
big-endian: func [n [integer!] /local r] [
r: copy #{}
until [
insert r to-binary to-char (n // 256)
0 = n: to-integer n / 256
]
r
]
 
 big-endian 56
== #{38}
 big-endian 2037
== #{07F5}
 
However, *DANGER, WILL ROBINSON!*,
 
1.1) This assumes byte order for values requiring more than 8 
 bits.1.2) It breaks for negative values!  (Explaining why and 
 proposing a repair are left as exercises for the reader... 
 ;-)
 
 2)  Check your math.  Last time I looked, 2037 was odd, which 
 means that
its binary representation MUST end in a one!  ;-)
 
 -jn-
 
 -- 
 ; Joel Neely  [EMAIL PROTECTED]  901-263-4460  38017/HKA/9677
 REBOL []  print to-string debase decompress #{
789C0BCE0BAB4A7176CA48CAB53448740FABF474F3720BCC
B6F4F574CFC888342AC949CE74B50500E1710C0C2400}
 
 




[REBOL] FTPing all files or selected files in a directory?

2000-09-28 Thread mdb

Hello, 

I've been transferring files using ftp and i noticed that it keeps on 
connecting for every file being transferred. Is there any way to just 
connect once and then do all the transfers?

Currently i have something like this:

filelist: read ftp://user:[EMAIL PROTECTED]/ 

foreach file filelist [write/binary file read/binary join 
ftp://user:[EMAIL PROTECTED]/ [file]]






[REBOL] REBOL does not work on Debian Linux 2 2 Re:

2000-09-13 Thread mdb

Hi, 

I'm not a Linux or Debain expert but i have it working on Debian Linux 2.1.


I get the "Segmentation fault" message when i run rebol using xterm but if
i use the Command Tool XShell, i works !!

I'm also using  the Libc5 version .

Hope this may help.

Mike.






[REBOL] REBOL does not work on Debian Linux 2 2 Re:(3)

2000-09-13 Thread mdb

Interesting,

I was told to use rebol041.tar.gz instead of rebol042.tar.gz
That failed because it required libtermcap.so.2 and we only have a
symbolic link from libncurses.so to libtermcap.so

I'm using the xxx041.tar.gz versions and didn't have to make any changes.

Did you try using a different Xshell? (like Command Tool).
Also have you tried using /View or ?Command?

Using xterm, i only get the segmentation fault message using /Core, both
/View and /Command work ok.

I'm also logged in as root.

Mike. 





[REBOL] probe parse img src=test.gif width=123 {=} Re:

2000-09-13 Thread mdb



I tried the above example and change the parse rule to {=} instead of 
{="} and
got the same result:

 probe parse img src="test.gif" width=123 {="}
["img" "src" "test.gif" "width" "123"]
== ["img" "src" "test.gif" "width" "123"]
 probe parse img src="test.gif" width=123 {=}
["img" "src" "test.gif" "width" "123"]
== ["img" "src" "test.gif" "width" "123"]

So, what is the purpose of the quote mark in the rules?

In this example, the quote mark is meaningless.
As the quote mark is used as a string delimiter, they will be taken out
during the parse operation, but then added back when the parsed characters
are made into a string.

So, "test.gif" becomes test.gif, which becomes "test.gif" again.
Maybe that's not very well explained, but i hope you get the idea.

Mike.
 







[REBOL] One Disk Rebol and OS Re:

2000-08-31 Thread mdb



Hey All,
I got Core running on MuLinux from a single floppy all in RAM. Its got
networking, ppp (though not currently working?), NFS, UMSDOS, smb
client, and few other tricks. Much of course thanks to M. Andreoli for
creating the MuLinux distribution, currently my favorite linux
distribution (http://sunsite.auc.dk/mulinux/).

Great news. I've been using MuLinux too for about a few weeks now. It's
very nice, great way to learn a lot about Linux without loading a "full
distribution", disk partioning etc etc. Plus it can be "cloned" to the hard
drive.

I managed to get ppp working, currently having problems with the mail
functionality.

Can't wait to see how you got Core running...

Mike Berrisford.







[REBOL] Rebol/Command - accessing all records in the queue??

2000-08-30 Thread mdb

Hello,

Using the latest experimental version of Rebol/Command, i'm able to connect
and access records from an Oracle Database.

using one-rec: first db-port will correctly return the next record

but using something like

all-recs: copy db-port

should return all the records according to the documentation, but it only
returns 1 record. Any ideas?

Thanks.

Mike Berrisford






[REBOL] Extending Webserver.r Re:(4)

2000-08-14 Thread mdb

Hello,

Cal Dixon's Web server is out at www.rebol.org, in the script library under
the Web section.

However i downloaded it last week, and wasn't able to get it to work,
either with an .html file or .cgi file, running REBOL/CORE 2.3 under
Windows 95.

If anyone has it working, or downloads it and gets it to work, maybe they
could enlighten me.

Thanks.

Mike.



 






[REBOL] Problems with scripts Webserver, Webserv and Rebweb.

2000-08-10 Thread mdb

Hello,

I've downloaded the scripts from rebol.org and the script library and i'm
not getting them all to work?

None of them work with the simple CGI script from Elan's book.

#!d:/rebol/rebol.exe -csi
REBOL[]
print { Content-Type: text/html^/^/
Welcome to my first REBOL CGI Script.}

I have got the script to work with Apache and PWS (here i had to take out
the first line).

Also Webserv won't display even an html document.

Any ideas??

Mike.





[REBOL] Problems with scripts Webserver, Webserv and Rebweb. Re:(2)

2000-08-10 Thread mdb

Tim.

Thanks to the information you posted sometime ago, i  have already managed
to get the script to work using PWS. It's my understanding that these
scripts are web servers that take the place of APache and PWS.

Mike.

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, August 10, 2000 4:59 PM
Subject: [REBOL] Problems with scripts Webserver, Webserv and Rebweb. Re:


 Are you using windows? (I presume from the path syntax on
 the first line)
 If so, to use PWS, you need to do the following:
   Add a new string value to:

HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\W3Svc\Parameters\Scri
   pt
   Map with name of .r (assuming this is the suffix for the rebol script)
 and data
   value of

   c:\rebol\rebol.exe -cs %s
(obviously substitute the appropriate path to your executable).

   Your rebol cgi scripts should reside in your PWS Scripts directory.
  In my case, I run from /cgi-bin.
 tim
 At 02:45 PM 8/10/00 -0800, you wrote:
 Hello,
 
 I've downloaded the scripts from rebol.org and the script library and i'm
 not getting them all to work?
 
 None of them work with the simple CGI script from Elan's book.
 
 #!d:/rebol/rebol.exe -csi
 REBOL[]
 print { Content-Type: text/html^/^/
 Welcome to my first REBOL CGI Script.}
 
 I have got the script to work with Apache and PWS (here i had to take out
 the first line).
 
 Also Webserv won't display even an html document.
 
 Any ideas??
 
 Mike.






[REBOL] Where's the blue truck ?

2000-07-27 Thread mdb

The Blue Truck has gone, but will it be back tomorrow morning???

Check http://demo.rebol.net/webcam to find out






[REBOL] Extracting Data From Eudora Re:

2000-07-26 Thread mdb


There are 3 scripts in the Script Library relating to Eudora.
They can be found using the "Search Script Library" under the "For
Developers" section of www.rebol.com.

Mike.





[REBOL] RT Convention/conference.

2000-07-26 Thread mdb

Hello,  

I think it's about time that RT organised a convention/conference and
brought together in one place, all the talented people that are actively
involved in promoting REBOL.

It would be wonderful to see and hear people like Elan, Gabriele, Julian,
Allen, Brett, Volker, Pekr, Ladislav, Brian, Larry, ... (my apologies for
any ommissions) discussing REBOL, together with all the great folks from
RT.

Just a thought.

Mike.







[REBOL] wait and ports Re:

2000-07-12 Thread mdb


http://www.rebol.com/core23add.html






[REBOL] set in object variable string Re:(2)

2000-06-07 Thread mdb


It works if the word already exists in the object.

Mike.

 test-object: make object! [x: "string"]
 print test-object/x
string
 set in test-object 'x "new value"
== "new value"
 print test-object/x
new value







[REBOL] (Fwd) publication inquiry Re:(2)

2000-05-22 Thread mdb

Hello,

Maybe www.rebolpress.com needs to be updated to reflect the new date??

Also if you go the the Barnes and Noble website and do a search on REBOL, 2
books show up. Does anyone have any details about them? It looks like the
Official Guide only details with /CORE, but what about the other book,
/VIEW, /COMMAND??


- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, May 19, 2000 10:48 AM
Subject: [REBOL] (Fwd) RE: publication inquiry



 --- Forwarded Message Follows ---
 From:   "Graab, Denise" [EMAIL PROTECTED]
 To: "'[EMAIL PROTECTED]'" [EMAIL PROTECTED]
 Subject:RE: publication inquiry
 Date sent:  Fri, 19 May 2000 13:00:42 -0400

 REBOL: The Official Guide is due to be published in July.

 Call 1-800-262-4729 or visit www.REBOLpress.com for details on ordering.

 Thank you.

 -Original Message-
 From: Ryan C. Christiansen [mailto:[EMAIL PROTECTED]]
 Sent: Wednesday, May 17, 2000 2:06 PM To: denise_graab@mcgraw-
 hill.com
 Subject: publication inquiry


 Hello.

 Can you tell me when REBOL: The Official Guide will become available for
 purchase?

 Thank you.

 Ryan Christiansen
 Web Developer





[REBOL] Question on Secure (repost) Re:(4)

2000-05-17 Thread mdb

 Not sure what to say, Andrew. Don't take this personally but your solutions
didn't work whereas Volker's did.

Yours:

downloaddir: %/d/anti%20virus%20downloads/
== %/d/anti%20virus%20downloads/
 secure compose [(downloaddir) allow]
** Script Error: Invalid argument: compose.
** Where: secure compose [(downloaddir) allow]
 DirPermission: 'allow
== allow
 secure reduce [downloaddir DirPermission]
** Script Error: Invalid argument: reduce.
** Where: secure reduce [downloaddir DirPermission]

=
Volker's


 do compose/deep[secure[(downloaddir) allow]]
== [net allow file [allow read ask write ask execute]]
 do compose/deep[secure[(downloaddir) allow]]
== [net allow file [allow read ask write ask execute]
%/d/anti%20virus%20downloads allo
w]


Mike.
===
- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, May 17, 2000 2:29 AM
Subject: [REBOL] Question on Secure (repost) Re:(3)


 Hi, Volker.
 Call me idiot, but I didn't understand what you're trying to say here:

  do compose/deep[secure[(my-dir) allow]]
 
  attention to the 'level in secure, this means, the compose is not
 evaluatet!
  you have to hack a bit more :)
 
   source secure
  secure: native [
  {Specify security policies (access levels and directories). Return prior
 settings.}
  'level [word! block!] "Levels are: quit, throw, ask, and allow."
  ]
 
  I suggest with default protection before:
  do compose/deep[secure[net ask file ask (my-dir) allow]]

 How is your solution better than:
 DirPermission: 'allow
 secure reduce [downloaddir DirPermission]
 ?

 Andrew Martin
 Who's been called an idiot today! :-( But I don't believe them... :-)
 ICQ: 26227169
 http://members.xoom.com/AndrewMartin/
 --





[REBOL] Question on Secure (repost)

2000-05-16 Thread mdb



Hello,I'm having a problem trying to change 
security settings with 'secure.If i change settings using the file name as 
in: secure [%/d/anti%20virus%20downloads/ allow]== [net 
allow file [allow read ask write ask execute]] secure 
[%/d/anti%20virus%20downloads/ allow]== [net allow file [allow read ask 
write ask execute]%/d/anti%20virus%20downloads allow]it works just 
fine. But if i try using:downloaddir: 
%/d/anti%20virus%20downloads/== 
%/d/anti%20virus%20downloads/ secure [downloaddir allow]** 
Script Error: Invalid argument: downloaddir.** Where: secure [downloaddir 
allow]it doesn't. Shouldn't either way 
work?Thanks.Mike.


[REBOL] Question on Secure

2000-05-15 Thread mdb

Hello,

I'm having a problem trying to change security settings with 'secure.
If i change settings using the file name as in:

 secure [%/d/anti%20virus%20downloads/ allow]
== [net allow file [allow read ask write ask execute]]
 secure [%/d/anti%20virus%20downloads/ allow]
== [net allow file [allow read ask write ask execute]
%/d/anti%20virus%20downloads allow]

it works just fine. But if i try using:

downloaddir: %/d/anti%20virus%20downloads/
== %/d/anti%20virus%20downloads/

 secure [downloaddir allow]
** Script Error: Invalid argument: downloaddir.
** Where: secure [downloaddir allow]

it doesn't. Shouldn't either way work?

Thanks.

Mike.






[REBOL] Question on Secure?

2000-05-15 Thread mdb

Hello,

If i try to change security using a file name as in

 secure [%/d/anti%20virus%20downloads/ allow]
== [net allow file [allow read ask write ask execute]]

it works just fine, However, if i try using


 downloaddir: %/d/anti%20virus%20downloads/
== %/d/anti%20virus%20downloads/
 secure [downloaddir allow]
** Script Error: Invalid argument: downloaddir.
** Where: secure [downloaddir allow]

it doesn't. Shouldn't both work??

Thanks.

Mike.







[REBOL] Question on Wait

2000-05-09 Thread mdb

Hello,

The following is taken from the Rebol Dictionary, describing WAIT.


If the value is a TIME, delay for that period.
If the value is a DATE/TIME, wait until that DATE/TIME.
If the value is an INTEGER or DECIMAL, wait that number of seconds.


Testing with TIME and INTEGER works fine.


 forever [print now/time wait 60 print now/time break ]
10:18:33
10:19:33
 forever [print now/time wait 00:01:30 print now/time break ]
10:20:12
10:21:43

However when i try to specify a DATE/TIME, i get the following


 forever [print now/time wait 9-May-2000/10:30:00 print now/time break ]
10:24:08
** Script Error: wait expected value argument of type: number time port
block.

The error seems to suggest that WAIT only expects a TIME and not a DATE?
Am i missing something?

Thanks.

Mike.






[REBOL] Question on Wait Re:(2)

2000-05-09 Thread mdb

Thanks Elan.

::Help wait agrees with your observation. It reports

:: help wait
::ARGUMENTS:
:: value -- (Type: number time port block)

::No mention of date. 

Your response begs the questions: Is the Rebol Dictionary incorrect ?
How do you fire off an event at a certain time of the day (say at 10:30, do
something?) If you specify a time, it will wait for that time, not till
that time?

Mike.








[REBOL] Ho to add hex values? Re:

2000-05-08 Thread mdb

Hi Pekr,


Hi,

what is the easy way for addition and investigation of hex values?
Let's  say I have h3cb and want to add h402. How to do it in an easy way?



Will this do the job ???


 to-hex (to-integer #{03cb}) + (to-integer #{0402})
== #07CD


Mike.





[REBOL] Ho to add hex values? Re:

2000-05-08 Thread mdb

Pekr: 

; what is returned here???
- enbase/base to-string #FF 2
== "0100011001000110"

"0100011001000110" is binary form of hexadecimal 4646, which in turn
represents the characters "FF".

 enbase/base to-string #FF 16
== "4646" 

Mike.





[REBOL] Question on Sort ? Re:(2)

2000-04-28 Thread mdb


Mike asked:
 How would I sort to get name/ages in descending order by name?

Have a look at sersort.html in the Users guide. There's a nice little
tutorial in there that should help you a lot.

Andrew Martin

Thanks Andrew. That is exactly what i needed.

I got so wrapped up in solving the problem that i forgot to look at the
obvious place, Documentation...

Also as soon as i sent the message, i realised that once i sorted by name
is ascending sequence, just processing the block from tail to head, gives
me the data in descending sequence!!!

Mike.






[REBOL] Question on Sort ?

2000-04-27 Thread mdb

Hi All,

The following code sorts the name-ages block by name in ascending order,
and also keeps the age with the corresponding name.

 name-ages: ["Larry" 45 "Curly" 50 "Mo" 42 "Mike" 48]
== ["Larry" 45 "Curly" 50 "Mo" 42 "Mike" 48]
 sort/skip name-ages 2
== ["Curly" 50 "Larry" 45 "Mike" 48 "Mo" 42]

1. How would i sort to get name/ages in descending order by name ?

2. How would i sort to get name/ages in ascending order by age ?

3. How would i sort to get name/ages in descending order by age ? 

I've a feeling it's got something to do with the compare refinement, but at
this point in time, it doesn't make much sense to me.

Thanks in advance.

Mike.





[REBOL] [REBOL] passing args to another script Re:

2000-04-21 Thread mdb

Hi Tim,

Finally my big chance to help someone. This is what it's all about. You
learn and pass it on. 

The list isn't very active maybe i can respond before someone else does


 
 How do I pass arguments to another script?
 Haven't had much success with the /args
 refinement.
 I've written two scripts. One "do's" the
 other as follows:
 ;CALLING script
 REBOL [
 Title: "testload.r (loading another file)"
 Date:   21-Apr-2000
 Author: ["newbie"]
 ]
 do %loadtest.r
 ;CALLED script
 REBOL [
 Title: "loadtest.r loaded from testload.r"
 Date:   21-Apr-2000
 Author: ["newbie"]
 ]
 print "in load test"
 print ["Command Line Arg: " system/script/args]

 ;I would like to pass one or more arguments to
 ;loadtest.r. What would be the correct way to do
 ;it?

 Thanks to all!! :) tim


The calling script would call the called script with:

do/args loadtest.r x

The called script would pick up x via:

filearg: system/script/args


Mike.





[REBOL] FTP Connection problems

2000-03-29 Thread mdb

Hello, i'm having 2 problems using FTP.

1.When i try to connect to my ISP, i always get the Network timeout
message. I have changed the timeout to 10 minutes but still get the same
error. I am able to connect using the ftp exec supplied with Win98. The
only difference i see is that using the WIN98 ftp is that it

"Opening ASCII mode data connection for /bin/ls."

whereas the REBOL ftp uses BINARY mode??

 read ftp://uuu:[EMAIL PROTECTED]/
URL Parse: uuu xxx home.gci.net none none none
Net-log: ["Opening tcp for" FTP]
connecting to: home.gci.net
Net-log: [
none ["220" "230"]]
Net-log: {220 firebird.gci.net FTP server (Version wu-2.6.0(2) Wed Jan 5
11:31:52 AKST 2000) ready
.}
Net-log: [["USER" port/user] "331"]
Net-log: "331 Password required for uuu."
Net-log: [["PASS" port/pass] "230"]
Net-log: "230 User uuu logged in."
Net-log: [
"TYPE I" "200"]
Net-log: "200 Type set to I."
Net-log: [["PORT" port/locals/active-check] "200"]
Net-log: "200 PORT command successful."
Net-log: [["CWD ~"] "250"]
Net-log: "250 CWD command successful."
Net-log: [["CWD" either empty? port/path ["./"] [join "./" port/path]]
"250"]
Net-log: "250 CWD command successful."
Net-log: [["LIST" "."] ["150" "125"]]
Net-log: {150 Opening BINARY mode data connection for /bin/ls.}
Net-log: [
none "226"]
** Access Error: Network timeout.
** Where: read ftp://uuu:[EMAIL PROTECTED]/



2. Connecting to an IBM mainframe always gives the following error message.
Win 98 ftp connects correctly 

 read ftp://uuu:[EMAIL PROTECTED]/
URL Parse: uuu xxx jdc1.state.ak.us none none none
Net-log: ["Opening tcp for" FTP]
connecting to: jdc1.state.ak.us
Net-log: [
none ["220" "230"]]
Net-log: {220-FTPSERVE IBM MVS V3R1 at JDC1.STATE.AK.US, 09:01:39 on
03/29/00}
Net-log: {220 Connection will close if idle for more than 5 minutes.}
Net-log: [["USER" port/user] "331"]
Net-log: "331 Send password please."
Net-log: [["PASS" port/pass] "230"]
Net-log: "230 uuu is logged on."
Net-log: [
"TYPE I" "200"]
Net-log: "200 Representation type is IMAGE."
Net-log: [["PORT" port/locals/active-check] "200"]
Net-log: "200 Port request OK."
Net-log: [["CWD ~"] "250"]
Net-log: [["CWD /"] "250"]
** User Error: Server error: tcp 550 A qualifier in "/" begins with an
invalid character..
** Where: read ftp://uuu:[EMAIL PROTECTED]/





[REBOL] Return value from a Script???

2000-03-02 Thread mdb

Hello,

Is it possible for a script to return a value in a similar manner that a
function does? I've suddenly realised that i have been developing scripts
but don't seem to have any way for them to communicate with each other?

As in:

Script1.r
REBOL []

...

do/args %Script2.r arg
Have Script2 return a value

...

Thanks.

Mike.




[REBOL] Parsing and Recursion [REPOST]

2000-02-28 Thread mdb



*** REPOSTING 
***

Hello,I'm having a problem with 
understanding Parsing using recursion. The codebelow consists of 4 tests. 
Tests 1 and 4 produce the correct results, both in terms of the values 
inthe block and that they returns TRUE. The [none] in the rule makes 
thishappen.Test 2 produces the correct values in the block but 
returns FALSE,presumably because [none] is missing from the 
rule.However why does Test 3 return TRUE but process the last input 
valuetwice??Mike.REBOL []check: 
func [] [clear inpsprobe parse "123+" colprint inpsclear 
inpsprobe parse "123+456-" colprint inps]inps: []digits: 
charset "0123456789"num: [copy value [some digits] (value: 
to-decimal value)]term: [num ["+" (insert tail inps value)|"-" (insert tail 
inps negatevalue)]];Test 1print "Test 1"col: [term col | 
[none]]check;Test 2print "Test 2"col: [term 
col]check;Test 3print "Test 3"col: [term col | 
term]check;Test 4print "Test 4"col: [term col | term | 
[none]]check


[REBOL] Parsing and Recursion ...

2000-02-23 Thread mdb

Hello,

I'm having a problem with understanding Parsing using recursion. The code
below consists of 4 tests. 

Tests 1 and 4 produce the correct results, both in terms of the values in
the block and that they returns TRUE. The [none] in the rule makes this
happen.

Test 2 produces the correct values in the block but returns FALSE,
presumably because [none] is missing from the rule.

However why does Test 3 return TRUE but process the last input value
twice??

Mike.





REBOL []


check: func [
] [clear inps
probe parse "123+" col
print inps
clear inps
probe parse "123+456-" col
print inps
]

inps: []
digits: charset "0123456789"


num: [copy value [some digits] (value: to-decimal value)]
term: [num ["+" (insert tail inps value)|"-" (insert tail inps negate
value)]]

;Test 1
print "Test 1"
col: [term col | [none]]
check
;Test 2
print "Test 2"
col: [term col]
check
;Test 3
print "Test 3"
col: [term col | term]
check
;Test 4
print "Test 4"
col: [term col | term | [none]]
check




[REBOL] Parse questions ?? Re:(2)

2000-02-20 Thread mdb

Thanks Gabriele,

I was wondering where the to-integer was, but then i realised that the
(value: load value) took care of it.
Interesting that you looked at the data in terms of repeating groups and so
processed them using some..., when i came up with a parse rule, i tried to
use recursion and i think that caused problems for me.

Mike.

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Saturday, February 19, 2000 2:50 AM
Subject: [REBOL] Re: Parse questions ??


 Hello [EMAIL PROTECTED]!

 On 19-Feb-00, you wrote:

  m I have a file consisting of lines in the following format:

  m "23123+34234+234234-23423+3-"

  m ie, n digits followed by a sign etc etc.

 What about:

  data: "23123+34234+234234-23423+3-"
 == "23123+34234+234234-23423+3-"
  values: make block! 10
 == []
  digits: charset "0123456789"
 == make bitset! #{
 FF03
 }
  parse data

 [some

 [copy value some digits
 [(value: load value)
 [["+" (insert tail values value) | "-" (insert tail values negate
value)]
 []
 []
 == true
  values
 == [23123 34234 -234234 23423 -3]

 Regards,
 Gabriele.
 --
 o) .-^-. (--o
 | Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila |
 | GIESSE on IRC \ \-\_/-/ /  http://www.amyresource.it/AGI/ |
 o) `-v-' (--o




[REBOL] Parse questions ??

2000-02-18 Thread mdb

Hello All,

I have a file consisting of lines in the following format:

"23123+34234+234234-23423+3-"

ie, n digits followed by a sign etc etc.

The only way i've been able to extract the data into a series is to do two
replaces, replacing "+" by "+ " and "-" by "- " and then parsing it using
the space as a delimiter. I can't use the sign as a delimiter because that
only returns the value and not the sign. 

My first question is, should parse allow the delimited character to be
optionally returned by way of a refinement?? In this case the sign is a
delimiter but also an integral part of the data.

The other problem i had was once i had the data in the form "123+", i
wasn't able to convert it to decimal, because the sign was at the end and
not the beginning, so i had to write code to move it.
Do people think that decimal and integer should be modified to allow for a
optional sign at the end??

Thanks.

Mike. 





[REBOL] Problem with to-money ???

2000-02-11 Thread mdb

Hello, I've been working on a script to take a file, sum the detail records
and compare to a total on a trailer record, which i have enclosed at the
end of this message.

The following shows 2 runs of the script, using different files that i put
together, one shows "BALANCED" and the other "NOT BALANCED", even though
the totals agree!!!

Even allowing for the fact that i might not be using the best use of
"to-money" and " / 100", it should still give consistent results, shouldn't
it ???


Script: "Untitled" (none)
HEADER FOUND!!
TRAILER FOUND!!
RECS READ =  41
TOTAL =  $410604386.69
TRAILER   =  $410604386.69
BALANCED

Script: "Untitled" (none)
HEADER FOUND!!
TRAILER FOUND!!
RECS READ =  7112
TOTAL =  $410604386.69
TRAILER   =  $410604386.69
NOT BALANCED

* BEGIN SCRIPT ***
REBOL []


file: read/lines %g01m0131.txt

type:

recs: 0

total:

ee:
tot_ee: 0


foreach line file [
  type: (copy/part line 2)
  
  if type = "00" [print "HEADER FOUND!!"]
  if type = "01" [
  recs: recs + 1
  line: skip line 58
  ee: (copy/part line 10)
  ee: to-money ee
  tot_ee: tot_ee + ( ee / 100)]
if type = "99" [print "TRAILER FOUND!!"
  line: skip line 12
  total: to-money (copy/part line 12)
  total: total / 100]
  

  
]
print ["RECS READ = " recs]
print ["TOTAL = " tot_ee]
print ["TRAILER   = " total]

if total = tot_ee [print "BALANCED"]
if total  tot_ee [print "NOT BALANCED"]



* END SCRIPT ***


Mike.   




[REBOL] Problem with to-money ??? Re:(2)

2000-02-11 Thread mdb

Thank you.

Very interesting, I hope this is well documented as a potential gotcha, in
that when dividing an integer by 100 you can get a number with more than 2
decimal places!

I do think it is also somewhat confusing and inconsistent that when you
print a money value, it only prints out 2 decimal places, yet when doing
comparisons, it can use more than 2.

Also is there any way of making print add ',' as thousand separators??
as in $999,999,999.99.

Mike.

It's a problem with the encoding of floating point numbers, not REBOL.
REBOL
uses floating point for money values. Try multiplying the numbers by a
thousand or a million and look for the little bits of imprecision.

To get round this, convert your number values (times 100) into integers,
and
only convert to money for printing.






[REBOL] Problem with to-money ??? Re:(2)

2000-02-11 Thread mdb


It's a problem with the encoding of floating point numbers, not REBOL.
REBOL
uses floating point for money values. Try multiplying the numbers by a
thousand or a million and look for the little bits of imprecision.


Too true! Too true!

The following shows the result ot multiplying the total and trailer values
by 1 million, and there's the difference.

HEADER FOUND!!
TRAILER FOUND!!
RECS READ =  7112
TOTAL =  $410604386.69
TRAILER   =  $410604386.69
$41060438669.75
$41060438669.00
NOT BALANCED

Mike.




[REBOL] /part size argument ??

2000-02-02 Thread mdb

Hello,

I have a text file that i want to extract, say, the first 5 characters
from. Checking the read documentation, says to use the refinement /part
that also needs the size argument, but i'm unable to see how that size
argument is specified??

the closest i've got is:

 read/part/size %test.txt
** Script Error: read expected size argument of type: number.
** Where: read/part/size %test.txt

gives an error. What does the read look like??

Thanks

Mike. 






[REBOL] /part size argument ?? Re:(4)

2000-02-02 Thread mdb

Great. Many thanks.

- Original Message -
From: [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Wednesday, February 02, 2000 2:38 PM
Subject: [REBOL] Re: /part size argument ?? Re:(2)


 Hello [EMAIL PROTECTED],

 Try this then:
 (copy the intended lines of code to a file and 'do it, or type it directly
 at the rebol console)

 REBOL []

 file: open %test.txt  ; file content is "TEST1TEST2TEST3TEST4TEST5"

 record-size: 5   ; in this case the record size is 5

 while [not tail? file] [
 print (copy/part file record-size) ; parens not nessesary,
; but helps reading
 file: skip file record-size
 ]

 close file




 Best regards
 Thomas Jensen


 On 03-Feb-00, [EMAIL PROTECTED] wrote:

  Thanks, that worked just fine. Now how would i get, say, the next 10
  characters. What i'm trying to do is take a line of data and break it
into
  fields based on length, ie there is no delimiting characters between the
  fields??
 
  Thanks.
 
  Mike.
 
 
 
 
  Hello [EMAIL PROTECTED],
 
  Try this:
  read/part %test.txt 5   ;= 5 is the "size" argument to /part
  == "This "
 
  (the content of the file is "This is a test file^/")
 
 
  Best regards
  Thomas Jensen
 
 
 




[REBOL] [REBOL]HELP! FTP Access problems Re:

2000-01-31 Thread mdb

Works for me too

 read ftp://jazz.trumpet.com.au/
connecting to: jazz.trumpet.com.au
== [%beta/ %bin/ %dostrump/ %etc/ %fanfare/ %firesock/ %ipv6/ %irc/
%lwp-vers/ %mailreader/ %
priv/ %private/ %scripts/ %slipper/ %t...







[REBOL] Me Too

2000-01-30 Thread mdb



Me Too


[REBOL] REBOL/View

2000-01-28 Thread mdb

Hello,

I just noticed this on todays (Friday 1/28/2000) Zdnet Screensavers Web
page, where they were talking about REBOL.


"The beta release of REBOL/View begins this week and along with REBOL/Core
is available for free download at REBOL.com. "

Do they know something we don't??

Mike.




[REBOL] Starting Browser from a REBOL Script??

2000-01-28 Thread mdb

Hello,

Is it possible to start a browser to display an html file from within a
REBOL Script???

For example, the mailview.r script from the REBOL Example Script Library
creates an html file, but i don't see any way of automatically starting the
browser to show the data without having to double-click on it (i'm using
Windows 95).

Thanks.

Mike.