Shoutbox

HTTP/HTML questions - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: HTTP/HTML questions (/showthread.php?tid=34063)

HTTP/HTML questions by Millenium_edition on 11-04-2004 at 01:35 AM

first,

quote:
I'm making this IRC bot, where you can access your logs from anywhere. The way you'll be able to use is, with an internet browser, connect to the IP of the bot and read the logs.

Now, my bot sends back:
code:
Content-Type: text/plain
All works fine. Unless there are some other characters in the text. (an example is the BOLD character used by plus!); if you use them, FireFox will ask you for Application/ostream (or something like that), instead of displaying the text file. Since IE ignores the content-type, it works fine in there.

What's the catch?
second
quote:
I'm making a dynamicly generated web page, and i'd like it to scroll down at every time I send data. Can I use javascript, or anything else to scroll down?

ty for reading this thread, it'd really help me if you found out
RE: HTTP/HTML questions by fluffy_lobster on 11-04-2004 at 04:38 PM

First:  if you use those characters with the text/plain mimetype, I think that your server is technically lying.  It's not plain text.  Firefox's approach is to try to correct it by resorting to an octet-stream download of the file to do with what you may - IE just tries to stick its fingers in its ears and show the page anyway.  If you want it to be web viewable you should ideally use the text/html content-type and then encode html special characters in the output

Second: see http://www.mediacollege.com/internet/javascript/page/scroll.html :)


RE: HTTP/HTML questions by Millenium_edition on 11-04-2004 at 05:58 PM

quote:
Originally posted by fluffy_lobster
First:  if you use those characters with the text/plain mimetype, I think that your server is technically lying.  It's not plain text.  Firefox's approach is to try to correct it by resorting to an octet-stream download of the file to do with what you may - IE just tries to stick its fingers in its ears and show the page anyway.  If you want it to be web viewable you should ideally use the text/html content-type and then encode html special characters in the output
I'm not going to encode 2mb large text files :-/
quote:
Originally posted by fluffy_lobster
Second: see http://www.mediacollege.com/internet/javascript/page/scroll.html
would it be possible to scroll another frame?
RE: HTTP/HTML questions by WDZ on 11-04-2004 at 06:08 PM

quote:
Originally posted by Millenium_edition
I'm not going to encode 2mb large text files :-/
Why not? Just use a program/script to do it... it shouldn't take long at all. :p
RE: HTTP/HTML questions by Millenium_edition on 11-04-2004 at 06:17 PM

quote:
Originally posted by WDZ
quote:
Originally posted by Millenium_edition
I'm not going to encode 2mb large text files :-/
Why not? Just use a program/script to do it... it shouldn't take long at all. :p
errr it will, as they are IRC logs, so pretty much everything will have to be encoded (hence the "<" and ">")

and, DZ, don't have an idea for that javascript thingy?
RE: HTTP/HTML questions by WDZ on 11-04-2004 at 06:33 PM

quote:
Originally posted by Millenium_edition
errr it will, as they are IRC logs, so pretty much everything will have to be encoded (hence the "<" and ">")
=/
quote:
Originally posted by Millenium_edition
and, DZ, don't have an idea for that javascript thingy?
top.frameName.scrollBy(0,500);

Replace frameName with the name of the frame to scroll, of course. The 500 could be changed to a big number like 9999999 to ensure that it always scrolls all the way down. That's what I use in the shoutbox.
RE: HTTP/HTML questions by fluffy_lobster on 11-04-2004 at 07:39 PM

The following code:

code:
$i = 1;
while($i < 100000){
$string .= '<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<';
$i++;
}
$string = htmlspecialchars($string);
Took 0.65 seconds on my server.  Bearing mind that it does 100,000 concatenation tasks before parsing the 3mb string that contains nothing but html special characters, it's not a difficult or time consuming business.
RE: HTTP/HTML questions by Millenium_edition on 11-05-2004 at 01:40 AM

Damn =(

it takes ages to convert 34 kb using my sub.

code:
Function Char2HTML(ByVal sString As String) As String
Dim i As Long, sTemp As String, l As Byte, sTemp2 As String
sTemp2 = Replace(sString, Chr(10), vbNullString, , , vbTextCompare)
For i = 1 To Len(sTemp2)
    l = AscB(Mid$(sTemp2, i, 1))
    If l = 13 Then
        sTemp = sTemp & "<br>"
    Else
        sTemp = sTemp & "&#" & CStr( l) & ";"
    End If
Next i
Char2HTML = sTemp
End Function
help? :(
RE: HTTP/HTML questions by RaceProUK on 11-05-2004 at 02:09 AM

Well, PHP is going to be faster than VB yes?
Anyway, you'd be better off with a more native language such as C++. Even Java would be faster than VB, and it has an object method somewhere that URL-encodes any string you pass to it.


RE: HTTP/HTML questions by Millenium_edition on 11-05-2004 at 02:21 AM

quote:
Originally posted by raceprouk
Well, PHP is going to be faster than VB yes?
Anyway, you'd be better off with a more native language such as C++. Even Java would be faster than VB, and it has an object method somewhere that URL-encodes any string you pass to it.
sorry for being rude, but I don't give a damn about learning other languages... Not at the moment at least.

And I've fixed the problem, by generating the HTMl at the same time of generating the TXT file, so that the webserver only has to grab the HTML file and send it through.
RE: HTTP/HTML questions by RaceProUK on 11-05-2004 at 10:32 AM

quote:
Originally posted by Millenium_edition
sorry for being rude, but I don't give a damn about learning other languages... Not at the moment at least.
That's not rude, so don't worry about it ;)
RE: HTTP/HTML questions by Millenium_edition on 11-05-2004 at 11:54 PM

other problem

code:
<input type="submit" name="SendMessage" value="Send">
Can I make it submit to another page than the one the user now is visiting?
RE: HTTP/HTML questions by WDZ on 11-06-2004 at 05:35 AM

You can use target="" in the <form> tag just as you would in a link. For example...

<form action="blah.php" target="_blank">
<form action="blah.php" target="myFrameName">


RE: HTTP/HTML questions by -dt- on 11-06-2004 at 09:13 AM

quote:
Originally posted by WDZ
You can use target="" in the <form> tag just as you would in a link. For example...

<form action="blah.php" target="_blank">
<form action="blah.php" target="myFrameName">
then if u use php u can grab the value by using
code:
$blah = $_POST['objectname'];

and $blah will hold the value of object

RE: HTTP/HTML questions by Millenium_edition on 11-06-2004 at 11:24 AM

actually, I didn't mean in another frame, I ment to another page. and that's in action=""

thank you anyway :)

(btw, -dt-, thanks, but I'm writing my own webserver, so no PHP :P )