SlideServe
Menu
Préférences
© SlideServe · v2026

Debugging and Ajax

alela avatar
15 diapositives · 183 Views · Jan 02, 2020

This session covers strategies for debugging web-enabled databases, focusing on debugging syntax errors, run-time exceptions, and logic errors. It also explores the use of Ajax in web applications.

Debugging and Ajax - slide 1
01 / 15Debugging and Ajax
1 / 17

Télécharger la présentation

Debugging and Ajax
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  1. Debugging and Ajax Session 7 INFM 718N Web-Enabled Databases

  2. Agenda • Debugging • Teams • Ajax

  3. (PC) Interface Design (IE, Firefox) Client-side Programming (JavaScript) Interaction Design Interchange Language (HTML, XML) Server-side Programming (PHP) Business rules (MySQL) (PC, Unix) • Relational normalization • Structured programming • Software patterns • Object-oriented design • Functional decomposition Client Hardware Web Browser Database Server Hardware

  4. Types of Errors • Syntax errors • Detected at compile time • Run time exceptions • Cause system-detected failures at run time • Logic errors • Cause unanticipated behavior (detected by you!) • Design errors • Fail to meet the need (detected by stakeholders)

  5. Debugging Syntax Errors • Focus on the first error message • Fix one thing at a time • The line number is where it was detected • It may have been caused much earlier • Understand the cause of “warnings” • They may give a clue about later errors • If all else fails, comment out large code regions • If it compiles, the error is in the commented part

  6. Run Time Exceptions • Occur when you try to do the impossible • Use a null variable, divide by zero, … • The cause is almost never where the error is • Why is the variable null? • Exceptions often indicate a logic error • Find why it happened, not just a quick fix!

  7. Debugging Run-Time Exceptions • Run the program to get a stack trace • Where was this function called from? • Print variable values before the failure • Reason backwards to find the cause • Why do they have these values? • If necessary, print some values further back

  8. Logic Errors • Evidenced by inappropriate behavior • Can’t be automatically detected • “Inappropriate” is subjective • Sometimes very hard to detect • Sometimes dependent on user behavior • Sometimes (apparently) random • Cause can be hard to pin down

  9. Debugging Logic Errors • First, look where the bad data was created • If that fails, print variables at key locations • if (DEBUG) echo “\$foobar = $foobar”; • Examine output for unexpected patterns • Once found, proceed as for run time errors • define (“DEBUG”, FALSE); to clean the output

  10. Ajax Applications • Google Maps • http://maps.google.com • Google Suggest • http://www.google.com/webhp?complete=1&hl=en • Sajax Tables • http://labs.revision10.com/?p=5 • Sajax • http://www.modernmethod.com/sajax/

  11. Sajax Example <? require("Sajax.php"); function multiply($x, $y) { return $x * $y; } sajax_init(); // $sajax_debug_mode = 1; sajax_export("multiply"); sajax_handle_client_request(); ?>

  12. <html><head> <title>Multiplier</title> <script> <? sajax_show_javascript(); ?> function do_multiply_cb(z) { document.getElementById("z").value = z; } function do_multiply() { // get the folder name var x, y; x = document.getElementById("x").value; y = document.getElementById("y").value; x_multiply(x, y, do_multiply_cb); } </script> </head> <body> <input type="text" name="x" id="x" value="2" size="3"> * <input type="text" name="y" id="y" value="3" size="3"> = <input type="text" name="z" id="z" value="" size="3"> <input type="button" name="check" value="Calculate" onclick="do_multiply(); return false;"> </body></html>

  13. Syntax How layout helps reading How variables are named How strings are used How forms are used How output is created MySQL Integration Opening a database Handling slashes Posing queries Using result sets Structured Programming How things are nested How arrays are used Modular Programming Functional decomposition How functions are invoked How arguments work How scope is managed How errors are handled How results are passed Code Walkthrough