The Smooth Motion: Case Study in Algorithmic Solving

Slides:



Advertisements
Similar presentations
Chapter 3 – Web Design Tables & Page Layout
Advertisements

Chapter 3 – Designing your web pages Dr. Stephanos Mavromoustakos.
UNIT 12 LO4 BE ABLE TO CREATE WEBSITES Cambridge Technicals.
6 Developing Content and Layout Section 6.1 Generate and organize content ideas Write and organize Web text Section 6.2 Identify page dimension guidelines.
Web Site Development Test 2 Working in DreamWeaver.
Chapter 6 Photoshop and ImageReady: Part II The Web Warrior Guide to Web Design Technologies.
Chapter 4 Marking Up With Html: A Hypertext Markup Language Primer.
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
Web-based Application Development Lecture 9 February 7, 2006 Anita Raja.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
Copyright © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley.
Creating Tables in a Web Site Using an External Style Sheet
Website design Feng Zhao College of Educatioin California State University, Northridge.
Chapter 4 Dreamweaver: Part II The Web Warrior Guide to Web Design Technologies.
Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Website Development with Dreamweaver.
HTML Comprehensive Concepts and Techniques Second Edition Project 3 Creating Tables in a Web Site.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 16: Java Applets & AWT Fundamentals of Web Programming.
Tutorial 4: Using CSS for Page Layout. 2 Objectives Session 4.1 Explore CSS layout Compare types of floating layouts Examine code for CSS layouts View.
Microsoft Visual Basic 2012 Using Procedures and Exception Handling CHAPTER SEVEN.
Web Technologies Website Development Trade & Industrial Education
The Bean Counter: A JavaScript Program
Learning Objectives Use the Bean Counter application as a model to do the following: Write input elements Create a button table Write an event handler.
Committed to Shaping the Next Generation of IT Experts. Exploring Microsoft Office Word 2007 Chapter 3: Enhancing a Document Robert Grauer, Keith Mulbery,
Website Development with Dreamweaver
Announcements Assignment 9 is due Project 2 is due 7/27/04 We will be skipping chapter 22 Test 3 (chapters 18-21) will be on 7/29/04 Tip of the Day : Functions.
Chapter 12 FRAMES. HOW FRAMES WORK When you view a framed page in a browser, you are actually looking at several HTML documents at once. The key to making.
1 Lesson 3 Power Techniques HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
MICROSOFT WORD 2007 INTERMEDIATE/ADVANCED. CREATE A NEW STYLE BASED ON A SELECTED TEXT HOME tab > STYLES group dialog launcher > at the bottom of the.
CSCE 102 – Chapter 6 (Web Design and Layout) CSCE General Applications Programming Benito Mendoza Benito Mendoza 1 By Benito Mendoza.
Chapter 18 A JavaScript Program. Learning Objectives Use the Bean Counter application as a model to do the following: –Write input elements –Create a.
IT: Web Technologies: Web Animation 1 Copyright © Texas Education Agency, All rights reserved. 1 Web Technologies Designing Web Site Layout Using.
Use CSS to Implement a Reusable Design Selecting a Dreamweaver CSS Starter Layout is the easiest way to create a page with a CSS layout You can access.
HTML ( HYPER TEXT MARK UP LANGUAGE ). What is HTML HTML describes the content and format of web pages using tags. Ex. Title Tag: A title It’s the job.
Committed to Shaping the Next Generation of IT Experts. Exploring Microsoft Office Word 2007 Chapter 3: Enhancing a Document Robert Grauer, Keith Mulbery,
Chapter 22 The Smooth Motion: Case Study in Algorithmic Solving.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Fluency with Information Technology Third Edition by Lawrence Snyder Chapter.
Learning Objectives State and apply the Decomposition Principle
Tutorial 7 Creating Animations. XP Objectives Learn about animation Create a timeline Add AP divs and graphics to a timeline Move and resize animation.
1 Creating Links Lesson 2. 2 In the center column type : Home | Order Now | Contact Us This is the navigation button which will link to the other pages.
What is HTML? HTML is a language for describing web pages. HTML stands for Hyper Text Markup Language HTML is not a programming language, it is a markup.
Positioning Objects with CSS and Tables
Microsoft Expression Web 3 Chapter 6 Adding Interactivity.
Committed to Shaping the Next Generation of IT Experts. Exploring Microsoft Office Word 2007 Chapter 3: Enhancing a Document Robert Grauer, Keith Mulbery,
Internet & World Wide Web How to Program, 5/e.  JavaScript events  allow scripts to respond to user interactions and modify the page accordingly  Events.
MODULE SIX WORKING WITH CHARTS AND IMAGES Functional ICT.
XP New Perspectives on Microsoft Office FrontPage 2003 Tutorial 5 1 Microsoft Office FrontPage 2003 Tutorial 5 – Creating Tables and Frames.
Chapter 18 A JavaScript Program. Learning Objectives Use the Bean Counter application as a model to do the following: –Write input elements –Create a.
Fluency with Information Technology
Marking Up with XHTML Tags describe how a web page should look
Applying CSS to Tables Stylish Tables.
Microsoft® Office FrontPage® 2003 Training
Programming the Web using XHTML and JavaScript
Using Procedures and Exception Handling
Chapter 14 Graphs and Paths.
Exercise 39 - Skills A table on your Web page provides one of the best ways to organize and align graphics, text and other objects on the page. You can.
Tutorial 6 Creating Dynamic Pages
Marking Up with XHTML Tags describe how a web page should look
Marking Up with XHTML Tags describe how a web page should look
Chapter 20 Hash Tables.
Information System Analysis
Marking Up with XHTML Tags describe how a web page should look
Using FrontPage Express
Marking Up with XHTML Tags describe how a web page should look
Introduction: Some Representative Problems
A drag and drop exercise can be created using Word quite easily using tables, text boxes and ensuring the document is saved properly.
Chapter 6 Dynamic Programming.
Chapter 2 Reference Types.
Chapter 4 Greedy Algorithms.
Marking Up with XHTML Tags describe how a web page should look
Presentation transcript:

The Smooth Motion: Case Study in Algorithmic Solving Chapter 22 The Smooth Motion: Case Study in Algorithmic Solving

Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Planning Smooth Motion Apply the Decomposition Principle Divide a large task into smaller subtasks that can be solved separately and then combine their solutions to produce the overall solution Principle can be applied again to each subtask, if necessary Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Planning Smooth Motion (cont'd) Carol Schwartz: Can we insert the table that appears as part of the text on page 637? Planning Smooth Motion (cont'd) Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Planning Smooth Motion (cont'd) Decide on a Problem-Solving Strategy Strategy on how to solve each part Order in which we'll solve parts Build a basic web page first Don't spend time embellishing page until other tasks are done Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Planning Smooth Motion (cont'd) Solve Independent Tasks before Dependent Tasks Some tasks rely on other tasks Independent tasks should be done first Tasks that depend on the independent tasks are done next, and so on PERT Chart Task dependency graph Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Build the Basic Web Page GUI Full GUI has table with heading, grid, keys, controls, instructions Basic structural page: Table Heading Instructions Background color, font style and color Centering of application on page Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Build the Basic Web Page GUI (cont'd) The Structural Page Five-row, one-column table Text for the Smooth Motion heading and Instructions in first and last rows The Structural Page Heading <h1> heading for heading, paragraph tag for instructions (set font color for instructions text) Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Animate the Grid Recall three basic steps of animation: Define and place initial image Prefetch frames for updating image Set timer and build timer event handler to update image Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Animate the Grid (cont'd) Frames for the Columns of Blocks Design and organize the column frames Indexing Columns from Left to Right On each time step, given column is replaced by column to its right If columns are indexed left to right, index in column i of grid at a given step is replaced on next time step by image in column i + 1 The last column needs to have a new image assigned Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Animate the Grid (cont'd) Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Animate the Grid (cont'd) Second Analysis Define and organize the eight columnar frames Define and fetch the initial images (0-19) Prefetch the eight frames for uploading the image Set a timer with an event handler that shifts the images in columns 1 through 19 to columns 0 through 18, and assign new frame into column 19 Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Animate the Grid (cont'd) Subtask: Define and Organize the Frames Guidelines for creating frame images Ensure all images overwriting one another have the same dimensions in pixels Ensure all frames are saved in .gif or .jpeg format, and that they are used consistently (only overwrite .gifs with .gifs) Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Animate the Grid (cont'd) Subtask: Define and Place Initial Images Use <img src> tag to place initial image on page Use a loop to complete image initialization of 20 images Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Animate the Grid (cont'd) Subtask: Prefetch the Frame Images Declare the array into which the images will be fetched Initialize the array elements to be image objects Assign the names of the files to the src fields of the image objects, causing browser to record the names and get the files Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Animate the Grid (cont'd) Subtask: Set Timer and Build Timer Event Handler Event handler animate() has three operations: To move all images but the first, one position to the left To assign a new frame to column 19 To schedule itself for sometime in the future Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

The Best Laid Plans… We find it cumbersome not to be able to start and stop animation on demand Build control task is scheduled for later Makes more sense to solve it now, to simplify our work Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Build Controls What should happen when the control is clicked? Go button click-event Start animation with setTimeout(), keeping track of the handle Stop button click-event End animation by clearing the timer using the handle Radio button click-event Set the timer interval by assigning to duration Place this code in the fourth row of the structural page table Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Sense the Keys Ability to recognize when mouse hovers over a given key We need to learn about mouse motion detection Browser with OS keeps track of where mouse is at any given time MouseOver and MouseClick events recognized in JavaScript Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Sense the Keys (cont'd) Subtask: Define and Organize the Frames Subtask: Place the Initial Images Placing the images creates the keys Place seven images in center of third row of the structural table using a loop Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Sense the Keys (cont'd) Subtask: Prefetch the Frames Analogous to earlier animations Since there are only two frames to prefetch, it's not worth writing a loop Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Sense the Keys (cont'd) Subtask: Build the Event Handlers here() for MouseOver gone() for MouseOut What should happen when mouse moves over a key Key must change color to give user feedback Must tell Grid Animation event handler which new Stack image to draw in the last position in the grid Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Sense the Keys (cont'd) Combine the Subtasks Add the event handler specifications to the <img src> tags Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Staircase Detection Subtask: Recognizing the Staircase How do we recognize the seven consecutive frame values? Keep predicting the next frame value Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Staircase Detection (cont'd) Subtask: Recognizing Continuity Modifiy the animate() function at the point where it is about to set the timer for the next tick If the staircase is found, there should be no next tick Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Assemble Overall Design Build Controls task was performed out of order Parts of Assemble Overall Design task performed ahead of time There is not much left to complete the programming Make sure the whole application runs as planned Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Primp the Design Make structural page more attractive Table background color Cell padding Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Assessment and Retrospective Three primary topics from earlier chapters used in this design: Loops Parameterizing functions for reuse Managing complexity with functions Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Copyright © 2006 Pearson Addison-Wesley. All rights reserved.

Copyright © 2006 Pearson Addison-Wesley. All rights reserved.