[REBOL] debugging TCP/IP programs
Has anyone written a listen utility to monitor port 80? I am trying to see what the remote web server is sending so that I can respond appropriately from a rebol client. --- Regards,Graham Chiu gchiuatcompkarori.co.nz http://www.compkarori.com/dynamo - The Homebuilt Dynamo http://www.compkarori.com/dbase - The dBase bulletin
[REBOL] Re: empty context possible? Re:
Hello [EMAIL PROTECTED]! On 18-Feb-00, you wrote: V I did and got something similar to this, but was able to hack V it with going to global scope by "/probe" instead of "probe". Actually, it doesn't work, or at least it doesn't here. I just get "hello" returned (just because it is the last value in the block); indeed, /probe is a refinement, not a word, so it is not evaluated as a word. do [probe] ; this is a word ** Script Error: probe is missing its value argument. ** Where: probe do [/probe] ; this is a refinement == /probe type? do [/probe] == refinement! V (Gabrielle, please don't V try this with "/delete rebol.exe"!!! But thank you for the I can: do [/delete %rebol] == %rebol Nothing happens here, even if I didn't bind it to a "secure" context. P.S.: just to let you know, my name is Gabriele (with just one "l"), and it is an italian male name. :-) Regards, Gabriele. -- o) .-^-. (--o | Gabriele Santilli / /_/_\_\ \ Amiga Group Italia --- L'Aquila | | GIESSE on IRC \ \-\_/-/ / http://www.amyresource.it/AGI/ | o) `-v-' (--o
[REBOL] debugging TCP/IP programs Re:
[EMAIL PROTECTED] wrote: Has anyone written a listen utility to monitor port 80? I am trying to see what the remote web server is sending so that I can respond appropriately from a rebol client. www.rebol.org look at Sterling's proxy script, very nice http://www.rebol.org/advanced/proxy.html http://www.rebol.org/advanced/proxy.r Regards, -pekr- --- Regards,Graham Chiu gchiuatcompkarori.co.nz http://www.compkarori.com/dynamo - The Homebuilt Dynamo http://www.compkarori.com/dbase - The dBase bulletin
[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] Precision in fractionnal numbers
I wrote before on the mailing list ([EMAIL PROTECTED]) about the importance of precision when manipulating money values. Money values are currently handled with floating point values stored in base 2. I'm trying to produce a sample of how this internal design might result in wrong results. I didn't found one yet with money values, but here is one with date values : d: now == 19-Feb-2000/18:43:56+1:00 d/time/second: 29.456 == 18:43:29.45599 This test was running on the Win32 platform. As you can see, the output is not the same as the input. This is due to the fact that the input (29.456) is converted from decimal to binary for storage, then from binary to decimal for output. One thing that too many programmers ignore is that conversion of fractionnal numbers may result in losing precision when converting from decimal to binary or from binary to decimal. For date value, I don't care because I don't plan to use so small values of time. But I repeat that precision is the most important thing when dealing with money values. Olivier Mengué
[REBOL] httpreferer?
How can I get the http refering page when using webserver.r ? -Rich
[REBOL] New? programming construct Re:(4)
Hi Elan, 17-Feb-2000 you wrote: Would that mean that GnuC++ would not be able to incorporate rules? Beta has had rule constraints for at least two or three years. Do you mean the Beta programming language, or just the beta versions of GnuC++? (Didn't think anybody outside of the University of Aarhus, here in Denmark, knew about Beta. And before I get your reply, I still think I'm right on that one ;-) ) Kind regards, -- Ole Friis [EMAIL PROTECTED] "Ignorance is bliss" (Cypher, The Matrix)
[REBOL] unsubsribe
NO
[REBOL] Digest Format for REBOL List
The REBOL e-list is very helpful. Probably many of us novice listeners would appreciate a digest format. A digest is a collection of the previous day's exchanges that is automatically compiled and mailed to (digest) subscribers once per day. This single daily e-mail is less troublesome than the raw traffic. Someone familiar with SELMA could figure out how to add digest capability. Subscribers should be able to change back and forth between regular and digest subscriptions. From what I gather about REBOL's capabilities, this sort of problem should be fairly trivial. Mark Evans
[REBOL] unsubsribe Re:
[EMAIL PROTECTED] wrote: Subject: [REBOL] unsubsribe NO MORE PLEASE 1 To unsubscribe from this list, simply send an email to this list with only this: unsubscribe in the subject line. To make sure of this, click this link: [EMAIL PROTECTED]?subject=unsubscribe Make sure your spelling of "unsubscribe" is correct. In fact, to make sure of it, copy the word unsubscribe from this email. Andrew Martin ICQ: 26227169 http://members.xoom.com/AndrewMartin/ --
[REBOL] .r to html monthly calendar prelude
Do any rebols have examples of .r scripts that create monthly calendars thatthey are willing to share? Or even a few thoughts on how you would create one. The following are some simple scripts I made yesterday as a prelude to html monthly calendar. The work, however I'd love to see how other people are thinking about calendar.r thatwill create interactive monthlycalendars for events, etc Ideally some link to a database or (block?) or (series?) will be useful so that http:// visitors or administrator will be able to change the events visa the http:// link. But before you see the prelude to the calendar scripts, let's assume I want to provide access to an http://wateva.com/admincal.r how do I go about protecting that admincal.r file soonly thepersons with the proper username and password have access? I'm talking about the internet here not a private intranet... ideally the admincal.r will ask the person for a username and password. If not correct it will send them to some index.htm or index.r fileafter a few tries. If they are authorized via the proper username and password that they enter then it continues on with the rest if the script allowing them to update or delete events, etcetera. REBOL [ Title: "day of the Week" Date: 18-Feb--2000 Author: "J B" Version: 1.0.0 Purpose: "Shows day of the week and number of days in months, it's a prelude to an HTML monthly calendar"] print "The ify way to show today is " if now/weekday = 1 [print "Monday"] if now/weekday = 2 [print "Tuesday"] if now/weekday = 3 [print "Wednesday"] if now/weekday = 4 [print "Thursday"] if now/weekday = 5 [print "Friday"] if now/weekday = 6 [print "Saturday"] if now/Weekday = 7 [print "Sunday"] print [" The switch way to show today is " switch now/weekday [ 1 ["Monday"]2 ["Tuesday"]3 ["Wednesday"]4 ["Thursday"]5 ["Friday"]6 ["Saturday"]7 ["Sunday"] ]; ends switch]; ends print ; QUESTION there's go to be more elegant ways of getting the named day than this?print [newline "QUESTION there's go to be more elegant ways of getting the named day than the two ways I've shown here?" newline] ; convert the current month to words, save it.switch now/month [1 [currentMonth: "January"]2 [currentMonth: "February"]3 [currentMonth: "March"]4 [currentMonth: "April"]5 [currentMonth: "Mayo"]6 [currentMonth: "June"]7 [currentMonth: "Julio"]8 [currentMonth: "Augusta"]9 [currentMonth: "September"]10 [currentMonth: "Octopus"]11 [currentMonth: "Novice"]12 [currentMonth: "Decent"] ] ; end switch of month firstOfMonth: now - now/day + 1 Print ["the first day of " currentMonth now/year "was" switch firstOfMonth/weekday [1 ["Monday"]2 ["Tuesday"]3 ["Wednesday"]4 ["Thursday"]5 ["Friday"]6 ["Saturday"]7 ["Sunday"] ] ; ends the switch] ; ends first day of month print ;figure out the number of days in this month and print monthInQeustion: now/monthEOMtest: firstOfMonth + 27 print ["before using to-date is EOMtest a date? " date? EOMtest]EOMtest: to-date EOMtestprint ["after to-date is EOMtest a date? " date? EOMtest]; I'd like to assign the above to EOMtest: [firstOfMonth + 27] ; however then if I use EOMtest/month it claims 'invalid path value: month'; I had to-date the EOMtest Now after working on this all day long I'm not sure ; about this so the following question maybe a bit silly...;; QUESTION why doesn't the type date value automatically transfer to the new variable?;; Note: the second time you run this both of the date? of EOMtest will be true,; because EOMtest is now in a date type resulting from ; the previous run unless of course you've reset all the variables;-}; which brings me to my next ; QUESTIION how do I easily clear or reset variables at the begining of the script? month: monthInQuestionwhile [month = monthInQuestion] [ EOMtest: EOMtest + 1 daysInMonth: EOMtest/day month: EOMtest/month] ; ends code of while block; go back one day for last day in monthEOMtest: EOMtest - 1daysInMonth: EOMtest/dayprint [" There are " daysInMonth " days in " currentMonth now/year] ; figuring out how many days in month; one way that seems intutive if I could do somthing like ; goToEndOfMonth: make date! [dd mm yy] where dd mm and yy are actually variables; and iterate using any of dd mm or yy... but that doesn't seem to work; help on the above... line is appreciated; than I could itereate any of these values.; and test for when mm change the previous dd is the number of days in month; instead I do the following... ; however, tmtowtdi so ... more elegant solutions will be greatly appreciated. print "Enter a date in the following format dd-mm-yy I'll tell you the day of the week of the first day, the last day and the number of days in that month."print " go ahead dd-mm-yy " inputDate: inputinputDate: to-date inputDatedateInQuestion: inputDatemonthInQuestion: dateInQuestion/month ; convert the monthInQuestion to words, save it.switch monthInQuestion [1 [MonthName:
[REBOL] .r to html monthly calendar prelude Re:
REBOL [ Title: "day of the Week" ] ;figure out the number of days in this month and print ; figuring out how many days in month ; one way that seems intutive if I could do somthing like=20 The 'standard', if there is such a thing, for figuring out the day of the week is "Zeller's Congruence". His formula might help you out. Sorry that I didn't take the time to convert it to Rebol. Would like to see it that way if some one is so inclined. /* Zeller's Congruence: From "Acta Mathematica #7, Stockholm, 1887. Determine the day of the week give the year, month, and the day of the month; which are passed in the structure 'utc' return( 0 = Sunday...6=Saturday ) and also set utc-wday J = Century (ie 19), K = Year (ie 91), q = Day of the month, m = Month March = month #3December = month #12, January = month #13, February = month #14 OF THE PREVIOUS YEAR. [q + [((m + 1) * 26 ) / 10] + K + (K / 4) + (J / 4) - (2 * J)] % 7 Because of the "% 7" term, -(2*J), and +(5*J) give the same answer. */ UINT weekday( gmt ) struct utc *gmt; { UINT mth, year, cent; register UINT temp; year = gmt-year; mth = gmt-month; if( mth 3 ) { mth += 12; --year; } cent = year / 100; /* 19th, 20th, or 21th etc century */ year %= 100; /* Tens of years (00-99) */ temp = gmt-day; /* Start with the day of the month */ temp += (((mth + 1) * 26) / 10); /* Advance to the start of the month */ temp += year; /* [K] Add in the year */ temp += (year / 4);/* [K/4] Correct for leap years */ /* Because of the "% 7" term, -(2*J), and +(5*J) give the same answer: */ temp += (cent * 5);/* [J*5] Correct for centuries */ temp += (cent / 4);/* [J/4] Give extra day ever 400 years */ temp %= 7; /* 7 days in a week */ if( !temp )/* Wrap Saturday to be the last day of week */ temp = 7; temp -= 1; /* 0 = Sunday...6=Saturday */ gmt-wday = temp; return( temp ); }
[REBOL] Re: What am I doing wrong? Re:(3)
Hello, On 07-Feb-00, [EMAIL PROTECTED] wrote: This list is a real good idea. I use Sambar and they have a list like this. I have never recieved this kind of product support from Microsoft.. There's the difference, you get your money's worth with Rebol. M$ support? Yeah, right! Elliott
[REBOL] New? programming construct Re:(5)
Hi Ole, you wrote: Do you mean the Beta programming language, Yes. or just the beta versions of GnuC++? (Didn't think anybody outside of the University of Aarhus, here in Denmark, knew about Beta. :-) And before I get your reply, I still think I'm right on that one ;-) ) Yikes. I didn't know Beta was *that* unknown. I actually printed out and studied the accompanying manuals. I especially like the idea of fragments. It provides some interesting added flexibility. I also found the arrow notation very intuitive and appealing. The only thing that stopped from actually using Beta beyond just entering all the examples from the manuals was the fact that the MS Windows GUI support was rather weak (at the time it relied on Tcl/Tk, if I remember correctly.) The kind of software I was looking to implement would have been very GUI intensive and I dreaded the idea of having to fool around with Tcl/Tk in order to get it to work, albeit through a Beta interface. At some point I remember someone announced that they were a implementing a constraint sub system for Beta. ;- Elan [: - )]
[REBOL] .r to html monthly calendar prelude Re:(2)
Hello, BP: On 20-Feb-00, [EMAIL PROTECTED] wrote: The 'standard', if there is such a thing, for figuring out the day of the week is "Zeller's Congruence". His formula might help you out. Sorry that I didn't take the time to convert it to Rebol. Would like to see it that way if some one is so inclined. I did a "Zeller's Congruence" last summer, as a learning experience. At the time, it was politely ignored because of REBOL's built-in date function. The only REBOL code that I have publicly available is at: http://www.naples.net/~nfn07075 -- ---===///||| Donald Dalley |||\\\===--- The World of AmiBroker Support http://webhome.idirect.com/~ddalley Member: ICOA and Team AMIGA
[REBOL] bpaddocks revival of Zeller's congruence Re:
; Here's a working zeller.r script... ; corrected a few of the goofs from previous post. ; note that this isn't quite what I was looking for when I posted the calendar.r html making letter ; however it's nice to know about Zeller's Congruence... REBOL [ Title: "bpaddock revival of Zeller's Convergenc or print the day of the Week" Date: 18-Feb--2000 Author: "converted from c? by JB c source provided by bpaddock" Version: 1.0.0 Purpose: "Shows day of the week, because we can" ] ; ; The 'standard', if there is such a thing, for figuring out ; the day of the week is "Zeller's Congruence". His formula ; might help you out. ; ; Sorry that I didn't take the time to convert it to Rebol. ; Would like to see it that way if some one is so inclined. ; ; jb was inclined as long as bpaddock edits...and error corrects ; /* Zeller's Congruence: From "Acta Mathematica #7, Stockholm, 1887. ; ; Determine the day of the week give the year, month, and the ; day of the month; which are passed in the structure 'utc' ; ; return( 0 = Sunday...6=Saturday ) and also set utc-wday ; ; J = Century (ie 19), K = Year (ie 91), q = Day of the month, m = Month ; ; March = month #3December = month #12, ; January = month #13, February = month #14 OF THE PREVIOUS YEAR. ; ; [q + [((m + 1) * 26 ) / 10] + K + (K / 4) + (J / 4) - (2 * J)] % 7 ; Because of the "% 7" term, -(2*J), and +(5*J) give the same answer. ; ; */ ; ; Print "If you want to know what day of the week any date is?" Print " Please, enter the year give all four digits " oyear: input year: make integer! oyear ; I DON'T know what the equivalent commands in Rebol are for initializing? ; UINT weekday( gmt ) ; struct utc *gmt; ; { ; UINT mth, year, cent; ; register UINT temp; ; year = gmt-year; ; mth = gmt-month; ; Print "Enter the month as m or mm" omth: input mth: make integer! omth ; how is this supposed to be set to integer? if mth 3 mth: mth + 12 year: year - 1 ] ;end if ; what is the proper way to enter more than one statement? ; could I have written: ; if mth 3 [mth: mth + 12 year: year - 1] ; if( mth 3 ) ; { ; mth += 12; ; --year; ; } ; cent: year / 100 ; cent = year / 100; /* 19th, 20th, or 21th etc century */ ; ok bpaddock what's the % command do here? remainder? Modulo? Integer Modulo? ; Just what is this dulo that I'm asking more of ? (imagine that being said by Groucho Marx?) ; even though I know it's not modulus does rebol have a modulus operator? ; year %= 100; /* Tens of years (00-99) */ year: remainder year 100 Print "Enter the day of the month as either d or dd" dd: input dd: make integer! dd ; or the above could be extraced from the present day as in the line below: ; dd: now/day ; but I prefer the interactive effect... the present is so limiting ; temp = gmt-day; /* Start with the day of the month */ ; we have day of the month from input ; temp += (((mth + 1) * 26) / 10); /* Advance to the start of the month */ temp: dd + (((mth + 1) * 26) / 10) ; gosh I hope that syntax works in Rebol... ; ; temp += year; /* [K] Add in the year */ temp: temp + year ; ; temp += (year / 4); /* [K/4] Correct for leap years */ temp: temp + year / 4 ; I haven't reviewed the hierarchy of operators but above line should work... ; ; /* Because of the "% 7" term, -(2*J), and +(5*J) give the same answer: */ ; temp += (cent * 5); /* [J*5] Correct for centuries */ temp: temp + (cent * 5) ; ; temp += (cent / 4); /* [J/4] Give extra day ever 400 years */ temp: temp + (cent / 4) ; ; temp %= 7; /* 7 days in a week */ print ["temp before dividing by 7 = " temp] temp: remainder temp 7 print ["temp after dividing by 7 = " temp] temp: make integer! temp print ["temp after temp: make integer! temp = " temp] ; ; if( !temp ) /* Wrap Saturday to be the last day of week */ if temp = 0 [ temp = 7] ; temp = 7; ; ; temp -= 1; /* 0 = Sunday...6=Saturday */ ; in my case I want 1 = Sunday 7 = Saturday... print [" The day of the week you were looking for "dd"/"omth"/"oyear " is " switch temp [ 1 ["Sunday"] 2 ["Monday"] 3 ["Tuesday"] 4 ["Wednesday"] 5 ["Thursday"] 6 ["Friday"] 7 ["Saturday"] ]; ends switch ]; ends print ; ; gmt-wday = temp; ; ; return( temp ); ; }
[REBOL] Doomsday Algorith / Day of the Week was bpaddocks revival of Zeller's congruence Re:
Just a quick parse and respond... this might be of interest to some of the folks on the list who might not be aware of it. John Conway of LIFE fame (the automata thing) is credited with an algorith similar to Zellers called the "Doomsday Algorithm." His algorithm is simple enough to perform in your head for any date in history, with just a little practice. Knocking out a Rebol implementation is on my todo list. A good starting point is http://www.interlog.com/~r937/doomsday.html Anyone know both of these algorithms well enough to talk about their differences, pros / cons of one over the other, etc? jb