|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here! |
|
#1
|
|||
|
|||
|
script execution
i've made a little script, that basically while it is open - never stops executing.. is this very draining on the server if it isn't doing much?
i don't want to tick off my host :eek: |
|
#2
|
|||
|
|||
|
RE: script execution
That script would use quite a bit of resources. As an example, the following script will hit the cpu usage to 100%..
Hopefully, your host is placing some types of limits on the cpu time that each process can take to avoid bad situations... |
|
#3
|
|||
|
|||
|
RE: script execution
well see they are running php is safe mode, so the longest i could normally get a script to execute is 30 seconds.. but then after that 30 seconds is up i got it triggered to refresh itself so it goes another 30 seconds, and it continues until i close the window.
you think this is a bad idea? |
|
#4
|
|||
|
|||
|
RE: script execution
Well, it all depends if they are limiting cpu usage on a per process basis. If they are, it doesn't matter. If they aren't, they should let you know there is a problem....that is if they are even paying attention, which I hope they would be....
What are you up to anyway? |
|
#5
|
|||
|
|||
|
RE: script execution
well our intranet here where i work has a strong firewall, and they don't allow us to download any chat software. firewall blocks applets too. so i'm making a minichat to run in a browser with as less refreshing as possible.. (because i find refreshing pages extremely annoying)
my script, runs in an infinite loop to check for new data in a txt file, then sleep for 1 second and check again, if there is no new data it flushes out white space, if there IS new data then it flushes the message. after the 30 or so seconds of execution time is used up, the page then reads the metatag which refreshes the page in 1 second to start the loop again. it runs beautifully with the exception of a dead page every now and then so i certainly hope it's not a problem. if they are limiting cpu usage on a per process basis what does that mean exactly? will my script just run slower? i'd be more than happy to give you a copy if you want to test anything. when i get home that is. |
|
#6
|
||||
|
||||
|
RE: script execution
I'd love to see what you have written. I want to put a chat on my website so my visitors can chat with me only using an "visitor" account I will set up for that purpose. ICQ offer an applet but they are all pretty unconfigurable so I'm looking for something more flexible.
|
|
#7
|
|||
|
|||
|
RE: script execution
if you think about it, the method i am using could be re-used to really solve most of the problems associated with client-side vs server-side. my script is more or less keeping a persistant connection between the server and the browser, and the browser doesn't need to be refreshed in order to receive new content.
i still have a few updates left to do and i need to find out whether or not this is in fact draining the cpu time. if not, who knows, maybe Matt will consider a browser-based instant messaging system for all us codewalkers i don't have the code in front of me now sarah, but if you drop me an e-mail i'll send some samples to you. |
|
#8
|
|||
|
|||
|
RE: script execution
i wouldn't go that far...
anyway, i so even better php/js chat system. i think it is used in phpGroupWare. to be short, it goes like this: page is divided in tree (two or more) frames. in the main frame (the biggest) messages are shown. in a bottom frame, there is a text field (for u to enter a msg) and a submit btn. and a third frame is invisible! it is that frame that is refreshed every X seconds (as you like) and whenever there are new messages on the server, it contains a simple javascript that adds that msgs to the main frame! now, that (imho) is a very elegant solution that simulates client/server app! |
|
#9
|
|||
|
|||
|
RE: script execution
however you'd get a longer delay.. and sometimes (for who knows why) refreshing pages go dead, so if you can't see a dead invisible page to manually refresh then what do you do?.
|
|
#10
|
|||
|
|||
|
RE: script execution
u could refresh that invisible frame from a main or bottom frame. just set a interval or timer (i always get those 2 mixed) in js and it can never go ded.
or, if u want to be shure, make a button in a bottom frame that refreshes the invisible frame. or, just look at phpGW and see that it works great... |
|
#11
|
|||
|
|||
|
RE: script execution
ahh js refresh i'll have to use that ty
|
|
#12
|
|||
|
|||
|
RE: script execution
m'kay, even with the js refresh i still get dead pages occasionally.. dunno. oh well
|
|
#13
|
|||
|
|||
|
RE: script execution
how did u do a js refresh thingy?
it is important that u do it from a diferent frame than the frame u use for mesages... and to use that func that calls a function every X (30) seconds... btw, i can't check. i can't catch u to be in a room... |
|
#14
|
|||
|
|||
|
RE: script execution
i'm just using the following..
<NOSCRIPT> <meta http-equiv="refresh" content="1"> </NOSCRIPT> <body onLoad="window.setTimeout(location.href='top.php',1000)"> since the page doesn't actually load fully for about a minute, until then it's just flushing out info and then reads the onload tag to restart the flushing.. |
|
#15
|
|||
|
|||
|
RE: script execution
and it doesn't work all the time?
why don't u try "my way". onLoad can't be trusted... |
![]() |
| Viewing: Codewalkers Forums > PHP Related > PHP Coding > script execution |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|