The place where everyone hangs out, chats, gossips, and argues
User avatar
By Andy B
#379651
Possibly the most brilliant and useless thing ever. I love crap like this! May even see of it's right at 8.50.
By jowie
#379652
I did a test and it did seem to come out at 2/3 (funnily!)... Unfortunately you cannot cheat and change your computer clock because it uses the server clock :P

I emailed Chris... Wonder if it's worthy of a mention? Who knows. Let me know if it gets a mention before 7.45! 8)
User avatar
By Console
#379690
I find it funny that you're using a PHP script to write a single variable in a javascript script for a flash app. Wouldn't a simple line of javascript be easier (and more compatible): -

Code: Select alljavascript:var a=document.title;void(window.setInterval("n=new Date();h=n.getHours();m=n.getMinutes();s=n.getSeconds();d=n.getDay();if(d==0||d>5||h*100+m<630)t=0;else if(h>=10)t=1;else t=(h*3600+m*60+s-23400)/12600;document.title=a+' - '+(t*100)+'%'",1000))
By jowie
#379727
Console wrote:I find it funny that you're using a PHP script to write a single variable in a javascript script for a flash app. Wouldn't a simple line of javascript be easier (and more compatible)

Probably :lol:

But it was just based on my limited knowledge of both PHP and JS... Also it meant that whatever computer you view it from, it will be the correct time even if the computer's time is incorrect. Though I'm just using that as an excuse! :oops:
User avatar
By Console
#379736
Damn straight.

jowie wrote:But it was just based on my limited knowledge of both PHP and JS... Also it meant that whatever computer you view it from, it will be the correct time even if the computer's time is incorrect.


Assuming that your Flash knowledge was not so limited, you could have used that to grab the time from the server directly, from the HTTP headers, which would reduce the time-drag caused by loading the page and the flash app. If you wanted to be really clever, of course, you could even go as far as to grab the time from an NTP server, and check periodically to make sure the time is spot on.
By jowie
#379745
This could all get rather complicated, couldn't it ;-) I wasn't aware you could get the time from HTTP headers. Never done that before. Is there drag? When I open the page it's pretty much there straight away.
User avatar
By Munki Bhoy
#379746
I wasn't complaining about geekery, I'm just glad to be home :D

(That and I'm crash coursing PHP at the moment for work)
User avatar
By Console
#379748
jowie wrote:I wasn't aware you could get the time from HTTP headers.


Apache, which is the server your site is hosted on, gives out an RFC 2822 formatted time-stamp by default (I think that function can be turned off, but I don't know how), which your Flash app could easily grab to get the time (and at intervals to make sure it's still on track - the computer clock might not be ticking seconds correctly). This would also make sure that no-one has cleverly rewritten the time-stamp on the page to make the Flash app give out an incorrect progression percentage.

jowie wrote:Never done that before. Is there drag? When I open the page it's pretty much there straight away.


There will be drag, especially the first time.
By jowie
#379753
So how does one pass an HTML header into Flash? I've not heard of that one before. Only way I could think of doing it is to get Flash to do a URLRequest for the page it was sitting in... Effectively requesting the same page twice... 8O
User avatar
By Console
#379756
Do the headers not get parsed into some global parameter? If not, can URLRequest read raw headers? You wouldn't have to request the same page - you could request a blank page, or even a non-existent page. In fact, it would be a good idea to just do a HEAD request (as opposed to GET), assuming that you can do that with Flash.
User avatar
By Andy B
#379759
Does this not constitute a private conversation? Certainly shouldn't be in general.

Hehehe.
User avatar
By Yudster
#379765
My god this is even worse than the thread where everyone is arguing with the trolls........