From: tamouse mailing lists Date: 2013-02-02T13:22:10+09:00 Subject: Re: Can ruby do this? On Thu, Jan 31, 2013 at 9:20 PM, Goran S. wrote: > I was wondering is Ruby capable of creating a website that is able to > rotate images say, once per hour; > - have a timer that counts from 60 to 0 mins that is linked to that > image rotation; > - all while being able to get images for said rotation (in certain > order) from a folder I earlier specified. I'm not exactly sure what you want here -- are you talking about a page that stays on user's browser for hours at a time? Or do you mean to change the image downloaded by many users over the course of a day once per hour? Both are quite doable in Ruby, although the implementation would be somewhat different. In the first case, where you want the web page to be sitting around being viewed for hours, you could do it with a page refresh to reload the entire page and the new image, or you could do it with an AJAX call to just load the image. Or, depending on how many images (and how big they are) you're talking about, you wouldn't even need an AJAX call, you could download all the images and just use a JavaScript timer to swap the images. (This is typically referred to as a carousel; google "JavaScript carousel".) In the second case, you wouldn't actually need a timer, per se, just store a Time when the current image expires. Then, when the site is loaded, check to see if the time has passed and substitute the next image and set a new expiration time.