Mobile App Development Mobile App Development Tools Nic Shulver, FCES, Staffordshire University A discussion and demonstration of AppInventor2 and PHP.

Slides:



Advertisements
Similar presentations
Batches, Buckets and Bookbags Elizabeth B. Thomsen NOBLE: North of Boston Library Exchange EGILS2014.
Advertisements

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
Tutorial 6 Creating a Web Form
Pre-defined System Functions Simple IF & VLOOKUP.
Aim: Use the given examples to record examples and our own ideas in our journal 1.Write technical examples in journal and/or participate in full.
1 Chapter 12 Working With Access 2000 on the Internet.
1 The World Wide Web. 2  Web Fundamentals  Pages are defined by the Hypertext Markup Language (HTML) and contain text, graphics, audio, video and software.
Chapter 7 Managing Data Sources. ASP.NET 2.0, Third Edition2.
Computer Science 101 Web Access to Databases Overview of Web Access to Databases.
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
With Alex Conger – President of Webmajik.com FrontPage 2002 Level I (Intro & Training) FrontPage 2002 Level I (Intro & Training)
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
PHP and HTML PHP: Hypertext Preprocessor Scripting at the server end allows for page customisation. Javascript may be used to make pages more interactive.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
NETWORK CENTRIC COMPUTING (With included EMBEDDED SYSTEMS)
Introduction to PHP and Server Side Technology. Slide 2 PHP History Created in 1995 PHP 5.0 is the current version It’s been around since 2004.
Advanced Web 2012 Lecture 4 Sean Costain PHP Sean Costain 2012 What is PHP? PHP is a widely-used general-purpose scripting language that is especially.
Additional Topics. Tutorial #9 Review – Forms Forms Legend and fieldset Fields Text Password Radio buttons, check box, text area, select lists Buttons.
ITD 3194 Web Application Development Chapter 4: Web Programming Language.
Create an online booking system (login/registration)
Server-side Scripting Powering the webs favourite services.
4-1 INTERNET DATABASE CONNECTOR Colorado Technical University IT420 Tim Peterson.
Making ODBC easier By Dave Doulton University of Southampton.
Introduction to InfoSec – Recitation 7 Nir Krakowski (nirkrako at post.tau.ac.il) Itamar Gilad (itamargi at post.tau.ac.il)
Nic Shulver, Retrieving Stored Data Introduction This set of slides shows: The information source database structure The data.
Nic Shulver, Retrieving Stored Data Introduction This set of slides shows: The information source database structure The data.
MySQL + PHP.  Introduction Before you actually start building your database scripts, you must have a database to place information into and read it from.
1 MySQL and phpMyAdmin. 2 Navigate to and log on (username: pmadmin)
1 PHP and MySQL. 2 Topics  Querying Data with PHP  User-Driven Querying  Writing Data with PHP and MySQL PHP and MySQL.
London April 2005 London April 2005 Creating Eyeblaster Ads The Rich Media Platform The Rich Media Platform Eyeblaster.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
LiveCycle Data Services Introduction Part 2. Part 2? This is the second in our series on LiveCycle Data Services. If you missed our first presentation,
PHP meets MySQL.
_______________________________________________________________________________________________________________ PHP Bible, 2 nd Edition1  Wiley and the.
Introduction to MySQL Lab no. 10 Advance Database Management System.
Creating Dynamic Web Pages Using PHP and MySQL CS 320.
PHP and MySQL CS How Web Site Architectures Work  User’s browser sends HTTP request.  The request may be a form where the action is to call PHP.
PHP Part 2.
Putting it all together Dynamic Data Base Access Norman White Stern School of Business.
PowerBuilder Online Courses - by Prasad Bodepudi
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Website Development with PHP and MySQL Saving Data.
1 Chapter 9 – Cookies, Sessions, FTP, and More spring into PHP 5 by Steven Holzner Slides were developed by Jack Davis College of Information Science.
© Anselm Spoerri Web Design Information Visualization Course Prof. Anselm Spoerri
Creating PHPs to Insert, Update, and Delete Data CS 320.
Dynamic web content HTTP and HTML: Berners-Lee’s Basics.
CSE 154 LECTURE 5: INTRO TO PHP. URLs and web servers usually when you type a URL in your browser: your computer looks up the.
Enterprise PHP – Reading Data from a DB Reading Data from a relational database in PHP Nic Shulver, FCES, Staffordshire University Using the SQLi interface.
PHP getting data from a MySQL database. Replacing XML as data source with MySQL Previously we obtained the data about the training session from an XML.
Creating a simple database This shows you how to set up a database using PHPMyAdmin (installed with WAMP)
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
Windows 7 WampServer 2.1 MySQL PHP 5.3 Script Apache Server User Record or Select Media Upload to Internet Return URL Forward URL Create.
Higher Computing Science Coding the Web: HTML, JavaScript, PHP and MySQL.
Fundamentals of Web DevelopmentRandy Connolly and Ricardo HoarFundamentals of Web DevelopmentRandy Connolly and Ricardo Hoar Fundamentals of Web DevelopmentRandy.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
: Information Retrieval อาจารย์ ธีภากรณ์ นฤมาณนลิณี
Tutorial 6 Creating a Web Form
PHP: Further Skills 02 By Trevor Adams. Topics covered Persistence What is it? Why do we need it? Basic Persistence Hidden form fields Query strings Cookies.
/16 Final Project Report By Facializer Team Final Project Report Eagle, Leo, Bessie, Five, Evan Dan, Kyle, Ben, Caleb.
Radoslav Georgiev Telerik Corporation
Lawson Mid-America User Group Spring 2016 Meeting.
A little PHP. Enter the simple HTML code seen below.
Lesson 11: Web Services and API's
Using AppInventor2 for teaching
Azure Machine Learning & ML Studio
MVC Framework, in general.
Please thank our sponsors!
PHP Forms and Databases.
Presentation transcript:

Mobile App Development Mobile App Development Tools Nic Shulver, FCES, Staffordshire University A discussion and demonstration of AppInventor2 and PHP.

Mobile App Development AppInventor2 and PHP Nic Shulver, FCES, Staffordshire University AppInventor2 has the a couple of ways to access server-side scripts One is the Connectivity / Web component (another is the User Interface / WebViewer) We set the URL field of a Web component to the address of a PHP script When we do “Call Web1.PostText” in our code blocks, it calls the PHP

Mobile App Development AppInventor2 and PHP Nic Shulver, FCES, Staffordshire University The best part of using “Web.PostText” is that the PHP script sees the request in exactly the same format as for an HTTP Form So if you can write PHP and call it from a form on a web page, you can use it with AppInventor2 It’s a good idea to debug your PHP via a web form before connecting it to AppInventor2

Mobile App Development Designer Nic Shulver, FCES, Staffordshire University Note the “Url” field of the Web1 component Simple “form”- like page Just a one-page example

Mobile App Development Blocks Nic Shulver, FCES, Staffordshire University Just two blocks of code Click -> call the PHP with some parameters When the PHP replies (later…) we grab the response text

Mobile App Development AppInventor and PHP Nic Shulver, FCES, Staffordshire University Simplest test PHP ever? <?php // for the server connection demo using an Android app if(isset($_REQUEST["p1"])) {$p1 = $_REQUEST["p1"]; $p2 = $_REQUEST["p2"]; echo "Testing!: $p1, $p2";// just reflects back what we put in! } ?>

Mobile App Development More complex demo Nic Shulver, FCES, Staffordshire University The second example has these features: PHP script with multiple inputs PHP script with database access PHP script with “Comma Separated Value” (CSV) output AI2 Web, Slider and Spinner control usage AI2 output to a Canvas AI2 parsing a CSV formatted record set AI2 blocks: Lists and Procedures

Mobile App Development Colour Picker Demo Nic Shulver, FCES, Staffordshire University The demo application uses three sliders to choose a colour (RGB) The colour data is matched by a SQL statement and any similar named colours are reported The “named colours” are the 147 individually named colours available in CSS, JS, X-Windows

Mobile App Development Search size Nic Shulver, FCES, Staffordshire University The “search size” specifies the size of the cube in RGB colour-space that will be searched by the SQL query It looks for red, green and blue values that are +/- the search size from the specified colour So if red is 200 and search size is 8, it allows matches to red values in the range

Mobile App Development Worst case Nic Shulver, FCES, Staffordshire University There are a lot of similar colours in one part of the colour space! The app works in real time Although it works well it’s not finished It would be nice to see the RGB value as well as the name And not clip off the longest names!

Mobile App Development Colour data table Nic Shulver, FCES, Staffordshire University The database: just a table called tblColour Fields holding the name and the red, green and blue values for that colour There are 141 colours in this table idtcNametcRtcGtcB 4aliceblue antiquewhite aqua0255 7aquamarine azure beige bisque black000 12blanchedalmond blue blueviolet brown burlywood cadetblue

Mobile App Development Colour Finder demo Nic Shulver, FCES, Staffordshire University When the sliders or the search size spinner are used, we query the database The PHP script is given the red, green, blue and size numbers

Mobile App Development Colour Finder demo Nic Shulver, FCES, Staffordshire University When the CSV data set arrives, we clear the canvas And draw grey stripes on the background

Mobile App Development Colour Finder demo Nic Shulver, FCES, Staffordshire University We make a row variable We convert the CSV into a list of lists We grab the 1 st item of a sublist (record) and print it

Mobile App Development Colour Finder demo Nic Shulver, FCES, Staffordshire University We use the r, g and b values to draw a block of colour Row by row…

Mobile App Development Colour Finder demo Nic Shulver, FCES, Staffordshire University <?php if(isset($_REQUEST['red'])) { // gets the data from the form $red = intval(0 + $_REQUEST['red'], 10); $grn = intval(0 + $_REQUEST['green'], 10); $blu = intval(0 + $_REQUEST['blue'], 10); $nStep = $_REQUEST['step']; Our PHP is pretty simple and can be broken down into four sections. The first section gets the parameters sent by AppInventor2.

Mobile App Development Colour Finder demo Nic Shulver, FCES, Staffordshire University // builds ranges for SQL range test (so we can get approximate matches) $r0 = $red-$nStep; $r1 = $red+$nStep; $g0 = $grn-$nStep; $g1 = $grn+$nStep; $b0 = $blu-$nStep; $b1 = $blu+$nStep; We are building some +/- values for the search to match non-exact colours.

Mobile App Development Colour Finder demo Nic Shulver, FCES, Staffordshire University $id = "dsa"; // connects to the database as DSA $mysqli = new mysqli("web.fcet.staffs.ac.uk", $id, $id, $id) or die ("It's dead, Jim"); // looks for similar colours $sql = "SELECT tcName, tcR, tcG, tcB from tblColour WHERE tcR BETWEEN $r0 AND $r1 AND tcG BETWEEN $g0 AND $g1 AND tcB BETWEEN $b0 AND $b1 order by tcName ASC"; A long but simple SQL statement – it does all the hard work for us!

Mobile App Development Colour Finder demo Nic Shulver, FCES, Staffordshire University echo "Search,$red,$grn,$blu\n"; $rs = $mysqli->query($sql); while($row = $rs->fetch_assoc()) { $name = $row['tcName']; $r = $row['tcR']; $g = $row['tcG']; $b = $row['tcB']; echo "$name,$r,$g,$b\n"; } Reports back the search colour as the first record, so there is always at least one record returned. Then formats up any matches and outputs them too. Note the simple, natural comma-separated format (CSV).

Mobile App Development Conclusion Nic Shulver, FCES, Staffordshire University That’s about it! We have seen the user interface, blocks code and PHP for a non-trivial example The example uses multiple controls, graphical output and CSV parsing The PHP is simple but effective, the hard work is done by the SQL statement

Mobile App Development Links App Inventor Named Colours Named Colours Nic Shulver, FCES, Staffordshire University