World: r3wp
[Core] Discuss core issues
older newer | first last |
sqlab 20-Sep-2008 [10919] | it looks as if the carriage returns are replaced by tabs. |
amacleod 20-Sep-2008 [10920x2] | There are also tabs in the text... I think the carriage returns have been stripped out? |
Here is what the block looks like just before I upload it to the database: [1 "FFP-LADDERS" "1-PORTABLE LADDERS" "2.1.2" { \table Straight Weight^-Ladders 20'^-55 lbs. 20'(Hook)^-60 lbs. 12'(Hook)^-35 lbs. /table } "" 20-Sep-2008/16:58:48-4:00] | |
sqlab 20-Sep-2008 [10922] | sorry, I looked too short.. did you look at the source of tretbase? |
amacleod 20-Sep-2008 [10923] | No, I'm working with Paul on it. He will be able to sort it out better than me. I thought it might be related to the same problem I had with my block of blocks above... |
BrianH 20-Sep-2008 [10924] | Try the new-line function. |
Graham 20-Sep-2008 [10925x6] | Mindtouch's Deki is the wiki now adopted by Mozilla internally. I suggested we use this instead of Mediawki because it has an API http://wiki.developer.mindtouch.com/MindTouch_Deki/API_Reference but .... |
It has multi-language support ( human languages ) | |
This is how to authenticate against the wiki using REBOL http://synapsedirect.com/forums/permalink/6737/6736/ShowThread.aspx#6736 | |
I had to alter the prot-http to allow get to send cookies. | |
If you click on their api reference you will see code samples nicely formatted with line numbers .. much nicer than Mediawiki | |
So, the API would allow someone to easily update the wiki directly from Rebol sources | |
Henrik 21-Sep-2008 [10931] | Graham, did you study my wiki-tools for Mediawiki? They have been available for over a year. |
Graham 21-Sep-2008 [10932] | nope. didn't know you had released them. I was aware that you had been working on something. |
Henrik 21-Sep-2008 [10933x2] | they are not entirely done, but doc uploading and syncing should work. |
so it should be possible to create a local editor to edit mediawiki pages, or to upload series of pages generated locally. | |
Gregg 21-Sep-2008 [10935] | new-line post from ML: http://www.rebol.org/ml-display-thread.r?m=rmlMMCC |
Graham 22-Sep-2008 [10936x3] | Looks like I need to do a HTTP PUT to upload binary files .... |
So, I guess I need a way to add the PUT method, and then switch the IO from lines mode to binary and then back again. | |
From my understanding, R3 implements http prot all as binary and does not use lines mode | |
Gabriele 22-Sep-2008 [10939] | yes, R3 tcp ports are binary only. |
Graham 22-Sep-2008 [10940x12] | So, how about something like read/custom url [ PUT %file [ header .. ] ] ? |
calculate the content-length, add the new headers, insert the file as binary and then switch back to lines mode for R2 ? | |
apart from it not working ... anyone see a problem with this? either all [block? port/state/custom post-data: find port/state/custom 'post post-data/2] [ http-command: "POST" HTTP-Get-Header: make HTTP-Get-Header append [ Referer: either find port/url #"?" [head clear find copy port/url #"?"] [port/url] Content-Type: "application/x-www-form-urlencoded" Content-Length: length? post-data/2 ] either block? post-data/3 [post-data/3] [[]] post-data: post-data/2 ][ either all [block? port/state/custom post-data: find port/state/custom 'get post-data/2] [ http-command: "GET" HTTP-Get-Header: make HTTP-Get-Header append [ Referer: either find port/url #"?" [head clear find copy port/url #"?"] [port/url] ] either block? post-data/3 [post-data/3] [[]] post-data: none ][ if all [block? port/state/custom post-data: find port/state/custom 'put post-data/2] [ http-command: "PUT" data: system/words/read/binary post-data/2 HTTP-Get-Header: make HTTP-Get-Header append [ Content-Type: "application/octet-stream" Content-Length: length? data ] either block? post-data/3 [post-data/3] [[]] ] post-data: post-data/2 ] ] | |
last line should be post-data: data | |
And it's working :) | |
read/custom URL compose/deep [ PUT %file.png [ Cookie: (cookie) ]] will use the http put method to upload a binary file and sets the cookie | |
So, this will work with large files, it should be changed so that it does a skip/binary and inserts the file in chunks. | |
If the server returns an error such as 400 bad request, Rebol appears to discard any messages that the server sends back with this .... and just throws an error. | |
Wouldn't it be better if we had access to the data sent to us without doing an 'open instead of a 'read ? | |
This is pretty cool .. I just uploaded a 14Mb file using PUT ( though I had to increase the http timeout period ) | |
Seems odd to me that the port will timeout even though it "knows" it is writing data to the port. | |
Here's the protocol with my changes .. http://rebol.wik.is/Protocols/Http | |
Louis 23-Sep-2008 [10952x2] | file: replace/all file {оп} {} Why can't rebol replace that string in the file I'm processing? It will replace it in a string entered at the command console, but not in my file. |
file: read %file.txt | |
Henrik 23-Sep-2008 [10954] | it's better to do it on a binary representation of the string, using 'as-binary. the chars you enter in console may not be of the same charset as those you have saved the file in. |
Louis 23-Sep-2008 [10955x3] | Like this? file: replace/all file as-binary {оп} {} |
Henrick, from what you say, I think I see what is happened. I'm copying the string from a utf-8 encoded file to an assci encoded file. The copy converts the string to different characters. But how do I get around this? | |
is happened = is happening | |
Henrik 23-Sep-2008 [10958x3] | you must work solely from the encoding in the file. intermixing input from the console will ruin that. I will post an example in a minute. |
or easier for me to explain: you must search for the hex values in the file. work only in binary. | |
what I would do is get the offending chars from your file in a text editor and paste them in a separate file and save it in the same encoding as the original file. then read/binary it with rebol, and you can see the hex values directly. | |
Gabriele 23-Sep-2008 [10961] | Graham, in R3's http you can use any method you want, with any headers you want and any content you want. Was this your question? (I do still need to add transparent cookie support. but that's a few minutes work, so it'll be there for release.) |
Louis 23-Sep-2008 [10962] | Henrik, that worked. Many thanks! |
Henrik 23-Sep-2008 [10963] | congrats :-) |
Graham 23-Sep-2008 [10964x4] | Gabriele ... I probably did ask that question and it's good to know the answer is affirmative. |
But since we are stuck without R3 at present, I'm needing to patch the R2 prot-http so that we can use all the headers. | |
methods. | |
What's the situation with timeouts in R3? | |
Gabriele 24-Sep-2008 [10968] | not too good yet. but, i know Carl has that internally, it's just not exposed. |
older newer | first last |