Debugging and Ajax Session 7 INFM 718N Web-Enabled Databases.

Slides:



Advertisements
Similar presentations
Chapter 5 Errors Bjarne Stroustrup
Advertisements

Error HandlingPHPMay-2007 : [#] PHP Error Handling.
PHP Week 11 INFM 603. Thinking About PHP Local vs. Web-server-based display HTML as an indirect display mechanism “View Source” for debugging –But not.
Nov 10, Fall 2006IAT 8001 Debugging. Nov 10, Fall 2006IAT 8002 How do I know my program is broken?  Compiler Errors –easy to fix!  Runtime Exceptions.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
LBSC 690 Session #10 Programming, JavaScript Jimmy Lin The iSchool University of Maryland Wednesday, November 5, 2008 This work is licensed under a Creative.
Exceptions in Java Fawzi Emad Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Introduction to PHP. PHP Origins Rasmus LerdorfRasmus Lerdorf (born Greenland, ed Canada) PHP originally abbreviation for ‘Personal Home Pages’, now ‘PHP.
Apache Tomcat Server – installation & use Server-side language-- use Java Server Pages Contrast Client-side languages HTML Forms Servers & Server-side.
Tutorial 10 Programming with JavaScript
Database Design and MySQL
MySQL and PHP Integration Session 6 INFM 718N Web-Enabled Databases.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
PHP Programming Session 2 INFM 718N Web-Enabled Databases.
Java Review 2 – Errors, Exceptions, Debugging Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Week 1 INFM 718N Web-Enabled Databases The Big Picture.
PHP Programming Part II and Database Design Session 3 INFM 718N Web-Enabled Databases.
Fall 2007CS 225 Program Correctness and Efficiency Chapter 2.
XML + Ajax Week 13 INFM 603.
WHAT IS PHP PHP is an HTML-embedded scripting language primarily used for dynamic Web applications.
CSCI 5801: Software Engineering
Computer Programming and Basic Software Engineering 4. Basic Software Engineering 1 Writing a Good Program 4. Basic Software Engineering.
Introduction To PHP 20 * Introducing the basics of programming * Discovering variables, loops, arrays and conditions * Integrating HTML and PHP Stations.
INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, October 18, 2012 Session 7: PHP.
Content Management Systems Week 5 LBSC 690 Information Technology.
Testing. What is Testing? Definition: exercising a program under controlled conditions and verifying the results Purpose is to detect program defects.
Databases and the Internet. Lecture Objectives Databases and the Internet Characteristics and Benefits of Internet Server-Side vs. Client-Side Special.
Designing For Testability. Incorporate design features that facilitate testing Include features to: –Support test automation at all levels (unit, integration,
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
Ajax and Ruby on Rails Session 9 INFM 603.
Lesson 19. JavaScript errors Since JavaScript is an interpreted language, syntax errors will usually cause the script to fail. Both browsers will provide.
JavaScript is a client-side scripting language. Programs run in the web browser on the client's computer. (PHP, in contrast, is a server-side scripting.
06/10/2015AJAX 1. 2 Introduction All material from AJAX – what is it? Traditional web pages and operation Examples of AJAX use Creating.
Content Management Systems Week 14 LBSC 671 Creating Information Infrastructures.
XP Tutorial 10New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Working with JavaScript Creating a Programmable Web Page for North Pole.
Tutorial 10 Programming with JavaScript. XP Objectives Learn the history of JavaScript Create a script element Understand basic JavaScript syntax Write.
Tutorial 10 Programming with JavaScript
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
DEBUGGING. BUG A software bug is an error, flaw, failure, or fault in a computer program or system that causes it to produce an incorrect or unexpected.
Testing and Debugging Session 9 LBSC 790 / INFM 718B Building the Human-Computer Interface.
Variables and ConstantstMyn1 Variables and Constants PHP stands for: ”PHP: Hypertext Preprocessor”, and it is a server-side programming language. Special.
Creating PHPs to Insert, Update, and Delete Data CS 320.
PHP Week 8 INFM 603. Agenda Questions PHP Drupal Project Plan.
CS 4720 Dynamic Web Applications CS 4720 – Web & Mobile Systems.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
1 Debugging and Syntax Errors in C++. 2 Debugging – a process of finding and fixing bugs (errors or mistakes) in a computer program.
David Lawrence 7/8/091Intro. to PHP -- David Lawrence.
Creating Databases for Web applications Server side vs client side PHP basics Homework: Get your own versions of sending working: both html and Flash!
1 Server versus Client-Side Programming Server-SideClient-Side.
School of Computer Science & Information Technology G6DICP - Lecture 6 Errors, bugs and debugging.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
5.01 Understand Different Types of Programming Errors
Chapter 8 Error Handling and Debugging. Debugging “When you get frustrated, step away from the computer!”
Exceptions Lecture 11 COMP 401, Fall /25/2014.
Text INTRODUCTION TO ASP.NET. InterComm Campaign Guidelines CONFIDENTIAL Simply Server side language Simplified page development model Modular, well-factored,
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
PHP (cont.). 2 Functions Definition – function name(arguments){... } –syntax name as for a variable, but without $ arguments as for variables –to return.
Dr. Abdullah Almutairi Spring PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used,
Introduction to Javascript. What is javascript?  The most popular web scripting language in the world  Used to produce rich thin client web applications.
PHP Overview. What is PHP Widely available scripting language Free Alternative to Microsoft’s ASP Runs on the Web Server; not in the browser Example:
COMPUTER PROGRAMMING I SUMMER Understand Different Types of Programming Errors.
JavaScript and AJAX 2nd Edition Tutorial 1 Programming with JavaScript.
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
PHP using MySQL Database for Web Development (part II)
5.01 Understand Different Types of Programming Errors
Testing and Debugging.
Content Management Systems
Topic: Functions – Part 2
5.01 Understand Different Types of Programming Errors
Presentation transcript:

Debugging and Ajax Session 7 INFM 718N Web-Enabled Databases

Agenda Debugging Teams Ajax

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

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)

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

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!

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

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

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

Ajax Applications Google Maps – Google Suggest – Sajax Tables – Sajax –

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

Multiplier <? 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); } * = <input type="button" name="check" value="Calculate" onclick="do_multiply(); return false;">

Code Walkthrough 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