HTTP/HTML questions |
Author: |
Message: |
Millenium_edition
Veteran Member
Posts: 1787 Reputation: 57
Joined: Apr 2003
|
O.P. HTTP/HTML questions
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
This post was edited on 11-04-2004 at 02:16 AM by Millenium_edition.
|
|
11-04-2004 01:35 AM |
|
|
fluffy_lobster
Veteran Member
Posts: -2
Posts: 1391 Reputation: 23
36 / /
Joined: Nov 2002
|
RE: HTTP/HTML questions
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
|
|
11-04-2004 04:38 PM |
|
|
Millenium_edition
Veteran Member
Posts: 1787 Reputation: 57
Joined: Apr 2003
|
O.P. RE: HTTP/HTML questions
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?
|
|
11-04-2004 05:58 PM |
|
|
WDZ
Former Admin
Posts: 7106 Reputation: 107
– / /
Joined: Mar 2002
|
RE: HTTP/HTML questions
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.
|
|
11-04-2004 06:08 PM |
|
|
Millenium_edition
Veteran Member
Posts: 1787 Reputation: 57
Joined: Apr 2003
|
O.P. RE: HTTP/HTML questions
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.
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?
|
|
11-04-2004 06:17 PM |
|
|
WDZ
Former Admin
Posts: 7106 Reputation: 107
– / /
Joined: Mar 2002
|
RE: HTTP/HTML questions
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.
|
|
11-04-2004 06:33 PM |
|
|
fluffy_lobster
Veteran Member
Posts: -2
Posts: 1391 Reputation: 23
36 / /
Joined: Nov 2002
|
RE: HTTP/HTML questions
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.
|
|
11-04-2004 07:39 PM |
|
|
Millenium_edition
Veteran Member
Posts: 1787 Reputation: 57
Joined: Apr 2003
|
O.P. RE: HTTP/HTML questions
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?
This post was edited on 11-05-2004 at 01:41 AM by Millenium_edition.
|
|
11-05-2004 01:40 AM |
|
|
RaceProUK
Elite Member
Posts: 6073 Reputation: 57
39 / /
Joined: Oct 2003
|
RE: HTTP/HTML questions
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.
|
|
11-05-2004 02:09 AM |
|
|
Millenium_edition
Veteran Member
Posts: 1787 Reputation: 57
Joined: Apr 2003
|
O.P. RE: HTTP/HTML questions
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.
|
|
11-05-2004 02:21 AM |
|
|
Pages: (2):
« First
[ 1 ]
2
»
Last »
|
|