Skip to content
UoL CS Notes

Home

This website houses notes from my studies at the University of Liverpool. If you see any errors or issues, please do open an issue on this site's GitHub.

Testing with JUnit & Ant

COMP285 Lectures

Testing with setup() & tearDown() We use setUp() and tearDown() to ensure that the tests don’t interfere with each-other. We can implement this, in our testing class, like so: package org.example.antbook.junit; //import JUnit4 classes: import static org.junit.Assert.*; import org.junit.Test; // import org.junit.Before; //import org.junit.* also would work import org.junit.After; //...

Read More

Ant Filesets and Path

COMP285 Lectures

Creating Filesets Filesets are a group of files represented like so: <fileset dir="src" includes="**/*.java" id="source.fileset"/> dir - Mandatory attribute to denote a root directory for the fileset. includes - Which files from this directory to include. id - A reference which can be used to call the fileset. We can...

Read More

PHP Sessions

COMP284 Lectures

As no data about a client is remembered by default we can’t track a series of requests from coming from the same user. This can be problematic if we want to send several forms, such as on a shopping site. Hidden Inputs One way of solving this is by sending...

Read More

Ant Properties, Datatypes & References

COMP285 Lectures

Datatypes The following datatypes are available in Ant: Paths - An ordered list of files and directories. Classpath is a variant of this. Filesets - A collection of files rooted from a specified directory. Patternsets - A collection of file matching patterns. Filtersets Properties This is a way of defining...

Read More

Pointer Basics

COMP281 Lectures

Pointers are a variable holding the address of another variable of the same data type. You can use them to create: Shared variables between different functions without copying. Linked data structures such as linked lists. Addresses vs Pointers You can get the address of a variable using &. You can...

Read More

HTML Forms & PHP

COMP284 Lectures

Web Applications using PHP flowchart LR Browser -->|1. Post Action| ws[Web Server] ws -->|2. Process| pp[PHP Processor] pp <-->|3. Store/Retrieve| ds[Database Server] pp -->|4. Merge with HTML| ws ws -->|5. Return HTML| Browser PHP & Forms We can use something like the following to call a php script with the...

Read More

Divide & Conquer Running Time

COMP202 Lectures

Running Time of Divide & Conquer We can use a recurrence relation to analyse the running time where: $T(n)$ denotes the running time on an input of size $n$. We can then extend this with a case statement that relates $T(n)$ to values of the function $T$ for problem sizes...

Read More

Testing Theory

COMP285 Lectures

Boundary Testing This is where we test: One Above One Below and on the value of a boundary. Orthogonal Testing Tests should only test a single possible bug. For example we could have two tests: One if the input is too long. One if the input is too short. We...

Read More

PHP Regular Expressions

COMP284 Lectures

PHP uses PCRE (Perl-compatible regular expressions). You can try out your expressions in a live environment at regex101 (ensure that PCRE2 is checked). PHP RE Syntax We can use the following syntax to define regular expressions in PHP: '/a*bc/' The expression is enclosed in two /. Quantifiers We can request...

Read More