[REBOL] Date formatting

2004-03-30 Thread A J Martin

I've been writing lots of reports in HTML and I've updated my formatting
functions for dates. You're welcome to use them.


Pad: function [
 "Pads a value with leading zeroes or trailing spaces or a specified fill
character."
 Value [any-type!] "The value."
 Width [integer!] "The desired width."
 /With Fill [char!] "With the specified Fill character."
 ] [
 Operator
 ] [
 Operator: either any-string? Value [
  any [Fill Fill: #" "] :tail
  ] [
  Value: form Value
  any [Fill Fill: #"0"] :head
  ]
 head insert/dup Operator Value Fill Width - length? Value
 ]

DD: func [Date [date!]] [
 pad Date/day 2
 ]

MM: func [Date [date!]] [
 pad Date/month 2
 ]

MMM: func [Date [date!]] [
 copy/part pick Rebol/locale/Months Date/month 3
 ]

: func [Date [date!]] [
 pad Date/year 4
 ]

DD-MM-: func [Date [date!]] [
 rejoin [DD Date #"-" MM Date #"-"  Date]
 ]

MMDD: func [Date [date!]] [
 rejoin [ Date MM Date DD Date]
 ]

DD: make object! [
 MM: make object! [
  : func [Date [date!]] [
   rejoin [DD Date #"/" Rebol/words/MM Date #"/" Rebol/words/ Date]
   ]
  ]
 MMM: make object! [
  : func [Date [date!]] [
   rejoin [DD Date #"/" Rebol/words/MMM Date #"/" Rebol/words/ Date]
   ]
  ]
 ]

D: make object! [
 MM: make object! [
  : func [Date [date!]] [
   rejoin [Date/day #"/" Rebol/words/MM Date #"/" Rebol/words/ Date]
   ]
  ]
 MMM: make object! [
  : func [Date [date!]] [
   rejoin [Date/day #"/" Rebol/words/MMM Date #"/" Rebol/words/ Date]
   ]
  ]
 ]

-- 
Andrew J Martin
ICQ: 26227169
http://www.rebol.it/Valley/
http://valley.orcon.net.nz/
http://Valley.150m.com/
-><-

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: newbie q : value & label in text-lists

2004-03-30 Thread Jones, Scott

Hi, "brds Janek",
...
> I would like to set up text-list in my layout, so it 
> shows just labels, but when selected I could get 
> value.
...

I suspect that there are several ways.  Here is one:

data: ["Label 1" "Value 1" "Label 2" "Value 2"]
labels: copy []
foreach [label value] data [append labels label]
view layout [
text-list data labels [
t/text: copy select data value
show t
]
t: text 200x24
]

--Scott Jones

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: ANNOUNCE: I have catched the source of the read/lines bug !

2004-03-30 Thread Anton Rolls

Here is a more reduced version.
It crashes as soon as I engage internet lock.

-Anton

REBOL [
Author: "Giuseppe Chillemi"
Description: "read/lines BUG Catcher"
Notes: {modified by Anton Rolls}
]

logfile: %Activity.log

log: func [string /local ts][
write/append/lines logfile ts: reform [now/time string]
ts
]

write logfile "" ; create new logfile
log "start"

loop 100 [
my-url: http://www.google.com
log "Point 1"
print log "Looping..."
log "Point 2"

; read-page
bug?: no
until [
if error? set/any 'err try [
my-page: read/lines my-url
][
print log rejoin ["! Read Error on page: " my-url mold disarm 
err]
bug?: yes
]
log "Point 3"
bug?
]
log "Point 4"
]

halt

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: ANNOUNCE: I have catched the source of the read/lines bug !

2004-03-30 Thread Anton Rolls

I see the crash here. I used a cleaned up version of
the script, which you can find at bottom.

Anton.

> If you use read/lines inside a "does" routine and read/lines 
> fails a couple
> of times Rebol will probably crash at the returning from the 
> routine block.
> 
>  
> 
> To reproduce the BUG used the following script + ZONE ALARM 
> (needed to STOP
> internet activity by hand).
> 
>  
> 
> Do this:
> 
> Run the script
> 
> Stop the internet activity with the aid of the "lock" of Zone 
> Alarm. Mantain
> the lock closed  until the script prints an error message.
> 
> Restart the internet activity and wait for the script to cointinue its
> looping. Then stop internet activity again.
> 
> Do this until Rebol will crash (this happen before 5 or 6 locks/unlocks)

> I have reported everything to the Rebol people and waiting for an answer.
> 
> Could you confirm the BUG too ?

> Giuseppe Chillemi

REBOL [
Author: "Giuseppe Chillemi"
Description: "read/lines BUG Catcher"
Notes: {modified by Anton Rolls}
]

logfile: %Activity.log

log: func [string][
write/append/lines logfile reform [now/time string]
]

write logfile "" ; create new logfile
log "start"

read-page: [
bug?: no
until [
if error? set/any 'err try [
my-page: read/lines my-url
][
print [now/time "! Read Error on page" my-url mold disarm err]
bug?: yes
]
log "Point 0"
bug?
]
log "Point 1"
]

activate-search: does [
my-url: http://www.google.com
log "Point 2"
print [now/time "Looping..."]
log "Point 3"

do read-page

log "Point 4"
]

loop 100 [activate-search]

halt
-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: Sending mails & authentification

2004-03-30 Thread Jones, Scott

 Re: Sending mails & authentification

Hi, Robert, 

I'm down at the south pole, and we've had satellite problem that has made it very 
difficult to keep up with the list.  I just happened to check the discussion list and  
noticed your problem.

The REBOL interpreter used to be more aggressive in its evaluation of expressions, and 
my 2001 esend and esmtp took advantage of the evaluation.  The newer versions of REBOL 
over the last couple of years are less aggressive, so last year I change the patch and 
found an easier way to apply it.  This patch is looks for the authentication requests 
and feeds the username and password, when appropriate:

system/schemes/smtp/handler/open-check: [none "220" ["EHLO" system/network/host]  
"250" "AUTH LOGIN" "334" [port/user] "334" [port/pass] "235"]

Then, I would throw the following view script in front of any script that used 
Exchange email.  Note that the script encodes the username and password in base 64, 
which is required by MS Exchange Server. You may of course replace "MSusername" with 
the default that you would like presented.  Hitting return key advances the field and 
does final entry.

view lo: layout [ 
text "username" 
f: field "MSusername" [ 
system/schemes/smtp/user: copy enbase/base value 64 
] 
text "password" 
field hide [ 
system/schemes/smtp/pass: copy enbase/base value 64 
unview/all 
] 
do [focus f] 
] 

Then, you should be able to use the regular send command for email.  With luck, this 
method will still work for MS Exchange (5.5 at least).

HOWEVER, it appears as though your smtp server may want a *plain* authentication, 
meaning no encoding.  If so, then you may wish to try:

view lo: layout [ 
text "username" 
f: field "username" [ 
system/schemes/smtp/user: copy value 
] 
text "password" 
field hide [ 
system/schemes/smtp/pass: copy value 
unview/all 
] 
do [focus f] 
] 

This version passes the unencoded versions of the username and password. 

Hope that this helps. 

--Scott Jones 
 

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: newbie q : value & label in text-lists

2004-03-30 Thread Ammon Johnson

how about something like...

data: ["one" 1 "two" 2 "three" 3]

view layout [
text-list "One" "Two" "Three" [print data/:value]
]

HTH!
~~Ammon ;~>


- Original Message - 
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, March 31, 2004 1:25 AM
Subject: [REBOL] newbie q : value & label in text-lists


> 
> Hi, List!
> 
> I would like to set up text-list in my layout, so it 
> shows just labels, but when selected I could get 
> value.
> Like in HTML forms:
> Label 1
> I tried some variants by using data blocks, but not 
> yet success.
> 
> 
> thanks
> brds
> Janek
> 
> -- 
> To unsubscribe from this list, just send an email to
> [EMAIL PROTECTED] with unsubscribe as the subject.
> 
> 
> 
> 


-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] A short history of sets ;)

2004-03-30 Thread Volker Nitsch

REBOL [
  Title: "History-demo"
]
hist: copy/deep[]
curr: copy[]
upd: func[block][
repend hist[exclude curr block exclude block curr]
curr: copy/deep block
? curr ? hist 
]
b: copy[]
append b 1 upd b
append b 2 upd b
append b [3 3.1] upd b
remove next b upd b
insert b 4 upd b

print "rebuilding"
curr: copy[]
foreach [rem app] hist[
curr: exclude curr rem
append curr app
? curr
]

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] newbie q : value & label in text-lists

2004-03-30 Thread sags

Hi, List!

I would like to set up text-list in my layout, so it 
shows just labels, but when selected I could get 
value.
Like in HTML forms:
Label 1
I tried some variants by using data blocks, but not 
yet success.


thanks
brds
Janek

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: SOAP lib?

2004-03-30 Thread Dide
Re: SOAP lib?

Olivier Auverlot was working on a SOAP library but it's not fullt finished.

Contact him directly to know more about what is done :

to-email rejoin ["Rebol" 'france #"@" 'numericable ".fr"]

DideC

> Robert M. Münch wrote:
> > On Fri, 26 Mar 2004 16:29:05 +0100, Maarten Koopmans  
> > <[EMAIL PROTECTED]> wrote:
> > 
> > 
> >>No, but what version? 1.0 1.1 or 1.2
> >>All of them are totally different :-)
> > 
> > 
> > Hi, really? Good to know! Up to now I avoided to get to deep into SOAP.
> > 
> > 
> >>I would consider XML-RPC if i were you.
> > 
> > 
> > Me too, but not the possible customer. But I'm going to check this out  
> > again and convince them to use the simpler XML-RPC variant. Thanks.
> > 
> 
> Just look at the w3.org specs and the differences. Print the first 
> chapter of the specs and he'll surely be convinded ;-)
> 
> --Maarten
> 
-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: [Bot] email command Bot

2004-03-30 Thread Gregg Irwin

Hi Mauro,

MF> Though none has shown any interest in the project 8).

Yeah, that happens sometimes. We all get busy with other things.

MF> So, where do you think is the best place to upload/publish the unifinished 
MF> code?

REBOL.org is a great place to put it, even if it's unfinished. Just
make note of that so people know what state it's in.

-- Gregg 

-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] ANNOUNCE: I have catched the source of the read/lines bug !

2004-03-30 Thread Giuseppe Chillemi
If you use read/lines inside a "does" routine and read/lines fails a couple
of times Rebol will probably crash at the returning from the routine block.

 

To reproduce the BUG used the following script + ZONE ALARM (needed to STOP
internet activity by hand).

 

Do this:

Run the script

Stop the internet activity with the aid of the "lock" of Zone Alarm. Mantain
the lock closed  until the script prints an error message.

Restart the internet activity and wait for the script to cointinue its
looping. Then stop internet activity again.

Do this until Rebol will crash (this happen before 5 or 6 locks/unlocks)

 

The script provides logging at /c/activity.log

As you can see the last logged line is "Point 3" which is written just
before the routine "read-page". All the loggin which happens inside the
"read-page" loop is written before "Point 3". "Point 4", which is written
after returning from "read-page", is never written if the bug occurs.

 

 

REBOL [

  Author: "Giuseppe Chillemi"

  Description: "BUG Catcher"

]

 

write/lines %/c/Activity.log reform [now/time ""]

 

read-page: does [

  go-on: 0

  until [

   either error? read-result: try [my-page:
read/lines to-url my-url]

 [

  print [now/time
now/time "! Read Error on page" my-url]

   ]

   [

 go-on: 1

   ]

write/append/lines %/c/Activity.log reform [now/time "Point 0"]

   go-on = 1

  ]

write/append/lines %/c/Activity.log reform [now/time "Point 1"]

]

 

 

activate-search: does [

 

   my-url: rejoin["http://www.google.com";] ;rejoin
should not be needed

   write/append/lines %/c/Activity.log reform
[now/time "Point 2"]

   print [now/time "Looping..."]

   write/append/lines %/c/Activity.log reform
[now/time "Point 3"] 

   read-page

   write/append/lines %/c/Activity.log reform
[now/time "Point 4"]

] 

 

loop 100 [activate-search]

halt

 

I have reported everything to the Rebol people and waiting for an answer.

Could you confirm the BUG too ?

 

 

 

Giuseppe Chillemi

[EMAIL PROTECTED]

 

 

 

 



-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] R: Re: R: patching print & probe so they log to a file disk. [logs] [print] [probe]

2004-03-30 Thread Giuseppe Chillemi


> This looks like a bug we were investigating on Rebol-View
> Alt-ME world. I and henrikmk did a lot of work isolating the
> bug. There is more work to do, it is not a totally simple
> example, but one of the instructions required to show the
> bug was read/lines.

My program has reached its goal at release 2.1.0 but I have freezed the
branch which produced the bug at 2.0.0. In this release I have an procedural
BUG which let the program continue even if the read/lines produces the
error. For this reason I can confirm what you write: the failure of
READ/lines is only one of the ingredients that reproduces this problem. This
is told me by the print(screen)/append(to file) logging present in some part
of the code.

I'll do some further investigation and I'll report to the mailing list ASAP.

Giuseppe Chillemi




-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: [Bot] email command Bot

2004-03-30 Thread Mauro Fontana


Thanks for the answers, expecially about my [small ranting].
Though none has shown any interest in the project 8).

So, where do you think is the best place to upload/publish the unifinished 
code?

Thanks again

M&F




-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.



[REBOL] Re: [files][attributes] Making a file hidden...

2004-03-30 Thread Izkata

YAY, Thanks!  Heh, I was using Set-modes wrong or something...
No wonder I couldn't figure it out >.<

> I> Okay, I *used* to know how to do this, but I can't manage to find
> I> any help on it for some reason..
>
> I> How does Rebol make files Hidden/Read-Only/Archived/whatever else?
>
> SET-MODES.
>
> >> get-modes first read %. 'file-modes
> == [creation-date access-date modification-date owner-write archived
hidden system]
> >> get-modes first read %. 'hidden
> == false
> >> set-modes first read %. [hidden: true]
> >> get-modes first read %. 'hidden
> == true
>
> -- Gregg


-- 
To unsubscribe from this list, just send an email to
[EMAIL PROTECTED] with unsubscribe as the subject.