[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Refreshing data displayed in browser every 24 hrs

Pragash Mr.

7/16/2008 12:22:00 PM

Hi,
I want to refresh the data which is displaying in browser for every 24
hrs is there any solution.....
plz reply

for ex: firstname i am displaying in browser i want to change the
firstname every 24 hrs ......
--
Posted via http://www.ruby-....

2 Answers

Max Williams

7/16/2008 1:12:00 PM

0

Pragash Mr. wrote:
> Hi,
> I want to refresh the data which is displaying in browser for every 24
> hrs is there any solution.....
> plz reply
>
> for ex: firstname i am displaying in browser i want to change the
> firstname every 24 hrs ......

I had that same problem and did it like this: basically, i mod 'days
since epoch' over array size to get an array index that changes every
day.

#get a list of possible resources to choose from, eg
@resources = Resource.find(:all)

days_since_epoch = Time.now.to_i/86400
@resource_of_the_day = @resources[days_since_epoch % @resources.size]

It means that @resource_of_the_day effectively changes at midnight
(server time) with no need for scheduled tasks or anything like that.


--
Posted via http://www.ruby-....

Tachikoma

7/17/2008 2:12:00 AM

0

On Jul 16, 8:22 pm, "Pragash Mr." <gananapraga...@srishtisoft.com>
wrote:
> Hi,
> I want to refresh the data which is displaying in browser for every 24
> hrs is there any solution.....
> plz reply
>
> for ex: firstname i am displaying in browser i want to change the
> firstname every 24 hrs ......
> --
> Posted viahttp://www.ruby-....

I'm sorry but i do not quite understand
Do you want to change data between requests for every 24 hrs, or wanna
refresh data in a 24-hrs-long request?