EECS1012. Net-centric Introduction to Computing. More PHP: Arrays and Files

Size: px
Start display at page:

Download "EECS1012. Net-centric Introduction to Computing. More PHP: Arrays and Files"

Transcription

1 EECS 1012 EECS1012 Net-centric Introduction to Computing More PHP: Arrays and Files Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst. Slides have been ported to PPT by Dr. Xenia Mountrouidou. These slides have been edited for EECS1012, York University. The contents of these slides may be modified and redistributed, please give appropriate credit. M.S. Brown, EECS York University 1 (Creative Commons) Michael S. Brown, 2017.

2 2 Arrays

3 Arrays 3 <?php $food = array("falafel", "pide", "poutine"); print "I like to eat $food[0] and $food[2] ";?> PHP I like to eat falafel and poutine. output An array stores multiple values accessible by a single variable name We can access the value sin the array using an index or key. EECS CS1012

4 Indexed Arrays 4 <?php $food = array("falafel", "pide", "poutine"); print "My favorite is $food[0] \n";?> PHP Index arrays (or numerical arrays) are arrays where the individual values in the array are access with a numeric index. Indexing starts at position 0, not 1. $food [index] array value "falafel" "pide" "poutine" EECS 1012

5 Indexed array syntax 5 $var[ index ] Array variable name index (sometimes called "offset") that you want to access within brackets [ ]

6 Array() function 6 <?php $num = array(100, 90, 80, 70, 60, 50, 40, 30, 20, 10); print $num[0]; # output would be 100?> PHP The function array() can be used to create an array variable as shown above. In this example, the data in the array are integers. $num [index] array value Indexed arrays are similar to how we accessed individual characters in string variables.

7 Manual array assignment 7 <?php $food[0] = "dosa"; $food[1] = "pide"; $food[2] = "poutine"; print "I like to eat $food[0] and $food[2] ";?> PHP I like to eat dosa and poutine. output We can manually assign values to an array. This example did not use the array function, but the result is identical.

8 print_r function 8 <?php $array_var = array( "CSS", "PHP", "HTML", "Coding" ); print_r($array_var);?> PHP Array ( [0] => CSS [1] => PHP [2] => HTML [3] => Coding ) output This function is referred to as the "Print Readable" function and helps you visualize the contents of your data. You can use it with arrays or other data types.

9 Appending an array 9 <?php $a = array("css", "HTML", "PHP"); Array $a[] = "Java Script"; ( print_r($a); [0] => CSS?> PHP [1] => HTML [2] => PHP [3] => Java Script ) output If you assign a value to an array without an index specified, e.g. $a[ ] = "Hello", PHP will append the new value at the "end" of the current array. EECS 1012

10 Associative Arrays 10 <?php $age = array("peter"=>"35", "Ben"=>"37", "Joe"=>"43"); print $age["peter ]; print \n ; print $age[ Joe ];?> PHP output Associative arrays uses a key to access an individual element in the array. Syntax: $var_name[ key ]. The key is often a string, but can also be a numerical value.

11 Associative array syntax 11 $var[ key ] Array variable name name of the key that you want to access within brackets [ ]

12 Associative arrays using array() 12 $a = array("peter"=>"35", "Ben"=>"37", "Joe"=>"43"); key is a string value is a string $a = array(1 => "Five", 2 => "Two", 3 => "Three"); key is a number value is a string Syntax to specify in the array() function: key => value. You will generally string values used as keys, but numerical values can also be used as shown above.

13 Associative array example 13 <?php $a["lecture"] = "Hall A"; $a["labs"] = "William Small 106"; $a["university"] = "York"; $a["college"] = "Lassonde"; print_r($a);?> You can also manually assign data to associative arrays. Array ( [lecture] => Hall PHPA [labs] => William Small 106 [university] => York [college] => Lassonde ) output EECS 1012

14 Printing array values 14 <?php $prez[0] = "Obama"; $prez[1] = "Trump"; $prez[2] = "Bush"; print "First $prez[2], then $prez[0], now $prez[1].. \n"; PHP First Bush, then Obama, now Trump... output We can print out indexed arrays just like other variables EECS 1012

15 Printing array with string keys 15 $a["university"] = "York"; $a["college"] = "Lassonde"; print "EECS is in the {$a["college"]} college \n"; PHP When we print array values with string keys, we need to place them within { } in the print statement EECS 1012

16 Arrays are used like other variables 16 $a = array( 5, 10, 15, 20, 25, 30 ); $a[0] = $a[0] + 10; // $a[0] now equals 15 $a[1]++; // $a[1] now equals 11 $a[2] = $a[3] + $a[5]; // $a[2] now equals 50 print_r($a); PHP The math operations in this example are just like we saw for non-array variables in the last lecture notes. Array ( [0] => 15 [1] => 11 [2] => 50 [3] => 20 [4] => 25 [5] => 30 ) OUTPUT

17 Arrays are used like other variables 17 $a = array( "first" => "Abdel", "last" => "Zhang" ); $anme = $a["first"]. " ". $a["last"]; print "$name \n"; PHP Abdel Zhang OUTPUT In this example the associative array values are accessed using keys. They are concatenated together (with a space in the middle) to form a larger string. EECS 1012

18 Expression breakdown 18 $name = $a["first"]. " ". $a["last"]; "Abdel". " ". "Zhang"; "Abdel ". "Zhang"; "Abdel Zhang"; $name = "Abdel Zhang"; EECS 1012 (1) access values from the two associative arrays (2) apply the first concatenation operator with "Abdel" and " ". (3) apply seccond concatenation operator with "Abdel " and "Zhang" (4) assign result to variable $name

19 Accessing arrays using variables 19 $a = array("pide", "Dosa", "Falafel", "Poutine"); print "I like the following foods "; for($i=0; $i < 4; $i++) { print "($i) $a[$i] "; } PHP I like the following foods: (1) Pide (2) Dosa (3) Falafel (4) Poutine output We can use a variable's value to access the index. In the above example, $i, is used to access the values in array $a

20 count function for arrays 20 $a = array("pide", "Dosa", "Falafel", "Poutine"); $a_length = count($a); print "The number of items in the array is $a_length. \n"; PHP The number of items in the array is 4. output count(a) returns the number of elements in the array a. Sometimes we call this the "size" of the array, or "length" of the array. EECS 1012

21 Simple array code example 21 <?php $names = array("abdel", "Xiong", "Tyler", "Mahsa", "Lili", "Deaner", "Tony", "Saeed"); EECS 1012 for($i=0; $i < count($names); $i++) { print "Student $i has name $names[$i] \n"; } Student 0 has name Abdel Student 1 has name Xiong Student 2 has name Tyler Student 3 has name Mahsa Student 4 has name Lili Student 5 has name Deaner Student 6 has name Tony Student 7 has name Saeed Output PHP

22 Some useful array functions 22 Function array_rand(a) count(a) array_sum(a) in_array(val, a) shuffle(a) sort(a) array_keys(a) Description Returns a randomly chosen index that is valid for array a returns the number of elements in an array Sums up all the values in the array Returns "true" if the given value is found in the array a rearranges the order of an array sorts the contents of array a returns an indexed array of all the keys in an associative array a EECS 1012

23 Examples array_rand() 23 <?php $names = array("abdel", "Xiong", "Tyler", "Mahsa", "Lili", "Deaner", "Tony", "Saeed"); $lucky = array_rand($names); # selects a random index! print "$names[$lucky] gets an A for EECS1012 \n"; PHP Deaner gets an A for EECS1012 EECS 1012

24 Examples sort() 24 <?php $names = array("abdel", "Xiong", "Tyler", "Mahsa", "Lili", "Deaner", "Tony", "Saeed"); sort($names); # this sorts the array, place result back in # the same variable for($i=0; $i < count($names); $i++) { print "Student $i has name $names[$i] \n"; } EECS 1012 Student 0 has name Abdel Student 1 has name Deaner Student 2 has name Lili Student 3 has name Mahsa Student 4 has name Saeed Student 5 has name Tony Student 6 has name Tyler Student 7 has name Xiong PHP Output

25 Examples array_keys() 25 $items= array("iphone" => 988, "Samsung" => 700, "LG" => 500); $keys = array_keys( $items ); # returns an array with the keys from # items for($i=0; $i < count($keys); $i++) { $key = $keys[$i]; print "Item: $i Brand: $key Price: $ $items[$key] \n"; } PHP Item: 0 Brand: iphone Price: $ 988 Item: 1 Brand: Samsung Price: $ 700 Item: 2 Brand: LG Price: $ 500 OUTPUT

26 Examples in_array() 26 $class = array("abdel", "Mahmoud", "Sam", "Tyler", "Susan", "Kyros"); $find_person = "Pasha"; if (in_array($find_person, $class)) # function returns TRUE or FALSE { print "$find_person is enrolled. \n"; } else { print "$find_person is not enrolled. \n"; } PHP Pasha is not enrolled. OUTPUT

27 27 More on strings

28 28 Processing strings The vast majority of content we will manipulate in web programming is text. Text is best represented using string types. Text is often organized (or semi-organized) into some type of structure, e.g. Class list Name address studentid Name address studentid Name address studentid

29 More on strings (and arrays) 29 Now that we know how to use arrays, we can revisit string functions There are many functions to process strings that return arrays of strings are their result, or that take arrays as their parameters We will examine two very useful string functions: implode and explode

30 Functions explode and implode 30 Name explode(delim, s) implode(delim, a) What does it do? Takes a string, s, and breaks it up into multiple strings based on the delimiter, delim. The result is an array of string. Takes an array of strings, a, and places them back into a single string separated by the delimiter, delim. EECS 1012

31 What is a delimiter? 31 A sequence of one or more symbols used to specify the boundary between independent regions. You use delimiters all the time! If you didn't add a space delimiter, text would be unreadable!

32 Explode - example 32 # imagine we read this string this from a file $bigstring = "Abdel abdel@gmail.com \n". "Lili lili@yahoo.com \n". "George xi@yorku.ca \n". "Xiong batman@136.com "; print $bigstring; $eachline = explode("\n", $bigstring); # this is an array $numberoflines = count($eachline); # this is the size # the array "eachline" print "Number of students = $numberoflines \n"; PHP EECS 1012 Number of students = 4 output

33 Explode breakdown 33 $bigstring = "Abdel abdel@gmail.com \n". "Lili lili@yahoo.com \n". "George xi@yorku.ca \n". "Xiong batman@136.com "; $eachline = explode("\n", $bigstring); The delimiter that specifies the boundaries of what want to separate. The string that we want to explode. EECS 1012

34 What is the result? 34 Explode returns an array that contains the strings that have been separated by the delimiter. $eachline = explode("\n", $bigstring); print_r($eachline) Array ( [0] => Abdel abdel@gmail.com [1] => Lili lili@yahoo.com [2] => George xi@yorku.ca [3] => Xiong batman@136.com )

35 Going further 35 # imagine we read this string this from a file $bigstring = "Abdel abdel@gmail.com \n". "Lili lili@yahoo.com \n". "George xi@yorku.ca \n". "Xiong batman@136.com "; $eachline = explode("\n", $bigstring); # this is an array for ($i = 0; $i < count($eachline); $i++) { $info = explode( " ", $eachline[$i]); print_r($info); } PHP

36 36 Going further $eachline = explode("\n", $bigstring); for ($i = 0; $i < count($eachline); $i++) { $info = explode( " ", $eachline[$i]); print_r($info); } With two applications of "explode" functions, we have taken our original string and broke it first into lines, then each line into the basic "info". $info[0] is the name $info[1] is the $info[2] is the studentid Array ( [0] => Abdel abdel@gmail.com [1] => Lili lili@yahoo.com [2] => George xi@yorku.ca [3] => Xiong batman@136.com ) Array ( [0] => Abdel [1] => abdel@gmail.com [2] => ) Array ( [0] => Lili [1] => lili@yahoo.com [2] => ) Array ( [0] => George [1] => xi@yorku.ca [2] => ) Array ( [0] => Xiong [1] => batman@136.com [2] => )

37 Yet even further $bigstring = "Abdel abdel@gmail.com \n". "Lili lili@yahoo.com \n". "George xi@yorku.ca \n". "Xiong batman@136.com "; $eachline = explode("\n", $bigstring); # break into lines print "<table> \n"; print "<tr> <th> Name </th> <th> </th> <th> Student ID </th> </tr> \n"; for ($i = 0; $i < count($eachline); $i++) { $info = explode( " ", $eachline[$i]); # break line into data # print this out to table! print "<tr><td> $info[0] </td> <td> $info[1] </td> <td> $info[2] </td></tr>\n"; } print "</table> \n";

38 A Table with a few lines of code! 38 Output from previous slide's PHP code.. <table> <tr> <th> Name </th> <th> </th> <th> Student ID </th> </tr> <tr> <td> Abdel </td> <td> abdel@gmail.com </td> <td> </td> </tr> <tr> <td> Lili </td> <td> lili@yahoo.com </td> <td> </td> </tr> <tr> <td> George </td> <td> xi@yorku.ca </td> <td> </td> </tr> <tr> <td> Xiong </td> <td> batman@136.com </td> <td> </td> </tr> </table> With just a few lines of code, we have created a table from our original big string! See example here

39 Implode function 39 Takes an array and forms a big string inserting the specified delimiter $names = array("abdel", "Xiong", "Tyler", "Mahsa", "Lili", "Deaner", "Tony", "Saeed"); $allnames = implode(",", $names); print '$names is of type '. gettype($names). "\n"; print '$allnames is of type '. gettype($allnames). "\n"; print '$names = '; print_r($names); print '$allnames = '; print_r($allnames); See code here

40 Implode explained 40 $names = Array ( [0] => Abdel [1] => Xiong [2] => Tyler [3] => Mahsa [4] => Lili [5] => Deaner [6] => Tony [7] => Saeed ) $allnames = implode(",", $names); EECS 1012 Make a single string by concatenating all the content with this delimiter inserted between each item. array to implode

41 Impode example 41 $allnames = implode(",", $names); print $allnames; PHP Abdel,Xiong,Tyler,Mahsa,Lili,Deaner,Tony,Saeed Output This example took our array of names and created a single string with a delimiter inserted between each item in the array.

42 Array/string recap 42 Arrays are useful data types to store a collection of data using the same variable name Two types of arrays: indexed and associative Many string functions return their results as arrays, or accept arrays as input EECS 1012

43 43 PHP File Input/Output

44 Files 44 File are stored on our "hard drives" the data remains there even when the computer is turned off. We can read and write data to files. These files are generally stored on the web server. PHP can read this data into the program. PHP can also write out information to files. EECS 1012

45 PHP file diagram 45 Text File Text file that is on the server. EECS 1012 PHP can access this file and incorporate its contents into the output. PHP can also write information to this file.

46 Facebook has a file on all of you! 46 Deaner's File Likes: Poutine, Beer, Smokes, Hockey Posts: Just Give'r Terry,,, Friends: Tron, Terry, Ron Facebook stores all your information, posts, likes, etc in files that it accesses each time you log in. It also shares this information with vendors who want to sell you things.

47 Basic PHP file I/O functions 47 function name file(filename) file_get_contents(filename) file_put_contents(filename, data, mode) file_exists(filename) category Reads the contents from a file with the name filename into an array of strings, where each string is a line from the file. Reads the contents from a file with the name filename into one large string. Write content from data to a file with the name filename, using a particular writing mode. Checks to see if a file of filename exists. There are many types of file functions for PHP, we will learn these two basic functions. I/O is computing speak for "Input/Output"

48 Reading from a file 48 File: foo.txt Hello how are you? I'm fine file("foo.txt") array( "Hello\n", #0 "how are\n", #1 "you?\n", #2 "\n", #3 "I'm fine\n" #4 ) file_get_contents ("foo.txt") "Hello\n how are\n you?\n \n I'm fine\n" file returns lines of a file as an array file_get_contents returns entire contents of a file as a string EECS CS1012

49 Example quotes.txt 49 Assume I have a file named "quotes.txt" in my webserver directory (e.g. www folder). This file has a quote on each line. quotes.txt "If you want to achieve greatness stop asking for permission." --Anonymous "Things work out best for those who make the best of how things work out." --John Wooden "To live a creative life, we must lose our fear of being wrong." Anonymous EECS 1012

50 Reading a file using file() 50 # opens the file and reads content in each line is placed into an # array $quotes = file("quotes.txt"); # randomly select an index in this array $i = array_rand($quotes); # convert the $quotes[$i] to special characters # (e.g. " becomes ") $output = htmlspecialchars($quotes[$i]); print "<p> <quote> $output </quote> </p> \n"; <p> <quote> "Successful entrepreneurs are givers and not takers of positive energy." --Anonymous </quote> </p> OUTPUT EECS 1012

51 Reading using file_get_content() 51 # opens the file and reads content in as one big string $content = file_get_content("quotes.txt"); # convert the string to all upper case $content = strtoupper ( $content ); # print the strint print $content; "IF YOU WANT TO ACHIEVE GREATNESS STOP ASKING FOR PERMISSION." --ANONYMOUS "THINGS WORK OUT BEST FOR THOSE WHO MAKE THE BEST OF HOW THINGS WORK OUT." --JOHN WOODEN "TO LIVE A CREATIVE LIFE, WE MUST LOSE OUR FEAR OF BEING WRONG." --ANONYMOUS "IF YOU ARE NOT WILLING TO RISK THE USUAL YOU WILL HAVE TO SETTLE FOR THE ORDINARY." --JIM ROHN. OUTPUT

52 Writing to a file 52 for($i=0; $i < 10; $i++) { $square = $i * $i; $output[] = "$i * $i = $square \n"; # appends to array } # writes an array of strings to the file. file_put_contents("square_table.txt", $output); EECS 1012 If the file doesn't already exisit, this creates a file named "square_table.txt" and places the following content in it. If the file did already exist, this overrides the content in the file. So, be careful with file writing! File: square_table.txt 0 * 0 = 0 1 * 1 = 1 2 * 2 = 4 3 * 3 = 9 4 * 4 = 16 5 * 5 = 25 6 * 6 = 36 7 * 7 = 49 8 * 8 = 64 9 * 9 = 81

53 Appending to a file (FILE_APPEND) 53 for($i=0; $i < 10; $i++) { $square = $i * $i; $output[] = "$i * $i = $square \n"; # appends to array } file_put_contents("square_table.txt", $output, FILE_APPEND); EECS 1012 When the FILE_APPEND parameter is passed to file_put_contents, new content will be appended to the end of the file. If the file already exists, this writes the data to the end of the file. If the file doesn't exist, it creates a new file. File: square_table.txt. 0 * 0 = 0 (Added to 1 * 1 = 1 the end of 2 * 2 = 4 the existing 3 * 3 = 9 file) 4 * 4 = 16 5 * 5 = 25 6 * 6 = 36.

54 Recap 54 Basic File I/O is very easy in PHP File content can be easily read in as an array or a string Data can be easily written out to files. NEXT UP: getting information from HTML files through forms EECS 1012

EECS1012. Net-centric Introduction to Computing. Crash Course on PHP

EECS1012. Net-centric Introduction to Computing. Crash Course on PHP EECS 1012 EECS1012 Net-centric Introduction to Computing Crash Course on PHP Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst.

More information

EECS1012. Net-centric Introduction to Computing. Lecture "Putting It All Together" and a little bit of AJAX

EECS1012. Net-centric Introduction to Computing. Lecture Putting It All Together and a little bit of AJAX EECS 1012 Net-centric Introduction to Computing Lecture "Putting It All Together" and a little bit of AJAX Acknowledgements The contents of these slides may be modified and redistributed, please give appropriate

More information

EECS1012. Net-centric Introduction to Computing. Lecture 3: CSS for Styling

EECS1012. Net-centric Introduction to Computing. Lecture 3: CSS for Styling EECS1012 Net-centric Introduction to Computing Lecture 3: CSS for Styling Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst.

More information

EECS1012. Net-centric Introduction to Computing. Lecture Introduction to Javascript

EECS1012. Net-centric Introduction to Computing. Lecture Introduction to Javascript EECS 1012 Net-centric Introduction to Computing Lecture Introduction to Javascript Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and

More information

EECS1012. Net-centric Introduction to Computing. Lecture JavaScript Events

EECS1012. Net-centric Introduction to Computing. Lecture JavaScript Events EECS 1012 Net-centric Introduction to Computing Lecture JavaScript Events Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M. Stepp, J. Miller, and V. Kirst.

More information

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming

Intro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals

More information

Lecture 10: Working with Files. CS 383 Web Development II Monday, March 12, 2018

Lecture 10: Working with Files. CS 383 Web Development II Monday, March 12, 2018 Lecture 10: Working with Files CS 383 Web Development II Monday, March 12, 2018 Working with Files Last week, we began to do some work with files through uploads, and we talked a little bit about headers

More information

Options. Real SQL Programming 1. Stored Procedures. Embedded SQL

Options. Real SQL Programming 1. Stored Procedures. Embedded SQL Real 1 Options We have seen only how SQL is used at the generic query interface an environment where we sit at a terminal and ask queries of a database. Reality is almost always different: conventional

More information

EECS1012. Net-centric Introduction to Computing. Lecture 5: Yet more CSS (Float and Positioning)

EECS1012. Net-centric Introduction to Computing. Lecture 5: Yet more CSS (Float and Positioning) EECS 1012 EECS1012 Net-centric Introduction to Computing Lecture 5: Yet more CSS (Float and Positioning) Acknowledgements Contents are adapted from web lectures for Web Programming Step by Step, by M.

More information

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02

Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Mobile Computing Professor Pushpendra Singh Indraprastha Institute of Information Technology Delhi Java Basics Lecture 02 Hello, in this lecture we will learn about some fundamentals concepts of java.

More information

CSCB20 Week 8. Introduction to Database and Web Application Programming. Anna Bretscher* Winter 2017

CSCB20 Week 8. Introduction to Database and Web Application Programming. Anna Bretscher* Winter 2017 CSCB20 Week 8 Introduction to Database and Web Application Programming Anna Bretscher* Winter 2017 *thanks to Alan Rosselet for providing the slides these are adapted from. Web Programming We have seen

More information

Creating HTML files using Notepad

Creating HTML files using Notepad Reference Materials 3.1 Creating HTML files using Notepad Inside notepad, select the file menu, and then Save As. This will allow you to set the file name, as well as the type of file. Next, select the

More information

Survey #2. Assignment #3. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings. Static Interface Types.

Survey #2. Assignment #3. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu. Readings. Static Interface Types. University of British Columbia CPSC 111, Intro to Computation Alan J. Hu Static Interface Types Lecture 19 Readings This Week: Ch 8.3-8.8 and into Ch 9.1-9.3 (Ch 9.3-9.8 and Ch 11.1-11.3 in old 2 nd ed)

More information

CLIL-3-PHP-3. Files - part 1. Once you master the art of working with files, a wider world of PHP web

CLIL-3-PHP-3. Files - part 1. Once you master the art of working with files, a wider world of PHP web Files - part 1 Introduction Once you master the art of working with files, a wider world of PHP web development opens up to you. Files aren't as flexible as databases by any means, but they do offer the

More information

What is PHP? [1] Figure 1 [1]

What is PHP? [1] Figure 1 [1] PHP What is PHP? [1] PHP is an acronym for "PHP: Hypertext Preprocessor" PHP is a widely-used, open source scripting language PHP scripts are executed on the server PHP is free to download and use Figure

More information

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA

TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA 1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared

More information

MITOCW watch?v=flgjisf3l78

MITOCW watch?v=flgjisf3l78 MITOCW watch?v=flgjisf3l78 The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high-quality educational resources for free. To

More information

Iteration and Arrays Dr. Abdallah Mohamed

Iteration and Arrays Dr. Abdallah Mohamed Iteration and Arrays Dr. Abdallah Mohamed Acknowledgement: Original slides provided courtesy of Dr. Lawrence. Before we start: the ++ and -- Operators It is very common to subtract 1 or add 1 from the

More information

IDM 232. Scripting for Interactive Digital Media II. IDM 232: Scripting for IDM II 1

IDM 232. Scripting for Interactive Digital Media II. IDM 232: Scripting for IDM II 1 IDM 232 Scripting for Interactive Digital Media II IDM 232: Scripting for IDM II 1 PHP HTML-embedded scripting language IDM 232: Scripting for IDM II 2 Before we dive into code, it's important to understand

More information

CS 112: Intro to Comp Prog

CS 112: Intro to Comp Prog CS 112: Intro to Comp Prog Importing modules Branching Loops Program Planning Arithmetic Program Lab Assignment #2 Upcoming Assignment #1 Solution CODE: # lab1.py # Student Name: John Noname # Assignment:

More information

Basic PHP. Lecture 19. Robb T. Koether. Hampden-Sydney College. Mon, Feb 26, 2108

Basic PHP. Lecture 19. Robb T. Koether. Hampden-Sydney College. Mon, Feb 26, 2108 Basic PHP Lecture 19 Robb T. Koether Hampden-Sydney College Mon, Feb 26, 2108 Robb T. Koether (Hampden-Sydney College) Basic PHP Mon, Feb 26, 2108 1 / 27 1 PHP 2 The echo Statement 3 Variables 4 Operators

More information

CEU s (Continuing Education Units) 12 Hours (i.e. Mon Thurs 5 9PM or Sat Sun 8AM 5PM)

CEU s (Continuing Education Units) 12 Hours (i.e. Mon Thurs 5 9PM or Sat Sun 8AM 5PM) Course Name: Intro to Ruby Course Number: WITP 312 Credits: Classroom Hours: 1.2 CEU s (Continuing Education Units) 12 Hours (i.e. Mon Thurs 5 9PM or Sat Sun 8AM 5PM) Flex Training - Classroom and On-Line

More information

MITOCW watch?v=0jljzrnhwoi

MITOCW watch?v=0jljzrnhwoi MITOCW watch?v=0jljzrnhwoi The following content is provided under a Creative Commons license. Your support will help MIT OpenCourseWare continue to offer high quality educational resources for free. To

More information

Week 13 Thursday (with Page 5 corrections)

Week 13 Thursday (with Page 5 corrections) Week 13 Thursday (with Page 5 corrections) Quizzes: HTML/CSS and JS available and due before 10 pm next Tuesday, May 1 st. You may do your own web research to answer, but do not ask classmates, friends,

More information

Web Programming Step by Step

Web Programming Step by Step Web Programming Step by Step Lecture 7 PHP Syntax Reading: 5.2-5.4 Except where otherwise noted, the contents of this presentation are Copyright 2009 Marty Stepp and Jessica Miller. 5.2: PHP Basic Syntax

More information

Programming language components

Programming language components Programming language components syntax: grammar rules for defining legal statements what's grammatically legal? how are things built up from smaller things? semantics: what things mean what do they compute?

More information

Shells & Shell Programming (Part B)

Shells & Shell Programming (Part B) Shells & Shell Programming (Part B) Software Tools EECS2031 Winter 2018 Manos Papagelis Thanks to Karen Reid and Alan J Rosenthal for material in these slides CONTROL STATEMENTS 2 Control Statements Conditional

More information

CS111: PROGRAMMING LANGUAGE II

CS111: PROGRAMMING LANGUAGE II 1 CS111: PROGRAMMING LANGUAGE II Computer Science Department Lecture 1: Introduction Lecture Contents 2 Course info Why programming?? Why Java?? Write once, run anywhere!! Java basics Input/output Variables

More information

ITS331 Information Technology I Laboratory

ITS331 Information Technology I Laboratory ITS331 Information Technology I Laboratory Laboratory #11 Javascript and JQuery Javascript Javascript is a scripting language implemented as a part of most major web browsers. It directly runs on the client's

More information

Lecture 7 PHP Basics. Web Engineering CC 552

Lecture 7 PHP Basics. Web Engineering CC 552 Lecture 7 PHP Basics Web Engineering CC 552 Overview n Overview of PHP n Syntactic Characteristics n Primitives n Output n Control statements n Arrays n Functions n WampServer Origins and uses of PHP n

More information

Basic PHP Lecture 17

Basic PHP Lecture 17 Basic PHP Lecture 17 Robb T. Koether Hampden-Sydney College Fri, Feb 24, 2012 Robb T. Koether (Hampden-Sydney College) Basic PHPLecture 17 Fri, Feb 24, 2012 1 / 30 1 PHP 2 Basic PHP 3 The Extended echo

More information

PHP Syntax. PHP is a great example of a commonly-used modern programming language.

PHP Syntax. PHP is a great example of a commonly-used modern programming language. PHP is a great example of a commonly-used modern programming language. C was first released in 1972, PHP in 1995. PHP is an excellent language choice for software that requires an easy way to do things

More information

Mobile Site Development

Mobile Site Development Mobile Site Development HTML Basics What is HTML? Editors Elements Block Elements Attributes Make a new line using HTML Headers & Paragraphs Creating hyperlinks Using images Text Formatting Inline styling

More information

Babu Madhav Institute of Information Technology, UTU 2017

Babu Madhav Institute of Information Technology, UTU 2017 Practical No: 1 5 years Integrated M.Sc.(IT) 060010811 Content Management Systems Practical List Write a PHP script to create one variable $department and assign a value BMIIT. Show value of $department

More information

COMP 2718: Shell Scripts: Part 1. By: Dr. Andrew Vardy

COMP 2718: Shell Scripts: Part 1. By: Dr. Andrew Vardy COMP 2718: Shell Scripts: Part 1 By: Dr. Andrew Vardy Outline Shell Scripts: Part 1 Hello World Shebang! Example Project Introducing Variables Variable Names Variable Facts Arguments Exit Status Branching:

More information

URLs and web servers. Server side basics. URLs and web servers (cont.) URLs and web servers (cont.) Usually when you type a URL in your browser:

URLs and web servers. Server side basics. URLs and web servers (cont.) URLs and web servers (cont.) Usually when you type a URL in your browser: URLs and web servers 2 1 Server side basics http://server/path/file Usually when you type a URL in your browser: Your computer looks up the server's IP address using DNS Your browser connects to that IP

More information

The design recipe. Readings: HtDP, sections 1-5. (ordering of topics is different in lectures, different examples will be used)

The design recipe. Readings: HtDP, sections 1-5. (ordering of topics is different in lectures, different examples will be used) The design recipe Readings: HtDP, sections 1-5 (ordering of topics is different in lectures, different examples will be used) Survival and Style Guides CS 135 Winter 2018 02: The design recipe 1 Programs

More information

ANSWER KEY First Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010

ANSWER KEY First Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010 ANSWER KEY First Exam Computer Programming 326 Dr. St. John Lehman College City University of New York Thursday, 7 October 2010 1. True or False: (a) T An algorithm is a a set of directions for solving

More information

COSC 122 Computer Fluency. Programming Basics. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 122 Computer Fluency. Programming Basics. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 122 Computer Fluency Programming Basics Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) We will learn JavaScript to write instructions for the computer.

More information

COMS 469: Interactive Media II

COMS 469: Interactive Media II COMS 469: Interactive Media II Agenda Review Conditional Statements String and Numeric Functions Arrays Review PHP History Rasmus Lerdorf 1995 Andi Gutmans & Zeev Suraski Versions 1998 PHP 2.0 2000 PHP

More information

Course Syllabus. Course Title. Who should attend? Course Description. PHP ( Level 1 (

Course Syllabus. Course Title. Who should attend? Course Description. PHP ( Level 1 ( Course Title PHP ( Level 1 ( Course Description PHP '' Hypertext Preprocessor" is the most famous server-side programming language in the world. It is used to create a dynamic website and it supports many

More information

28-Nov CSCI 2132 Software Development Lecture 33: Shell Scripting. 26 Shell Scripting. Faculty of Computer Science, Dalhousie University

28-Nov CSCI 2132 Software Development Lecture 33: Shell Scripting. 26 Shell Scripting. Faculty of Computer Science, Dalhousie University Lecture 33 p.1 Faculty of Computer Science, Dalhousie University CSCI 2132 Software Development Lecture 33: Shell Scripting 28-Nov-2018 Location: Chemistry 125 Time: 12:35 13:25 Instructor: Vla Keselj

More information

CSC 337. JavaScript Object Notation (JSON) Rick Mercer

CSC 337. JavaScript Object Notation (JSON) Rick Mercer CSC 337 JavaScript Object Notation (JSON) Rick Mercer Why JSON over XML? JSON was built to know JS JSON JavaScript Object Notation Data-interchange format Lightweight Replacement for XML It's just a string

More information

DR B.R.AMBEDKAR UNIVERSITY B.Sc.(Computer Science): III Year THEORY PAPER IV (Elective 4) PHP, MySQL and Apache

DR B.R.AMBEDKAR UNIVERSITY B.Sc.(Computer Science): III Year THEORY PAPER IV (Elective 4) PHP, MySQL and Apache DR B.R.AMBEDKAR UNIVERSITY B.Sc.(Computer Science): III Year THEORY PAPER IV (Elective 4) PHP, MySQL and Apache 90 hrs (3 hrs/ week) Unit-1 : Installing and Configuring MySQL, Apache and PHP 20 hrs Installing

More information

Spring INF Principles of Programming for Informatics. Manipulating Lists

Spring INF Principles of Programming for Informatics. Manipulating Lists Manipulating Lists Copyright 2017, Pedro C. Diniz, all rights reserved. Students enrolled in the INF 510 class at the University of Southern California (USC) have explicit permission to make copies of

More information

Final Examination Semester 2 / Year 2010

Final Examination Semester 2 / Year 2010 Southern College Kolej Selatan 南方学院 Final Examination Semester 2 / Year 2010 COURSE : PROGRAMMING LOGIC AND DESIGN COURSE CODE : CCIS1003 TIME : 2 1/2 HOURS DEPARTMENT : COMPUTER SCIENCE LECTURER : LIM

More information

Python: common syntax

Python: common syntax Lab 09 Python! Python Intro Main Differences from C++: True and False are capitals Python floors (always down) with int division (matters with negatives): -3 / 2 = -2 No variable data types or variable

More information

CS 25200: Systems Programming. Lecture 10: Shell Scripting in Bash

CS 25200: Systems Programming. Lecture 10: Shell Scripting in Bash CS 25200: Systems Programming Lecture 10: Shell Scripting in Bash Dr. Jef Turkstra 2018 Dr. Jeffrey A. Turkstra 1 Lecture 10 Getting started with Bash Data types Reading and writing Control loops Decision

More information

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel

Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Web Application Development (WAD) V th Sem BBAITM(Unit-1) By: Binit Patel Introduction: PHP (Hypertext Preprocessor) was invented by Rasmus Lerdorf in 1994. First it was known as Personal Home Page. Later

More information

SECTION 2: PROGRAMMING WITH MATLAB. MAE 4020/5020 Numerical Methods with MATLAB

SECTION 2: PROGRAMMING WITH MATLAB. MAE 4020/5020 Numerical Methods with MATLAB SECTION 2: PROGRAMMING WITH MATLAB MAE 4020/5020 Numerical Methods with MATLAB 2 Functions and M Files M Files 3 Script file so called due to.m filename extension Contains a series of MATLAB commands The

More information

COMP1730/COMP6730 Programming for Scientists. Data: Values, types and expressions.

COMP1730/COMP6730 Programming for Scientists. Data: Values, types and expressions. COMP1730/COMP6730 Programming for Scientists Data: Values, types and expressions. Lecture outline * Data and data types. * Expressions: computing values. * Variables: remembering values. What is data?

More information

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

Scripting. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Scripting Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Adapted from Practical Unix and Programming Hunter College Copyright 2006 2009 Stewart Weiss What a shell

More information

Class API. Class API. Constructors. CS200: Computer Science I. Module 19 More Objects

Class API. Class API. Constructors. CS200: Computer Science I. Module 19 More Objects CS200: Computer Science I Module 19 More Objects Kevin Sahr, PhD Department of Computer Science Southern Oregon University 1 Class API a class API can contain three different types of methods: 1. constructors

More information

PHP. Introduction. PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server

PHP. Introduction. PHP stands for PHP: Hypertext Preprocessor PHP is a server-side scripting language, like ASP PHP scripts are executed on the server PHP Introduction Hypertext Preprocessor is a widely used, general-purpose scripting language that was originally designed for web development to produce dynamic web pages. For this purpose, PHP code is

More information

CSE 390a Lecture 2. Exploring Shell Commands, Streams, and Redirection

CSE 390a Lecture 2. Exploring Shell Commands, Streams, and Redirection 1 CSE 390a Lecture 2 Exploring Shell Commands, Streams, and Redirection slides created by Marty Stepp, modified by Jessica Miller & Ruth Anderson http://www.cs.washington.edu/390a/ 2 Lecture summary Unix

More information

CS 241 Data Organization. August 21, 2018

CS 241 Data Organization. August 21, 2018 CS 241 Data Organization August 21, 2018 Contact Info Instructor: Dr. Marie Vasek Contact: Private message me on the course Piazza page. Office: Room 2120 of Farris Web site: www.cs.unm.edu/~vasek/cs241/

More information

Insertion Sort: an algorithm for sorting an array

Insertion Sort: an algorithm for sorting an array Insertion Sort: an algorithm for sorting an array Let s use arrays to solve a problem that comes up often in programming, namely sorting. Suppose we have an array of objects that is in no particular order

More information

File Operations. Lecture 16 COP 3014 Spring April 18, 2018

File Operations. Lecture 16 COP 3014 Spring April 18, 2018 File Operations Lecture 16 COP 3014 Spring 2018 April 18, 2018 Input/Ouput to and from files File input and file output is an essential in programming. Most software involves more than keyboard input and

More information

University of Windsor : System Programming Winter Midterm 01-1h20mn. Instructor: Dr. A. Habed

University of Windsor : System Programming Winter Midterm 01-1h20mn. Instructor: Dr. A. Habed University of Windsor 0360-256: System Programming Winter 2007 - Midterm 01-1h20mn. Instructor: Dr. A. Habed Solution Last name: First name: Student #: NONE NONE NONE Read this first Make sure your paper

More information

PHP. Interactive Web Systems

PHP. Interactive Web Systems PHP Interactive Web Systems PHP PHP is an open-source server side scripting language. PHP stands for PHP: Hypertext Preprocessor One of the most popular server side languages Second most popular on GitHub

More information

Princess Nourah bint Abdulrahman University. Computer Sciences Department

Princess Nourah bint Abdulrahman University. Computer Sciences Department Princess Nourah bint Abdulrahman University 1 And use http://www.w3schools.com/ JavaScript Objectives Introduction to JavaScript Objects Data Variables Operators Types Functions Events 4 Why Study JavaScript?

More information

The Big Python Guide

The Big Python Guide The Big Python Guide Big Python Guide - Page 1 Contents Input, Output and Variables........ 3 Selection (if...then)......... 4 Iteration (for loops)......... 5 Iteration (while loops)........ 6 String

More information

Sign-Up Page (signup.php): form Name: Gender: Age: Personality type:

Sign-Up Page (signup.php): form Name: Gender: Age: Personality type: CSCI 366 (Database and Web Dev) Dr. Schwartz Lab 7: PHP and Forms (Adapted from Web Programming Step by Step) Due Monday, April 9 th at 11:59pm, 100 pts For this assignment, you will create a simple multi-page

More information

Lecture 12. PHP. cp476 PHP

Lecture 12. PHP. cp476 PHP Lecture 12. PHP 1. Origins of PHP 2. Overview of PHP 3. General Syntactic Characteristics 4. Primitives, Operations, and Expressions 5. Control Statements 6. Arrays 7. User-Defined Functions 8. Objects

More information

CSc 372. Comparative Programming Languages. 36 : Scheme Conditional Expressions. Department of Computer Science University of Arizona

CSc 372. Comparative Programming Languages. 36 : Scheme Conditional Expressions. Department of Computer Science University of Arizona 1/26 CSc 372 Comparative Programming Languages 36 : Scheme Conditional Expressions Department of Computer Science University of Arizona collberg@gmail.com Copyright c 2013 Christian Collberg 2/26 Comparison

More information

CS101 Introduction to Programming Languages and Compilers

CS101 Introduction to Programming Languages and Compilers CS101 Introduction to Programming Languages and Compilers In this handout we ll examine different types of programming languages and take a brief look at compilers. We ll only hit the major highlights

More information

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users

Let's Look Back. We talked about how to create a form in HTML. Forms are one way to interact with users Introduction to PHP Let's Look Back We talked about how to create a form in HTML Forms are one way to interact with users Users can enter information into forms which can be used by you (programmer) We

More information

Regular Expressions. Todd Kelley CST8207 Todd Kelley 1

Regular Expressions. Todd Kelley CST8207 Todd Kelley 1 Regular Expressions Todd Kelley kelleyt@algonquincollege.com CST8207 Todd Kelley 1 POSIX character classes Some Regular Expression gotchas Regular Expression Resources Assignment 3 on Regular Expressions

More information

Regular Expressions 1

Regular Expressions 1 Regular Expressions 1 Basic Regular Expression Examples Extended Regular Expressions Extended Regular Expression Examples 2 phone number 3 digits, dash, 4 digits [[:digit:]][[:digit:]][[:digit:]]-[[:digit:]][[:digit:]][[:digit:]][[:digit:]]

More information

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan

Lecture Programming in C++ PART 1. By Assistant Professor Dr. Ali Kattan Lecture 08-1 Programming in C++ PART 1 By Assistant Professor Dr. Ali Kattan 1 The Conditional Operator The conditional operator is similar to the if..else statement but has a shorter format. This is useful

More information

Chapter 2: Data and Expressions

Chapter 2: Data and Expressions Chapter 2: Data and Expressions CS 121 Department of Computer Science College of Engineering Boise State University August 21, 2017 Chapter 2: Data and Expressions CS 121 1 / 51 Chapter 1 Terminology Review

More information

CS 380 WEB PROGRAMMING

CS 380 WEB PROGRAMMING 1 CS 380 WEB PROGRAMMING Instructor: Xenia Mountrouidou Who am I? 2 Dr. X PhD at North Carolina State University Worked for IBM Post doc at College of William and Mary Scuba diver, manga comics collector,

More information

Non-trivial extraction of implicit, previously unknown and potentially useful information from data

Non-trivial extraction of implicit, previously unknown and potentially useful information from data CS 795/895 Applied Visual Analytics Spring 2013 Data Mining Dr. Michele C. Weigle http://www.cs.odu.edu/~mweigle/cs795-s13/ What is Data Mining? Many Definitions Non-trivial extraction of implicit, previously

More information

CS 3360 Design and Implementation of Programming Languages. Exam 1

CS 3360 Design and Implementation of Programming Languages. Exam 1 1 Spring 2017 (Thursday, March 9) Name: CS 3360 Design and Implementation of Programming Languages Exam 1 This test has 8 questions and pages numbered 1 through 7. Reminders This test is closed-notes and

More information

Grouping Objects. Primitive Arrays and Iteration. Produced by: Dr. Siobhán Drohan. Department of Computing and Mathematics

Grouping Objects. Primitive Arrays and Iteration. Produced by: Dr. Siobhán Drohan. Department of Computing and Mathematics Grouping Objects Primitive Arrays and Iteration Produced by: Dr. Siobhán Drohan Department of Computing and Mathematics http://www.wit.ie/ Topic List Primitive arrays Why do we need them? What are they?

More information

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017

Class 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 1 1. Please obtain a copy of Introduction to Java Programming, 11th (or 10th) Edition, Brief

More information

Introduction to TURING

Introduction to TURING Introduction to TURING Comments Some code is difficult to understand, even if you understand the language it is written in. To that end, the designers of programming languages have allowed us to comment

More information

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers

A Big Step. Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers A Big Step Shell Scripts, I/O Redirection, Ownership and Permission Concepts, and Binary Numbers Copyright 2006 2009 Stewart Weiss What a shell really does Here is the scoop on shells. A shell is a program

More information

CS 231 Data Structures and Algorithms, Fall 2016

CS 231 Data Structures and Algorithms, Fall 2016 CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard

More information

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013

Review Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Review Chapters 1 to 4 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Introduction to Java Chapters 1 and 2 The Java Language Section 1.1 Data & Expressions Sections 2.1 2.5 Instructor:

More information

COMS 469: Interactive Media II

COMS 469: Interactive Media II COMS 469: Interactive Media II Agenda Review Files and Directories Review User Defined Functions Cookies File Includes CMS Admin Login Review User Defined Functions Input arguments Output Return values

More information

jquery with Fundamentals of JavaScript Training

jquery with Fundamentals of JavaScript Training 418, 4th Floor, Nandlal Hsg Society, Narayan peth, Above Bedekar misal, Munjobacha Bol, Shagun Chowk, Pune - 411030 India Contact: 8983002500 Website Facebook Twitter LinkedIn jquery with Fundamentals

More information

CSc 520 Principles of Programming Languages

CSc 520 Principles of Programming Languages CSc 520 Principles of Programming Languages 36 : Scheme Conditional Expressions Christian Collberg Department of Computer Science University of Arizona collberg+520@gmail.com Copyright c 2008 Christian

More information

B. V. Patel Institute of BMC & IT 2014

B. V. Patel Institute of BMC & IT 2014 Unit 1: Introduction Short Questions: 1. What are the rules for writing PHP code block? 2. Explain comments in your program. What is the purpose of comments in your program. 3. How to declare and use constants

More information

bash Execution Control COMP2101 Winter 2019

bash Execution Control COMP2101 Winter 2019 bash Execution Control COMP2101 Winter 2019 Bash Execution Control Scripts commonly can evaluate situations and make simple decisions about actions to take Simple evaluations and actions can be accomplished

More information

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 11 Introduction to PHP

Copyright 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley. Chapter 11 Introduction to PHP Chapter 11 Introduction to PHP 11.1 Origin and Uses of PHP Developed by Rasmus Lerdorf in 1994 PHP is a server-side scripting language, embedded in XHTML pages PHP has good support for form processing

More information

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan

COSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan COSC 123 Computer Creativity Introduction to Java Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Introduce Java, a general-purpose programming language,

More information

Chapter 9 SQL in a server environment

Chapter 9 SQL in a server environment Chapter 9 SQL in a server environment SQL in a Programming Environment embedded SQL persistent stored modules Database-Connection Libraries Call-level interface (CLI) JDBC PHP Database connection The third

More information

Python lab session 1

Python lab session 1 Python lab session 1 Dr Ben Dudson, Department of Physics, University of York 28th January 2011 Python labs Before we can start using Python, first make sure: ˆ You can log into a computer using your username

More information

Scheme: Strings Scheme: I/O

Scheme: Strings Scheme: I/O Scheme: Strings Scheme: I/O CS F331 Programming Languages CSCE A331 Programming Language Concepts Lecture Slides Wednesday, April 5, 2017 Glenn G. Chappell Department of Computer Science University of

More information

COP 1220 Introduction to Programming in C++ Course Justification

COP 1220 Introduction to Programming in C++ Course Justification Course Justification This course is a required first programming C++ course in the following degrees: Associate of Arts in Computer Science, Associate in Science: Computer Programming and Analysis; Game

More information

Introduction to Data Management. Lecture #1 (The Course Trailer )

Introduction to Data Management. Lecture #1 (The Course Trailer ) Introduction to Data Management Lecture #1 (The Course Trailer ) Instructor: Mike Carey mjcarey@ics.uci.edu Database Management Systems 3ed, R. Ramakrishnan and J. Gehrke 1 Today s Topics v Welcome to

More information

SQL: Data Definition Language. csc343, Introduction to Databases Diane Horton Fall 2017

SQL: Data Definition Language. csc343, Introduction to Databases Diane Horton Fall 2017 SQL: Data Definition Language csc343, Introduction to Databases Diane Horton Fall 2017 Types Table attributes have types When creating a table, you must define the type of each attribute. Analogous to

More information

Chapter 9: Simple JavaScript

Chapter 9: Simple JavaScript Chapter 9: Simple JavaScript Learning Outcomes: Identify the benefits and uses of JavaScript Identify the key components of the JavaScript language, including selection, iteration, variables, functions

More information

Introduction to Python Code Quality

Introduction to Python Code Quality Introduction to Python Code Quality Clarity and readability are important (easter egg: type import this at the Python prompt), as well as extensibility, meaning code that can be easily enhanced and extended.

More information

University of Washington, CSE 190 M Homework Assignment 4: NerdLuv

University of Washington, CSE 190 M Homework Assignment 4: NerdLuv University of Washington, CSE 190 M Homework Assignment 4: NerdLuv This assignment is about making a simple multi-page "online dating" site that processes HTML forms with PHP. Online dating has become

More information

PYTHON. Varun Jain & Senior Software Engineer. Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT. CenturyLink Technologies India PVT LTD

PYTHON. Varun Jain & Senior Software Engineer. Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT. CenturyLink Technologies India PVT LTD PYTHON Varun Jain & Senior Software Engineer Pratap, Mysore Narasimha Raju & TEST AUTOMATION ARCHITECT CenturyLink Technologies India PVT LTD 1 About Python Python is a general-purpose interpreted, interactive,

More information

Public-Service Announcement I

Public-Service Announcement I Public-Service Announcement I Are you an engineer, designer, or entrepreneur? Come check out Mobile Developers of Berkeley. We create end-to-end solutions with a diverse breath of skills. Our members hone

More information

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements

Lecture 05 I/O statements Printf, Scanf Simple statements, Compound statements Programming, Data Structures and Algorithms Prof. Shankar Balachandran Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 05 I/O statements Printf, Scanf Simple

More information

Administration. Conditional Statements. Agenda. Syntax. Flow of control. Lab 2 due now on floppy Lab 3 due tomorrow via FTP

Administration. Conditional Statements. Agenda. Syntax. Flow of control. Lab 2 due now on floppy Lab 3 due tomorrow via FTP Administration Conditional Statements CS 99 Summer 2000 Michael Clarkson Lecture 4 Lab 2 due now on floppy Lab 3 due tomorrow via FTP need Instruct account password Lab 4 posted this afternoon Prelim 1

More information