World: r3wp
[Core] Discuss core issues
older newer | first last |
Joe 30-May-2006 [4768] | thanks, good examples |
Oldes 31-May-2006 [4769] | Anton, yout ftp patch was not working, but I solved the issue with missing directories using this code: while [ error? set/any 'err try [trgp: open/direct/new/write rejoin [ftp-url trg-dir trg-file]] ][ err: disarm err if all [ err/code = 800 parse err/arg1 [thru "tcp 550 " copy missingdir to ":" to end] ][ print ["Making directory:" join ftp-url missingdir] if error? try [make-dir join ftp-url missingdir][ trgp: none break ] ] ] |
Anton 31-May-2006 [4770] | Oldes, what FTP server did you try it with ? |
Oldes 31-May-2006 [4771x2] | the code above is not working either:-( |
It works only for one directory level:-) | |
Anton 31-May-2006 [4773] | How badly was my ftp patch not working ? :-) |
Oldes 31-May-2006 [4774] | it's not making missing dirs |
Anton 31-May-2006 [4775] | Did you get this net-error "Cannot open a dir port in direct mode" ? |
Oldes 31-May-2006 [4776] | ** User Error: Server error: tcp 550 httpdocs/test/1/2/: No such file or directory |
Anton 31-May-2006 [4777] | Are you sure the patch was applied correctly ? (uncomment the ;print "patch" line.) Perhaps your FTP scheme is already patched ? |
Oldes 31-May-2006 [4778x2] | and this one as well: ** User Error: Cannot open a dir port in direct mode |
if I use /direct | |
Anton 31-May-2006 [4780x4] | Ah that's right. |
Ok, I recommend to use open and close the port *not* in direct mode, just to create the directory. Then, try opening your port in direct mode to do the write. | |
Sorry, that wasn't very clear.. Use my code snippet above just to create the path. port: make port! ftp-spec ; only path, no target port/state/flags: port/state/flags or system/standard/port-flags/open-new port/handler/open port close port ; now try to open/direct ... etc.. | |
There is some debug info available with: trace/net on | |
Oldes 31-May-2006 [4784] | I found the problem, you have this: {Server error: tcp 550 Can't change directory to} thru {:} {No such file or directory} but my ftp server's response is only: Server error: tcp 550 httpdocs/test/1/2/: No such file or directory |
Anton 31-May-2006 [4785x3] | Aha..! yes, very good. I knew that piece of code was possibly brittle. (Thankyou FTP, thankyou.) |
Maybe I should just look for "tcp 550" what do you think ? | |
or parse response [thru "error" thru " tcp " thru " 550 "] | |
Oldes 31-May-2006 [4788] | yes, that's working now |
Anton 31-May-2006 [4789x2] | Cool. Does it work even in direct mode ? |
I think you can just open the port once now. | |
Oldes 31-May-2006 [4791x2] | no |
YES, it's working even in direct mode. But must use the file name as well | |
Anton 31-May-2006 [4793x2] | Yes, that's right, you would have got the "Cannot open a dir port in direct mode" error ? |
Congratulations. You successfully used my patch. :-) | |
Oldes 31-May-2006 [4795x2] | and I think, this should be enough: thru "tcp 550" to end |
lines 81 and 107 | |
Anton 31-May-2006 [4797] | Could be. Thanks for your report. |
Oldes 31-May-2006 [4798] | Thanks you for the patch:-)) |
Anton 31-May-2006 [4799x3] | Most welcome, Oldes. |
What's your FTP server, by the way ? | |
(I mean, what's the name and version of the FTP server ?) | |
Oldes 31-May-2006 [4802] | ProFTPD 1.2.10 Server (ProFTPD) |
Anton 31-May-2006 [4803x2] | Thankyou. |
Ok uploaded new version to the same location. | |
Gordon 2-Jun-2006 [4805] | Hello; I'm getting an "Internal Error: No more global variable space Where: to-word ** Near: to word! :value" when i run a program that after reading a file into memory, it then does a character by character parse of the file and writes any words that it finds to a new file. The code that seems to be causing a problem is this: Write/Append OutFileNameFull reduce [to-word WordStr newline] It gets through about 1.5 MB before it "runs out of global variable space". Why is it running out of global variable space when there is only the one variable (to-word WordStr)? |
Oldes 2-Jun-2006 [4806x7] | you reached Rebol's limit - you have declared too many global variables with the command to-word WordStr. Do you really need it? |
Why you convert it to word anyway? | |
Write/Append OutFileNameFull join WordStr newline | |
Nut if I understand it well, you need content of variable which is stored in the wordStr | |
(nut = but) | |
>> w: "someWord" == "someWord" >> reduce [to-word w] == [someWord] >> find first system/words 'someWord == [someWord] | |
but this is interesting: >> length? first system/words == 2600 >> newword ** Script Error: newword has no value ** Near: newword >> length? first system/words == 2601 | |
Gordon 2-Jun-2006 [4813x2] | Thanks but WordStr is a string and I need it to be a word type. |
Actually, you are right. Thanks Oldes. I was able to write it all to the file then read it back in and parse it into 'words' without using 'to-word'. | |
Anton 4-Jun-2006 [4815] | This is a frequent stumbling block with beginners - using more words than necessary. Words are really good at expressing distinct concepts (ie. variables). If you have lots of similar data, then that really just calls for a series. |
Graham 4-Jun-2006 [4816x2] | Anyone tried printf from the library? |
>> do %printf.r >> printf ["%d" .02 ] ** Access Error: Cannot open sprintf ** Where: routine-call ** Near: routine: make routine! spec library | |
older newer | first last |