I have an MVC application I'm hosting on AppHarbor that takes 20 seconds or so to start up. Since I can't control the timeout period on AppHarbor, any user that visits the application gets a blank screen while resources spool up.
I'd like to at least show the user something other than a blank page while resources are being loaded.
I've tried adding an index.html page with a redirect, but I only want that page to appear when the application first fires up.
Try this link, it's not the one I currently use (couldn't find it online), but it seems easy enough to use.
Since you have a very long load at the start, you can use this:
//hide after page load completed
$(document).ready(function () {
$('.loader').css("display", "none");
});
Other then that just follow their explanation there, if you have any questions about it, I'll try and help more.
Related
I have long running data processing on one page. It takes 3 minutes - that is an operation done by the admin and it is not executed very often.
What will happen if the user closes the page? I suppose if that user have more tabs or pages opened to the same site, the execution will continue otherwise will stop. Is that correct thinking?
When an ASP.NET page runs, the page goes through a life cycle in which it performs a series of processing steps. These include initialization, instantiating controls, restoring and maintaining state, running event handler code, and rendering.
All your code will be running no matter if the client is there or not to receive it . as #DLeh mentioned in his comment The server doesn't know and doesnt' care if the browser has closed the page.
check this out for more info MS Link
I have an rails application with a huge database (hundreds of gigabytes) that has a lot of different options what to do with the data. In some cases, like changing data, this can be done in a background task I do with Sidekiq. But in other cases, like viewing data with a lot of rows and columns or complex SQL queries, the process of getting the data takes quite long.
What I want to do, is show the user that something is happening when he clicks a link. Like the progress bar many browsers have, but more obvious, so even users not used to working with browsers should see that something is happening and loading.
The question is how to do this. I already tried different options with AJAX and jQuery but most of the times I can only do this for certain actions, but basically I want to do it for the whole application. So every time the user sends a request to load a new page, I want to immediately show him, that something is happening.
The closest I came was a Javascript, that was always triggered. The problem was that it literally happened every time and forced to reload the page. This means when I toggled an element it showed the progress bar and then reloaded the page.
In essence, what I'm looking for:
My application runs on Ruby and Rails 4 and every time a new page is loaded I want the user to show that his request is being processed, so even if the request takes a couple of seconds, the user won't get nervous because he knows that something is happening.
I would really appreciate any help for finding a solution, because I can't seem to find any...
You should use a javascript animation to show to the user that something is happening.
For example : http://ricostacruz.com/nprogress/
I'm trying to figure out exactly what happens when you link to a same-domain external page with JQM. I know the new page gets added to the DOM, but if I cruise through 5 or so of these links, are all 5 now in the DOM?
Firebug is showing the initial page and the active page in the DOM and nothing else.
Chrome is showing variable results, usually storing the last page and the active page.
What exactly happens here?
Do I need to assume all my handlers on a page are lost when I change page? So I need to rebind them on each pageinit?
Easy way to check. Bind page create:
$('#pageID').live('pagecreate', function (event) { alert("Inserted to the dom") };
That triggers when the page is inserted to the dom. If the alert is triggered every time you enter the page, it means the page is not saved to the dom. And I think that is actually the case. But I am not sure.
I'm looking on how exactly I can show a "loading element" while the page is first requested. Most examples I find, explain on how to show a "loading element" on an Ajax.BeginForm or Ajax.ActionLink...
What I'm trying to do is having a couple of dashboards.
When the user requests the page, the dashboards are shown immediately, but the data is still being loaded.
While the data is being loaded, a "loading element" should appear in the dashboard.
So, some sort of Ajax.RenderPartial, but that does not exist :)
In this case you could show the loading element immediately when the page is first requested along with the dashboards and hide it later when those dashboards are finished loading. There's the endRequest event you could subscribe to.
I have a rails application on a shared server that also has a decently sized database, which is still growing, behind it. The application takes a long time to start/load the homepage, about 20-30 seconds for me, although some people report waiting up to several minutes.
Is there a way to flash a notice that informs people that the database may take several minutes to load while they are waiting?
It's hard to say based on your question, since we don't know exactly what your home page is showing or how it's displaying it, but assuming you are referring to an AJAX (based on the tag) call that is retrieving something from the database to be displayed on your homepage, there are a few things you can try:
Paginate the items. Is whatever you're loading a long list of items? If so, only retrieve a few at once, and let the user decide if they want to see more.
Load the rest of the page (header, footer, navigation bar, etc), and then place a loading gif spinner in the area where the content is to be loaded. If you use a javascript library like jQuery this is pretty trivial, and there are a ton of tutorials out there for it. Here is a good site for free loading indicators: http://ajaxload.info/. What you'll want to do is make the AJAX call and use your javascript library to set the loading image. Then, in the success callback for your ajax call, hide the spinner and show the content.
Load one item at a time. Make a separate ajax call for each item you're going to load, so that the user sees them coming in. This will probably end up taking longer overall (you're hitting the database more often), but the visual may be a nice psychological hack.
Look at how your database queries are set up. Are you getting everything you need in one find? That's the best way to do it, as every time you have to make another trip to the database you're increasing the wait time.
Other than that the best thing you can do is get better hardware if possible, maybe look into a VPS like linode.com.