I have added new revision pages to the Higher and National 5 areas, they will be finished over the next couple of days. These pages will contain links to revision posts as well as other revision material and class notes. I will in the future add an area for the BGE and National 4 courses.
rtf – Rich Text Format, text and formatting stored, new standard allow for the storing of embedded images.
Audio:
wav – uncompressed audio
mp3 – compressed audio
Graphics:
jpeg – used for photographs due to strong compression
bmp – uncompressed
gif – used for animations and drawings, few colours
png – compressed with partial transparency.
Video:
mp4 – compressed
avi – uncompressed
Pdf: Portable Document Format – used to retain the look and format of a document across difference platforms. Document always looks the same regardless of screen size, fonts etc.
Factors affecting file size and quality
Resolution – the number of pixels used to make up the picture.
Colour Depth – the number of possible colours used to make up a pixel. The more possible colours the greater the file size.
Sampling Rate – in sound files the number of recordings taken per second., the greater the sample rate the higher the quality and file size.
Calculation of file size for colour bitmap.
Horizontal Pixels = image width x resolution(DPI)
Vertical Pixels = image height x resolution(DPI)
Number of pixels = Horizontal Pixels x Vertical Pixels
File Size = Number of pixels x colour depth (in bits)
Example 1
This is enlarged but is 1 inch by 1 inch.
In that case there are 72 x 1 x 72 x 1 = 5184 pixels
Example 2
Bitmap with a resolution of 600×600 pixels in 8 bit colour.
Storage requirements
600 x 600 x 1 bytes = 360000 It is 1 byte as it is 8 bits per pixel 360000/1024 = 351.6 kilobytes
Example 3
Calculate the number of pixels in 4 inch by 5 inch photograph scanned which has a resolution of 600 dots per inch.
Pixels = 4 x 600 x 5 x 600 = 7,200,000 bits 7,200,000 / 8 = 90000 bytes 90000 bytes / 1024 = 878.9 Kb
Vector Graphics
It is possible to edit each object separately, for example, change the shape, colour, size and position.
Even if an object in a vector graphic is quite large, it doesn’t need a lot of computer memory. Therefore the file size of a vector graphic is often very small.
Vector graphics are scalable when you resize them, they do not lose quality.
Need for compression – reduces the file size so that the web page loads more quickly. Reducing bit depth has the same impact. Quality of the image is affected.
Appropriate use of compression can reduce file sizes.
Small file sizes can be transmitted and processed more quickly.
For example, a whole webpage can be compressed, reducing the amount of data which has to be sent to the client computer and therefore reducing the load time. The browser will decompress the page before displaying it.
Individual media elements audio, graphics and video within the webpage could also be compressed in order to reduce the size further.
Lossless compression reduces file sizes without removing any data.
Lossy compression reduces file sizes by removing some data.
Audio Formats
MP3 (.mp3) Lossy compression
Removes the very high or low frequencies that humans cannot hear.
When two similar sounds (but different volume) occur at the same time, removing the quieter one.
User can choose the level of compression.
A full compression MP3 compresses data to around 10% of the original size, with relatively little loss of quality.
Audio File Size Calculations
To calculate the file size (in bits) of an uncompressed audio file the basic formula is:
sample frequency (Hz) x sample depth (bits) x length (seconds) x number of channels
Sample frequency is the number of times per second that a sample of the original sound was taken.
1 Hz = once every second. 1 KHz = 1000 times every second.
Sample depth is the number of bits that were used to store each sample.
Length of sound should always be converted into seconds if necessary.
Number of channels is typically 1 (mono) or 2 (stereo), although it could be more for a surround sound file.
Calculate the file size of a mono voice recording captured at 24KHz with a sample depth of 8 bits, lasting for 15 seconds.
24000 x 8 x 15 x 1 = 2880000 bits 2880000 / 8 = 360000 bytes 360000 / 1024 = 351.56 KB
Graphic Formats
JPEG (.jpg) Lossy compression
24 bit colour.
Allows the user to select an appropriate level of compression.
JPEG is a good compression format for high-quality images and images where quality is unimportant (e.g. thumbnails).
PNG (.png) Lossless compression
Intended to improve upon GIF format.
24 bit colour.
Allows user to set alpha level for improved transparency.
GIF (.gif) Lossless compression • Restricted to 8 bit colour.
Uses LZW algorithm to compress data.
Several images can be stored in one GIF file, allowing for animation.
Allows a specific colour in an image to be made transparent.
GIF is a good compression format for images with areas of flat colour, images that have few colours, animated images or images that require transparency.
RLE (Run Length Encoding) is a lossless compression algorithm.
It works by taking runs of the same colour and storing them as two numbers: how many pixels and colour code of this run of pixels.
RLE works best for images with large blocks of the same colour.
If an image has many different colours (e.g. a photo) RLE could potentially end up increasing the file size!
LZW (Lempel Ziv Welch) is a lossless compression method which is more effective than RLE.
It works by looking for repeated patterns of bits within data, stores them in a dictionary, then replaces them with references to the dictionary.
Indexed colour involves storing the actual RGB codes used by the image in a separate colour palette, in order to reduce file size. This can be used as a compression technique where the bit depth of the graphic is less than 24.
Graphic file size calculations
To calculate the file size (in bits) of a bitmap graphic file the basic formula is:
number of pixels in image x bit depth
Bit depth or colour depth is the number of bits that were used to store the colour of each pixel.
Example 1
Calculate the file size of a 400 x 400 pixel graphic with a colour depth of 24.
400 x 400 = 160000 pixels in the image 160000 x 24 = 3840000 bits 3840000 / 8 = 480000 bytes 480000 / 1024 = 468.75 KB
Example 2
Calculate the file size of a 300 x 200 graphic with 256 colours.
256 colours means a colour depth of 8 (because 28 = 256)
300 x 200 = 60000 pixels in the image 60000 x 8 = 480000 bits 480000 / 8 = 60000 bytes 60000 / 1024 = 58.6 KB
Example 3
Calculate the file size of a 6’ x 5’ image, scanned at 200dpi, with 16 bit colour.
6 x 5 x 200 x 200 = 1200000 pixels in image 1200000 x 16 = 19200000 bits 19200000 / 8 = 2400000 bytes 2400000 / 1024 = 2343.75 KB 2343.75 / 1024 = 2.3 MB
Video Formats
MPEG (.mp4) Lossy compression
The level of compression can be determined by the user.
Key frames (individual still images) are compressed and stored as JPEGs – generally only one full frame in every 8 to 24 frames needs to be stored.
Any data that stays the same beyond the key frame does not need to be stored. Changes to the image in each subsequent frame are then stored.
AVI (.avi) No compression built-in
Limited to 320 x 240 resolution
Limited to 30 frames per second
Can take up a large amount of storage space and can be quite RAM intensive.
Video file size calculations
To calculate the file size (in bits) of an uncompressed video file the basic formula is:
number of pixels in frame x bit depth x frame rate (fps) x length of video (in seconds)
A video is simply a series of bitmap images, so this rule simply multiplies the size of one image by the number of images in the video.
Calculate the file size of a 300 x 250 pixel video, using 16 bit colour, 30 frames per second and lasting 30 seconds.
300 x 250 = 75000 pixels 75000 x 16 = 1200000 bits for 1 image 1200000 x 30 = 36000000 bits for 1 second of video 36000000 x 30 = 1080000000 bits for entire video /8 = 135000000 bytes /1024 = 131835.94 KB /1024 = 128.75 MB
Thank you to C O’Toole & A Madill from Braidhurst High School for allowing me to edit and publish this here.
A database is a collection of data stored in a structured, organised manner.
Flat file databases
A flat file database has all data is contained in one file (a table or entity).
Data is organised into fields (columns or attributes) and records (rows or occurrences).
Field Types
Basic field types include: text, numeric, date, time.
Other field types include:
Object (a container) – can contain graphic, audio, video, etc.
Link – contains a hyperlink.
Calculation – contains a formula to calculate its contents from other data in the record. Automatic calculation of data reduces the chance of human error.
Boolean – stores Yes/No or True/False.
Summary – calculates data based on data from multiple records in database. For example, totals up the contents of a particular field across all records.
Relational Databases
Relational databases have two or more files linked together. Using linked tables reduces unnecessary duplication of data, therefore reducing the opportunity for error.
Good database design avoids data duplication by using linked tables where appropriate and reduces errors in data entry by using suitable validation techniques.
Relationships
There are 3 types of relationships between tables in a relational database.
One-to-one (1:1)
One record in the first table can only link to exactly one record in the second table.
One-to-one relationships are rarely used, except as a means of splitting up a large, unwieldy table or treating part of a table differently (e.g. keeping some fields secure).
Example
In a database with a Customer Details table linked to an Account Details table – one customer can only have one account, and vice versa.
However, the Customer Details table can be made available to all staff whilst the Account Details table could only be available to senior staff.
One-to-many (1:M)
One record in the first table can link to two or more records in the second table.
Each record in the second table can only be linked to exactly one record in the first table.
Example
In a database with a Customers table linked to a Tickets table – one customer can have many tickets, but each ticket may only have one customer.
Many-to-many (M:M)
One record in the first table can link to two or more records in the second table.
One record in the second table can also link to two or more records in the first table.
Many-to-many relationships are usually undesirable in relational database design.
Example
In a database with a Pupils table linked to a Teachers table – one pupil can have many teachers, and vice versa.
Entity Relationship Diagrams
Relationships can be represented graphically using an Entity-Relationship (ER) diagram.
There are many different notations for ER diagrams, we will use crow’s foot notation.
• The names of entities are written in boxes joined by straight lines.
• At the “many” end the line forks.
• At the “one” end the line it judt joins the box.
Keys
Primary Key
A primary key is a field which is a unique identifier for each record.
A file may have only one primary key.
At the design stage, primary keys are usually identified by underlining.
Foreign Key
A foreign key is the primary key copied from another file, used to link two files.
In order to create a link, the primary key from the “one” entity gets copied into the “many” entity as a foreign key.
At the design stage, foreign keys are usually identified using an asterisk.
Compound Key
A compound key is a key which consists of two or more fields in order to create a unique identifier. This is required when no single field can be used to uniquely identify a record.
Example
Litters (Litter ID
Sire
Dame
Number in litter
DOB)
Puppies (Puppy ID
Puppy name
Sex
Cost of puppy
Litter ID*)
Customers (Customer name
Address
Puppy ID*)
There are 3 tables in this database.
• The Litters table has Litter ID as a primary key.
• The Puppies table has Puppy ID as a primary key.
• The Customers table uses Customer name and Address as a compound key.
• Litter ID is a foreign key in the Puppies table.
This creates a one-to-many relationship between Litters and Puppies.
• Puppy ID is a foreign key in the Customers table.
This creates a one-to-many relationship between Puppies and Customers.
Field Validation
Using appropriate validation reduces the chance of error when data is input.
Various validation techniques can be used to ensure data is appropriate:
Presence check – ensures field cannot be left empty, good validation for a primary key.
Restricted choice – the user is presented with a list of options to choose from using a drop-down menu, option buttons or similar. This is often used for the input of data for a foreign key, by automatically generating the list of options from the linked file.
Length check – ensures an appropriate number of characters is input, e.g. minimum of 8 characters, maximum of 20.
Range check – used on numeric fields to ensure number is within certain range e.g. between 0 and 100.
Queries
Queries allows the user to find information in a database.
Users may perform simple queries looking at the contents of one field or complex queries looking at the contents of many fields.
When answering exam questions always state what data is being searched for and which field it should be in.
Examples
To find all the male pupils who are over 12
SEARCH for “male” in the Gender field AND >12 in the Age field
To find all the people who live in Edinburgh or Glasgow
SEARCH for “Edinburgh” in the Town field OR “Glasgow” in the Town field
To find all the people born in the 1990s
SEARCH for >31/12/89 in the DOB field AND <1/1/00 in the DOB field
Sorting
Sorting puts database records in order based on the contents of particular fields.
Ascending order goes from A to Z, smallest number to largest number.
Descending order goes from Z to A, largest number to smallest number.
Examples
Put the customers in alphabetical order
SORT on Surname field in Ascending order then the Forename field in Ascending order.
Find the tallest person in the database
SORT on Height field in Descending order then look at the first record in the list.
Reports
Reports allow the presentation of selected data from the database.
The output can be customised in a variety of ways, including displaying only chosen fields and formatting the data in a particular way.
Here is a report which has been produced to show details of all employees who earn more than £30000.
The above report has less fields than the full database and also includes a header and summary fields. Changes to the formatting of the Birth Date column and other column headings.
Forms
Database creators can prepare forms layouts specially designed for inputting data, to help improve usability.
A well laid-out form, using suitable techniques such as drop-down menus or checkboxes, reduces the typing required and makes data input easier and faster.
Data dictionaries
A data dictionary is a design notation used to show the fields required in each table of a relational database, including field types, validation required, etc.
Thank you to C O’Toole & A Madill from Braidhurst High School for allowing me to edit and publish this here.
field – the fields below; Exhibitor, Company Name, Area, Stand Number, Product Reference, Item Name, Price (£)
record – A single row in a table, there are 8 records below
file – the entire database
Flat file database
flat file all the data is stored in one table
Drawbacks Data duplication Data inconsistency or update/ deletion/insertion anomalies Data integrity errors (due to data inconsistency) Inconsistent search results in multi-value fields
Flat file databases can lead to errors as shown below
Is it a man John Silver or a woman Joan Silver for member 1034?
Usability: how useable software is in relation to its intended purpose; usability testing involves a target group of users who are often asked to perform a series of tasks under controlled conditions
Accessibility: how easy it is for users with disabilities to make full use of software that has been developed; examples include voice recognition and text to speech software; read out alt attribute on image tags on websites
Thank you to C O’Toole & A Madill from Braidhurst High School for allowing me to edit and publish this here.
Software Development Languages: use of pre-processors (allow a programmer to implement code in a language that will be translated into another before becoming machine code); use of frameworks (provides a pre-generated set of code programmers can use for design); app development (web apps used to handle different operating systems, software development kits used to create one app that can be changed for different operating systems); HTML5 (latest version of HTML)
Software Development Environments: use of text editors, graphical user interface creation, de-bugging tools, collaboration tools and the cloud, emulators and mini development environments via browser software
Intelligent Systems: designed to demonstrate aspects of human intelligence by using a computer system to replicate human decision making and interaction; key features include ability to learn, ability to make decisions without human input, presence of several aspects of human intelligence
Online Systems: a system that is interactive (server and client communicate and update data) and fully functional in real time when accessed via the Internet; A ticket ordering web based system or an online shopping site are examples of common online systems
Rapid Application Development: means that the users should be involved at all stages of the development process and that changes to the design can be made at any time throughout the life of the project; it also means that the development process is faster and more flexible; emphasis is on creating software quickly and efficiently
Top-Down/Step-wise refinement: breaking down a problem into smaller more manageable steps
1 Setup Variables
2 Initialise Values
3 Do Calculation
1.1 Create number1 as a global variable
1.2 Create number2 as a global variable
2.1 Set number1 to 0
2.2 Set number2 to 0
2.3 Set total to 0
3.1 Receive number1 from keyboard
3.2 Receive number2 from keyboard
3.3 Set total to number1 + number2
Agile Methodologies: a product of RAD; emphasis on small scale developments, and with teams of people who have a flexible approach to change in requirements; it is important to keep the client involved in the process; there should be daily meetings between the clients and the developers, and necessary changes made to the requirements even late in development
Thank you to C O’Toole & A Madill from Braidhurst High School for allowing me to edit and publish this here.