Using Smart Tools to Write Good Code

Similar documents
Selenium Web Test Tool Training Using Ruby Language

OSSW ICOSST 2009, Al-Khawarizmi Institute of Computer Science University of Engineering and Technology, Lahore

Komodo IDE 4. Multi-platform, multi-language IDE for dynamic languages and Ajax technologies.

Unveiling Zend Studio 8.0

FIREFOX MENU REFERENCE This menu reference is available in a prettier format at

Koenig Solutions Pvt. Ltd. Selenium with C#

The course also includes an overview of some of the most popular frameworks that you will most likely encounter in your real work environments.

Css Pdf Reader Software For Windows 7 64 Bit

,

CSCI 201 Google Chrome DevTools

Insights Extension Development Survey. Professor Amrit Tiwana. Iowa State University College of Business Ames, Iowa , USA

Zend Studio has the reputation of being one of the most mature and powerful

What s New in Enterprise Jeff Simpson Sr. Systems Engineer

Google Chrome For Windows 7 32 Bit Latest Version 2015

OU EDUCATE TRAINING MANUAL

A network is a group of two or more computers that are connected to share resources and information.

Selenium IDE. Steve Kwon, Raphael Huang, Amad Hussain, Mubasil Shamim

HTML, XHTML, and CSS. Sixth Edition. Chapter 1. Introduction to HTML, XHTML, and

Slide 1 CS 170 Java Programming 1 Duration: 00:00:49 Advance mode: Auto

Detects Potential Problems. Customizable Data Columns. Support for International Characters

Comodo Chromium Secure Software Version 36.1

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

Web browsers - Firefox

Rapise Quick Start Guide An Introduction to Testing Web Applications with Rapise

Smart Browser: A framework for bringing intelligence into the browser

Programming the World Wide Web by Robert W. Sebesta

5/19/2015. Objectives. JavaScript, Sixth Edition. Understanding Syntax Errors. Introduction to Debugging. Handling Run-Time Errors

Planning and Designing Your Site p. 109 Design Concepts p. 116 Summary p. 118 Defining Your Site p. 119 The Files Panel p. 119 Accessing Your Remote

Working with WebNode

Installing VS Code. Instructions for the Window OS.

CS 268 Lab 6 Eclipse Test Server and JSPs

Download Beginning ASP.NET E-Commerce In C#: From Novice To Professional (Expert's Voice In.NET) PDF

Notepad++ The COMPSCI 101 Text Editor for Windows. What is a text editor? Install Python 3. Installing Notepad++

Telerik Test Studio. Web/Desktop Testing. Software Quality Assurance Telerik Software Academy

Developing Web Sites with Free Software

Css Pdf Editor Software For Windows Xp Full Version

Introduction. Key features and lab exercises to familiarize new users to the Visual environment

Client-side Debugging. Gary Bettencourt

Setting Up a Development Server

Contents. 1. Using Cherry 1.1 Getting started 1.2 Logging in

Using Development Tools to Examine Webpages

ispring Converter CLIPP Help Documentation

Dreamweaver is a full-featured Web application

CIW: JavaScript Specialist. Course Outline. CIW: JavaScript Specialist. 30 Dec

Instructor s Notes Web Data Management Web Client/Server Concepts. Web Data Management Web Client/Server Concepts

Zend Studio 3.0. Quick Start Guide

Chapter 1 Introduction to HTML, XHTML, and CSS

But before understanding the Selenium WebDriver concept, we need to know about the Selenium first.

Dreamweaver CS4. Introduction. References :

Oxygen Xsd From Xml File Visual Studio Generate Sample

PHP & MySQL In Easy Steps Ebooks Free

Chrome and IE comparisons

Javascript Validator Xml Schema Eclipse Plugin

Introduction. Thank you for picking up Silverlight 1.0 Unleashed! IN THIS CHAPTER. . Who Should Read This Book?. Software Requirements

Problem Installing Adobe Flash Player Mozilla Firefox Portable

powered by Series of Tubes Senator Ted Stevens talking about the Net Neutrality Bill Jul 17, powered by


ActiveNET Enterprise Solution Company

Table of Contents WWW. WWW history (2) WWW history (1) WWW history. Basic concepts. World Wide Web Aka The Internet. Client side.

CENG 256 Internet Programming Draft

Credits: Some of the slides are based on material adapted from

1. Adjusting Your Work Area

MAIN HEADING BOTTOM of Page TOP of Page Validate HTML code. Validate CSS3 code Accessibility Checker Portal Page Index Navigation

Table Of Contents. iii

User Guide Zend Studio for Eclipse V6.1

Designing for diverse devices. Dr. Andres Baravalle

Client Side JavaScript and AJAX

Javascript Coding Interview Questions And Answers In C++ Pdfs >>>CLICK HERE<<<

Visual Studio.NET. Although it is possible to program.net using only the command OVERVIEW OF VISUAL STUDIO.NET

1 Introduction. 2 Web Architecture

Zend Studio TM. User Guide: Zend Studio 5.2. By Zend Technologies, Inc. w w w. z e n d. c o m

A personal research assistant. Inside your browser.

Understanding Browsers

JAVASCRIPT - CREATING A TOC

Copyright 2018 MakeUseOf. All Rights Reserved.

With Dreamweaver CS4, Adobe has radically

chapter Gearing up to hack Mozilla Firefox is as simple as understanding Hacking Firefox Boot Camp COPYRIGHTED MATERIAL in this chapter

Flash Player Update Guide Windows 7 64 Bit Google Chrome

JavaScript Programming

VISION BASICS. Introduction (note materials updated for Vision 6.8.0)

Introduction to XML. Asst. Prof. Dr. Kanda Runapongsa Saikaew Dept. of Computer Engineering Khon Kaen University

University College of Southeast Norway ASP.NET. Web Programming. Hans-Petter Halvorsen,

Exploiting unknown browsers and objects. with the Hackability inspector

Govt. of Karnataka, Department of Technical Education Diploma in Computer Science & Engineering. Fifth Semester. Subject: Web Programming

Live Guide Co-browsing

Master Project Software Engineering: Team-based Development WS 2010/11

Skype for Business/Lync

Integration Test Plan

KEEPOD QUICK USER GUIDE

Workstation Configuration

Comodo Dragon Software Version 24.0

Introduction to XML 3/14/12. Introduction to XML

Independence Community College Independence, Kansas


Languages in WEB. E-Business Technologies. Summer Semester Submitted to. Prof. Dr. Eduard Heindl. Prepared by

1. Selenium Integrated Development Environment (IDE) 2. Selenium Remote Control (RC) 3. Web Driver 4. Selenium Grid

Improved Web Development using HTML-Kit

CSCI 201 Lab 1 Environment Setup

Screenshot By John Darrin

Learn Html And Css With W3schools

Transcription:

B Using Smart Tools to Write Good Code All software development methodologies, with no exception, do include at least one stage of testing of the code. This is because the code most programmers write, the authors of this book included, doesn't usually run perfectly from its first version. No matter what technology or platform you choose, you'll find many tools in the market that can help you test, debug, and test the performance of your application. In this appendix, we cover a few tools that can make your life easier when writing AJAX applications. Getting a Good Code Editor Having a good editor is the first step for increasing your coding efficiency. The list of code editors is endless, and each programmer seems to have his or her own preferences, so we can't make a definitive recommendation here. We suggest, however, that you take a look at the following: PSPad is a freeware editor that knows how to highlight the syntax for almost any existing file format. Additional plug-ins can add integrated CSS editing functionality and spell checking. This editor is available only for the Windows platform, and you can download it from http://www.pspad.com. SciTE is a free source-code editor based on the Scintilla source-code editing component (http://www.scintilla.org), and it is available for Intel Win32 and Linux-compatible operating systems with GTK+. You can see screenshots and download it at http://scintilla.sourceforge.net/scite.html. PHP Designer 2006 is a freeware PHP IDE with integrated debugger. Find more details about it at http://www.mpsoftware.dk. There are many, many more editors around, both free and commercial, and Google may help you find some better than these listed here. Once you know exactly what you're looking for, the solution will be a few mouse clicks away.

Using Smart Tools to Write Good Code Debugging Your Code While the most popular debugging method for JavaScript code is by displaying messages using alert, a number of better tools are available when more power is needed. The JavaScript Console available in many web browsers is perhaps the first tool you should get accustomed to. The JavaScript Console displays the errors and warnings found while running the JavaScript code in a web page. Access this feature in Firefox from the Tools JavaScript Console menu, in Opera by opening Tools Advanced JavaScript console, and in Mozilla you need to click Tools Web Development JavaScript Console. Other web browsers may have this feature too. Take note that the JavaScript Console has different behavior in each web browser, and that the console catches errors from all opened web pages. Figures B.1 and B.2 show the same error intercepted by the JavaScript Console in Firefox and Opera. Figure B.1: The JavaScript Console in Firefox 1.5 Figure B.2: The JavaScript Console in Opera 8.5

Appendix B The DOM Inspector is an important tool that shows the DOM of the loaded page. This feature comes by default with Mozilla (Tools Web Development DOM Inspector). The DOM Inspector is packaged with Firefox as well, but it isn't installed by default. When installing Firefox, choose Custom install (instead of the default Standard install), and check the Developer Tools checkbox when asked about additional components. Amongst the very useful features of the DOM Inspector are that it allows you to dissect a page that was dynamically generated on the client, and it highlights in the web page the nodes that you select in the inspector window. Figure B.3 shows the DOM Inspector in action, inspecting the AJAX Chat web application. Figure B.3: Inspecting the AJAX Chat with Firefox's DOM Inspector The Venkman Debugger is the heavy weaponry in your JavaScript debugger arsenal. It allows you effectively debug the JavaScript code, and it includes functionality that you could expect from a respectable debugger, such as setting breakpoints, allowing executing code in an interactive session window, reading local variable data, and proceeding line by line through the code. At the moment of writing, the Venkman Debugger is available for Firefox 1.0 and 1.5, and can be downloaded from http://www.mozilla.org/projects/venkman. Figure B.4 shows the Venkman Debugger in action, debugging the AJAX Chat application

Using Smart Tools to Write Good Code Figure B.4: Debugging AJAX Chat Using the Venkman Debugger The Venkman Debugger also has a code profiling option, which you can use to analyze how many times each JavaScript code executed, and how much time it took. You can start and stop the profiling engine by clicking the Profile button on the toolbar, or by selecting the Collect Profile Data entry in the Profile menu. Also in the Profile menu you can choose to Clear Profile Data (which you may want after performing changes in the code and needing new data), and Save Profile Data. When saving profile data, it will format the output depending on the file type you choose. The profiler collects data about all JavaScript events that happen in all open browser windows, so you will need to scroll down to get at the files and functions you're interested in. Figure B.5 shows sample output from the AJAX Whiteboard demo (Please refer to the Whiteboard ebook that you can find on the book' mini-site at http://ajaxphp.packtpub.com).

Appendix B Figure B.5: Profiling AJAX Whiteboard JavaScript debugging is possible with Internet Explorer as well, in which case you also need an external debugger. First you need to enable debugging, by un-checking Tools Internet Options Advanced Browsing Disable Script Debugging (Internet Explorer). After enabling debugging, you need a debugger tool. Visual Studio (see Figure B.6) is very powerful, and it supports, among many other features, debugging JavaScript code. Visual Web Developer 2005 Express Edition is freely available as a trial version, at http://msdn.microsoft.com/vstudio/express/vwd. You can also use Microsoft's Script Debugger (the download link is so long that's impossible to type, but you can easily search for the tool at http://www.microsoft.com/downloads).

Using Smart Tools to Write Good Code Figure B.6: Debugging AJAX Chat using Visual Web Developer 2005 Express Edition To debug the server-side PHP script, you can use one of the many PHP editors that support this feature. The most powerful IDE for PHP code editing and debugging is Zend Studio, which you can buy from http://www.zend.com. Other Useful Tools Web Developer Extension is a plug-in that works with Firefox, Flock, and Mozilla and includes many features for web developers. Figure B.7 shows one of Web Developer Extension's menus. You can download the Web Developer Extension from http://chrispederick.com/work/webdeveloper.

Appendix B Figure B.7: The Web Developer Extension contains Numerous Features HTML Validator is a Mozilla plug-in that validates your web pages for W3C compliance. You can download and install this plug-in from http://users.skynet.be/mgueury/mozilla. The validator displays a simple symbol in the browser's status bar showing if the page is valid, and if you double-click that symbol, a window such as the one in Figure B.8 appears to show the problematic lines.

Using Smart Tools to Write Good Code Figure B.8: Google Generates a Few Compliance Warnings Checky is another validator for Mozilla browsers, which unlike the HTML Validator, uses online resources to perform validation instead of doing it locally. However, it supports validation of a much wider selection of formats, including HTML, XHTML, CSS, RDF, RSS, XML, and many more. You can download this plug-in at http://checky.sourceforge.net. DevBoi (http://devboi.mozdev.org) adds a sidebar with documentation for HTML, CSS, DOM, and XUL (XML User Interface Language). You can chose to install the documentation locally, which occupies 4 MB, or let DevBoi fetch the data from online sources. After installing, the Ctrl + F9 shortcut (Tools Zhluk.com DevBoi in Firefox) will execute the program. The following figure shows the visual appearance of DevBoi:

Appendix B B.9: DevBoi Loaded the W3C Page for createattribute UrlParams (http://urlparams.blogwart.com) is a small plug-in that shows the POST and GET parameters of a web page. Once installed, you can make it show from View Sidebar UrlParams (Alt+U). You can find this plug-in useful for web development, although it can't be of much help for AJAX development because the POST/GET parameters you're interested in are passed in the background. Depending on your project at hand, you might want to have a look at other Firefox plug-ins, such as the XSD Schema Validator (http://xsdvalidator.mozdev.org), XPather (http://xpath.alephzarro.com), and XPath Checker (http://slesinsky.org/brian/code/ xpath_checker.html). Using the Tools Here are the very first steps for writing and debugging code efficiently: When your application doesn't work as expected, the first step to make is to open the JavaScript console. Quite frequently, you will find this window flooded with errors from other pages, so you might want to clear it and re-run the problematic code. If you suspect the problem is at the server side, then check the Apache error log file. This file is by default installed as Apache2/logs/error.log.

Using Smart Tools to Write Good Code Passing data using GET makes debugging easier, because it allows you to simply test the server scripts by calling them directly from the browser. This technique is demonstrated in some of the case studies. Showing debugging messages using alert in JavaScript, or echo and exit in PHP, will always be handy, no matter how many advanced debugging tools you have around. These are just a few basic suggestions, and I'm sure you'll find many more for your own projects, depending on the project complexity and your skill level.