How to produce a XHR log silently with Chrome - debugging

I would like to spot a "random" bug on a site. In order to do that I would like to have all the XHR requests saved in a log file, which is a very easy thing. The problem is that I'm not the user, so I have to set up someone else's machine to do that.
The problem is that the user doesn't know how to use the "developer tools" so I would like to have a tools that keep trace of everything without bothering the user. Bear in mind that this bug can occur once in a day and during this time the user can close the browser and re-open it. Do you have any suggestion? thanks!

I think that the best way would be to make the logs from within the site that you're trying to observe.
If you don't have access to it, another solution might be to find/develop a browser extension that logs any xhr to a local file.

Related

CodeIgniter Blank Page

n00b here. After searching the forums I have not yet come across this problem as I am experiencing it.
I have a CI site that was working correctly until about three days ago. My problem is as follows:
On button click - Page Loads correctly.
On Enter press - CI Blank Page of Death loads.
For example: When I login, after the login process has run it must reroute me to the Dashboard, unless I still have a temporary password where I get rerouted to the "Change Password" screen first and then to the Dashboard.
AS LONG AS I USE THE BUTTONS AND CLICK THEM EVERYTHING WORKS.
On ENTER PRESS, I get the Blank Screen of Death.
However, on TAB to BUTTON and then ENTER it works.
The problem is not consistent however. I have some processes that do not have views attached and NONE of them will run - hit ENTER and get blank. They are all failing on ENTER PRESS.
I am slowly going off my trolley. Logging is ON, Directories for cache and logs are 775. NOTHING is showing in my logs...
First Try to active error handlers for displaying of errors for addittional info to post here what error is occuring..
// change settings for error handler to show errors
// $this setup is used for checking errors for development to be shown....
ini_set('display_errors', 1);
error_reporting(E_ALL);
by the way if your using CI version 2 higher
you can see it in its index.php file an configuration for displaying error also.
define('ENVIRONMENT', 'development'); //just set up environtment to development
Even though there are accepted answers I wanted to add a way that worked for me to figure out this problem.
Usually the "Blank Page" indicates a PHP parsing error somewhere in the code. Strange thing for me was that on my local MAMP based test server the code ran fine. I FTP it to my hosted server and all of a sudden, blank page of death.
Even though I had errors on, log errors on, display errors on, nothing appears in any log file.
I was able to find the error by a funny little trick. I added an echo line in CodeIgniter.php in the system/core. Obviously hacking the core was not a great idea but all I wanted to do was to see how far it was getting in the load process.
When my echo appeared after trying to load a page on the remote hosted server it also displayed the parsing problem in a derived controller! Not sure why the error did not come out without the "echo" added. But adding it seemed to trigger some output to be generated, IE my echo line and the PHP parse error was appended.
Not sure if this will help anyone but it turned out to be a nice easy way to find the error which only showed on the remote server.
Obviously, don't forget to put your core file back to its original state without the echo.
This was fixed by copying the application into a fresh CI 2.3 install.
I have no idea what actually caused this "erratic" behaviour.
The application worked correctly as designed whenever a BUTTON was CLICKED but gave the blank death screen when ENTER was PRESSED.
This inconsistent behaviour is what threw me. The fact that my logs (CI and APACHE) also showed nothing was also very strange. Had this been a parse error, surely the behaviour on "Click" and on "Enter Press" should have been the same.
My non-view controllers for various ad-hoc admin jobs are now also working correctly, which they were not before, as they use "Enter Press" (having no buttons to "Click").
I am still going to invite best guesses as to why this behaviour occurred the way it did.
Surely someone out there (Phil Sturgeon et al) with extensive CI experience has encountered this non-consistent blank screen behaviour and knows what caused it.
Thank you to all the people who took the time and effort to assist me!!!
Big UP!!! StackOverflow!!!
probably error in INCLUDE login.php
My problem was Apache stop working because of ...Skype! Skype actually work on the same 443 and Apache didn't start! I hate this Skype! Bring me nuts for a while.
Installing php5-pgsql worked for me

Trouble on localhost: Must update page many times

I'm currently making a webpage and running it locally on localhost for testing. But whenever I make a change to that page and want to see the result in the browser I run into a "problem". I have to update (press F5 or the update button in the browser) several times for the site to show. In the meantime it's just white...
Let's say I have the site up in my browser (looking good), and then I make a change and want to see it. I press the update button in my browser one time and the site is now just white. I press it again and again, but it stays white. Until I press it a random number of times, and it works. Sometimes I just have to update once, and sometimes I have to update 7-8 times. Sometimes it's fast as hell, and other times it's slow as my schools computers.
Does anyone know if there might be a problem with the site itself (and this problem will continue to exist, even after I upload it to the server), or if it's just a problem with my internet/ computer/ known problem when running on localhost?
I'm using XAMPP on a Mac and have tried testing the page in both Safari and Chrome.
Thanks for all the tips in advance!
From Europe with a problem,
Alekplay
EDIT 1:
It turns out Chrome decided to give me an error message instead of a white screen now. It says "no data received", and Safari is still just blank. Any ideas? I've tried turning off caching.
EDIT 2:
Did some tweaking here and there, and found out that it's SimpePies autoloader.php that's causing my problems. Any of you have any knowledge around SimplePie, and know how I can make the site load faster? It's fine when I've commented out require_once('php/autoloader.php');, but I need that for my feeds to load. Any ideas?
Into chrome you can turn caching off. Just take a look to this page :
http://geek.michaelgrace.org/2011/09/disable-google-chrome-cache/
With Chrome: CTRL+SHIFT+R
I don't know about Safari.
That may be something related with the cache or with apache itself.
Find out if you have any error on apache's error.log. It might be related to an error similar to this one:
AH00052: child pid 62969 exit signal Segmentation fault (11)
then you should check: "[notice] child pid XXXX exit signal Segmentation fault (11)" in apache error.log
Basically it states to try to increase output_buffering in your php.ini
You would have to run a backtrace on the coredump to know why it crashed, as indicated elsewhere. In mi case it was APC, and the error went away as soon as it was disabled on php.ini. Yours might be because some other cause.

Can an standalone / external C++ executable or JavaScript create cookies for Firefox?

I need to create/update/remove cookie for FireFox browser. This cookie is a client cookie, as in it has to be created by C++ executable and it will be present on the end user machine.
How can I achieve this?
Thank you
You basically have two options:
You attempt to manipulate Firefox data (file cookies.sqlite) directly. It's a fairly simple SQLite database so there is nothing complicated about that. However, catch 1: this cannot be done while Firefox is running. Also, catch 2: the format might change in future (as happened before) and your application will stop working or, worse, break the file.
You do it from inside Firefox. For example, you would write a bootstrapped extension that would use nsICookieManager2 interface to add the cookie and then Add-on Manager API to uninstall itself immediately after that. Then your application would only have to run Firefox with the command line firefox -url file:///path/to/extension.xpi (works even if Firefox is already running). The catch here: the user would need to confirm extension installation. So you cannot do it behind his back, you need to explain what is happening and why.

Any way to find out what my shared hosting "lag" is?

I have shared hosting with hostgator and until about a month ago, things were dandy. Now.. every 2 to 3 minutes, I'll click a link and the browser won't resolve for about a full minute. This is any of my sites.. and links that are both database calls or very simply html hyperlinks. It's with any browser and at work or home.
I've opened 2 tickets with hostgator and they swear all their tests show that there are no problems, but.. I get this over and over and over again.. and have for weeks now.
Is there any kind of error outputting I could do.. or tools of any kind that would allow me to troubleshoot this myself?
Not sure about other browsers, but Google Chrome has a tool to measure the time a website took to load. Click the wrench icon in the top right, then go to Tools -> Developer Tools. Then you will see a new section at the bottom of the screen. Click the Network tab and it will show you a lot of data about the latency etc. It will also show you which file is the one that is taking the longest. Hope this helps.
From a console on the server itself, use the wget command to pull a page. Do it periodically in a script, logging to a file. Put it in cron. That'll show you if there are any lag issues with the server itself. If that looks good, then it's somewhere in the network. You could do a similar test from another box on another provider, which if comes up clean, points to your ISP or DNS as the culprit.

Firefox extension: Handle file save dialogs

Some of the webpages I visit have stubborn save file dialogs for executables. I would like to do one of the following using an extension:
Save the file by default and close the dialog box. I looked at http://kb.mozillazine.org/File_types_and_download_actions It doesn't really work for these files (the problem is described at: http://kb.mozillazine.org/File_types_and_download_actions under 'Unable to set automatic action. I verified the headers.)
I guess I can use browser.download.manager.closeWhenDone from https:// developer.mozilla.org/en/Download_Manager_preferences , if I figure out the first part :)
Suppress the download manager from showing any such dialogs altogether.
I found https:// developer.mozilla.org/en/nsIDownloadManager#addListener() and https:// developer.mozilla.org/en/Download_Manager_improvements_in_Firefox_3 that look promising. I don't really know how to extract the source URI for the transfer either. I'm curious if anyone has any existing examples for using these or if there's a better way to do this. Or if someone knows what part of Firefox's code I could poke, that would be useful too.
Thanks!
PS: Sorry,I had to break the hyper-links above with an unnecessary space after https:// - apparently I need 10 reputation to do that :)
FWIW, I managed to work around this - though my solution probably wont work for most others.
Fortunately I'm behind a proxy I control, so I just corrected the obnoxious headers (Content-Disposition and Content-Type) before they reached Firefox. These were forcing Firefox to open the File Save Dialog box despite my specified preference to 'Always save file of this type'. Furthermore, I set 'browser.download.manager.closeWhenDone' property to True. Works for me, and I cruise through such sites w.o being interrupted.

Resources