From: Hassan Schroeder Date: 2013-06-16T02:25:29+09:00 Subject: Re: Can I use Sinatra to render dynamic pages? On Sat, Jun 15, 2013 at 9:46 AM, Ruby Student wrote: > My statement about "overkill" WAS NOT INTENDED TO BE FOR Sinatra. If you go > back you'll find that I was talking about TomCat. To quote: "If Sinatra is overkill for what I want, perhaps I should look into something different." And again, it's "Tomcat", NOT "TomCat"; precision counts, in programming and discussions about programming :-) > My application will, every second, read the content of the file Is there any reason you can't get the data direct from the process that's writing that file? Reading from a file being written every second seems a bit clumsy. Just to muddy the water a bit :-) > Display the new information, counter, on the browser WITHOUT THE USER HAVING > TO REFRESH IT. In other words, I want to refresh the browser's content > without user having to do anything. The new information must be continuously > be updated and displayed. > Someone suggested Javascript but I don't want to start learning yet another > programming tool when I think that Ruby and some web tool such as Sinatra > might be able to help me with this. Rails was also suggested. I am probably > still not making any sense! The difference between your Shoes application and a web app is that a web app is a client-server architecture. You can certainly use Ruby and Sinatra for the server part, which responds to data requests, but those requests come from a web client, in this case a browser. And JavaScript is the language you use to program behavior in browsers. That said, you could most simplistically use a meta-refresh tag in an iframe on your page to display the changing data without any user action. I certainly wouldn't try to refresh an entire page, even a simple one, every second. One way or another, you're going to have to learn how web clients work, though. :-) Good luck, -- Hassan Schroeder ------------------------ hassan.schroeder@gmail.com http://about.me/hassanschroeder twitter: @hassan