Wednesday, 13 December 2006

Week 12 - term one wrapup

There will be a lecture as usual on Friday. In this lecture, I will provide some general feedback on the assignment whilst it is fresh (burnt in?) in your minds. I will also go over the normalisation exercise which was left incomplete 3 lectures ago.

I will then introduce an exercise for the tutorial which uses PHP to process XML files and XML from a remote weather site. I think you will find this exercise simple but surprisingly powerful.

Finally we will have a poll to judge the best of the photo album sites. Make sure you bring your mobile phones because we will be using a SMS-enabled application to do this. There will a small prize for the best site.

MP3 lecture recordings

In addition to the slides and example material, the last two lectures have accompanying recordings which might be helpful, despite the ums and erhs and the poor referencing from speech to slides, if you missed either or both of the last two lectures. Please let me know if you find these resources helpful.

Friday, 8 December 2006

Course work

I have added links to the group list to each of your mini Flickr implementations. I will be awarding a prize for the entry judged to be the best by us and you, so I encourage you to take a look at these some time in the next few days.

Week 11 - Moving from tables to Trees

In this session, I continue the work on tree structures by looking at the difference between table and tree structures as represented in XML format. We will look at some of the motivation behind the use of XML, in particular the problems with complex relational systems, the problem of data interchange and the emerging XML technologies.

Friday, 1 December 2006

Week 10 - Trees , the DOM and AJAX

This week we will look at another key data structure, the tree . Tree structures are found in many places in computing, incuding filesystems and the structure of documents. We will look at some general aspects of trees and then look at how one tree, the DOM (Document Object Model) in a browser, can be accessed and updated using Javascript. The example we look at also uses a different client-server communication model called AJAX.

Monday, 27 November 2006

New , Improved Blog

I have moved the DSA blog to the new Beta-Blogger. This provides for tagging of blog entries and an improved user interface which I hope will assist you all.

The announcements on UWEOnline are based on a feed from this blog. The order is oddly different from the entries in the blog itself due to the order in which entries where actually created. Publish

Week 9 - Managing short lived data

This week we look at modelling and storing data associated with the interaction between user and machine, including the use of cookies and sessions, and finishing with Associative arrays

Friday, 17 November 2006

Week 8 - One thing in one place

This week's lecture deals with the issue of normalisation in data and code.

Friday, 10 November 2006

Week 7 - Browser- Server interaction with PHP

The slides for this lecture describe how to use forms and sticky forms with PHP. Here are the full set of examples. Note that in this code, the parameters are referenced directly as PHP variables, rather than using the $_REQUEST array in the album code. This approach is usable but depreciated ( i.e. you are advised not to use it). Most (All?) commercial hosting sites will require the more wordy but more secure approach.

I have also adapted a tutorial from the WebMonkey site and added some advice on how to use PHP at home, paying special attention to how to secure your server which is very important.

Tuesday, 31 October 2006

Week 6 - 3-tier and PHP

We now move on to looking at how a web application can be developed using PHP and MySQL. The example we provide is some basic code for a photo album. This includes example code for the basic operations

Powerpoint Slides

see the PHP entry in this Blog for information and resources on PHP

Examples of PHP scripting

Saturday, 28 October 2006

Simple Album code

Here is a very basic photo album application implemented in PHP and MySQL with all sources in this zip file.

There is sample PHP code for doing some of the basic tasks in this application:
  • creating a member
  • editing a members details
  • adding a photograph
  • displaying photos
This implementation is very basic and you should identify shortcomings, select those that you will want to repair or new functionality to be added and then extend this base code (or write your own from scratch) .

I''ve made a few minor improvements to the sample code handed out in class:
  • A few more comments
  • Changed from $_GET[] to $_REQUEST[] as the array from which form data is accessed. This array includes data sent from a form either as method='get' or method='post'. Use get during testing and switch to post if necessary in production
  • dropped the MYSQL_ASSOC parameter - it's not necessary

Friday, 27 October 2006

Group Allocations

Here are the group allocations for the first assessment - if you are not down here and on the course it is very important that you attend the tutorial on the 3rd of November to be assigned a group.

Group A: Michael Wiggins, Phil Neath, James Hanson, Farhan Maswood (4) - Phototurk
Group B: Keir Moffat, Carl Webster, Adam Barnwell (3) - Ticklr
Group C: Craig Sperrings, Alistair Philipps, Mike Cox, Gurdev Singh (4) - Lil Flickr
Group D: Harpal Singh, Tom Piccarilli, Jay Pick, Luke Taylor (4) -
Group E: Nikki Mackenzie, Ian Wingfield, Fahmida Noor, Nitendra Gurung (4) - Photoshare
Group F: Jessie Owen, Tyra Yu Zhang, Tom Lopez, Gary Herbert (4) - Flipr
Group G: David Wilson, Iain Rose, Nathan Agland, Mathew Tanner (4) - Flickd
Group H: Chris Cutler, Jason Brady, Craig Poole, John Paul Vargheese (4) - Picture Perfect
Group I: Joe Lam, Elspeth Limer, Ady Harold, Charles Lindores (4) - Fickr

Thursday, 26 October 2006

Week 5 - ERM to RDBMS

Conversion of an ERM to a Relational Database using QSEE

Friday, 20 October 2006


MySQL is installed for student use on the host 'shares', a Unix server accessible only from within the UWE domain. The current version is 4.0.13.

Each student has one database, with the same name as their UNIX username. All tables must be created in this database. Login with the UNIX username and original UNIX password. Get it reset by the help desk if you can't recall what this password is.

You can access the database in either of two ways:
  • Using the web client PHPMyAdmin:
    • This GUI interface allows you to browse, edit, create and modify tables. However, since we are using QSEE to generate code, this will not be so helpful although a file of SQL commands can also be executed.
  • By logging in directly to the server for example, using Putty and starting the SQL command line interpretor (CLI).
    • e.g to start: >mysql - u cjwallac -ppasssword
    • to execute a file of SQL commands use the source command : source 'filename'
  • Table names on the version of MySQL running on the host 'shares' are case sensitive because this a Unix server. Take care when developing on Windows because case is not signicant so code may work on your own machine but not when installed at UWE.
  • The SQL generated from QSEE will cause errors when loaded using PHPMyAdmin due problems with comment lines with no space after --. You must also ensure that there is a use statement at the beginning. To overcome these problems you must edit the generated code. The mysql CLI is not so fussy and thus easier to use.
  • auto_increment is not settable in QSEE so this will need to be set separately. One approach is to define such changes in a separate file of Alter Commands for example:
    • alter table photo
      modify photoid int auto_increment;


PHP links


The current version in CEMS is PHP5.

There are three servers with slighly different PHP configurations.
  • - a PHP script will run either on web02 for students or web03 for staff. PHP on these servers has error reporting turned off. For students, www is only accessible if a request has been approved to permit access.
  • - error reporting is turned on. You should use this server for all development. isa is only available within UWE
  • is an older server and runs PHP4
You can check the PHP configuration: isa, www, stocks

  • Put all php scripts in a suitable subdirectory of your public_html account on the UNIX server (in the nas folder)
  • To execute a php script, use a URL of the form
  • Use the 'isa' host for all development.
  • You need a line editor like PFE32 so that when an error references a line number, you can find that line in the editor. (we need a better editor - suggestions?)
  • Beware of the slight time lag between editing a script via Windows and the same changed script being executed on the relevant UNIX server.
  • Use the $_REQUEST array to access both get and post variables. Use method="get" when testing - it's much easier to detect errors if you can see the values being passed from the browser on the command line. You can also bookmark a URL so a test can be repreated without having to enter the data again. You will also need to use 'get' when a deep link is created, for example in the Album code to fetch a a JPEG.
  • You can get a php script to display nicely using a suffix of .phps. This can help spot missing quotes or brackets. In my examples I create a symbolic link in Unix to the .php file itself. Beware of exposing passwords to your MySQL account if you do this - place connection details in a separate file which can be placed above the web accessible pages in public_html.
  • Larry Ullman, PHP and MySQL for Dynamic Web Sites, Peachpit Press ISBN 0321336577
  • Luke Welling and Laura Thomson, PHP and MySQL Web Development, Sams Publishing. ISBN 0672326728
  • Leon Atkinson, Core PHP Programming, Prentice Hall , 2001

Week 4 Abstraction layers

This week we move up the abstraction layers to look at conceptual modelling. In particular we look at Entity-Relationship Modelling (ERM) and the use of a case tool QSEE which we will use. Shortly the emphasis will be on using QSEE to create a Relational database, but at present we will use QSEE to record our understanding of the underlying data structures required to support Flickr.

In the tutorial we will be forming groups to undertake the first coursework. These groups will be selected to get a mixing of backgrounds and technical skills.

To get the basic use of QSEE sorted, you will be using this package to diagram the KML folder description from the lecture.

  • A Folder has a name and contains zero, one or more PlaceMarks and some Styles
  • A Placemark has attributes of :
    • A name
    • A description
    • A position defined by its longitude, latitude and Altitude, each represented by a signed decimal number
  • Each Placemark belongs tojust one Folder
  • A Style defines the appearance of one or more placemarks
    • the symbol to show as a jpeg image
    • the size,
    • the foreground and background colours.
  • Each Placemark has a Style
The QSEE package includes some excellent help files and examples and I have supplemented this with some additional notes. We expect that you will use QSEE to document your understanding of the Flickr application before using it in a model-driven mode to create your own version of Flickr.

Sunday, 15 October 2006

Coursework 1

The specification for the first coursework, a group project, is here and hard-copies were handed out in lectures some weeks ago.

Groups have been created.

Sample PHP code to demonstrate how to do the basic operations is provided, as is guidance on the use of PHP and MySQL in CEMS.

Thursday, 12 October 2006

Week 3 - Logical Data Models and the relational model

Now we move up the layers to look at how data is represented logically, in particular as relations, the basic ideas behind the relational database and MySQL as a typical implementation.

In the tutorial, you will be starting the SQL workbook.

Thursday, 5 October 2006

ITMB lecture

There will be a lecture (video-cast) by Toby Thurston, an Information Architect with IBM on Tuesday 10th October form 16:45 to 18:00 in 1N5.

More infomation is on the flyer.

This should be very relevant to the Multimedia students.


Actually, my mistake, Toby was an IT Architect, which covers the overall system architecture.

Week 2 - Abstraction layers

In week 2 we will be looking at the idea of layers of abstraction. To illustrate the benefits of abstraction, we will spend some time looking at the physical layer and how to delve into it by looking at the Exif data in JPEG files.

In the workshop you will use the hex editor to explore other JPEG files and to unpick MP3 ID3 metadata. Progress on the Flickr review will also be checked.

Saturday, 30 September 2006

Background Questionnaire

This background Questionnaire is an attempt to find out something about your preparation for this module in previous modules.