Programming Week 5 LBSC 690 Information Technology.

Slides:



Advertisements
Similar presentations
Introducing JavaScript
Advertisements

INFM 603: Information Technology and Organizational Context Jimmy Lin The iSchool University of Maryland Thursday, September 19, 2013 Session 3: JavaScript.
Java Script Session1 INTRODUCTION.
Programming Week 9 LBSC 690 Information Technology.
Working with JavaScript. 2 Objectives Introducing JavaScript Inserting JavaScript into a Web Page File Writing Output to the Web Page Working with Variables.
Web Infrastructure Week 3 INFM 603. The Key Ideas Questions Structured Programming Modular Programming Data Structures Object-Oriented Programming.
LBSC 690 Session #10 Programming, JavaScript Jimmy Lin The iSchool University of Maryland Wednesday, November 5, 2008 This work is licensed under a Creative.
Data Structures Week 4 INFM 603. The Key Ideas Structured Programming  Modular Programming  Data Structures Object-Oriented Programming.
Programming Week 5 LBSC 690 Information Technology.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
XP 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial 10.
LBSC 690: Session 10 Programming, JavaScript Jimmy Lin College of Information Studies University of Maryland Monday, November 12, 2007.
Programming Week 6 LBSC 690 Information Technology.
Web Infrastructure Week 2 INFM 603. Agenda Questions XHTML CSS JavaScript.
2012 •••••••••••••••••••••••••••••••••• Summer WorkShop Mostafa Badr
CS102 Introduction to Computer Programming
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 9 Interactive Multimedia Authoring with Flash - Introduction to Programming “Computers and Creativity” Richard D. Webster, COSC 109 Instructor.
PHP: Hypertext Processor Fred Durao
Javascript and the Web Whys and Hows of Javascript.
FALL 2005CSI 4118 – UNIVERSITY OF OTTAWA1 Part 4 Web technologies: HTTP, CGI, PHP,Java applets)
CS 0004 –Lecture 1 Wednesday, Jan 5 th, 2011 Roxana Gheorghiu.
Microsoft Visual Basic 2005: Reloaded Second Edition
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Structured Programming Week 3 INFM 603. Muddiest Points Emergent behavior of the Web HTML class attribute The details of JavaScript … p.style1 { font-family:arial;
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Generations of Programming Languages First generation  Machine Language Second Generation  Assembly Language Third Generation  Procedural language such.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript Environment.
Client Scripting1 Internet Systems Design. Client Scripting2 n “A scripting language is a programming language that is used to manipulate, customize,
Most Difficult and Confusing Topics Pre-Class Face-to-Face Meeting LIS 7008 Information Technologies LSU/SLIS.
INTRODUCTION TO JAVASCRIPT AND DOM Internet Engineering Spring 2012.
1 JavaScript in Context. Server-Side Programming.
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 Session 2: What is JavaScript?
Tutorial 10 Programming with JavaScript
Introduction to Computer Systems and the Java Programming Language.
Visual C++ Programming: Concepts and Projects
Intro to PHP IST2101. Review: HTML & Tags 2IST210.
XP Tutorial 10New Perspectives on HTML and XHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties Tutorial.
JavaScript Scripting language What is Scripting ? A scripting language, script language, or extension language is a programming language.
Scott Marino MSMIS Summer Session Web Site Design and Authoring Session 8 Scott Marino.
ECA 225 Applied Interactive Programming1 ECA 225 Applied Online Programming basics.
Scripting and Interactivity 이병희
1 JavaScript in Context. Server-Side Programming.
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
Tutorial 11 1 JavaScript Operators and Expressions.
Scripting with Client-Side Processing Scripting with Client Side Processing Lesson – Web Technologies Copyright © Texas Education Agency, All rights.
JavaScript Introduction and Background. 2 Web languages Three formal languages HTML JavaScript CSS Three different tasks Document description Client-side.
Tutorial 10 Programming with JavaScript. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Learn the history of JavaScript.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Programming Session 6 LBSC 690 Information Technology.
JavaScript and Ajax (JavaScript Environment) Week 6 Web site:
XP Tutorial 10New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with JavaScript Creating a Programmable Web Page for North Pole Novelties.
1 Agenda  Unit 7: Introduction to Programming Using JavaScript T. Jumana Abu Shmais – AOU - Riyadh.
IST 210: PHP Basics IST 210: Organization of Data IST2101.
Java Programming: From the Ground Up
“Under the hood”: Angry Birds Maze
Software Programming J. Holvikivi 2014.
T. Jumana Abu Shmais – AOU - Riyadh
Week 5 LBSC 690 Information Technology
“Under the hood”: Angry Birds Maze
Tonga Institute of Higher Education IT 141: Information Systems
Tutorial 10: Programming with javascript
Tonga Institute of Higher Education IT 141: Information Systems
Web Programming and Design
Presentation transcript:

Programming Week 5 LBSC 690 Information Technology

Outline Programming Javascript SMIL

Software Software models aspects of reality –Input and output represent the state of the world –Software describes how the two are related Examples –Ballistic computations –Google –Microsoft Word

Types of Software Application programs (e.g., Powerpoint) –What you normally think of as a “program’’ Compilers and interpreters –Programs used to write other programs Operating system (e.g., Windows Vista) –M anages display, CPU, memory, disk, tape, E mbedded program (e.g., TiVO) –P ermanent software inside some device

Programming Languages Used to specify every detail of the model Special purpose –Able to specify an entire class of models Spreadsheets (Excel,...) Databases (Access, Oracle,...) General purpose –Able to specify any possible model JavaScript, Java, Perl, C, C++,...

History of Programming Machine language –Language that machine can understand Assembly language –Assembler changes names to machine code High-level languages –Compiler/Interpreter translates to machine language –FORTRAN, COBOL, C, C++, Javascript Visual programming language –Visually arrange the interface components –Visual Basic, …

Programming Languages Hardware Machine Language Assembly Language COBOLCJavaC++JavaScript

Machine Language Everything is a binary number –Operations –Data For instance ADD first number (21) second number (86)

Assembly Language Symbolic instruction codes and addresses –Symbolic instruction code “ADD” –Symbolic address “SUM1” For instance ADD 21, SUM1

High level Languages Procedural (modular) Programming –Group instructions into meaningful abstractions –C, Pascal, Perl Object oriented programming –Group “data” and “methods” into “objects” –Naturally represents the world around us –C++, Java, JavaScript

Programming for the Web PHP [Server side] –Forms encode field values into a URL –Web server passes field values to a PHP program –Program generates a Web page as a response JavaScript [Client-side, interpreted] –Human-readable “source code” sent to the browser –Web browser runs the program Java applets [Client-side, compiled] –Machine-readable “bytecode” sent to browser –Web browser runs the program

Variables Data types –Boolean: true, false –Number: 5, 9, –String: “Hello World” A “variable” holds a value of a specific data type –Represented as symbols: x, celsius In JavaScript, var “declares” a variable var b = true;create a boolean b and set it to true var n = 1;create a number n and set it to 1 var s = “hello”;create a string s and set it to “hello”

Operators -xreverse the sign of x (negation) 6+5Add 6 and 5 (numeric) “Hello” + “World” Concatenate two strings 2.1 * 3 Multiply two values x++increase value of x by 1 x = 5set the value of x to be 5 x += yx = x + y x *= 5x = x * 5

Statements In JavaScript, instructions end with a semicolon –If missing at end of line, it is automatically inserted Simple assignment statements celsius = 5/9 * (f-32); Statements that invoke a method Temperature.toCelsius(104); Return a value from a method return celsius;

Functions Reusable code for complex “statements” –Takes one or more values as “parameters” –Returns at most one value as the “result” function convertToCelsius(f) { var celsius = 5/9 * (f-32); return celsius; } c = convertToCelsius(60); function convertToCelsius(f) { var celsius = 5/9 * (f-32); return celsius; } var f = 60; c = convertToCelsius(f);

Algorithms A sequence of well-defined instructions designed to accomplish a certain task Derived from the name of the Persian mathematician Al-Khwarizmi

Basic Control Structures Sequential –Perform instructions one after another Conditional –Perform instructions contingent on something Repetition –Repeat instructions until a condition is met Not much different from cooking recipes!

Sequential Control Structure a = 2 b = 3 c = a * b

Conditional Selection Control Structure if (gender == “male”) { greeting = “Hello, Sir” } else { greeting = “Hello, Madam” }

Generating Boolean Results x == y true if x and y are equal x != y true if x and y are not equal x > ytrue if x is greater than y x <= y true if x is smaller than or equal to y x && ytrue if both x and y are true x || ytrue if either x or y is true !xtrue if x is false

Repetition Control Structure Program Example 1: n = 1 while ( n <= 10) { document.writeln(n) n++ } Program 2: For (n = 1; n <= 10; n++) { document.writeln(n) }

Arrays A set of elements –For example, the number of days in each month Each element is assigned an index –A number used to refer to that element For example, x[4] is the fifth element (count from zero!) –Arrays and repetitions work naturally together

JavaScript My first script document.write("Hello, world!") Try it at

Placement JavaScript is usually in the section … <!-- function calculate() { var num = eval(document.input.number.value); … document.output.number.value = total; } //--> …

Handling Events Events: –Actions that users perform while visiting a page Use event handlers to response events –Event handlers triggered by events –Examples of event handlers in Javascript onMouseover: the mouse moved over an object onMouseout: the mouse moved off an object onClick: the user clicked on an object

HTML “Forms” Accept input and display output for JavaScript In HTML Please enter a number: The sum of all numbers up to the number above is JavaScript code var num = eval(document.input.number.value); document.output.number.value = 10; Reads in a value eval function turns it into a number Changes the value in the textbox

Hands On: Adopt a JavaScript Program Launch a Web browser – See how it behaves if you are 13 (or 65) View source and read the program Save a local copy Make some changes and see how it works

Programming Tips Attention to detail! –Careful where you place that comma, semi-colon, etc. Write a little bit of code at a time –Add some functionality, make sure it works, move on –Don’t try to write a large program all at once Debug by viewing the “state” of your program –Print values of variables using document.write –Is the value what you expected?

JavaScript Resources Google “javascript” –Tutorials: to learn to write programs –Code: to do things you want to do Engineering and Physical Sciences Library

Synchronizing Multiple Media Scripting Languages –Synchronized Multimedia Integration Language (SMIL) Custom applications –Macromedia Flash Content representation standards –MPEG 4

SMILe W3C standard –Player-specific extensions are common XML, with a structure similar to HTML …

Elements in SMIL Window controls (in ) –Controlling layout:, Timeline controls (in ) –Sequence control:,, –Timing control:,, Content types (in ) –,,,

SMIL Examples Implemented in RealOne Player Example: –First, run the executable –Then, view.smil file

Discussion Point: When is Lossless Compression Important? For images? For text? For sound? For video?

Before You Go! On a sheet of paper (no names), answer the following question: What was the muddiest point in today’s class?