RAW

new BookmarkLockedFalling
Alyce
Administrator
*****

Alyce Avatar

Posts: 519Female

-Alyce
Alyce
Administrator
*****

Alyce Avatar

Posts: 519Female

Post by Alyce on Nov 10, 2007 10:07:54 GMT -5

Here's what I have. Is this a correct usage?

t$ = "<html><head><title>Raw Demo</title><center><h1>Raw Demo</h1></center></head>"
t$ = t$ + "<body><p>Hello, Run BASIC!</p><p>Hit the BACK button.</p></body></html>"

print "Testing Run BASIC"
print
link #lk, "Click Me",[click]
wait

[click]
raw t$
wait
-Alyce
Janet
Global Moderator
*****

Janet Avatar

Posts: 276

Post by Janet on Nov 10, 2007 10:56:51 GMT -5

I'd like to know the advantage of using raw over html. Modifying Alyce's short demo, this code

t$ = "<html><head><title>Html Demo</title><center><h1>Raw Demo</h1></center></head>"
t$ = t$ + "<body><p>Hello, Run BASIC!</p><p>Hit the BACK button.</p></body></html>"

Cls
html t$
print: print
Link#l, "Click Me to End",[click]


Wait

[click]
Cls
html t$
End

shows the link to be clicked to end the program. But, Alyce's original Raw demo

t$ = "<html><head><title>Raw Demo</title><center><h1>Raw Demo</h1></center></head>"
t$ = t$ + "<body><p>Hello, Run BASIC!</p><p>Hit the BACK button.</p></body></html>"

Cls
raw t$
print: print
Link#l, "Click Me to End",[click]


Wait

[click]
Cls
raw t$
End

doesn't display Link#1. So, when would it be preferable to use raw over html?
[br]
mikeukmid
Guest

Guest Avatar

Post by mikeukmid on Nov 10, 2007 11:24:37 GMT -5

I assumed raw was to to get a web page in MIME type text format, ie no backgrounds or image links etc for old browsers which can only display text - maybe I'm not understanding too.

'returns source code for web page
a$ = httpget$("http://www.nuip.net/")
print a$
print " "
link #cont, "Continue",[cont]

wait

[cont]
cls

'returns a web page with MIME type text/plain
raw httpget$("http://www.nuip.net/")

end


Mike.
Last Edit: Nov 10, 2007 11:44:46 GMT -5 by mikeukmid
Alyce
Administrator
*****

Alyce Avatar

Posts: 519Female

Post by Alyce on Nov 10, 2007 11:29:26 GMT -5

Mike, that's a nice example.

It works to print out one's own HTML as well, and when you do that, the page does not include any of Run BASIC's html headers. (Try viewing source, both before and after clicking my link.)
-Alyce
Alyce
Administrator
*****

Alyce Avatar

Posts: 519Female

-Alyce
Brent
Full Member
***

Brent Avatar

Posts: 129Male

Post by Brent on Nov 10, 2007 14:22:54 GMT -5

The RAW command does the equivalent to a CLS and WAIT in one command. Therefore it's not necessary to place a WAIT after it.

In its current form, RAW is meant to show plain text only. The fact that IE interprets this text as HTML is probably a bug in IE.
[b]Brent[/b][br][br][url=http://www.b6sw.com/forum/viewforum.php?f=32]SapientBoard[/url] 0.1.2 released 02 May 2009
Alyce
Administrator
*****

Alyce Avatar

Posts: 519Female

Post by Alyce on Nov 10, 2007 14:27:47 GMT -5

brent said:
The RAW command does the equivalent to a CLS and WAIT in one command. Therefore it's not necessary to place a WAIT after it.

In its current form, RAW is meant to show plain text only. The fact that IE interprets this text as HTML is probably a bug in IE.


Thanks, Brent. That helps my understanding. I need to install another browser on my test machine so I can see how things work outside of MSIE.
-Alyce
mikeukmid
Guest

Guest Avatar

Post by mikeukmid on Nov 10, 2007 14:46:26 GMT -5

Sorry Alyce, I thought modding my reply would make things clearer but obviously not. The RB docs give no clue what Carl intended RAW to do but my testing implied it was for plain text - like the difference in plaintext & richtext emails. The source for the returned raw page has "Content-Type" content="text/html;" so maybe that confuses IE, I dont know and don't have other browsers installed. I prefer IE (ducking quickly, covering my head ;D) Tried changing the header to text/plain but that had no effect. Over to Carl?

Mike.
carlgundel
Administrator
*****
Creator of Run BASIC

carlgundel Avatar

Posts: 975

Post by carlgundel on Nov 10, 2007 15:18:24 GMT -5

The intent of RAW is really so you can create web services. Another program (even another RB program) can access the server and get back a pure text answer. This could be readable text, XML, rows of comma separated values, or whatever.

-Carl
Alyce
Administrator
*****

Alyce Avatar

Posts: 519Female

-Alyce
turbov21
Guest

Guest Avatar

Post by turbov21 on Nov 10, 2007 15:31:47 GMT -5

carlgundel said:
This could be readable text, XML, rows of comma separated values, or whatever.

-Carl


Carl, last time I tried to use RAW to generate XML, the feed validator I was using rejected it because the header was for "text/plain", has this changed in Beta 5?
carlgundel
Administrator
*****
Creator of Run BASIC

carlgundel Avatar

Posts: 975

Post by carlgundel on Nov 10, 2007 15:39:25 GMT -5

Carl, last time I tried to use RAW to generate XML, the feed validator I was using rejected it because the header was for "text/plain", has this changed in Beta 5?

Why shouldn't your validator be willing to accept XML in a plain text form?

I'm willing to fix this, but I'm not sure how. Lemme think.

-Carl
Last Edit: Nov 10, 2007 15:40:28 GMT -5 by carlgundel
turbov21
Guest

Guest Avatar

Post by turbov21 on Nov 10, 2007 16:00:19 GMT -5

carlgundel said:
Why shouldn't your validator be willing to accept XML in a plain text form?

I'm willing to fix this, but I'm not sure how. Lemme think.

-Carl


I guess it takes it (so mea culpa on the bad wording), but it recommends that the header be "text/xml", here's the page:

brrdd.com/?19 (shortened)
Last Edit: Nov 10, 2007 16:02:03 GMT -5 by mikeukmid
carlgundel
Administrator
*****
Creator of Run BASIC

carlgundel Avatar

Posts: 975

Post by carlgundel on Nov 10, 2007 16:24:50 GMT -5

turbov21 said:
carlgundel said:
Why shouldn't your validator be willing to accept XML in a plain text form?

I'm willing to fix this, but I'm not sure how. Lemme think.

-Carl


I guess it takes it (so mea culpa on the bad wording), but it recommends that the header be "text/xml", here's the page:

Thanks.
brrdd.com/?19 (shortened)

Thanks. Very interesting.

-Carl