SlideShare une entreprise Scribd logo
1  sur  32
Charlie Love
Education Support Officer
Aberdeen City Council
@charlie_love
Software development using Server-
side scripting
• an integrated approach to Higher Computing
Science.
• approaches to increase teaching time
• reduce the assessment
• strategies for integrated delivery blending
components of the SDD and ISDD units
• use contemporary web technologies:
Apache/Mysql/PHP/JavaScript
Higher Computing Science
Software Design
and
Development
Information
Systems Design
and
Development
Assessment
Assessment
Information
Systems Design
and Development
Software Design
and Development Integrating the delivery of
units using a server side
scripting language
will increase teaching time
and decrease time take for
assessment
Using *AMP stack
+ ++
Get *AMP on your computers
• Education Scotland Blog post with information
• http://glo.li/edscot-amp
• MAMP
• EasyPHP
• XAMMP
• WAMP
• etc.
Building solutions
• Agile methodologies
• Interative prototyping
• Design->Build->Test->Repeat
• Working code
• Limited Feature Set -> Expanded Feature Set
sub-programs/routines
defined by their name and arguments (inputs
and outputs)
• PHP uses functions which typically return a
single value.
• Use of &parameter passes values by
reference to the PHP function (essentially
creating a subprogram)
including parameter passing (value
and reference, formal and actual)
function read_users( $file, &$user_id, &$user_name,
&$user_image, &$password_string, $index ) {
$textline = fgets($file);
$textarray = explode(',',$textline);
$user_id[$index] = trim($textarray[0])
$user_name[$index] = trim($textarray[1]);
$user_image[$index] = trim($textarray[2]);
$password_string[$index] = trim($textarray[3]);
}
methods
• methods are subroutines associated with an
object
• they have access to the objects data.
• PHP includes support for object oriented
programming
• Use the MySQL API to show methods on
database objects
If ($result = $mysqli->query
("SELECT * FROM user WHERE user_id = '" .
$login_user_id . "'"))
{
$obj = $result->fetch_object();
$user_id = $obj->user_id;
$user_name = $obj->user_name;
$user_image = $obj->user_image;
$result->close();}
Data types and structures
• string
• numeric
(integer and real)
• Boolean
$mysting=“Some
text”;
$integer = 12;
$real =15.232;
$is_set = true;
• Records - Implement as an array of objects
class Owner
{
public $year;
public $measure;
public $month;
public $name;
}
$names = array('Lars', 'James', 'Kirk', 'Robert');
for ($i = 1 ; $i <= 3 ; $i++) {
$owner = new Owner();
$owner->year = 2012;
$owner->measure = $i;
$owner->month = rand(1,12);
$owner->name = array_rand($names);
$owners[] = $owner;
}
• sequential files (open, create, read, write,
close)
• fopen(filename, mode)
– Creates and/or opens file
– Mode is read and/or write and moves file pointer
to start or end of file.
– http://www.php.net/manual/en/function.fopen.p
hp
• fwrite($file, $textline);
– $file is the file handle from opening the file
– $textline is the line of text to be written
• fgets($file)
– Reads line of text from the file
• fclose($file) – close file
Standard Algorithms
• input validation (server side) / server-side
validation of online form data
– Set up form in html
– Process and validate form on submission
– Processing happens at server
– User interaction is required to create validation
loop
<?php
$username="”;
if (isset($_GET[’username'])) {
$error_found = false;
$message = "username is accepted”;
$username = $_GET[’username’];
if(strlen($username) < 8 ) {
$error_found = true;
$message = “Enter 8 or more characters”;
}
echo "<div>" . $message . "</div>";
}
if (($error_found) || (!isset($error_found))) { //show form if err found or 1st visit
?>
<form action="<?php echo $_SERVER[‘PHP_SELF’];?>" method="get">
<input type="text" name="username" value="<?php echo $username;?>">
<input type="submit" value="Submit" name="update"/>
</form>
<? php } ?>
Linear search
• linear search
function linear_search($needle, $haystack) {
for($i = 0; $i < count($haystack); $i++) {
if ($needle == $i)
return true;
}
return false;
}
$haystack = array(1,2,3,4);
$needle = 3;
$found = linear_search($needle, $haystack);
Finding minimum and maximum
Inbuilt max and min functions do it out of the box
function findmax($array_of_values) {
$current_max = $array_of_values[0];
for($i = 1; $i < count($array_of_values); $i++) {
if ($array_of_values[$i] > $current_max) {
$current_max = $array_of_values[$i];
}
}
return $current_max;
}
$my_array= array(12,25,23,14);
$biggest_number = findmax($my_array);
count occurrences
function count_values($val_to_count, $array_of_values) {
$counter = 0;
for($i = 0; $i < count($array_of_values); $i++) {
if ($array_of_values[$i] == $val_to_count) {
$counter++;
}
}
return $counter;
}
$my_array= array(12,25,23,14,72,83,12,12,63,25,14);
$count_of_values = count_values(12, $my_array);
Coding (ISDD)
• scripting (database/web pages)
• client-side scripting
• server-side scripting
• server-side validation of online form data
Structures and Links (Database)
• MySQL
• phpMyAdmin - Database front end
– Can be used to generate SQL for coding
– Web based – simplifies database management
Structures and Links (Web)
• PHP, HTML, CSS, JavaScript all play well together
<html>
<head>
<title><?php echo $title;></title>
<style>
hr {color:sienna;}
p {margin-left:20px;}
body {background-image:url(“bg.gif");}
</style>
<script>
function show_message() {
alert(“hello there”);
}
</script>
<body onLoad=“show_message();”>
….
PHP and MySQL
//connect to the database using mysqli API
$mysqli = new mysqli("localhost", "root", "root",
”mydatabase");
if ($mysqli->connect_errno) {
echo "Failed to connect to MySQL: (" .
$mysqli->connect_errno . ") "
. $mysqli->connect_error;
die;
}
Run a query and retrieve results
if ($result = $mysqli->query("SELECT * FROM my_table
WHERE field_id = '" . $field_id . "'"))
{
$obj = $result->fetch_object();
$my_field_id = $obj->field_id;
$my_field1 = $obj->field1;
$my_field2 = $obj->field2;
/* free result set */
$result->close();
}
Write to the database
$sql = mysqli('localhost','user','password','database');
$name = $_POST['name'];
$age = $_POST['age'];
$email = $_POST['email'];
$query = $sql->prepare("INSERT INTO `tablename`
VALUES ('?','?','?');");
$query->bind_param("sis",$name,$age,$email);
$query->execute();
Relationships in MySQL
Implemented using queries
SELECT * FROM table1, table2
WHERE table2.id = table1.hid
id field
12 Harry
13 Sally
14 Joe
15 Kirsty
id field hid
3232 sweets 12
3233 candy 12
3234 chocolate 12
3235 popcorn 13
3236 soup 13
table1 table2
Search in MySQL
Implemented using queries
SELECT * FROM table1, table2
WHERE table1.id = 12;
SELECT * FROM table1, table2
WHERE table1.field LIKE “%Joe%”
AND WHERE table2.id = table1.hid ;
Assessment
• You need to show that the candidate has
achieve all the Assessment Standards
• SDD Outcome 2 and ISDD Outcome 1 can be
assessed in the same exercise
• Alternative evidence can be gathered as part
of learning and teaching
• SDD Outcome 1 for part of this as well
Higher Assignment
• Assignment 1: Coding + Database (Diving
Championship – available now)
• Assignment 2: Server Side Scripting
– File handling
– Linear Search
– Server side scripting
– Online database integration
• Assignment 3: Client Side Scripting
– CSS
– Browser based
Blog: http://charlielove.org
Twitter: @charlie_love

Contenu connexe

Tendances

PHP language presentation
PHP language presentationPHP language presentation
PHP language presentationAnnujj Agrawaal
 
Website designing company_in_delhi_phpwebdevelopment
Website designing company_in_delhi_phpwebdevelopmentWebsite designing company_in_delhi_phpwebdevelopment
Website designing company_in_delhi_phpwebdevelopmentCss Founder
 
Synapse india reviews on php website development
Synapse india reviews on php website developmentSynapse india reviews on php website development
Synapse india reviews on php website developmentsaritasingh19866
 
Hbase Introduction
Hbase IntroductionHbase Introduction
Hbase IntroductionKim Yong-Duk
 
11 page-directive
11 page-directive11 page-directive
11 page-directivesnopteck
 
Software Development with Open Source
Software Development with Open SourceSoftware Development with Open Source
Software Development with Open SourceOpusVL
 
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Arun Gupta
 
Linux, Apache, Mysql, PHP
Linux, Apache, Mysql, PHPLinux, Apache, Mysql, PHP
Linux, Apache, Mysql, PHPwebhostingguy
 
WordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a FrameworkWordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a FrameworkExove
 
Sql abstract from_query
Sql abstract from_querySql abstract from_query
Sql abstract from_queryLaurent Dami
 
Vibe Custom Development
Vibe Custom DevelopmentVibe Custom Development
Vibe Custom DevelopmentGWAVA
 
Introduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingIntroduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingRobert Carr
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDBOpusVL
 
SilverStripe From a Developer's Perspective
SilverStripe From a Developer's PerspectiveSilverStripe From a Developer's Perspective
SilverStripe From a Developer's Perspectiveajshort
 
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)Laura Scott
 
Introduction_Web_Technologies
Introduction_Web_TechnologiesIntroduction_Web_Technologies
Introduction_Web_TechnologiesDeepak Raj
 

Tendances (20)

PHP language presentation
PHP language presentationPHP language presentation
PHP language presentation
 
Top ten-list
Top ten-listTop ten-list
Top ten-list
 
Website designing company_in_delhi_phpwebdevelopment
Website designing company_in_delhi_phpwebdevelopmentWebsite designing company_in_delhi_phpwebdevelopment
Website designing company_in_delhi_phpwebdevelopment
 
Synapse india reviews on php website development
Synapse india reviews on php website developmentSynapse india reviews on php website development
Synapse india reviews on php website development
 
Hbase Introduction
Hbase IntroductionHbase Introduction
Hbase Introduction
 
11 page-directive
11 page-directive11 page-directive
11 page-directive
 
Software Development with Open Source
Software Development with Open SourceSoftware Development with Open Source
Software Development with Open Source
 
Introduction to Monsoon PHP framework
Introduction to Monsoon PHP frameworkIntroduction to Monsoon PHP framework
Introduction to Monsoon PHP framework
 
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
Hyperproductive JSF 2.0 @ JavaOne Brazil 2010
 
19servlets
19servlets19servlets
19servlets
 
Linux, Apache, Mysql, PHP
Linux, Apache, Mysql, PHPLinux, Apache, Mysql, PHP
Linux, Apache, Mysql, PHP
 
WordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a FrameworkWordPress Café: Using WordPress as a Framework
WordPress Café: Using WordPress as a Framework
 
App auto crud
App auto crudApp auto crud
App auto crud
 
Sql abstract from_query
Sql abstract from_querySql abstract from_query
Sql abstract from_query
 
Vibe Custom Development
Vibe Custom DevelopmentVibe Custom Development
Vibe Custom Development
 
Introduction to Drupal (7) Theming
Introduction to Drupal (7) ThemingIntroduction to Drupal (7) Theming
Introduction to Drupal (7) Theming
 
Introduction to CouchDB
Introduction to CouchDBIntroduction to CouchDB
Introduction to CouchDB
 
SilverStripe From a Developer's Perspective
SilverStripe From a Developer's PerspectiveSilverStripe From a Developer's Perspective
SilverStripe From a Developer's Perspective
 
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
Grok Drupal (7) Theming (presented at DrupalCon San Francisco)
 
Introduction_Web_Technologies
Introduction_Web_TechnologiesIntroduction_Web_Technologies
Introduction_Web_Technologies
 

Similaire à Amp and higher computing science

LAB PHP Consolidated.ppt
LAB PHP Consolidated.pptLAB PHP Consolidated.ppt
LAB PHP Consolidated.pptYasirAhmad80
 
PHP Hypertext Preprocessor
PHP Hypertext PreprocessorPHP Hypertext Preprocessor
PHP Hypertext Preprocessoradeel990
 
nodejs_at_a_glance.ppt
nodejs_at_a_glance.pptnodejs_at_a_glance.ppt
nodejs_at_a_glance.pptWalaSidhom1
 
HackU PHP and Node.js
HackU PHP and Node.jsHackU PHP and Node.js
HackU PHP and Node.jssouridatta
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's CodeWildan Maulana
 
PHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHPPHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHPLariya Minhaz
 
phpwebdev.ppt
phpwebdev.pptphpwebdev.ppt
phpwebdev.pptrawaccess
 
Drupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp BratislavaDrupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp BratislavaGábor Hojtsy
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckrICh morrow
 
Rits Brown Bag - PHP & PHPMyAdmin
Rits Brown Bag - PHP & PHPMyAdminRits Brown Bag - PHP & PHPMyAdmin
Rits Brown Bag - PHP & PHPMyAdminRight IT Services
 
Drupal security
Drupal securityDrupal security
Drupal securityJozef Toth
 
How to develop Big Data Pipelines for Hadoop, by Costin Leau
How to develop Big Data Pipelines for Hadoop, by Costin LeauHow to develop Big Data Pipelines for Hadoop, by Costin Leau
How to develop Big Data Pipelines for Hadoop, by Costin LeauCodemotion
 

Similaire à Amp and higher computing science (20)

PHP and MySQL
PHP and MySQLPHP and MySQL
PHP and MySQL
 
LAB PHP Consolidated.ppt
LAB PHP Consolidated.pptLAB PHP Consolidated.ppt
LAB PHP Consolidated.ppt
 
Php with mysql ppt
Php with mysql pptPhp with mysql ppt
Php with mysql ppt
 
PHP Hypertext Preprocessor
PHP Hypertext PreprocessorPHP Hypertext Preprocessor
PHP Hypertext Preprocessor
 
nodejs_at_a_glance.ppt
nodejs_at_a_glance.pptnodejs_at_a_glance.ppt
nodejs_at_a_glance.ppt
 
HackU PHP and Node.js
HackU PHP and Node.jsHackU PHP and Node.js
HackU PHP and Node.js
 
Lecture 7: Server side programming
Lecture 7: Server side programmingLecture 7: Server side programming
Lecture 7: Server side programming
 
Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
Php intro
Php introPhp intro
Php intro
 
Exploring Symfony's Code
Exploring Symfony's CodeExploring Symfony's Code
Exploring Symfony's Code
 
Assetic (Zendcon)
Assetic (Zendcon)Assetic (Zendcon)
Assetic (Zendcon)
 
PHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHPPHP Unit-1 Introduction to PHP
PHP Unit-1 Introduction to PHP
 
phpwebdev.ppt
phpwebdev.pptphpwebdev.ppt
phpwebdev.ppt
 
Drupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp BratislavaDrupal Security from Drupalcamp Bratislava
Drupal Security from Drupalcamp Bratislava
 
Phphacku iitd
Phphacku iitdPhphacku iitd
Phphacku iitd
 
PHP from soup to nuts Course Deck
PHP from soup to nuts Course DeckPHP from soup to nuts Course Deck
PHP from soup to nuts Course Deck
 
Rits Brown Bag - PHP & PHPMyAdmin
Rits Brown Bag - PHP & PHPMyAdminRits Brown Bag - PHP & PHPMyAdmin
Rits Brown Bag - PHP & PHPMyAdmin
 
Drupal security
Drupal securityDrupal security
Drupal security
 
How to develop Big Data Pipelines for Hadoop, by Costin Leau
How to develop Big Data Pipelines for Hadoop, by Costin LeauHow to develop Big Data Pipelines for Hadoop, by Costin Leau
How to develop Big Data Pipelines for Hadoop, by Costin Leau
 

Dernier

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxDr. Sarita Anand
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and ModificationsMJDuyan
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxAmanpreet Kaur
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxEsquimalt MFRC
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdfssuserdda66b
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsKarakKing
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...pradhanghanshyam7136
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Association for Project Management
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 

Dernier (20)

How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptxHMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
HMCS Max Bernays Pre-Deployment Brief (May 2024).pptx
 
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdfVishram Singh - Textbook of Anatomy  Upper Limb and Thorax.. Volume 1 (1).pdf
Vishram Singh - Textbook of Anatomy Upper Limb and Thorax.. Volume 1 (1).pdf
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 

Amp and higher computing science

  • 1. Charlie Love Education Support Officer Aberdeen City Council @charlie_love
  • 2. Software development using Server- side scripting • an integrated approach to Higher Computing Science. • approaches to increase teaching time • reduce the assessment • strategies for integrated delivery blending components of the SDD and ISDD units • use contemporary web technologies: Apache/Mysql/PHP/JavaScript
  • 3. Higher Computing Science Software Design and Development Information Systems Design and Development Assessment
  • 4. Assessment Information Systems Design and Development Software Design and Development Integrating the delivery of units using a server side scripting language will increase teaching time and decrease time take for assessment
  • 6.
  • 7. Get *AMP on your computers • Education Scotland Blog post with information • http://glo.li/edscot-amp • MAMP • EasyPHP • XAMMP • WAMP • etc.
  • 8. Building solutions • Agile methodologies • Interative prototyping • Design->Build->Test->Repeat • Working code • Limited Feature Set -> Expanded Feature Set
  • 9. sub-programs/routines defined by their name and arguments (inputs and outputs) • PHP uses functions which typically return a single value. • Use of &parameter passes values by reference to the PHP function (essentially creating a subprogram)
  • 10. including parameter passing (value and reference, formal and actual) function read_users( $file, &$user_id, &$user_name, &$user_image, &$password_string, $index ) { $textline = fgets($file); $textarray = explode(',',$textline); $user_id[$index] = trim($textarray[0]) $user_name[$index] = trim($textarray[1]); $user_image[$index] = trim($textarray[2]); $password_string[$index] = trim($textarray[3]); }
  • 11. methods • methods are subroutines associated with an object • they have access to the objects data. • PHP includes support for object oriented programming • Use the MySQL API to show methods on database objects
  • 12. If ($result = $mysqli->query ("SELECT * FROM user WHERE user_id = '" . $login_user_id . "'")) { $obj = $result->fetch_object(); $user_id = $obj->user_id; $user_name = $obj->user_name; $user_image = $obj->user_image; $result->close();}
  • 13. Data types and structures • string • numeric (integer and real) • Boolean $mysting=“Some text”; $integer = 12; $real =15.232; $is_set = true;
  • 14. • Records - Implement as an array of objects class Owner { public $year; public $measure; public $month; public $name; } $names = array('Lars', 'James', 'Kirk', 'Robert'); for ($i = 1 ; $i <= 3 ; $i++) { $owner = new Owner(); $owner->year = 2012; $owner->measure = $i; $owner->month = rand(1,12); $owner->name = array_rand($names); $owners[] = $owner; }
  • 15. • sequential files (open, create, read, write, close) • fopen(filename, mode) – Creates and/or opens file – Mode is read and/or write and moves file pointer to start or end of file. – http://www.php.net/manual/en/function.fopen.p hp • fwrite($file, $textline); – $file is the file handle from opening the file – $textline is the line of text to be written • fgets($file) – Reads line of text from the file • fclose($file) – close file
  • 16. Standard Algorithms • input validation (server side) / server-side validation of online form data – Set up form in html – Process and validate form on submission – Processing happens at server – User interaction is required to create validation loop
  • 17. <?php $username="”; if (isset($_GET[’username'])) { $error_found = false; $message = "username is accepted”; $username = $_GET[’username’]; if(strlen($username) < 8 ) { $error_found = true; $message = “Enter 8 or more characters”; } echo "<div>" . $message . "</div>"; } if (($error_found) || (!isset($error_found))) { //show form if err found or 1st visit ?> <form action="<?php echo $_SERVER[‘PHP_SELF’];?>" method="get"> <input type="text" name="username" value="<?php echo $username;?>"> <input type="submit" value="Submit" name="update"/> </form> <? php } ?>
  • 18. Linear search • linear search function linear_search($needle, $haystack) { for($i = 0; $i < count($haystack); $i++) { if ($needle == $i) return true; } return false; } $haystack = array(1,2,3,4); $needle = 3; $found = linear_search($needle, $haystack);
  • 19. Finding minimum and maximum Inbuilt max and min functions do it out of the box function findmax($array_of_values) { $current_max = $array_of_values[0]; for($i = 1; $i < count($array_of_values); $i++) { if ($array_of_values[$i] > $current_max) { $current_max = $array_of_values[$i]; } } return $current_max; } $my_array= array(12,25,23,14); $biggest_number = findmax($my_array);
  • 20. count occurrences function count_values($val_to_count, $array_of_values) { $counter = 0; for($i = 0; $i < count($array_of_values); $i++) { if ($array_of_values[$i] == $val_to_count) { $counter++; } } return $counter; } $my_array= array(12,25,23,14,72,83,12,12,63,25,14); $count_of_values = count_values(12, $my_array);
  • 21. Coding (ISDD) • scripting (database/web pages) • client-side scripting • server-side scripting • server-side validation of online form data
  • 22. Structures and Links (Database) • MySQL • phpMyAdmin - Database front end – Can be used to generate SQL for coding – Web based – simplifies database management
  • 23.
  • 24. Structures and Links (Web) • PHP, HTML, CSS, JavaScript all play well together <html> <head> <title><?php echo $title;></title> <style> hr {color:sienna;} p {margin-left:20px;} body {background-image:url(“bg.gif");} </style> <script> function show_message() { alert(“hello there”); } </script> <body onLoad=“show_message();”> ….
  • 25. PHP and MySQL //connect to the database using mysqli API $mysqli = new mysqli("localhost", "root", "root", ”mydatabase"); if ($mysqli->connect_errno) { echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error; die; }
  • 26. Run a query and retrieve results if ($result = $mysqli->query("SELECT * FROM my_table WHERE field_id = '" . $field_id . "'")) { $obj = $result->fetch_object(); $my_field_id = $obj->field_id; $my_field1 = $obj->field1; $my_field2 = $obj->field2; /* free result set */ $result->close(); }
  • 27. Write to the database $sql = mysqli('localhost','user','password','database'); $name = $_POST['name']; $age = $_POST['age']; $email = $_POST['email']; $query = $sql->prepare("INSERT INTO `tablename` VALUES ('?','?','?');"); $query->bind_param("sis",$name,$age,$email); $query->execute();
  • 28. Relationships in MySQL Implemented using queries SELECT * FROM table1, table2 WHERE table2.id = table1.hid id field 12 Harry 13 Sally 14 Joe 15 Kirsty id field hid 3232 sweets 12 3233 candy 12 3234 chocolate 12 3235 popcorn 13 3236 soup 13 table1 table2
  • 29. Search in MySQL Implemented using queries SELECT * FROM table1, table2 WHERE table1.id = 12; SELECT * FROM table1, table2 WHERE table1.field LIKE “%Joe%” AND WHERE table2.id = table1.hid ;
  • 30. Assessment • You need to show that the candidate has achieve all the Assessment Standards • SDD Outcome 2 and ISDD Outcome 1 can be assessed in the same exercise • Alternative evidence can be gathered as part of learning and teaching • SDD Outcome 1 for part of this as well
  • 31. Higher Assignment • Assignment 1: Coding + Database (Diving Championship – available now) • Assignment 2: Server Side Scripting – File handling – Linear Search – Server side scripting – Online database integration • Assignment 3: Client Side Scripting – CSS – Browser based

Notes de l'éditeur

  1. Go mobile with Glow What works well, what needs to get better Did you know Glow did this…?
  2.  functions  procedures
  3. Loosely types – have to accept in exam
  4. Follow me on Twitter. Thank you for your time today.