
| # | User | Message | Date |
| 704 | Vladimir | Ufffff......... I just found it in reb23 core documentation chapter 11.... :) That's what you get when you rely on google... :) | 31-Mar 8:41 |
| 703 | Vladimir | I looked at available documentation, and can not find any advanced settings like that in there..... Where can I find info like that ? p.s. But I can always ask you guys :) | 31-Mar 8:31 |
| 702 | Gregg | Another common issue with FTP is to set system/schemes/ftp/passive to true. | 30-Mar 18:39 |
| 701 | Vladimir | Thanks Brian !!!! I just didnt see it yesterday evening.... :) | 29-Mar 8:34 |
| 700 | BrianH | Try this: write/binary ftp://user:pass@ftp.site.com/file.txt read/binary %file.txt Yoiu were trying to write to a directory, not a file. | 28-Mar 23:26 |
| 699 | Vladimir | I want to upload file on ftp.
I know I can do it like this:
write/binary ftp://user:pass@website.com read/binary %file Or I am supossed to do it.... it just wont let me.... >> write/binary ftp://user:pass@ftp.site.com read/binary %file.txt ** User Error: Cannot open a dir port in direct mode ** Near: write/binary ftp://user:pass@ftp.site.com read/binary %file.txt I can read the contents of ftp rootdir with: print read ftp://ftp.site.com/ But writing is not working.... What does it mean: "Cannot open a dir port in direct mode"? | 28-Mar 19:59 |
| 698 | Vladimir | Here is one question for you guys: | 28-Mar 19:41 |
| 697 | Vladimir | Ahaaa..... so it was only matter of path..... http://www.rebol.net/rs instead of http://www.rebol.net/rebservices ..... :) Thanks! | 13-Feb 17:26 |
| 696 | btiffin | Compressed at http://www.rebol.net/rs/server.r and client.r with the standard save ... ctx-services thingy. I'm pretty sure this is Gabriele's later release that has support for large file transfers. I would say yes, LNS is still a good plan. It's in use with DevBase. | 13-Feb 14:54 |
| 695 | Vladimir | Can anyone point me to some place where I could get rebol/services source code? I can not find it in usual places.... ?!?!?!?!? :( Is it right way to go if I plan an app that will need to exchange data over net ? | 13-Feb 13:48 |
| 694 | Tomc | I think Rebol can be used in the classroom in liew of a mainstream language based if nothing else on the fact that by the time the kids are ready there is apt to be a "new" mainstream language. what is important is learning to think and from my experiance rebol gets in the way far less than other mainstream languages. | 1-Feb 20:37 |
| 693 | Anton | What's the problem ? Rebol can be used for teaching programming, just like any other language. It has the three basic features: sequence, selection and iteration, so it can do anything :) Seriously, if you can find a programming course in another language, perhaps you can translate into rebol on the fly. | 1-Feb 7:39 |
| 692 | Rod | I look at things like Easy VID and Easy Draw and wonder what the possibilities could be to expand on that in place active content. | 1-Feb 2:02 |
| 691 | Rod | I have taken a stab at online training when blackboard.com came out, did a short expert course in my primary language (Progress 4GL) to some friends. It was an interesting experiment and very worth doing. At the time though the technology parts via the web was very limited (still is really but even worse then). I wonder if the emergence of VoIP, video and flash has moved us past how interaction might be done differently to just the same with different delivery mechanism. | 1-Feb 2:00 |
| 690 | btiffin | Rod; agreed. It is not in my nature to aggress when it comes to business, play, or life so if this is pursued it'll be a local night school kinda start. First step is an attempt at an Altme parse lecture surrounded by friendlies. :) | 1-Feb 1:41 |
| 689 | Rod | I think REBOL has merit in the classroom but it can't be from the angle of what you need to be an IT programmer. It has to be more about theory and creativity to make machines do amazing things. I am afraid though that your all or nothing situation and be ready by the fall schedule doesn't sound like a good combination. You would want some real world, already done it here in this setting, kind of platform to start from to move into that kind of education space. | 1-Feb 1:26 |
| 688 | Gregg | If you want to get a job as a grunt programmer in a big company, using whatever tools they tell you are in fashion, REBOL is not the right tool for you--though it may be a nice support language. If you want to think about hard problems and algorithms, it's as good as Lisp/Scheme within limits (e.g. tail recursion), and easier to play around with. If you want to get the job done and either make the tool call yourself, or can convince the people who do that REBOL is up to the task, it's great. And if you aren't a CS major, but know that computers and programming will affect you in business, and you want to be able to to some "light" programming, I think it's great. | 31-Jan 23:03 |
| 687 | SteveT | I've been lecturing accounts & tax at Manchester recently and I've had a chance to chat with some of the programming students during breaks. I think all of them hated whatever they used in college !! Some of them state that what they were taught bore no relation to what abilities they now need in the work place. | 31-Jan 22:52 |
| 686 | btiffin | Sunanda; I'm starting to take a deep interest in RitC. But I have doubts. Doubts that need to be squashed. Sadly, Ontario (a fairly vast province) has standardised curriculum now. It's all schools or no schools here. I'm not a fan, the excuse was that some kids in some boards were getting sub-par educations, ignoring the fact that some boards were providing above-par educations and instead picking a middle-of-the-road bland education for all. | 31-Jan 22:15 |
| 685 | Sunanda | It'd be fun to get REBOL into the classrooms. But it'd take some plans and (probably) some pedagogically oriented libraries to beat a language like Turing that is described as "Designed for computer science instruction". | 31-Jan 21:58 |
| 684 | btiffin | Yeah; Turing is for algorithm thinking. It's a Niklaus Wirth, Pascal variant, designed explicitly for teaching. Which means some company in Toronto is probably building a rocket engine control system with it as we speak. :) | 31-Jan 21:26 |
| 683 | Pekr | So - the dialect of REBOL? :-) | 31-Jan 21:16 |
| 682 | Pekr | OTOH - I would not taught them anything like JAVA too. Maybe some basic. It is not even about particular language, but a bit of alghoritmical thinking ... and maybe Basic like syntax ... | 31-Jan 21:16 |
| 681 | james_nak | Yes, that I'm afraid is true. My son is studying VB now and I am for right now waiting to show him the Rebol way. In some ways it's like learning an instrument in that some are more likely to lead to jobs or bands for that matter. At some point statistically speaking, that is, you would have to learn another "accepted" language. | 31-Jan 21:15 |
| 680 | btiffin | And getting serious; We all love REBOL, our being here is testament to that. BUT... Would you deem REBOL as a language that could be taught to 14 year olds and have the principal of a school think "Yes, I've prepared my students for the IT world to the best of my abilities"? Honestly. imho; REBOL is maybe a little too different to be the "Yep, if you know REBOL, you know enough to build a career in programming" language. | 31-Jan 21:11 |
| 679 | btiffin | That last question is too short. Would RT appreciate the potential of having bureaucrats trying to stick their hands in the cookie jar? is more what I meant. | 31-Jan 21:01 |
| 678 | btiffin | I've been chatting with some students (Ontario, Canada mainly) and our high schools have been teaching Turing. Well Holt Software just recently announced a cease to operations. Turing is now free but I think this opens a door for what the kids in Ontario will be learning starting in September 2008. Could REBOL be it? What would it take to startup a REBOL in the Classroom commercial endeavour? Would RT like it if such a company existed? | 31-Jan 20:51 |
| 677 | Vladimir | I have dbf specifications printed out.... I'll try to make something tonight.... My table is simple one... just a list of customers with their debt status , and that is what my boss wants to have with him where ever he is... :) Thats why I want to upload it to webpage and he can then acces it even with his mobile phone...... But table has a lot of records so Ill have to make some filtering.... Thank you for suggestions.... | 29-Jan 15:19 |
| 676 | Pekr | btw - IIRC rebol.org contained some DBF viewer, but it was probably already mentioned. I was using DBFs for more than 15 years. Uh, those were the days :-) | 29-Jan 15:11 |
| 675 | Pekr | DBF is rather simple format. Not sure it would not be better to use some ODBC driver for it though. There is a problem with indices and memo files. There were several systems out there with different aproaches. E.g. Clipper implemented RDD - abstracted "replaceable database drivers", which took different strategies for indices and memo files. I am also not sure, that nowadays, there is any advantage in using DBF files against e.g. SQLite. | 29-Jan 15:10 |
| 674 | Oldes | I don't have any DBF file, but looking at spec, it should not be difficult to read it. | 29-Jan 14:41 |
| 673 | Oldes | The output (write functions) is not complete as I don't need it so much | 29-Jan 14:38 |
| 672 | Oldes | here is a version with some rebcode optimizations: http://box.lebeda.ws/~hmm/rebol/stream-io_rebcode_latest.r | 29-Jan 14:35 |
| 671 | Oldes | Here is for example script for parsing AVI file using the %stream-io.r script: http://box.lebeda.ws/~hmm/rebol/avi_latest.r but I use it to parse other formats as well | 29-Jan 14:32 |
| 670 | Oldes | I'm using this script to parse binary formats: http://box.lebeda.ws/~hmm/rebol/stream-io_latest.r | 29-Jan 14:30 |
| 669 | Vladimir | There is only one file that needs to be put online..... Its 13 Mb big.... Anybody has some advice how to parse it in binary mode? | 29-Jan 12:28 |
| 668 | Gregg | Vladimir, yes, if you need it. I think it would be a neat thing to have, but there hasn't been a rush of people clamoring for it. Petr, it can be done, it just won't be as much fun as it should be. :-) Oldes, Brian is correct. QuickBASIC/VB and PowerBASIC were well-suited to this task, because you could declare a type structure and get/put it directly. | 29-Jan 11:55 |
| 667 | BrianH | File I/O with binary file structures needs better conversion facilities than REBOL has, at least to do efficiently. | 28-Jan 23:22 |
| 666 | Oldes | what do you mean with "structured file I/O"? | 28-Jan 21:12 |
| 665 | Pekr | Gregg - don't forget you need to parse indices too :-) | 28-Jan 17:48 |
| 664 | Vladimir | Should I make dbf dialect ? :) | 28-Jan 17:45 |
| 663 | Gregg | One thing REBOL isn't particularly good at is structured file I/O, which is what you need for DBF. Perfect job for a dialect though. :-) | 28-Jan 17:44 |
| 662 | Gregg | Francois Jouen did a DBF viewer some time back. I'm not sure if REBOLFrance is still up or not. I have the old code here. http://www.rebol.org/cgi-bin/cgiwrap/rebol/ml-display-thread.r?m=rmlQZKQ I thought it would be a nice thing to have, but never pursued it since I didn't *need* it. | 28-Jan 17:42 |
| 661 | Vladimir | How can i convert content of dbf file to readable html file on webserver ? I thought to use rebol to make conversion, and then transfer html to server using ftp... Can someone point me in the right direction ? | 28-Jan 17:31 |
| 660 | Gabriele | we're using rebol/services to transfer backups from www.rebol.net to mail.rebol.net. files are a couple hundred MB. see http://www.rebol.net/rs/demos/file-client.r | 30-Oct 10:44 |
| 659 | Ingo | A script to send files over the network using tcp. It once started with 2 3-liners, http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=remote-file.r | 30-Oct 10:37 |
| 658 | Vladimir | Files are 1-2 Mb. Ziped archives of dbf files.
As I said now I'm using small rebol script to send file as attachment, human on the other side is downloading them and unpacking them, and its working.
I planed to make a "server" side script that would download newly arrived attachments and unpack them in designated folders, but then I thought about trying some real client-server approch...
Then again, server would have to be started at the time of transfer. I have to know ip adresses and to make them public (hamachi jumps in as help)...
E-mail used as buffer for data is not bad... And it works... But I have to check max mailbox size .... What if workers execute sending script more then ones? There is one strange thing with sending big (>1 Mb) files:: On win98 it goes without any problem. On XP at the end of transfer rebol returns an error message about network timeout, but the file is sent and all is ok.. Thanks guys... Lot of info... Will check it out and send my experiences. | 30-Oct 7:16 |
| 657 | btiffin | Vladimir; Check out http://rebol.net/cookbook/recipes/0058.html for one way. It's a good exercise in getting a client server app running as well. And of course, follow the advice of the others here; there are many options. | 30-Oct 4:58 |
| 656 | james_nak | Here is something from the rebservices section from Gabriele: "client has experimental generic http proxy support; server has the new, much improved file service. see http://www.rebol.net/rs/demos/file-client.r for example usage to transfer big files." | 30-Oct 4:19 |
| 655 | Graham | I think Carl posted some code on how to do huge file transfers. | 30-Oct 3:38 |
| 654 | Graham | I've done file transfer using async Rebol rpc, and also using Uniserve | 30-Oct 3:37 |
| 653 | Gregg | You could also write a custom app that sends via email, and a reader on the other end that grabs them. | 30-Oct 0:09 |
| 652 | Gregg | There are a lot of ways you could do it, FTP, LNS, AltMe file sharing, custom protocol on TCP. It shouldn't be hard, but I would try to use something existing. The devil is in the details. | 30-Oct 0:08 |
| 651 | Henrik | how big files are you transfering? | 29-Oct 22:55 |
| 650 | Vladimir | How complicated is it to make simple file transfer between two computers (one client and one server) in rebol? What protocol should I use? Any ideas? Currently I'm sending e-mails from clients with file-atachments because its the simplest way of collecting data from clients. (so far they were doing it by hand - so this is a big improvement :) | 29-Oct 22:48 |
| 649 | Vladimir | This functionality was not present in previous versions of rebol... I think it was introduced in some patch this year... By the way I dont know wich version of view I use on every other pc... one at home, one at work... laptop... I will download newest and update all.... :) Thanks for help... | 26-Oct 17:04 |
| 648 | Vladimir | Now it works... | 26-Oct 17:02 |
| 647 | Brock | I thought the problem may have been that the first character following set-net is a "|" characther rather than theh "[", that must just be a typo. | 26-Oct 15:56 |
| 646 | Pekr | heh, I know there can be user and pass set, I just did not know it could be set via set-net, I always used max of 6 params for the function :-) | 26-Oct 11:40 |
| 645 | Vladimir | I found it! :)
all you need to do is add info in set-net fields....
instead of this:
set-net [user@mail.com smtp.mail.com pop3.mail.com]
use this:
set-net [user@mail.com smtp.mail.com pop3.mail.com none none none "user" "pass"] Im happy :) | 26-Oct 11:34 |
| 644 | Pekr | try to look for esmtp. Usually there is a requirement for sending your user account name and pass. Hopefully you can find something ... | 26-Oct 11:15 |
| 643 | Vladimir | I would think someone else already came with a solution for such acommon problem.......... | 26-Oct 11:05 |
| 642 | Vladimir | is there a way to give this user authentication data to it? Ill check rebol.org for that... | 26-Oct 11:05 |
| 641 | Vladimir | So this means my old provider was not that rigid on smtp control.... uffff.... :) | 26-Oct 11:04 |
| 640 | Vladimir | :( | 26-Oct 11:03 |
| 639 | Vladimir | I just set up outlookexpress and "my server requires authentication" is a problem.... | 26-Oct 11:03 |
| 638 | Pekr | before you do so though, please try to configure your mail client (FireBird, Outlook), to see what kind of setting you are heading for, as the problem as well can be related to some other issue :-) | 26-Oct 10:58 |
| 637 | Pekr | smtp servers usually don't allow you to send email via themselves, if you are not part of particular network, or they require authentication to smtp - usually your accont name and password is enough. I think that in such case, you are out of luck with REBOL. Not sure our smtp protocol can handle it ... but - go to www.rebol.org and try to search for "smtp" - there are some scripts which could help you .... | 26-Oct 10:57 |
| 636 | Pekr | The problem probably is, that you are trying to send your email from outside of @mail.com domain. | 26-Oct 10:53 |
| 635 | Vladimir | What could be problem with this script? set-net [user@mail.com smtp.mail.com pop3.mail.com] today: now/date view center-face layout [ size 340x120 button "Send mail" font [size: 26] 300x80 [ send/attach/subject user@mail.com "" %"/c/file.xls" reduce [join "Today " :danas] quit ] ] I get this error: ** User Error: Server error: tcp 554 5.7.1 <user@mail.com>: Relay access denied ** Near: insert smtp-port reduce [from reduce [addr] message] Could it be some security issue? It worked with previous internet provider... A week ago we changed it and now this happens... Should I contact my provider to change some security settings or should I change something in the script? | 26-Oct 10:44 |
| 634 | Anton | So, I advise to trap events in subface/feel/engage, not in window/feel or screen-face/feel. (insert-event-func adds a handler which is processed in screen-face/feel) | 7-Oct 12:35 |
| 633 | Anton | Vladimir, the window/feel gets time events at full speed. Any subface/feel gets time events at subface/rate. | 7-Oct 12:32 |
| 632 | Vladimir | Its ok like this... :) I can make what ever I need for my editor using this method. I guess things will be more controllable in R3... Thanks again for help! | 4-Oct 16:24 |
| 631 | Gregg | The event handling system will call your insert-event-func handler as fast as it can, if there are availalbe events, and there will always be time events, occurring at whatever rate REBOL uses them. I don't know of any way to control when, or how often, your func is called. | 4-Oct 15:32 |
| 630 | Vladimir | I'm actually interested only in keypress events...
But I have to limit the rate of events... I know there is the rate element in every face, and I did make it work for time event and that is ok.
But I couldn't make keypress event occur in timed intervals.
I'm not saying I have to have it. Maybe it just isnt supossed to be. But it says in docs: "The focal-face must be set to a valid face object (one that is part of a pane in the face hierarchy) and the system/view/caret (explained in next section) must also be set in order to: 1. Receive keyboard events ...." So I put this inside engage func: system/view/focal-face: face system/view/caret: tail "" And now it works... I dont even use caret but you have to set it to some bogus value! So in my opinion rate element has no influence on key events (if I type like crazy I get 19 key events for 1 second...). But I can make some sort of counter and simply do keypress response only when I want to... | 4-Oct 13:42 |
| 629 | Oldes | insert-event-func is simply used for global events, you can use it to detect 'close, 'resize, 'active and 'inactive as well. Why you should have such a event handlers in feels? | 4-Oct 9:55 |
| 628 | Vladimir | But I would love to know: How to set key press event on something so that it would be timed? Or how to make insert-event-func function get called in precise timed intervals? | 3-Oct 20:55 |
| 627 | Vladimir | I red part of docs (6.4 Focus and Keyboard Events) but it doesnt help......... Well so far I'm ok, my editor can move on.... :) | 3-Oct 20:54 |
| 626 | Vladimir | But, why? Ohhhh why do I need to do it like that? :) | 3-Oct 20:51 |
| 625 | Vladimir | Thanks Oldes! I did it.... I used insert-event-func for key events and feel for time events.... | 3-Oct 20:50 |
| 624 | Izkata | It looks like the event function isn't being triggered for the box, but rather for system/view/screen-face or something - >> ke: func [f e][if e/type = 'time [print f/text]] >> insert-event-func :ke >> view layout [box "Testing" with [rate: 1]] none none None of them print "Testing", as a call from the box should | 3-Oct 14:43 |
| 623 | Oldes | (I mean don't use the insert-event-func for changing color but only for geting the key events) | 3-Oct 11:32 |
| 622 | Oldes | If you want just blinking cursor, don't use insert-event-func, but just something like that:
cursorMover: func[f e][
if e/type = 'key [
switch e/key [
up [cursor/offset/y: cursor/offset/y - 10]
down [cursor/offset/y: cursor/offset/y + 10]
left [cursor/offset/x: cursor/offset/x - 10]
right [cursor/offset/x: cursor/offset/x + 10]
]
show cursor
]
e
]
insert-event-func :cursorMover view layout/size [ cursor: box 10x10 with [ rate: 10 colors: [0.0.0 255.255.255] feel: make feel [ engage: func [f a e] [ if a = 'time [ f/color: first head reverse f/colors show f ] ] ] ] ] 400x400 | 3-Oct 11:32 |
| 621 | Vladimir | Sorry for spamming this gruoup... but I was wrong.... I mixed to source files... Editid one and ran another... so ... it still doesnt work....... | 3-Oct 11:06 |
| 620 | Vladimir | I guess I should read docs more :) | 3-Oct 10:58 |
| 619 | Vladimir | Done it! All I needed was: system/view/focal-face: grid | 3-Oct 10:58 |
| 618 | Vladimir | Thanks for help! | 3-Oct 10:24 |
| 617 | Vladimir | I know it works, but I remember puting insert-event-func there for a reason.... If I remember I couldnt get keyboard response from my iterated pane somehow.... I'll try it again .... | 3-Oct 10:24 |
| 616 | Vladimir | pane is not a problem...... your code works (as it should) :) | 3-Oct 10:23 |
| 615 | Vladimir | I will check if iterated pane is the source of problem.... | 3-Oct 10:16 |
| 614 | Vladimir | I'm just typing something like that.... :) | 3-Oct 10:15 |
| 613 | Oldes | Use somethink like: view layout [ box with [ rate: 10 feel: make feel [ engage: func [f a e] [ if a = 'time [print now/time/precise] ] ] ] ] | 3-Oct 10:14 |
| 612 | Vladimir | yeah... I guess its a mix between insert-event-func and iterated pane..... pane is generated every time and my adding rate element to it doesn't effect global rate..... thanks for answer! | 3-Oct 10:13 |
| 611 | Vladimir | :) | 3-Oct 10:11 |
| 610 | Oldes | Here is simplified your problem:
ke: func[f e][ if e/type = 'time [print now/time/precise] e]
insert-event-func :ke
view layout [box with [rate: 10]] But I cannot help you. I'm not a view guru. It looks you should not use insert-event-func if you don't want to get all time events. | 3-Oct 10:10 |
| 609 | Vladimir | I tried to put rate:1 in my grid face.... I tried to put it in pixel_face... I tried to put it in pane-func... | 3-Oct 10:04 |
| 608 | Vladimir | Problem is that events are always happening the same rate... no matter what I do.... | 3-Oct 10:03 |
| 607 | Vladimir | That is what I do in key-event func....: if event/type = 'time [ ? now/time cursor_color: (3 - cursor_color) | 3-Oct 10:02 |
| 606 | Oldes | Which events? If from keyboard, you have to filter them in your key-event function. | 3-Oct 10:01 |
| 605 | Vladimir | No matter where I put the rate: 1 element I get 24 events in one second..... How can I slow this down? | 3-Oct 9:49 |
| 604 | Vladimir | pixel_face: make face [
size: pixel_size
edge: none
color: black
data: 0
] ... pane-func: func [face index] [ index: (index - 1) either integer? index [ if index < ((grid_size/x) * (grid_size/y)) [ xx: (index // (grid_size/x)) + 1 yy: to-integer ((index / (grid_size/x)) + 1) pixel_face/data: index pixel_face/offset/y: ((yy - 1) * (pixel_size/y)) pixel_face/offset/x: ((xx - 1) * (pixel_size/x)) pixel_face/color: pick paleta sprite-colors/:yy/:xx return pixel_face ] ][ ; return to-integer index/y / 20 + 1 ] ] key-event: func [face event] [ if event/type = 'key [ switch event/key [ up [cursor_y: cursor_y - 1] down [cursor_y: cursor_y + 1] left [cursor_x: cursor_x - 1] right [cursor_x: cursor_x + 1] ] sprite-colors/:cursor_y/:cursor_x: 2 show grid ] if event/type = 'time [ ? now/time cursor_color: (3 - cursor_color) sprite-colors/:cursor_y/:cursor_x: :cursor_color show grid ] event ] insert-event-func :key-event grid: make face [ offset: ((screen_size - window_size) / 2) size: window_size rate: 00:00:05 color: blue effect: [gradient] pane: :pane-func ] view/new grid do-events | 3-Oct 9:48 |
| 603 | Vladimir | Here is a piece of code from graphic editor.... I have problems with "insert-event-func" | 3-Oct 9:45 |
| 602 | Vladimir | Well first of all ....Im new here... :) joined yesterday... and I have a problem on my hands..... | 3-Oct 9:44 |
| 601 | btiffin | Patrick; Check out http://www.rebol.org/cgi-bin/cgiwrap/rebol/art-display-article.r?article=lf019t It's an experiment in rebol.org hosting public wiki articles. Plus I'm plugging my own work :) | 27-Jul-07 23:29 |
| 600 | Geomol | Patrick, before I started with REBOL, I had many years of experience with many different languages, both as a hobby and professional. It wasn't hard for me to grasp new languages, because every new one always reminded me of some other language, I already knew. Then I came to REBOL, and I could make small scripts after a few days. But it took me more than a year to really "get it". And it's just the best language, I've ever programmed in. It keeps amaze me after all these years, and I constantly find new things, new ways of doing things. From your posts here, you're having a very good start, as I see it. Just keep hacking on that keyboard, and don't forget to have fun! | 27-Jul-07 16:58 |
| 599 | ? | Yes...that will happen. The best way is to try to teach what you know now to someone else. To Teach is to learn. | 27-Jul-07 15:25 |
| 598 | PatrickP61 | I am looking forward for the Rebol lightbult to go on full power!!! I think it just takes me playing around with rebol more to get there! | 27-Jul-07 15:16 |
| 597 | Gregg | I should point out that NEW-LINE, as Anton used it, is a handy shortcut that takes the place of foreach+print for simple console display. | 27-Jul-07 14:53 |
| 596 | Gregg | It can be confusing at times, and even once you know what you're doing, you sometimes have to think about it a bit. The up-side is that you have a great deal of control once you know how to use it. | 27-Jul-07 14:51 |
| 595 | Gregg | You shouldn't have to worry about new-line at all. It's actually relatively new, so we all lived without it for a long time. | 27-Jul-07 14:50 |
| 594 | PatrickP61 | Sounds like more advanced stuff than I'm understanding right now. I'll read up on the terms. When I get REBOL code solution, I'd like to understand how Rebol is processing the code. What it does logically first, and logically second... I think I get confused about when Rebol does the evaluations. | 27-Jul-07 14:47 |
| 593 | Gregg | For display or formatted output. It's *very* useful when generating code for example. | 27-Jul-07 14:40 |
| 592 | Gregg | On "append append", yes. You could also do it like this: "append line join blk/:n tab", the difference being that APPEND modifies its series argument, and JOIN does not. REPEAT is 1-based, not zero, Anton is using "-1 + length? blk" rather than "(length? blk) - 1" or "subtract length? blk 1". The first of those cases requires the paren because "-" is an op! which will be evaluated before the length? func, so REBOL would see it like this "length? (blk - 1)", which doesn't work. | 27-Jul-07 14:39 |
| 591 | PatrickP61 | Hi Gregg -- Is that primarily for display purposes, or could it be used for other things? | 27-Jul-07 14:39 |
| 590 | Gregg | "...insert a tab between varying numbers of values per line <versus> ... insert a tab in-between col 1 and col2" -- Correct. On new-line, it's kind of advanced because it doesn't insert a newline (CR/LF), but rather a hidden marker between values that REBOL uses when molding blocks. | 27-Jul-07 14:31 |
| 589 | PatrickP61 | Anton, I understand Rebolek answer, but I want to understand your answer too.
I'm wondering about the line: repeat N -1 + length? Blk [append append Line Blk/:N tab]
does Rebol do the inner append first (in math expressions) like this: [append ( append Line Blk/:N ) tab]
and then do this for the number of "lines" in the array
N Out-block
0 []
1 "Col A1^-Col B1"
2 "Col A1^-Col B1" "2^-3"
3 "Col A1^-Col B1" "2^-3" {line "3"^-col "b"} I think I see the above progression, but not sure about Blk [append Line last Blk] Is this advancing the starting position within In-array? | 26-Jul-07 16:51 |
| 588 | PatrickP61 | My teachers, Anton and Rebolek have submitted two answers. The difference between them is that Anton's answer will insert a tab between varying numbers of values per line, where Rebolek will insert a tab in-between col 1 and col2 (assuming only 2 columns in the array). Is that a correct interpretation? | 26-Jul-07 16:33 |
| 587 | PatrickP61 | Thank you Reblek -- didn't see your answer at first! | 26-Jul-07 16:18 |
| 586 | PatrickP61 | I see how it works now -- Thank you Anton and Volker!! | 26-Jul-07 16:16 |
| 585 | Volker | and with the new-line all strings in own lines | 26-Jul-07 16:15 |
| 584 | Volker | as lots of strings in one line | 26-Jul-07 16:15 |
| 583 | PatrickP61 | So if i read you right, then if I didn't do new-line/all, and tried to probe Out-block, it would show the entire contents as one large string, whereas new-line/all will allow probe to show each value as a spearate line. Right? | 26-Jul-07 16:14 |
| 582 | Volker | there is a hidden markerin values, for newline | 26-Jul-07 16:12 |
| 581 | Volker | else all strings would be on one line. only interesting for probing rebol-code, does not change the strings itself | 26-Jul-07 16:12 |
| 580 | PatrickP61 | Forgive me, how does it do that? | 26-Jul-07 16:12 |
| 579 | Volker | it cleans up rebol-listings | 26-Jul-07 16:11 |
| 578 | PatrickP61 | Anton, what does the new-line/all do. I gather it inserts newlines after each value. Is that right? | 26-Jul-07 16:11 |
| 577 | Anton | new-line/all out-block on == [ "Col A1^-Col B1" "2^-3" {line "3"^-col "b"} ] | 26-Jul-07 16:08 |
| 576 | Anton | in-array: [["Col A1" "Col B1"]["2" "3"][{line "3"} {col "b"}]] out-block: copy [] foreach blk in-array [ line: copy "" repeat n -1 + length? blk [append append line blk/:n tab] if not empty? blk [append line last blk] append out-block line ] | 26-Jul-07 16:07 |
| 575 | Rebolek | >> out-block: copy [] == [] >> foreach line in-array [append out-block rejoin [line/1 "^-" line/2]] == ["Col A1^-Col B1" "2^-3" {line "3"^-col "b"}] | 26-Jul-07 16:00 |
| 574 | PatrickP61 | My teachers, I have an array ( block (of "lines") within a block (of values) ) that I would like to convert to a block (of "lines") with all values joined with an embedded tab. What is the best way to achieve this? See example: In-array: [ [ {Col A1} {Col B1} ] <-- I have this [ {2} {3} ] [ {line "3"} {col "b"} ] ] Out-block: [ {Col A1^(tab)Col B1} <-- I want this {2^(tab)3} {line "3"^(tab)col "b"} ] | 26-Jul-07 15:53 |
| 573 | Gregg | More reference info here: http://www.rebol.com/docs/core23/rebolcore-16.html#section-3.1 And you also have the words CR, LF, and CRLF available. | 20-Jul-07 16:27 |
| 572 | PatrickP61 | Ahhhhh | 20-Jul-07 15:41 |
| 571 | Geomol | Ah, there's the explanation, a newline can be specified as ^(line) (for some reason) | 20-Jul-07 15:41 |
| 570 | PatrickP61 | Just what I needed!!! | 20-Jul-07 15:40 |
| 569 | Geomol | Now you're at it, check http://www.rebol.com/docs/core23/rebolcore-16.html#section-2.11 and http://www.rebol.com/docs/core23/rebolcore-8.html for info about strings in REBOL. | 20-Jul-07 15:39 |
| 568 | PatrickP61 | :-) | 20-Jul-07 15:29 |
| 567 | Geomol | Unfortunately there are some strange things in the corners of REBOL, but you'll learn to live with it. | 20-Jul-07 15:29 |
| 566 | PatrickP61 | As a newbie, it seemed natural to try ^(newline), but the shortcut ^/ works for me too. | 20-Jul-07 15:28 |
| 565 | Geomol | It's a bit strange, that ^(newline) doesn't work, now that ^(tab) does. Maybe it was just forgotten. | 20-Jul-07 15:27 |
| 564 | PatrickP61 | Perfect! ^/ works just great! | 20-Jul-07 15:24 |
| 563 | Geomol | A tab can also be specified as: " ^-" | 20-Jul-07 15:24 |
| 562 | Geomol | If you just write NEWLINE in the prompt, you'll see how it's defined. You can specify a newline in a string as str: "a string with a newline: ^/" | 20-Jul-07 15:22 |
| 561 | Geomol | str: "" insert str newline | 20-Jul-07 15:21 |
| 560 | PatrickP61 | Another question -- I know to use escape to insert things like a tab as in ^(tab) into a string. What can I use to insert a newline? ^(newline) doesn't work. | 20-Jul-07 15:10 |
| 559 | btiffin | Oh, by the way...we added to the %form-date.r script in the library. See I'm New for details. | 19-Jul-07 4:48 |
| 558 | btiffin | Ports are nifty little objects. :) And if you just type
>> In-port
you get back nothing, just another prompt.
>>
The interpreter does not display the internals of objects, but print does, so what you are seeing is the object! that is In-port. Well, I'm lying...In-port is a port! not an object! Close but not the same. ports emulate a series! wrapped in object! wrapped in enigma. Or is it an object! wrapped in a series! disguised as a sphynx? :) first In-port is a REBOL reflective property feature that when you get it, you'll go "Ahhhh" as you step closer to the Zen of REBOL. For fun with a really big object! try >> print system | 19-Jul-07 4:16 |
| 557 | PatrickP61 | Yes, It does dump a lot of stuff that I don't kow about!!! | 19-Jul-07 4:02 |
| 556 | Geomol | I think, your code print the port specs and everything. | 18-Jul-07 22:14 |
| 555 | Geomol | Change the print line to: print first In-port | 18-Jul-07 22:12 |
| 554 | PatrickP61 | My goal is to be able to control how much of a file is loaded into a block then process the block and then go after the next set of data. That is why I am using PORT to do this function instead of reading everything into memory etc. | 18-Jul-07 21:47 |
| 553 | PatrickP61 | This is not doing what I want. I want it to continue to run through all lines of a file and print it | 18-Jul-07 21:46 |
| 552 | PatrickP61 | In-port: open/lines In-file
while [not tail? In-port] [
print In-port
In-port: next In-port
] close In-port | 18-Jul-07 21:45 |
| 551 | PatrickP61 | I am a little confused about PORTS. I want to control how much information is loaded into a block but I am not sure how to determine if data remains in a port. Example: | 18-Jul-07 21:45 |
| 550 | Tomc | Yes Patrick you have it right. The rules I gave would fail
since you have multiple names/members I would try to get away from the line by line mentality and try to break it into your conceptual record groupings file, pages, sections, and details... One trick I use is to replace a string delimiter for a record with a single char so parse returns a block of that record type. this is good because then when you work on each item in the block in turn you know any fields you find do belong to this record and that you have not accidently skipped to a similar field in a later record. something like this pages: read %file replace/all/case pages "PAGE" "^L" pages: parse/all pages "^L" foreach page pages[ p: first page page: find page newline replace/all/case page "NAME" "^L" sections: parse page "^L" foreach sec section [ s: first section sec: find sec newline parse sec [ any [thru "Member" copy detail to newline newline (print [p tab s tab detail]) ] ] ] ] | 7-Jul-07 5:56 |
| 549 | PatrickP61 | Oops -- I should put the IF at New Name line at the end of the loop, or put the capture of the name in that part. | 6-Jul-07 16:12 |
| 548 | PatrickP61 | Note to all -- Please realize this is a simplified version of the real report -- There are many more fields and other things to code for, but they are all similar items to the example PAGE, NAME, and MEMBER fields. | 6-Jul-07 16:09 |
| 547 | PatrickP61 | This is my pseudocode approach: New page is identified by a page header text that is the same on each page and the word PAGE at the end of the line New section is identified by a section header text that is the same within the page and the text "NAME . . . . :" Members lines do not have an identifying mark on the line but are always preceeded by the NAME line. Member line continue until a new page is found, or the words "END OF NAME" is found (which I didnt show in my example above). Initialize capture fields to -null- like PAGE, NAME Initialize OUTPUT-FLAG to OFF. Loop through each line of the input file until end of file EOF. /|\ If at a New-page line | or at end of Name section | Set OUTPUT-FLAG OFF | If OUTPUT-FLAG ON | Format output record from captured fields and current line (MEMBER) | Write output record | IF at New Name line | Set OUTPUT-FLAG ON | IF OUTPUT-FLAG OFF | Get capture fields like PAGE-NUMBER when at a PAGE line | Get NAME when at a NAME line. |____ Next line in the file. | 6-Jul-07 16:07 |
| 546 | PatrickP61 | Thank you Sunanda -- I will give that a try. Just to let you know -- My goal is to convert a printable report that is in a file into a spreadsheet. Some fields will only appear once per page like PAGE. Some fields could appear in a new section of the page multiple times like NAME in my example. And some fields could appear many times per section like MEMBER: _______________________ Page header PAGE 1 Section header NAME1.1 Detail lines MEMBER1.1.1 Detail lines MEMBER1.1.2 Section header NAME1.2 Detail lines MEMBER1.2.1 Detail lines MEMBER1.2.2 Page header PAGE 2 (repeat of above)____________ I want to create a spreadsheet that takes different capturable fields and place them on the same line as the detail lines like so... ______________________ Page Name Member 1 NAME1.1 MEMBER1.1.1 1 NAME1.1 MEMBER1.1.2 1 NAME1.2 MEMBER1.2.1 1 NAME1.2 MEMBER1.2.2 2 NAME2.1 MEMBER2.1.1 ... (the version numbers are simply a way to relay which captured field I am referring to (Page, Name, Member) Anyway -- that is my goal. I have figured out how to do the looping, and can identify the record types, but you are right about the possiblity of mis-identifying lines. | 6-Jul-07 15:54 |
| 545 | Sunanda | Not sure this is a case for parse......You seem to have four types of line:
-- those with "page" in a specific location on the line
-- those with "name" in a specific location on the line
-- those with "member" in a specific location on the line
-- others which are to be ignored .... eg your orginal line 6 "Line 6 600 Desc 1 text 12/23/03" What I would do is: * use read/lines to get a block * for each line in the block, identify what record type it is by the fixed literal .... something like: if "page" = copy/part skip line 25 4 [....] * perhaps use parse to extract the items I need, once I know the line type *** If you just use parse in the way you propose, you run the risk of mis-identifying lines when there is a member called "page" or "name" | 6-Jul-07 8:50 |
| 544 | PatrickP61 | My Page, Name, & Member is always in the same order on separate pages within a file. like so: Line 1 Page 1 Line 2 Name Line 3 Member Line n... Member Line 50 Member Line 51 Page 2 Line 52 Name Line 53 Member Line 54 Member ... | 6-Jul-07 3:09 |
| 543 | PatrickP61 | Tomc -- This version means that I need to have the entire file read in as a string -- Not with Read/Lines -- Because the newline will the the "delimiter" within the string while the Read/Lines will delimit each newline to a separate string inside a block. Do I have that right? | 6-Jul-07 3:06 |
| 542 | Tomc | snd the keywords only exist as key words | 6-Jul-07 0:45 |
| 541 | Tomc | if your page,name & member always exist and are in that order ... parse/all read %file [ some [ thru "Page " copy token integer! (print ["Page" token]) thru "Name " copy token to newline(print ["Name" token]) thru "Member " copy token to newline (print ["Member" token]) ] ] | 6-Jul-07 0:44 |
| 540 | PatrickP61 | In my example above, I have three parse rules defined. I need to add several more. Does the PARSE process the string once per rule? i.e. Does it scan the string for Get-page, then Get-file, then Get-member (scan the string 3 times), Or can I structure the pase rules together to process against the string once? | 5-Jul-07 19:39 |
| 539 | PatrickP61 | Thank you Sunanda -- That did work, but I thought Read/Lines would return a single line -- no maybe that is Read/Line without the s -- is that right? | 5-Jul-07 19:33 |
| 538 | Sunanda | Try in-text: read/lines %file-name | 5-Jul-07 19:11 |
| 537 | PatrickP61 | Situation: I want to read in an input file and parse it for some strings
Current: My test code will do the parsing correctly IF the input block contains each line as a string
Problem: When I try to run my code against the test file, It treats the contents of the file as a single string.
Question: How do I have Rebol read in a file as one string per line instead of one string?
In-text: [ "Line 1 Page 1"
"Line 2 Name String-2"
"Line 4 Member String-3 on 12/23/03"
"Line 5 SEQNBR abcdef "
"Line 6 600 Desc 1 text 12/23/03"
"Line 7 5400 Desc 2 Page 4 12/23/03"
"Line 8 Number of records searched ]
Get-page: [thru " Page " copy Page-id to end]
Get-file: [thru "Name " copy Name-id to end]
Get-member: [thru "Member " copy Member-id to end] Page-id: Name-id: Member-id: "-" for N 1 length? In-text 1 [ parse In-text/:N Get-page parse In-text/:N Get-file parse In-text/:N Get-member ] print [ "Page" Page-id ] print [ "Name" Name-id ] print [ "Member" Member-id ] | 5-Jul-07 18:47 |
| 536 | Ashley | "for n 1 length? data 1" -> "repeat n length? data" | 3-Jul-07 6:05 |
| 535 | PatrickP61 | Sunanda -- I like to see how to solve the same problem in different ways thanks for the reply | 3-Jul-07 2:36 |
| 534 | PatrickP61 | The second one got the right part of the series | 3-Jul-07 2:34 |
| 533 | PatrickP61 | My first attempt had print [index? Data Data] while the second attempt has print [index? Data first Data] | 3-Jul-07 2:34 |
| 532 | Brock | Your first answer seems to work for me | 3-Jul-07 2:09 |
| 531 | Brock | blk: [ "first line" "second line" "third line"] while [not tail? blk][ print [index? blk first blk] blk: next blk] | 3-Jul-07 2:09 |
| 530 | Brock | >> blk: ["First line of data" "Second line of data" "Third line of data"] >> while [not tail? blk][ print [index? blk first blk] blk: n ext blk] 1 First line of data 2 Second line of data 3 Third line of data | 3-Jul-07 2:06 |
| 529 | Sunanda | One way: data: [a b c] for n 1 length? data 1 [print [n data/:n]] | 2-Jul-07 20:44 |
| 528 | PatrickP61 | Give me enough time, and I will figure it out --- :-) Data: head In-text while [not tail? Data] [ print [index? Data first Data ] Data: next Data ] Is there a better way to code this kind of thing? | 2-Jul-07 20:17 |
| 527 | PatrickP61 | I tried this out but not getting the results I wanted: Data: head In-text while [not tail? Data] [ print [index? Data Data ] Data: next Data ] I'm getting this: 1 Line A Line B Line C 2 Line B Line C 3 Line C Any suggestions? | 2-Jul-07 20:11 |
| 526 | PatrickP61 | Now that I think of it, I probably do not need to manuipulate a Count variable -- I can probably use INDEX right? | 2-Jul-07 19:52 |
| 525 | PatrickP61 | Question to all: If I have a block of data inside of In-text like this: Line A Line B Line C How can I print the line number (position in the block) along with the contents of the line? I tried this but it didn't work: foreach Line In-text [ print rejoin [ Count: Count + 1 ] Line ] | 2-Jul-07 19:50 |
| 524 | Anton | :) ok | 29-Jun-07 15:28 |
| 523 | PatrickP61 | my mistake -- I mean Notepad -- not Notebook | 29-Jun-07 13:36 |
| 522 | Sunanda | I have indeed: http://www.rebol.org/cgi-bin/cgiwrap/rebol/view-script.r?script=base-convert.r Will handle integer <--> base conversions. Up up base 36 out of the box Up to base 255 if you adjust the configurable parameters: http://www.rebol.org/cgi-bin/cgiwrap/rebol/documentation.r?script=base-convert.r#toc-19 | 29-Jun-07 13:22 |
| 521 | Gregg | "nor bases higher than 16 ..." -- Except base64. I have some old base conversion code, and I think Sunanda has some posted on REBOL.org as well, if you really need to convert to intermediate bases. | 29-Jun-07 12:17 |
| 520 | Anton | What's this "notebook" program ? You mean "notepad" (which does have option to save to unicode) ? | 29-Jun-07 4:04 |
| 519 | Anton | That's how it looks. | 29-Jun-07 4:02 |
| 518 | PatrickP61 | Sunanda -- Now I see what you are saying -- Out of the 4 bytes A0 00 A0 00, Extract did its job right by returning A0 A0 and got rid of the two 00! | 29-Jun-07 3:43 |
| 517 | Tomc | sigh | 29-Jun-07 2:56 |
| 516 | Tomc | nor bases higher than 16 ... | 29-Jun-07 2:56 |
| 515 | Tomc | you cannot set any binary base ... no nibbles | 29-Jun-07 2:54 |
| 514 | Tomc | >> system/options/binary-base: 16 == 16 >> as-binary "foo" == #{666F6F} >> system/options/binary-base: 4 == 4 >> as-binary "foo" == #{666F6F} >> | 29-Jun-07 2:54 |
| 513 | Sunanda | If I'm reading it right: Your input has _0A00_0A00_ -- two new lines and your output has: _0A_0A_ -- two new lines Extract won't affect that -- it simply takes every second byte of the input string, regardless of whether they are newlines or not. | 28-Jun-07 22:58 |
| 512 | PatrickP61 | Hi Sunanda, -- Thanks for your input on byte order mark. Aside from that would you have any idea as to why the extract will not remove the second A0? See notes above -- here is Greggs suggested code to convert UTF-16: InText: rejoin extract Read InFile 2 ; gets rid of every other byte except newline. | 28-Jun-07 21:09 |
| 511 | Sunanda | FFFE is a "byte order mark" -- something that has been slipped in at the beginning of the file to indicate the file is in UTF-16, little endian format....If it started FEFF you'd have to extract all the other bytes. Looks like the original file (or whatever did the EBCDIC to UTF-16 conversion on the AS400) is using A0A0 to mean newline. You may need to clean those up by hand: | 28-Jun-07 20:18 |
| 510 | PatrickP61 | #{FF_4C_69_6E_65_31_0A_0A_4C_69_6E_65_32} <-- this is what I get when I use the extract routine for InText __y__L___i___n__e__1__?__?__L__i___n__e__2 <-- The extract is clearly NOT skipping the newline. What do you think? | 28-Jun-07 18:50 |
| 509 | PatrickP61 | #{FFFE_4C00_6900_6E00_6500_3100_0A00_0A00_4C00_6900_6E00_6500_3200} _ ___y____L___i_____n____e____1____?____?____L____i_____n____e____2 What are those questionmarks? | 28-Jun-07 18:34 |
| 508 | PatrickP61 | Ok -- I think I have it: my sample input is a two line text field in UNICODE like Line1 Line2 as-binary InText shows #{FFFE4C0069006E00650031000A000A004C0069006E0065003200} | 28-Jun-07 18:31 |
| 507 | Gregg | Notice the leading base value at the head of the binary! value. | 28-Jun-07 18:18 |
| 506 | Gregg | >> system/options/binary-base: 2 == 2 >> as-binary s == 2#{0100011101110010011001010110011101100111} >> system/options/binary-base: 64 == 64 >> as-binary s == 64#{R3JlZ2c=} | 28-Jun-07 18:18 |
| 505 | Gregg | By default, REBOL shows binary values as hex, but you can change to other bases. Check out enbase/debase also. >> system/options/binary-base == 16 >> s: "Gregg" == "Gregg" >> as-binary s == #{4772656767} | 28-Jun-07 18:17 |
| 504 | PatrickP61 | Gregg -- I dont know how to reveal the binary/ascii values of the file, but the spanish y looks like it may be hex FF. Do you have rebol code that can convert the characters into hex? | 28-Jun-07 17:58 |
| 503 | Gregg | Look at the binary/ascii value of those chars; what are they? | 28-Jun-07 17:28 |
| 502 | PatrickP61 | Anton, Is it possible that Rebol is interpreting the CRLF as newline newline when dealing with unicode files? | 28-Jun-07 17:26 |
| 501 | PatrickP61 | At first, I thought it just be some stray bytes comming from the AS400, but I was able to re-create a file using Notebook and get same results. Any of you should be able to test this out by: 1. Open Notebook 2. Type in some text 3. Save the file with Encoding to UNICODE | 28-Jun-07 17:24 |
| 500 | PatrickP61 | Notice the spanish y at the beginning of the output | 28-Jun-07 17:19 |
| 499 | PatrickP61 | Hi Anton -- This is my simulated input for a unicode text file: Line1...10....+...20....+...30....+...40....+...50 Line2...10....+...20....+...30....+...40....+...50 If I run this code: InFile: %"Small In unicode.txt" InText: rejoin extract read InFile 2 ; Convert from UNICODE to ANSI but keeps double spacing. OutFile: %"Test Out.txt" write OutFile InText print InText I get these results ˙Line1...10....+...20....+...30....+...40....+...50 Line2...10....+...20....+...30....+...40....+...50 I get them in the output file when I use the Rebol editor, and in notebook (when I open the file) and I get them in console when PRINT InText. | 28-Jun-07 17:17 |
| 498 | Anton | I don't think EXTRACT is at fault, it does a very simple job, getting every second character. | 28-Jun-07 16:28 |
| 497 | Anton | There is READ and READ/BINARY READ is text mode and translates line terminators automatically from the target system into rebol's format, which is the same as unix (using LF). | 28-Jun-07 16:27 |
| 496 | Anton | Patrick, on the double newlines. Can you inspect the result of read InFile ? How many newlines are present at that point ? Useful rebol words: NEWLINE ; this is the newline character that rebol uses CR ; carriage return character LF ; linefeed character CRLF ; both CR and LF in a string | 28-Jun-07 16:25 |
| 495 | PatrickP61 | Hi PhilB -- The formatted text report is generated on the AS400 into the work spool area. I then can use the INavigator software on the PC to connect to it and drag and drop it on the PC, where I can look at it via Word or Notebook. I'm not sure where the encoding to UniCode is happening -- I suspect the INavigator software, but then, it may not be an issue since Rebol can convert it to readable text, even with the extra newline between each line, I'm sure that annoyance can be overcome too. | 28-Jun-07 15:16 |
| 494 | PhilB | Patrick ... on your AS400 problem .... how is the data transferred to the PC? Is it directly from an AS400 file via the data transfer utility built into, or is it a file from the IFS ? (I have used Rebol to read data transferred from an AS400 and didnt get the data as unicode.) | 28-Jun-07 15:04 |
| 493 | Gregg | To match your ruler, do: make-ruler 25 | 28-Jun-07 4:51 |
| 492 | Gregg | make-ruler: func [count /local res str-ct offset] [ res: head insert/dup copy "" "....+....+" count repeat ct count [ str-ct: form ct * 10 offset: subtract length? str-ct 1 change at res ct * 10 - offset str-ct ] res ] | 28-Jun-07 4:50 |
| 491 | Gregg | I don't know about more elegant, but here's a func, just for fun. | 28-Jun-07 4:50 |
| 490 | PatrickP61 | Hello my teachers. Is there a more elegant way to create a ruler than this in rebol... Str7: Str8: "" Ruler: rejoin [ for Count 10 90 10 [ Str8: rejoin [ Str8 "....+..." Count ] ] for Count 100 250 10 [ Str7: rejoin [ Str7 "....+.." Count ] ] ] print Ruler | 27-Jun-07 19:05 |
| 489 | PatrickP61 | When you try to save a document under Notebook, the encoding choices are UTF-8, UNICODE, ANSI among others. UNICODE may be the same as UTF-16 because it does look like every single character is saved as two bytes. The code (rejoin extract read InFile 2) does eliminate the double characters but I noticed that the entire file is still double spaced -- as if the newline is coded twice and not removed from the rejoin. But that extra newline may be an annoyance than anything else. | 27-Jun-07 18:18 |
| 488 | Geomol | I'm not too much into unicode. Is that utf-16, where every char is 2 byte? I think, my scripts can only handle utf-8. | 27-Jun-07 16:59 |
| 487 | PatrickP61 | It works!!!! Code to convert UNICODE to InFile: %"Test In unicode.txt" InText: rejoin extract Read InFile 2 write OutFile InText | 27-Jun-07 15:50 |
| 486 | Gregg | Try it in the console and see what you get. The console is your friend. :-) | 27-Jun-07 15:41 |
| 485 | PatrickP61 | Hi Gregg -- So should I do something like this: InText: rejoin extract Read InFile 2 | 27-Jun-07 15:41 |
| 484 | Gregg | Obviously simplistic, just throwing away they extra byte for each char. | 27-Jun-07 15:38 |
| 483 | Gregg | rejoin extract my-unicode-string 2 | 27-Jun-07 15:38 |
| 482 | PatrickP61 | Thanks Geomol, Since I am a newbie, I can easily resave the files as ANSI instead of UNICODE and avoid the conversion problem, at least in the short term. Once I get my "Convert to Table" program working, then I can look at your links to convert from UNICODE. | 27-Jun-07 15:05 |
| 481 | Geomol | I guess, you have to convert it. I've once build a RebXML format, that could be transfered to/from XML. I can handle utf-8. You can find code to convert from utf-8 here: http://home.tiscali.dk/john.niclasen/rebxml/xml2rebxml.r (search for unicode) The other way can be found here: http://home.tiscali.dk/john.niclasen/rebxml/rebxml2xml.r (search for iso2utf-8) | 27-Jun-07 14:59 |
| 480 | PatrickP61 | Hi All,
Have any Rebolers dealt with UniCode files? Here is my situation. I work on an IBM AS400 that can "port" files over to the PC. Notebook opens it up just fine, but Rebol doesn't see it the same way. If I Cut & Paste the contents of the file into an empty notebook and save it, Rebol can see it just fine. Upon further study, I noticed at the bottom of the SAVE AS window that Encoding was set to UNICODE for the AS400 file, while the cut & paste one was set to ANSI. Does Rebol want ANSI text files only, or can it read UNICODE files too? | 27-Jun-07 14:45 |
| 479 | Gabriele | prin will insert a space though, so you may want to do print join "---" count instead. | 27-Jun-07 7:55 |
| 478 | Gabriele | prin ["---" count] not print "---" count | 27-Jun-07 7:54 |
| 477 | PatrickP61 | Hi Geomol, I just signed on. Will try out the code later -- many thanks | 27-Jun-07 0:28 |
| 476 | Geomol | Do you follow the code? | 26-Jun-07 22:18 |
| 475 | Geomol | This is a way without copies: str: "----+-----" for Count 10 125 10 [change skip str either Count < 100 [8][7] Count prin str] | 26-Jun-07 22:17 |
| 474 | Geomol | I think, Volker meant, you should make one large ruler of 125 chars. | 26-Jun-07 22:17 |
| 473 | PatrickP61 | I'll see what I do with it ... | 26-Jun-07 22:14 |
| 472 | Geomol | You could also go for a combination with one little string, that you change (by putting in the number) and print. | 26-Jun-07 22:13 |
| 471 | PatrickP61 | Volker -- I'm a newbie so bear with me, I don't understand your suggestion. Do you mean I should do this: Ruler: for Count 10 125 10 [ prin "----+-----" then what? | 26-Jun-07 22:13 |
| 470 | Geomol | I corrected myself. because it *doesn't* have these copies ... | 26-Jun-07 22:12 |
| 469 | PatrickP61 | doesn't what? | 26-Jun-07 22:11 |
| 468 | Geomol | doesn't | 26-Jun-07 22:09 |
| 467 | Geomol | My version produce a lot of copies of the string. Volker's suggestion is better, because it don't have these copies, so doesn't disturb the garbage collector too much. | 26-Jun-07 22:09 |
| 466 | Geomol | It's hard to read, sorry, but it's short. :-) | 26-Jun-07 22:04 |
| 465 | Geomol | str: "----+-----" for Count 10 125 10 [prin join copy/part str 10 - length? to-string Count Count] | 26-Jun-07 22:03 |
| 464 | Volker | make the string without numbers, put the numbers in. with 'at, 'change/part ruler num length? num. | 26-Jun-07 22:03 |
| 463 | PatrickP61 | Hi everyone, I want to write out a Ruler line to a text file for a specified length of bytes similar to the following for 125 bytes in length: ----+---10----+---20----+---30----+---40----+---50----+---60----+---70----+---80----+---90----+--100----+--110----+--120----+ I tried the following code, but not what I want: Ruler: for Count 10 125 10 [ prin "----+---" Count ] I got this instead: ----+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+---Ruler: 120 Any suggestions? | 26-Jun-07 21:36 |
| 462 | Geomol | I think, that'll fail, if the file is empty! | 25-Jun-07 20:01 |
| 461 | Geomol | Or you can do something like: fp: open/lines %file.txt until [ line: first fp if find skip line 115 "Page" [print "new page"] tail? fp: next fp ] close fp | 25-Jun-07 19:58 |
| 460 | PatrickP61 | I will check out PARSE and try some examples later. Thanks for your help. Will be back later | 25-Jun-07 17:29 |
| 459 | Volker | if parse/all LINE [ 115 " " "Page" to end] ["its a new page"] ;.. | 25-Jun-07 17:25 |
| 458 | Volker | if parse/all[115 " " "Page" to end] ["its a new page"] (not testet) | 25-Jun-07 17:24 |
| 457 | PatrickP61 | I need to load in a single page at a time, then "process" that page before going on to the next page and processing it. Are you suggesting that I go ahead and read in all the lines of the report and then go through that block to identify a page? | 25-Jun-07 17:24 |
| 456 | Volker | (except if its megabytes^^) | 25-Jun-07 17:22 |
| 455 | Volker | you can use read/lines to have all lines in a block | 25-Jun-07 17:22 |
| 454 | Rebolek | Volker: OK, variables yes. | 25-Jun-07 17:20 |
| 453 | PatrickP61 | Ahhh so much to learn and not enough time!!! Thanks for your patience
Ok, on to another issue. I have a text file as a printable report that contains several pages within it. Each line can be as large as 132 columns wide (or less). - The literal " Page " will begin in column 115 and that indicates the start of a printed page. I want to write a script that will read this text file one-page-at-a-time, so I can do some processing on the page. How do I write a script to load in a single "page"? I am guessing that I need to open a PORT and have rebol read all the lines until I get "....Page." in bype position 115. Any suggestions? | 25-Jun-07 17:19 |
| 452 | Volker | altme: clicking the pen. | 25-Jun-07 17:07 |
| 451 | Volker | Rebolek, i said all the time "with variables". Of course it does not know what you use as function and what as variable | 25-Jun-07 17:07 |
| 450 | Anton | If you hover over the icons, you see the help info text at top left. | 25-Jun-07 17:03 |
| 449 | PatrickP61 | This is a test This is a test OK It works! | 25-Jun-07 17:03 |
| 448 | Rebolek | It's the "pen" icon, press it and you can send messages with CTRL+S | 25-Jun-07 17:02 |
| 447 | PatrickP61 | P.S. In AltMe, what do you guys type to get a carriage return without sending the AltMe message until you do an <enter> | 25-Jun-07 17:01 |
| 446 | PatrickP61 | Wow, I guess there are a lot of ways to "explain" how rebol is evaluating an expression. Thank you. I will try them all sometime. | 25-Jun-07 17:00 |
| 445 | Rebolek | Volker: no, ?? changes the meaning of expression in case you put it before function: >> f: func [a][a] >> a: 1 == 1 >> b: probe f a 1 == 1 >> type? :b == integer! >> b: ?? f a f: func [a][a] == 1 >> type? :b == function! | 25-Jun-07 17:00 |
| 444 | Volker | ?? does a get, you can put it in expressions before variables | 25-Jun-07 16:59 |
| 443 | Volker | append head copy/part trim ?? string ?? ln "something" ; works | 25-Jun-07 16:58 |
| 442 | PatrickP61 | Ok to sum up: Probe will return only the value to console, ? will return the variable along with short text and value, and ?? will return var name with value | 25-Jun-07 16:58 |
| 441 | Volker | but you can put both in the expression | 25-Jun-07 16:58 |
| 440 | Rebolek | probe evaluates, while?? not. | 25-Jun-07 16:58 |
| 439 | Rebolek | Volker: no, ?? gets 'value and probe gets value as input, so they return something different. | 25-Jun-07 16:57 |
| 438 | Rebolek | you have for example your code: append head copy/part trim string ln "something" and to easy understand what's going on, you can put 'probe after 'append, 'head, 'copy/part and 'trim to see how the evaluation is going on. | 25-Jun-07 16:56 |
| 437 | Volker | thats true with ?? too (as long as you dump vars) thats the advantage over ? | 25-Jun-07 16:55 |
| 436 | Rebolek | it prints value to console and returns that value | 25-Jun-07 16:54 |
| 435 | Rebolek | hte advantage of probe is that you can insert it anywhere in your code | 25-Jun-07 16:54 |
| 434 | Rebolek | Sorry, I meant ?? works same as ?, not probe | 25-Jun-07 16:54 |
| 433 | PatrickP61 | Ohhh I like the ?? var-name better! | 25-Jun-07 16:53 |
| 432 | Rebolek | ?? - it's same as with probe: >> ?? probe probe: func [ {Prints a molded, unevaluated value and returns the same value.} value ][ print mold :value :value ] | 25-Jun-07 16:51 |
| 431 | PatrickP61 | Hi Volker, after a few variations, I used this: print reduce ["var-name= " var-name] What is the syntax for '?? | 25-Jun-07 16:49 |
| 430 | Volker | I rarely type into the console and probe everywhere in the code. there is also '??, which shows the name of the word too. | 25-Jun-07 16:46 |
| 429 | PatrickP61 | I will check it out | 25-Jun-07 16:18 |
| 428 | Geomol | Carl write about the console here: http://www.rebol.com/docs/quick-start4.html | 25-Jun-07 16:08 |
| 427 | Geomol | Use some time to really understand probe. I use it all the time. | 25-Jun-07 16:07 |
| 426 | Geomol | Yes, use the console! Also use PROBE in the script to check values. You can put PROBE in anywhere, also in the middle of a sequnce of words. | 25-Jun-07 16:05 |
| 425 | PatrickP61 | As a newbie, what suggestions do you have for me to debug my rebol scripts. For example, I have a script called "Convert_to_Table" that I am just starting to write. I can execute it -stand alone- and see the results of the run, but what I would like to do is be able to see what the console has for any values. In other words, when I double click the "Convert_to_Table" I can see the results but not ask the console questions like print Count or the like. How do you suggest a newbie debug a script? Should I go into console first and then perform a "do Convert_to_Table" and then be able to ask questions of console, or is there another way?. | 25-Jun-07 16:00 |
| 424 | Geomol | A suggestion: Many words in REBOL can do more than one thing, sometimes depending on data-type of the argument or the use of refinements. It's almost impossible to remember it all. So as a new one to the language, check the help for the new words, you're learning. Like >> ? reduce >> ? compose | 25-Jun-07 15:54 |
| 423 | PatrickP61 | Works -- Thank you | 25-Jun-07 15:49 |
| 422 | Rebolek | then only values in parens get evaluated | 25-Jun-07 15:47 |
| 421 | Rebolek | If you do not want to evaluate everything, use compose: compose [(count) " Total lines"] | 25-Jun-07 15:47 |
| 420 | PatrickP61 | Thank you -- I'll try it | 25-Jun-07 15:47 |
| 419 | Rebolek | yes | 25-Jun-07 15:46 |
| 418 | PatrickP61 | Rebolek - Does the word REDUCE evaluate all values in the block? | 25-Jun-07 15:46 |
| 417 | Rebolek | hi Patrik, try this: write OutFile reduce [Count " Total lines"] | 25-Jun-07 15:46 |
| 416 | PatrickP61 | I'm a newbie and wanted to ask this question on a simple rebol program. If I have a variable COUNT and I wanted to write this value with a literal could I do this: write OutFile [Count " Total lines"]/append. But the word Count is not evaluated and I get "Count Total lines" instead of "8 Total lines". What do I need to tell rebol to return the value of COUNT? | 25-Jun-07 15:45 |
| 415 | PatrickP61 | Hi everyone, | 25-Jun-07 15:41 |
| 414 | Geomol | :-D | 22-Jun-07 23:06 |
| 413 | Graham | So, I can debug my programs in the bath :) | 22-Jun-07 23:06 |
| 412 | Graham | and very expensive | 22-Jun-07 23:05 |
| 411 | Graham | I actually bought some HP tough paper for this purpose. It's water proof and and can be printed upon with laser printers. | 22-Jun-07 23:05 |
| 410 | Gregg | I have some big books I like, but my favorites tend to be smaller. I love Jon Bentley's books, and anything by Robert Glass (almost wrote Philip Glass there :-), Kernighan, and DeMarco and Lister are other favorites. | 22-Jun-07 23:04 |
| 409 | Geomol | lol, you're special! | 22-Jun-07 23:03 |
| 408 | Graham | and preferably with water proof pages so I can read it in the bath :) | 22-Jun-07 22:57 |
| 407 | Graham | the bigger the better | 22-Jun-07 22:56 |
| 406 | Geomol | To everyone: What characterize a good learning book? Do you prefer thick books with deep explanation and many examples, or do you prefer the thin book with the essentials? Look at your collection of technical book; about computer languages, OSs, databases or what you have. Which ones do you like, and which ones is no-good? | 22-Jun-07 22:52 |
| 405 | denismx | Well I did'nt mean "built-in" in Rebol, but built using Rebol, of course. | 10-Jun-07 1:47 |