r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[Core] Discuss core issues

Gabriele
14-May-2006
[4372]
not sure code is readable... but if you want to play with it anyway...
Henrik
14-May-2006
[4373x2]
that looks good
as long as it's readable to rebol :-)
Graham
14-May-2006
[4375x2]
$ echo "1234567890" | perl -pe '1 while s/(.*)(\d)(\d\d\d)/$1$2,$3/'
   1,234,567,890
http://www.sunmanagers.org/pipermail/summaries/2002-December/002817.html
and there's an awk script on the same page
PeterWood
14-May-2006
[4377x2]
Try this thread, which includes a version of Gabriele's form-decimal 


http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlLTLK
All the versions are quite long though.
Henrik
14-May-2006
[4379]
gabriele's solution works fine here :-)
PeterWood
14-May-2006
[4380]
Did you notice the ; ***WARNING*** positive numbers only.
Gabriele
14-May-2006
[4381x7]
the version i sent him is the older, more generic one, which uses 
italian rules for formatting (, to separate decimals, ' to separate 
groups of 3 digits)
graham, the above regexp can be written in parse as:
digits: charset "1234567890" reverse rewrite reverse "1234567890" 
[[x: 4 digits] [(copy/part x 3) "," (pick x 4)
using my rewrite function
sorry, should be: digits: charset "1234567890" reverse rewrite reverse 
"1234567890" [[x: 4 digits] [(copy/part x 3) "," (pick x 4)]]
>> digits: charset "1234567890" reverse rewrite reverse "1234567890" 
[[x: 4 digits] [(copy/part x 3) "," (pick x 4)]]
== "1,234,567,890"
i wouldn't suggest doing it this way though ;)
Graham
14-May-2006
[4388x2]
to-comma: func [ n [number!]
	/local tx result
][
	tx: reverse form n
	result: copy ""
	while [ not tail? tx ][
		repend result [ part: copy/part tx 3]
		tx: skip tx 3
		if all [ not tail? tx 3 = length? part ][
			append result ","
		]
	]
	reverse result
]
no decimals ...
Gabriele
14-May-2006
[4390]
don't forget that if you use comma to group digits, you can't load 
it back in rebol anymore.
Graham
14-May-2006
[4391x3]
Rebol uses ' as a separator
to-comma: func [ n [number!]
	/local tx result parts left right
][
	one-comma: func [ tx /local result ][
		result: copy ""
		while [ not tail? tx ][
			repend result [ part: copy/part tx 3]
			tx: skip tx 3
			if all [ not tail? tx 3 = length? part ][
				append result ","
			]
		]
		result
	]
	parts: parse tx: form n "."
	left: reverse one-comma reverse parts/1	
	either found? parts/2 [
		right: one-comma parts/2
		rejoin [ left "." right ]
	][
		left
	]
]

handles decimal points as well.
>> to-comma 1
== "1"
>> to-comma 1234
== "1,234"
>> to-comma .1
== "0.1"
>> to-comma .1234
== "0.123,4"
>> to-comma 1234.1234
== "1,234.123,4"
Joe
15-May-2006
[4394x3]
I have trouble sending a BCC email with the new send function. Can 
anybody verify ? (I am using authenticated smtp)
h: make system/standard/email [ BCC: [copy-:-domain-:-com]]
send/header [to-:-email-:-com] msg h
Anton
15-May-2006
[4397x2]
Vaguely I think it should be: reduce ['bcc [copy-:-domain-:-com]]
no sorry, let me try...
Graham
15-May-2006
[4399]
don't think send supports cc
Anton
15-May-2006
[4400]
Yes, that's right, SEND is BCC by default.  Note the /show refinement: 
  /show "Show all recipients in the TO field"    That means by default 
they are not shown.
Joe
15-May-2006
[4401x4]
looking at send source, /show just clears the header to field, so 
it works when you send to multiple recipients and each one doesn't 
see who else received the email. When a message is sent to a single 
recipient the client shows the message is directed to you anyway. 
The trouble is this is not bcc
In this case, each message is individually addressed with only the 
recipient's email name appearing in the To field (similar to BCC 
addressing).
http://www.rebol.com/docs/core23/rebolcore-13.html- section 9.2
Sorry, the above to posts refer to the Core 2.3 docs. I have trouble 
with the "similar to bcc" If someone can provide some hints on how 
I should handle BCC then I will modify send source. To me this is 
a bug (i submitted to RAMBO) and I don't see what's the point of 
having BCC field in the standard header if this field is ignored
Graham
15-May-2006
[4405x3]
if you want bcc, just send the mail again addressed to the bcc recipient.
I think those fields are telling the email client how to send them. 
 It is up to you to implement them.
I can't think of any reason why an email client should ever receive 
an email with a bcc field.
Joe
15-May-2006
[4408x5]
Graham, I tried that but you get the same email than before with 
a different recipient but no BCC. I want to use BCC for some archiving 
project so I want to preserve the original To field like in real 
Bcc messages
Graham, I am not in the corporate world, but when I was Bcc was one 
of the hottest features, so many people used it to copy managers 
without the recipients being aware. I did like that use but it was 
widely accepted method to keep people in the loop
I did like
 --> I meant I didn't like
A semi-solution to this problem has been posted in RAMBO http://www.rebol.net/cgi-bin/rambo.r?id=4103&
This is a hack because the message shows the original headers so 
it's not true bcc but it partly solves my problem thanks
Brock
15-May-2006
[4413x2]
Joe, I had problems with BCC in a corporate mass emailing I did. 
 Even though it did not display the email address in the mail client, 
if you viewed the header of the mail message the BCC content was 
there.
A disgruntled recepient spammed the entire BCC list indicating our 
company didn't care or respect their privacy... just my luck.. .this 
was the first attempt to use Rebol for a valuable task at this job!! 
:-(
Maxim
15-May-2006
[4415]
<ouch!>
Joe
15-May-2006
[4416x2]
smtp-port: 	open [scheme: 'esmtp]
msg:		head insert insert tail net-utils/export o-h newline msg
insert		smtp-port reduce [v-from reduce [v-to] msg]   	
insert		smtp-port reduce [v-from reduce [v-bcc] msg]
Hi Brock, this is how I fixed the bcc issue. I set up the right headers 
in o-h and then send the to message and afterwards the bcc message
Anton
16-May-2006
[4418x2]
Joe, did you mean that the BCC field with all the addresses should 
appear in the header of every recipient's email ?
If so, then that's not how it's supposed to work. BCC really does 
mean "blind carbon copy". The recipient should have no way of knowing 
other addresses. Your only standards-conformant remedy is to use 
CC.
Henrik
16-May-2006
[4420]
is system/locale ever used for anything beyond the date requester? 
it would be nice if it were possible to localize date! type
Gabriele
16-May-2006
[4421]
send - i think there is a lot of confusion here