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

World: r3wp

[I'm new] Ask any question, and a helpful person will try to answer.

BrianH
24-Jun-2009
[3113x2]
You can use up to 10 tuple elements - any higher wouldn't fit into 
an immediate value.
I wonder why there are no datatypes specific for networking?

In general we like our types to be more widely applicable. However, 
we have tuple!, url!, and port!. The rest can be handled by functions.
Paul
24-Jun-2009
[3115x3]
mhinson, not sure if your using R2 or R3 but if your using R2 then 
you might want to know about get-modes.
>> get-modes tcp:// 'interfaces
== [make object! [
        name: "lo0"
        addr: 127.0.0.1
        netmask: 255.0.0.0
        broadcast: none
        dest-addr...
>> print get-modes tcp:// 'interfaces
name: "lo0"
addr: 127.0.0.1
netmask: 255.0.0.0
broadcast: none
dest-addr: none
flags: [multicast loopback]
name: "if15"
addr: 169.254.102.14
netmask: 255.255.0.0
broadcast: 169.254.255.255
dest-addr: none
flags: [broadcast multicast]
name: "if12"
addr: 192.168.1.105
netmask: 255.255.255.0
broadcast: 192.168.1.255
dest-addr: none
flags: [broadcast multicast]
I don't know what the equivalent in R3 is.
BrianH
24-Jun-2009
[3118]
Nothing yet :(
mhinson
25-Jun-2009
[3119]
The get-modes looks interesting. Can it produce information about 
any ip address I might give it?  like 172.22.37.55/28 

I suppose that is an example of a very common network address "type"
BrianH
26-Jun-2009
[3120]
GET-MODES gets information about ports, not addresses.
mhinson
26-Jun-2009
[3121]
Hi. is there a special function to remove the last element of a string 
please? this works, but seems a bit cryptic.
reverse next reverse {a.b.c.}        Thanks.
Sunanda
26-Jun-2009
[3122]
These avoids the double reversal -- not sure if they are less cryptic:
     head clear  back tail  {a.b.c.}
     head remove back tail {a.b.c.}
mhinson
26-Jun-2009
[3123]
Thanks Sunanda. I like clear back tail {a.b.c.}  then I can directly 
modify my string.
Gregg
28-Jun-2009
[3124]
Wrapping it in a func makes it less cryptic. :-)
mhinson
4-Jul-2009
[3125]
Hi. If I obtain a date from a file and it is a DATE!  what is in 
that date?  for example I know it contains date/month, but can I 
get it to return the month as a string with a leading 0 or anything 
like that?  Or is it up to me to code the formatting I need from 
integer date values? Is this documented anywhere or can I see any 
of the source some how.  Thanks.
BrianH
4-Jul-2009
[3126]
There are no built-in date formatting functions that do that. However, 
I'm sure the REBOL.org script library has one :)
mhinson
4-Jul-2009
[3127]
Hi Brian, I see some goodies there. What I am doing is too trivial 
to want to link any large blocks of code just for that so I will 
just code the bit I need I think.  I was puzzled because DATE returns 
the info with the month as  a word, but date/month returns an integer, 
so I imagined there must me more to DATE! than just a structure containing 
integers?
Ladislav
4-Jul-2009
[3128x2]
documented: do you mean like date/month date/day, etc?
http://www.rebol.com/docs/core23/rebolcore-16.html#section-3.2
mhinson
4-Jul-2009
[3130]
Hi Ladislav, yes. or any other bits of information attached to dtae 
types
Ladislav
4-Jul-2009
[3131x3]
(I found a couple of errors in the text)
seems, it was changed recently
the file http://www.rebol.com/r3/docs/datatypes/date.htmllooks like 
being affected too
Graham
4-Jul-2009
[3134x2]
>> d: now
== 5-Jul-2009/10:36:09+12:00
>> d/1
== 2009
>> d/2
== 7
>> d/3
== 5
though it's 4th of July for you guys ...
Ladislav
4-Jul-2009
[3136]
not for me anymore
mhinson
4-Jul-2009
[3137]
Thanks...  I can work with that information, but I am curious as 
to how referencing the whole date gives Jul  but there seems no option 
fot the month as a word.... not that I want it, but I am curious 
how that works.
Ladislav
4-Jul-2009
[3138]
>> d: now
== 5-Jul-2009/0:36:25+1:00
Graham
4-Jul-2009
[3139]
not applying to those guys who should be asleep!
Ladislav
4-Jul-2009
[3140]
LOL
Graham
4-Jul-2009
[3141]
which reminds me .. date functions should have a /utc refinement 
:)
mhinson
4-Jul-2009
[3142]
I write my best code in the middle of the night with no PC... shame 
it is all forgotton by the morning, or written on toilet pater.
Sunanda
4-Jul-2009
[3143]
Happy 753rd year of independence (source: wikipedia, apparently):
http://www.theonion.com/content/node/50902
Graham
4-Jul-2009
[3144x2]
mhinson .. look at the locale
753 years ???
Sunanda
4-Jul-2009
[3146]
Check the article, graham.
Graham
4-Jul-2009
[3147x2]
>> probe system/locale
make object! [
    months: [
        "January" "February" "March" "April" "May" "June"

        "July" "August" "September" "October" "November" "December"
    ]
    days: [

        "Monday" "Tuesday" "Wednesday" "Thursday" "Friday" "Saturday" "Sunday"
    ]
]
Gavin Menzies, the english "historian" claims the americas were "discovered" 
by a chinese fleet in 1421 ...
Ladislav
4-Jul-2009
[3149]
>> d: now
== 5-Jul-2009/0:42:01+2:00
>> pick system/locale/days d/weekday
== "Sunday"
>> pick system/locale/months d/month
== "July"
BrianH
4-Jul-2009
[3150]
Discovery means less and less every day :(
Graham
4-Jul-2009
[3151x2]
I'll only trust wikipedia when they put the "a" back in ... as wikipaedia
WTF ... did Ladislav's time zone undergo a shift  ... or is he flying 
??
mhinson
4-Jul-2009
[3153]
so does Rebol always reference the system/locale when printing a 
DATE! but only store the inteeger values?  or does it store the date 
in julian format & do more complex stuff to output even things like 
date/year
Ladislav
4-Jul-2009
[3154]
graham: the first one was from R3, the second one from R2
Graham
4-Jul-2009
[3155]
oh !
Ladislav
4-Jul-2009
[3156]
so "flying from R3 to R2"
Graham
4-Jul-2009
[3157]
In both cases .. your clock, or mine, is out by 2 mins
BrianH
4-Jul-2009
[3158]
mhinson, MOLD and FORM never reference system/locale - REBOL syntax 
is English-based.
Ladislav
4-Jul-2009
[3159]
my clock is out
Sunanda
4-Jul-2009
[3160]
Not sure we know the actual internal format.....You could run some 
timing tests to get an idea.
Another useful R2 mezzanine that may help. Mike:
   to-idate now
(to-idate not yet in R3)
Ladislav
4-Jul-2009
[3161]
is it known, that R3 does not take into account the DST?
BrianH
4-Jul-2009
[3162]
It does not notice the change, but does take into account the dst 
at start time.