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

World: r3wp

[Core] Discuss core issues

Terry
24-Jan-2010
[15603]
name "=" your-xml-data ??
Maxim
24-Jan-2010
[15604x2]
like I said it depends on the server but most servers expect a form-like 
post data.
where name is the name of the variable which stores the xml and your-xml-data 
is, obviously, your xml file content.


you might also need to url-encode the xml-data so it gets read properly 
at the other end.
Terry
24-Jan-2010
[15606]
of xml?
Maxim
24-Jan-2010
[15607x4]
eh not sure what that refers to, but I guess you refer to "which 
stores the xml" ?
name is the argument name, like you would specify in a form.
(or a url, if it where a get)
the api of the server might also tell you to put some values in the 
URL to specify the function you are accessing on the server, some 
prefer that in the post data, its all very site specific.
Terry
24-Jan-2010
[15611x4]
yeah.. i don't think i have enough info i the api
GET works fine
it asks for the function be the first xml tag ie: <restmethod>
and then chokes.. im thinking it the rest header is lacking somehow.. 
but if it's asking for just xml, where would I shove it? I would 
think the rebol custom 'post' would do that.. but yeah, probably 
needs the Content-Type: "application/xml" .. ?

It's this kind of verbose nonsense that should have been left behind 
in the last century.
Maxim
24-Jan-2010
[15615]
so you should probably have to give a name to the parameter which 
is followed by the xml data  ex:

postdata=<restmethod><sometag>value</sometag></restmethod>
Terry
24-Jan-2010
[15616x2]
it doesn't specify
I can try with SOAP api provided, but i get the feeling it's going 
to be just as much of a time sink.
Maxim
24-Jan-2010
[15618x3]
for example, I did an interface for the meetup.com site in an hour, 
but their API docs are VERY well done and its really simple.
is this a pubic site?
(but you need a paying account for it to be any usefull, cause its 
bound to the account number)
Terry
24-Jan-2010
[15621]
not public
Maxim
24-Jan-2010
[15622]
do you have a client that works inside a browser?
Terry
24-Jan-2010
[15623]
I'll stick with GET for now.. thanks for your help
(no)
Maxim
24-Jan-2010
[15624]
you can try something devious, using rebol.  :-)
Terry
24-Jan-2010
[15625x3]
(send you a pm)
(send you a pm)
hmm
Maxim
24-Jan-2010
[15628]
-you open a tcp listen port
-edit the hosts file so your remote server points to 127.0.0.1

-and then just print out the data which the client would have sent 
to the server.


this works for just about every networked application I have tried 
and is a very powerfull way to learn how to build custom clients 
in rebol
Terry
24-Jan-2010
[15629]
could use wireshark i suppose
Maxim
24-Jan-2010
[15630]
yep good point
Henrik
24-Jan-2010
[15631]
Cyphre made this new FORM-DECIMAL function. I've been allowed to 
share it, so it can be tested:

form-decimal: func [
	num cifre
	/local m n o p result
][
	p: ""
	result: either find num: form num #"e" [
		parse num [
			any [copy m to "." skip] copy n to "E" skip o: (
				all [
					not m
					m: n
					n: ""
				]
				if m/1 = #"-" [
					m: copy next m
					p: "-"
				]
				z: (length? m) + to-integer o
				result: to-string reduce either negative? z [
					["0." (head insert/dup copy "" "0" abs z) m n]
				][
					o: join m n
					["" o (head insert/dup copy "" "0" (z - length? o))]
				]
			)
		]
		result
	][
		num
	]
	result: parse result "."
	o: result/1
	o: skip tail result/1 -3
	while [not head? o][insert o #"." o: skip o -3]
	all [
		not result/2
		insert tail result ""
	]
	result/2: copy/part result/2 cifre
	insert/dup tail result/2 "0" cifre - length? result/2
	all [cifre > 0 insert next result ","]
	all [result/1/1 = #"0" p: ""]
	join p result
]
Graham
24-Jan-2010
[15632x2]
Have you seen Gabriele's version?
The fact it uses the name "cifre" suggest it is related to Gab's 
vesion!
Steeve
24-Jan-2010
[15634]
What's that ? (seems messy at first glance)
With which params is that supposed to work ?
Graham
24-Jan-2010
[15635x2]
decimal! and integer!

where the latter specifies the number of decimal places
The task is to convert from scientific notation to numbers only
Steeve
24-Jan-2010
[15637x2]
I just have the feeling that it should be done with only few lines
*could be
Henrik
24-Jan-2010
[15639x2]
Graham, this is a replacement for Gabriele's version. This one is 
more complete.
The primary issue is overcoming REBOL's varying usage of scientific 
notation. That's one reason it's so big (but still smaller than Gabriele's).
Maxim
24-Jan-2010
[15641]
I've done my own, and its similar, in size and functionality... not 
much to do... the scientific notation is a pain to manage.
Graham
24-Jan-2010
[15642x2]
I suggest we fix core so that it triggers scientific notation at 
7 decimal places as it does in R3 instead of at 2 decimal places 
as it does no.
w.
Steeve
24-Jan-2010
[15644]
well, using a "mask" approach, allows more capabilities then just 
providing the number of decimals.

Like I've done here for R3: http://www.rebol.net/cgi-bin/r3blog.r?view=0302#comments
(see fnum)


It's true, it doesn't handle scientific notation as entry currently, 
but hey !, it should not take more than 2 or 3 more lines.
Graham
24-Jan-2010
[15645]
I'd rather we didn't have the problem in the first place!
Henrik
24-Jan-2010
[15646]
Yes, agree. I'm helping building a rather large app, where this is 
important and when things like this aren't trivial to solve... But 
what ever happens, I think we need a function like this in R3 and 
R2-Forward.
Gregg
24-Jan-2010
[15647]
It should be part of a general FORMAT func IMO.
BrianH
24-Jan-2010
[15648]
The disadvantage to that is that it makes the FORMAT function more 
complex, and thus slow.
Gregg
24-Jan-2010
[15649]
It's just chocies. Format, as it stands, isn't something I'll use. 
And if someone shows me a case where the overhead has a noticable 
and visible impact on their code, I will refactor a custom version 
for them. :-) 


I'm open to discussion, scenarios, and the backs of envelopes. Where 
is FORMAT likely to be used, how often will it be called, and how 
slow is too slow?
BrianH
24-Jan-2010
[15650]
Numeric formatting should be fast enough to get called in a tight 
loop for grid output. Thousands of times, really quickly.
Graham
24-Jan-2010
[15651x2]
well, if you format you change the type
in rebgui at least