can i see real time javascript events like ajax calls in firebug? - c#

So when I do an ajax POST I can see the thing firing in firebug, I can see the spinning icon as it's running, a finished icon when it's done. I can see results or errors and whatnot, you all know the deal.
Is there a way to get it to show me every javascript event as it fires? So if I have something like this in my windows onload:
defaultJs.LoadImages();
defaultJs.CheckAccount(username);
vendorsJs.UpdateSearch();
I would ideally see each of those happening, or be able to step through them similar to how you would step through CS files while you're attached to the WWW process with F10 and F11 and all that.
My problem is how long it takes tracking through another person's code when I'm tasked with finishing the work of another developer that's been moved to another project. I basically have to do what I described manually reading the code, or set up a ton of console.logs to try and force this sort of information into something I can read.
I'm hoping firebug has some feature I haven't enabled, or there's a program like fiddler (where you see things loading realtime) that'll do it for me.
Sorry if this is a repeat question, I wasn't able to find an answer that worked for me after some searching. I appreciate any time anyone commits to helping me out here. Have a good day yall.

you can debug the JS code using FireBug
http://getfirebug.com/javascript

Related

ASP.Net / C# 4.5 -- Async Processing -- Async Await

I am looking for some direction on what is the best route I should go with this. I have posted a few times, going off of some recommended design patterns. I have not really received a good direction based on what I am trying to accomplish. I am new to working with Async Processing, and would appreciate some pointers in the right direction. So far, on one of my previous post I have been called ignorant because I requested code samples. Please understand I have been reading everything, and trying everything I can find on the internet. Needless to say there are a LOT of different directions I could go with this, and I am not sure which one is the best.
I will explain what I am trying to do, at a high level, and if anyone out there can PLEASE help me by pointing me in the right direction I would appreciate it. Also, if anyone can point me to some code samples, I would love that. I do not mind reading the material, but it makes a lot more sense if I can see code to follow along with what it is saying. Most of the documentation I have found has code samples, or partial code samples, and I have been doing my best to try to use what I have found to work with my specific need. So far, not much luck. I will admit, when it comes to ASYNC processing, I guess I am ignorant. :)
Anyway, here is what I am trying to accomplish. I am leaving out any specific technology that I may consider using to avoid the debate as to if what I am posting is out of date, or behind the times. I am looking for a point in the right direction, and I am open to whatever at this point. I just need to get this working.
Here is the basics of what I am needing to do
I have an ASP.Net Web Site "Project" that I am working with.
I have a screen that is used to print reports using Active Reports 7.
My task is to allow the user to click a "Print / Preview" button and fire off the report processing.
While the report is running, I need to give the user the ability to click a "Cancel" button and terminate the processing and return to the report screen. (So the UI needs to be responsive during this time the report is processing so the user can click on the cancel button.)
While the report is processing I need to display a popup message to indicate the report is running.
When the report finishes processing, I need to hide this popup message, to indicate to the user the report is completed. Then I need to open the report to be viewed by the user. Currently this is a javascript function that we prepare during the report processing code that opens a new window and calls the report viewer. (So after the report has completed I need the ability to call a javascript function.)
If anyone can kindly point me in the right direction I will be very thankful. I do not mind doing the leg work and reading a mountain of documentation. I just need to be able to know what I am looking at will provide me with the above functionality. Like I said earlier, ignorance or not, if I can get some sample working code (not asking anyone to code this for me, just some code I can step through and help to understand what is happening) it would help a lot.
Thanks you in advance for your time and consideration.
Since you want some operation to happen at the server side along with the UI responding and showing progress. Showing progress of the event. I would suggest using Signalr.Net.
http://signalr.net/
http://www.asp.net/signalr/overview/getting-started/tutorial-getting-started-with-signalr
This is a realtime web api and with this you can create a hub which has functions say "ProcessReport" and "cancelProcessing" you can call this from javascript while connection is open on click of the button and show the progress popup with a cancel button. Have a client event registered with the hub in js say "updatestatus" which can be called from the server to close the popup and eventually close the signalr connection, once the operation is finished. And similarly in the popup cancel click you can again call the hub function cancelProcessing and perform your cancellation and call back with updateStatus.
Hope this helps.

C# Application Restart does not call program Main()

I've already wrote an application that works user base. I was looking for the best way to use for current user logging-out. So I've used Application.Restart();
Soon I found that the code doesn't work properly and Program.Main() doesn't call back again.
I wondered that my Login form Load Method is not going to perform (The Login Form is calling from program class).
So I'll really thankful if you let me know about my bugs and correct solutions.
http://msdn.microsoft.com/en-us/library/system.windows.forms.application.restart.aspx
Comment listed "Bug in VS2010 SP1"
after calling this method, the application no longer run in debug mode, it's not spawned by the IDE and all breakpoints stop functioning.
EDIT:
This is where something like log4net can really be helpful. It's a very simple library to add to your project and would let you write out debug information to a file so, even though the next instance wasn't spawned by the IDE and wont get breakpoints, you could still do some verification that it's hitting what you expect through the use of Debug traces. Just a suggestion...
A new process gets created, and it's not spawned by the IDE.
A breakpoint is not a valid way to test if Main is entered again.
See somewhat related post:
Does Application.Restart() creates new process for application or no?
If you'd like, you could write to a file or some other simple test in Main just to prove to yourself that it is entered.
Microsoft recently released a solution that allows debugging to continue after Application.Restart(), in the form of a Power Tool:
Child Process Debugging Power Tool
Blog Post
Download in VS Gallery

Postdata confirmation box bypass?

Ik working on some project, and there is one main problem I have. I'm writing some code that is performing some actions on the web, like posting data. But what happens all the time: Javascript code on the pages reload the page, just after i posted data, so it will ask for confirmation. I just need to know, is there any way at all to do this? I'm using C# with WatIn. I've thought of some ways myself:
Disabling all message boxes, doesn't seem to work for this box.
Detect when the box shows up and then press cancel, but I don't know if that's possible?
Look in the Javascript code and when it tries to call the Reload method intercept that or something?
Some other setting that disables this auto-reload? (tried some thing called METAreload i think but didn't work)
Google doesn't give me the information I need, I have been searching on this for quite a while now. Someone knows how to get rid of this box blocking my program?
Ok, I finally fixed it myself. There was a javascript function that would make the page reload when the timer was at 0. Just by putting javascript in the URL bar i could replace that function bij an empty one, and now it won't reload anymore!

javascript key down problem

I have a key down event attached to one of my textboxes and over time and modifications/additions of 3rd party scripts the key down doesn't work any more. I've tried replacing key down with key up/key press but no luck.
How would you trouble shoot something like this (to me, it's like a needle in the haystack).
in your Javascript code where you handle the KeyDown event, add "debugger" before your code, and you'll be able to debug JavaScript.
function HandleKeyDown() {
debugger;
// rest of your code here
}
If you're using IE, then in Tools - Advanced, you must make sure that "disable script debugging" is not checked, or it won't stop at your debug point.
If you use Visual Studio 2010, there's a neat JavaScript debugger built in :)
To me the best approach to troubleshooting is start taking out everything is not necessary to make i work. In this case, start deleting all the 3rd party scripts and extra code one at a time, while you try if it works or not every time you delete something. Sooner or later you will find what part of the code is causing this, then you can worry about how to fix it.
It would help if you could post a link to your code.
There are a couple of ways you could do it. Is there a javascript error?
If there is no error to indicate a line of code that's bad, then I would eliminate the thrid party scripts so that your script works as intended. Then, add in the scripts one at a time, continuously checking to see if your keydown still works.
Once you know which script is messing with the keydown functionality you can then start using comments and alerts to isolate the issue in that third party script.

Receive a message FROM another process

I've been teaching myself how to use messages with Window's APIs, and have actually been doing very well learning them. Problem is, I can't figure out how to receive a message from another application to start code within mine.
Essentially, what I want to do is allow others using a commercial application to click the save button (on the commercial application), and have my application stop the save message, prompt the user, and from that either cancel the save to allow them to continue, or allow the save (which I know how to do now through messages).
I just need to know how to catch a message, and stop it. If anyone can point me to an API call, or function, or just documentation that may help, please do.
Check out Detours by Microsoft Research. It's possible, but not simple. Also, look into how client-side game cheats are performed. I will not link any of them here, but they are out there. That's essentially what you want to do.
I think you'll need to attach your own application to the running process the same way a debugger would... Unless the commercial application has a custom method of plugging into their architecture to do this.
The next question is... do you want to proceed down this path.

Categories