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

World: r3wp

[Rebol School] Rebol School

todun
4-Oct-2011
[3858]
trim/tail did not work for me.
PeterWood
5-Oct-2011
[3859]
Try:

write %b.txt head remove back tail read %a.txt

(I think that trim doesn't treat a "newline" as whitespace)
todun
5-Oct-2011
[3860]
PeterWood: Thanks . sadly that didn't work either. though the other 
issues are greater at this point.
GrahamC
5-Oct-2011
[3861]
You should be able to open/direct, skip to the end and write a space 
or null to the end
todun
5-Oct-2011
[3862]
@GrahamC, how do I accomplish this?
PeterWood
5-Oct-2011
[3863x2]
The code that I gave does remove a newline from the end of a file:

>> read/binary %a.txt                            

== #{31323334350E}

>> write %b.txt head remove back tail read %a.txt

>> read/binary %b.txt                           
 
== #{3132333435}
Can you show the last few characters of your file here?
Geomol
5-Oct-2011
[3865x2]
The example with trim/tail does remove the newline from the end here.
Peter, on what system is #{0E} a newline?
todun
5-Oct-2011
[3867x3]
How do I make a file containing tokens on each line be displayed 
one at a time in an "info" field (.ie. non-modifiable view, just 
readable) on the view when I click a button?
How do I make the data loaded from the file change to another token 
in the file when I click another button?
@PeterWood, thanks for the suggestion. I will try that.
Kaj
5-Oct-2011
[3870]
Please don't cross-post, thanks
PeterWood
5-Oct-2011
[3871x3]
John: It isn't it was my mistake.
Here is the correction:

>> write %a.txt "12345^/"                       
 
>> read/binary %a.txt   
 
== #{31323334350A}

>> write/binary %b.txt head remove back tail read %a.txt

>> read/binary %b.txt                                  
 
== #{3132333435}
So I believe the answer to todun's issue is the need to use the binary 
refinement of write to stop REBOL adding a newline at the end of 
the file.
todun
5-Oct-2011
[3874]
@Kaj, I have no idea what the conventions are here or what all the 
different rooms mean. I assumed that my questions in "I'm new" were 
not meeting the requiremetns of the room so I posted here. Sorry 
if I'm tresspasing on some rule here.
Henrik
5-Oct-2011
[3875]
we usually simply say "let's talk in group X", if a specific topic 
is inappropriate for the current group.
todun
5-Oct-2011
[3876x3]
@Henrik, thanks for the tip.
@PeterWood, ok. thanks. I will try that.
how can I do MVC(Model View Controller) in REBOL? Thanks.
Kaj
5-Oct-2011
[3879]
Look in the !QM QuarterMaster group here
todun
5-Oct-2011
[3880]
@Kaj: do I repost the question there or  is this information someplace 
online?
Kaj
5-Oct-2011
[3881]
The answer is in there, so I don't think you'll have to repost :-)
todun
5-Oct-2011
[3882]
@Kaj, I just reposted. Oops.
Kaj
5-Oct-2011
[3883]
It's a good approach to want to design a first REBOL GUI program 
in MVC parts, but I think you'll find when you fit them together, 
that the resulting code would blend together. We don't really talk 
in MVC terms about View code
todun
5-Oct-2011
[3884]
@Kaj, what is idiomatic REBOL to approach my problem? How do I make 
sense of it?
Kaj
5-Oct-2011
[3885x2]
There's not much idiom for this, like in general in functional languages, 
because for such a small program, not much code is needed in REBOL
Just write the three MVC parts and then fit them together
todun
5-Oct-2011
[3887]
@Kaj, ok. So I can just write all my VIEW as a function. Repeat the 
same for Model and CONTROLLER? How will I then combine them?
Kaj
5-Oct-2011
[3888x2]
A view is typically a template. In REBOL, it would be a piece of 
View dialect
Model and controller would be functions, that you can then connect 
to the View GUI
todun
5-Oct-2011
[3890x3]
@Kaj, thanks. This is begining to make sense. The view is like a 
template, something static the user will see. The MODEL, is a function, 
the controller coordinates with Model and View somehow.
@Kaj, I've not used MVC much myself, but the rumor out there is that 
it's one way to go. So when you say connect them, what do you mean?
@Kaj, Also, when I have a Model with multiple parts that are best 
represesnted as functions themselves, how can I make it available 
to the view(these "sub-functions")?
Kaj
5-Oct-2011
[3893x4]
What you call idiom would mostly be the View dialect. That's specifically 
for specifying GUIs
The GUI dialect has places for actions. That's where your model and 
controller functions would go
For simple programs, that code is often so small that we tend to 
write it out directly in the GUI dialect
If you have little experience with all the forms of MVC, it's better 
to forget it and just follow the REBOL tutorials
todun
5-Oct-2011
[3897x2]
@Kaj, can you point me to a sample program that has these features 
you speak of?
Kaj, I have looked at several REBOL tutorialss and I cannot seem 
to be able to make them do exactly what I wanted, hence my pining 
for a paradigm like MVC.
Kaj
5-Oct-2011
[3899]
No, as I say, we don't usually use MVC as such. Any View example 
shows how to specify some GUI with some actions
todun
5-Oct-2011
[3900]
@Kaj, oh I see. So an action like an Alert?
Kaj
5-Oct-2011
[3901x2]
Perhaps, but an alert usually has its own little dialog GUI
Actions within the GUI dialect are regular REBOL code, so they can 
be anything
todun
5-Oct-2011
[3903]
@Kaj, ok. do you have an example in mind?
Kaj
5-Oct-2011
[3904]
Please follow the many tutorials linked from the REBOL site
todun
6-Oct-2011
[3905x3]
@Kaj: Ok  thanks.
is there a way to add 5 to a variable anytime it is called?
for example x: 0    ....           counter: x + 5
so everytime I call counter it should result in 5, 10, ...