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

World: r3wp

[Core] Discuss core issues

Pavel
8-Feb-2008
[9046x2]
TCP should be functional, but for the curious guy How to put valid 
event into system port (not to mesh with other system events) and 
how to wait for it?
Is it possible to build own class of events in system port? To easy 
ignore other plenty of events.
Oldes
8-Feb-2008
[9048]
I never used system port so I don't know
btiffin
8-Feb-2008
[9049x3]
insert-event-func  ??
But, R2 doesn't allow event insertion though, only monitoring.
afaik
Pavel
8-Feb-2008
[9052]
Does anybody built an event marshaller (in Amiga words broker) for 
interprocess comuncation? Any coments welcome.
Robert
9-Feb-2008
[9053]
IIRC I posted this topic once but there was no real good solution 
to it. I often face the following problem:


My app performs a bunch of calculations based on user input. Now, 
if a user hacks in extremly big numbers, the app crashes because 
of "math overflow".


The hard part is that it's mostly impossible to predict at which 
calculation step this will happen. Making code "division by zero" 
proof is not problem, but how do I make my code "math overflow" proof?
Graham
9-Feb-2008
[9054]
Trapping the error is not good enough?
Gregg
9-Feb-2008
[9055x2]
Pavel, I've done various things for IPC. There is no standard REBOL 
solution I know of though. How best to do it depends on the rest 
of your app, it's design, and what you mean by "event marshaller". 
Simple TCP has worked well for me in the past.
I'm still hoping for ARexx type support built in to REBOL.
Robert
10-Feb-2008
[9057x2]
Graham, well how do you trap the error if you have hundreds of calculations? 
Just on the global level? That's what I do. But overall the app than 
fails.
To be really save, one has to check for overflow for every single 
operation.
Gregg
10-Feb-2008
[9059]
What about having a central calculation engine in the app, and passing 
everything through that?
Robert
11-Feb-2008
[9060x2]
How does this help? You still have to check for an overflow either 
while doing every single operation or upfront.
Example: We have this simple formular:

result: (a * b) + (c * d)

There are three points of failure:
1. a * b overflows
2. c * d overflows
3. (a * b) + (c * d) overflows


And if you need to give feedback to the user you have to check every 
single operation.
Sunanda
11-Feb-2008
[9062]
I'd suggest something like this:

-- calculations are done in a special function that is passed a string, 
eg
   ans: calc "(a * b) + (c + d)"
-- the 'calc DOes the string, protected by an 'attempt
-- if it succeeds, it passes back the result

-- if not, it throws an error report. If necessary, you can parse 
the original string and try each part of the calculation to find 
the first failure....Recursively via 'calc to drill down nested parentheses 
of course.

**

Two obvious drawbacks to this suggestion:

1. all variables need to be global -- unless you do a lot of other 
work

2. beware side effects of malformed calc strings. You would not like 
it to be "delete/any *.*"
Oldes
11-Feb-2008
[9063]
Maybe you can use an expression dialect to do the calculation.
Gregg
11-Feb-2008
[9064]
If you want to provide exact details, you're going to have to do 
some analysis and processing yourself.
Henrik
12-Feb-2008
[9065]
>> read http://store.apple.com

connecting to: store.apple.com
connecting to: store.apple.com

** User Error: Error.  Target url: http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore
could not be retrieved.  Server response...
** Near: read http://store.apple.com

That's not a particularly useful error?
Sunanda
13-Feb-2008
[9066]
Nice thread contrasting LISP and REBOL:

http://coding.derkeiler.com/Archive/Lisp/comp.lang.lisp/2008-02/msg00756.html
Reichart
13-Feb-2008
[9067x2]
Would be cool to reduce that argument (debate) to a table (like Gregg 
did for Python).  If someone does that part, I will update the Qwiki...
Would love to have a collection of REBOL vs EVERYTHING
Gabriele
13-Feb-2008
[9069]
Henrik, btw, R3 can read that URL.
Oldes
13-Feb-2008
[9070x2]
I can read it from R2 as well
And one can always use  trace/net on  to see, where is a problem
Henrik
13-Feb-2008
[9072]
must have been while the store was down. some one came up with a 
bash script to check when it would come up again, and thought it 
would be easy to do in rebol, but no. :-/
Oldes
13-Feb-2008
[9073]
but maybe it's because I'm using my own version of http scheme
Henrik
13-Feb-2008
[9074x3]
works in standard R2 right now
when the store is down, the replace the page with a message. it's 
not like the site goes entirely down.
they replace
Oldes
13-Feb-2008
[9077]
ah... you have to use modified scheme for that if the site is responding 
something with error message.
Henrik
13-Feb-2008
[9078]
interesting. would it be qualified for 2.7.6?
Oldes
13-Feb-2008
[9079x3]
or you can use this:

if error? set/any 'err try [read http://store.apple.com][  err: disarm 
err probe err/arg1]
the server response is truncated only in console... I've just tested 
it with a very long invalid local url.
and someone should fix the altme to display correctly urls... is 
it just me who don't like it? Such a visible thing:/
Henrik
13-Feb-2008
[9082]
yes, I don't like it either...
Oldes
13-Feb-2008
[9083]
and it's such a simple fix.. it just needs to enhance the width of 
the face which is used to measure the width of the text.... I bet 
it's just a one byte fix.
Henrik
13-Feb-2008
[9084x2]
let's bring it to the 2.7.6 group and point it out there.
sorry, I'm talking nonsense.
Gabriele
14-Feb-2008
[9086]
if it's an error response, you can catch it in R3 in async mode. 
:) more work, but you don't need to hack the http scheme.
james_nak
15-Feb-2008
[9087]
Here's something I haven't figured out yet: Let's say I have an object 
that includes other objects
make object! [
lists: ["tom" "fred"]

objs: [ [ make object! [ name: "hello"] ] [make object! [name: "world"] 
]  ]
]

When I "load" this back from a file, is there a way I can "do" the 
entire object. It appears that the obj/objs remain in their rebol 
form but are not "real" objects. For now I have been just "doing" 
them as I get to them but it sure would be nice to simply get it 
done all at once.

Thanks, I hope you understand what I mean.
Graham
15-Feb-2008
[9088]
do you try save/all to save the object to a file?
Anton
15-Feb-2008
[9089]
James,
Create some nested objects:


 objects: context [objs: reduce [reduce [context [name: "hi"]] reduce 
 [context [name: "there"]]]]
	
Save them in a binary (should be just like saving to file):

	bin: make binary! ""
	
	save/all bin objects
	
Load back from the binary (should be like loading from file):
	
	objects2: do as-string load bin
	
Test to see if the nested objects were created properly:	
	
	>> type? objects2/objs/1/1
	== object!

	>> probe objects2/objs/1/1
	make object! [
		name: "hi"
	]
[unknown: 5]
16-Feb-2008
[9090]
I need to be able to explicitly determine if something some functions 
return false as their value.  I wrote a quick function to do this 
but shouldn't we already have something that does this?

My function is:


false?: func [val][either all [logic? val not val][return yes][return 
no]]
btiffin
16-Feb-2008
[9091]
That would be truefalse  :)   Sorry, couldn't resist.  But, yes, 
REBOL is very tri-state with the t f none thing. And zero being true, 
as a forther still rubs wrong, but that chaffing is almost over and 
done with.  Plus RebGUI now supports bi-state options, so life is 
good(er).  :)
[unknown: 5]
16-Feb-2008
[9092x2]
no that function wouldn't tell you if something is true.
true? func [val][either all [logic? val val][yes][no]]
btiffin
16-Feb-2008
[9094]
Sorry, I meant   a "true" false.
[unknown: 5]
16-Feb-2008
[9095]
yes