World: r3wp
[Core] Discuss core issues
older newer | first last |
BrianH 21-Jan-2010 [15584x2] | People say "do it in a dialect" like those come for free. There's dialect processing overhead, issues of when the arguments are processed, decisions about whether there are keywords or not. To get an idea about the real overhead of doing it in a dialect, look at the source of APPLY or MAP-EACH in R2. Both are compiled dialects. |
If there's any way to make your code execute in one of the native dialects, do it, it's worth it. | |
Janko 21-Jan-2010 [15586] | data: parse-fixed-width-lines read/lines %PO.txt [ vat-incl: 4 [ trim empty? not ] vat-num: 9 trim ... ] this func is used to execute [ trim empty? not ] with a value.. which is similar to pipe or stack lang with only 1 level deep stack :)) stream-through: func [ fs d /local x acc ] [ accumulate x acc copy [] fs [ do compose [ (x) d ] ] ] |
Gregg 23-Jan-2010 [15587] | Janko, Ladislav did the most extensive CURRY I know of, though Joel Neely also did one, and a number of us have rolled simple versions here and there. http://www.fm.tul.cz/~ladislav/rebol/curry.r |
Henrik 23-Jan-2010 [15588x2] | Is there any solid way to find which chars are illegal in a specific file system? |
Never mind. Using some tables here. | |
Geomol 23-Jan-2010 [15590] | Henrik, I've used info here: http://en.wikipedia.org/wiki/Filename Do you have better info? |
Henrik 23-Jan-2010 [15591x2] | http://support.grouplogic.com/?p=1607 I used this one. |
but I see yours is better | |
Terry 23-Jan-2010 [15593x2] | Any gotchas when posting xml via read/cutom [post "<my xml>"] ? |
I'm getting a "REST method is not defined" response. | |
Maxim 23-Jan-2010 [15595] | that will depend how the server wants the post data... |
Terry 23-Jan-2010 [15596] | maybe some kind of REST header needs to be sent as well? |
Maxim 23-Jan-2010 [15597x6] | not an expert on REST interfaces... though I am using one with a server right now... |
are you sure your URL is built accoring to the server's specs? | |
also might want to make sure the content-type is set to: "application/xml" | |
(in the header) | |
IIRC you also need to name your post data... complete example, something like: header: [Content-Type: "application/xml"] name: "get-info" read/custom reduce ['post rejoin [ "value=" your-xml-data "&"] 'header header] | |
oops read/custom reduce ['post rejoin [ name "=" your-xml-data "&"] 'header header] | |
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! | |
older newer | first last |