pause or stop Firefox 'tamper data'? - firefox-addon

I have been using 'tamper data' of Firefox to sniff the requests sent back and forth. I don't change the requests, just want a clear view of them. 'tamper data' is a great tool, except for 1 thing, to me,
there is no way to pause, ie, stop tracking requests. I have an application that is sending an ajax call every 1 second or so. All I want is to track the initial requests when the applciation starts. but the ajax calls keep polluting the 'tamper data' window and I cannot get hold of the initial requests as they get rolled to the top.
Can anyone please share some hints to achieve what I want? Really appreciate it

the net tab of firebug does not have that problem. It always fixes on the earliest entries

Related

How to warn user if he/she accidentally close/leave session at website?

We develop accounting system on a web with ASP.NET MVC and encountered this problem - if user is in the middle of the work and somehow manages to close browser all work is gone (and users are not geeks at all it did happen and will happen). Especially problematic at Chrome in Windows after they removed warning of closing tabs from philosophical reasons so now it will just shut down. We would like to be able to somehow catch this behavior. Also even when Firefox for example has warning that user is going to shut down his tabs - simple clicking the checkbox will remove it all again. So is it possible to keep track of this action to prevent user accidentally closing browser and lost all the work? Or is it even possible to do for example in Chrome? The solution would be simple warning window but it needs to show basically everytime if closing while our web application is alive. We don't want to keep session alive after closing browser for obvious security reasons. Also - it should work at Chrome, IE and Firefox. Thank you for your help.
you can try the below code:
window.onbeforeunload = function()
{
return "Are you sure you want to exit";
}
If your front end is using MVVM such as AngularJS or Knockout, or any of the other popular binding libraries, consider a different approach to preventing the user from quitting the page.
In a client-side interval, serialize your view model and store it in local storage.
When the save/exit condition for the current page is met, clear the local storage.
If the page is loaded again, and there is something in local storage, this means that on the previous session, the browser was closed before saving - so deserialize the local storage object back into the viewmodel (use a unique key per page) - you can combine this with some UI that tells the user that their previous state has been restored, click ok to continue or start over to start again (which would reset the viewmodel)
I should add that you'll have to watch out for multiple simultaneous tabs, so you may want to work around this by making the key unique somehow, e.g. creating two invoices simultaneously.
This essentially provides an auto-save but client-side only.
You can combine this technique with using window.onBeforeUnload as per Tejinder's answer, but as you cannot style the "unload confirmation" prompt, providing an auto-resume is a much better experience.

No action method is hit after certain amount of tabs are open in Chrome and Firefox

Is there a limit on number of open tabs for an ASP.NET MVC application to be able to make another request? Why I'm asking this is because, I make some requests in a blank target and after having 5 open tabs, I am not able to invoke any action method unless I close one of those 5. To make sure it's not related to anything that deals with database stuff, I put a breakpoint to the first line of the desired action method. The first 5 requests go super fast. But the sixth one.. The breakpoint doesn't hit on the sixth request. It's only after I close any of the previously opened tabs that the breakpoint hits immediately.
To be honest, I'm not sure if this is even related to ASP.NET MVC, because I have this problem in Chrome and Firefox. With IE10, there's no such problem. Do you have any idea what the problem is?
I'm both glad and sad to have found the reason behind this weird behavior. I use SignalR for realtime notifications. As browsers have maximum number of concurrent connections, which is something around 6, I am not able to open an additional tab that has SignalR connection started. So this is a browser limitation. There are workarounds though. One of them is adopting subdomain approach like facebook does.
Another one is limiting the number of open connections as described in this blogpost

what are the reasons to have a waiting time before redirecting a page?

Quite some pages around the web have a waiting time period before redirecting you to the "correct" url.
Sometimes, they are downloading pages that make you wait a few seconds before the download starts, other times, they are simple redirects for when urls have changed for whatever reason, etc.
In most cases they also provide a direct link to the destination url, and mention "if your page doesn't reload automatically, click this link" (or something like that).
My question is, What is the reason of waiting? Why not to simply redirect immediately? what are the "benefits" of waiting?
The only reason i can think of is when the page has moved, and you notify the user so they, for instance, may change they bookmarks or something.
But in most other cases, the user just don't want to wait and doesn't care. So if they already provide the direct link anyway, (so the user can click it ASAP), why not to simply redirect immediately, and make it 'transparent' to the user?
So what are the real reasons to wait for redirects? and in which cases they apply?
If there's a noticeable delay, it usually means that JavaScript is being used.
As far as I know, there isn't any actual use for it. One difference however, is how search engines handle it. If it returns a 200 (OK) status code, the search engines may index it, if it has suitable content. HTTP redirects are never indexed (just their destinations).
For temporary flexible redirects (like I'm feeling lucky) the server should issue a 302 response.
If it's moved permanently, the server should respond with 301. This code also means that the browser should cache the redirection indefinitely, which works like updating a bookmark.

BroadCast Admin message to Each Session User

I have a requirement to inform every user to save their work and logout so that admin can reset iis or do some changes in the asp.net MVC application server.
looping through session object collection is not thread safe that is what i have learned.
any other ideas?
and even if i can get hold of active sessions how do i send a message to those clients ?
thanks in advance.
Save the message in a database and query the database for every request to see if a message exist.
This seems like a poorly-defined requirement.
Serious maintenance should be done at a specific time, and users should be alerted to that time window well in advance.
Simply restarting IIS is a pretty quick procedure... is there any reason users would lose their work when simply restarting IIS? While I've been filling out this StackOverflow answer, for instance, they could have restarted the server a dozen times. Once I hit Post, if the server is down, it'll either timeout and leave my work in the textarea, or else it will connect successfully if the server is back in time.
If I'm not submitting data, but just clicking a link, the same applies: either the browser times out, in which case a simple refresh is enough once the server is back up, or it eventually takes the user where they want to go.
If you're doing pure AJAX requests you will need to handle a missing server yourself, rather than relying on the browser to do it, but you'd need to work that out anyway because of the Eight Fallacies of Distributed Computing #1: "The network is reliable." (see http://en.wikipedia.org/wiki/Fallacies_of_Distributed_Computing)
So, I'd actually push back on that requirement. They're asking you to do something that won't really meet the need (users don't lose data, have a reasonably good experience), that will become complicated, and that will be a brittle solution in the end.
Sounds like a case for SignalR!
https://github.com/SignalR/SignalR

Loading page while rails app starts?

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.

Resources