presentation

Download Report

Transcript presentation

HTML, MATLAB & Delphi
Aleksey Charapko
11/3/13
HTML

Markup Language

Created at CERN for scientific purposes

No executable code

Controls the “look” of the document
HTML

Widely used on the Internet

Many versions exist

Most current version is HTML5

Still not an official standard

Widely used

Not fully supported
HTML

Basic structure of HTML is a tag

Tags define elements placed on the page

Tag is a markup command

Looks like a text inside angled braces


Ex. <html>, <p>
Tags are often paired

Opening and closing tags

Ex. </html>, </p>
HTML

Has a number of defined tags

All non tags are displayed on the screen as text

Ignores double white spaces and new lines

New lines are markup

Tags exists for new lines
HTML

Parsing

Many parsers exists – Browsers

HTML is parsed into DOM (Document
Object Model)

Tree structure, can be manipulated with
JavaScript
HTML Example
<!DOCTYPE html>
<html>
<head>
<title>Example 0</title>
</head>
<body>
<p>
HTML Example #0
</p>
<p>
This is a correct HTML file
</p>
</body>
</html>
HTML Parsing

Most parsers are not “Strict”

Allow for errors in HTML

Have error correction mechanisms

Degrades readability

Makes developers careless
HTML Tag Soup

Tag Soup:
<!DOCTYPE html>
<html>
<head>
<title>Example 1</title>
</head>
<body>
<p>
This is a tag soup <strong>example
</p>
</strong>
<p>
In this example child tag closes after the parent tag
</p>
</body>
</html>
HTML Parsing

How much of HTML is correct?

validator.w3.org

www.unf.edu?

www.unf.edu/~ree/ ?

www.google.com ?
HTML

Time Proven

20+ years

Easy to use

Hard to follow standards
MATLAB

Scientific language

Used in research, engineering and education

Interpreted

Procedural

OOP
MATLAB

Comes bundled with MATLAB software

Available for Windows, Linux, Mac OS

Mobile app availability

Runs calculations in a cloud.
MATLAB Matrices

MATrix LABoratory

Matrix manipulation

2x3 Matrix:


MyMatrix = [4 5 7; 3 8 2]
Matrix Operations

Must adhere to rules of matrix operations
MATLAB Matrices
myMatrix = [4 5 7; 3 8 2];
myOtherMatrix = [1 2 3; 9 8 7];
ans = myMatrix * myOtherMatrix;
“Inner matrix dimensions must agree” error
myMatrix = [4 5 7; 3 8 2];
MyOtherMatrix2 = [1 2; 9 8; 3 4];
ans = myMatrix * MyOtherMatrix2
Result:
ans =
70
81
76
78
MATLAB Matrices

Matrix is not an array


Can hold only numeric data types
MATLAB supports cells which can hold nonnumeric data types
MATLAB

Supports integration with other languages

C/C++, Fortran, etc.


Requires special MATLAB function to be
written
Java

Can interface straight form the MATLAB
code
MATLAB & Java

Seamless integration with Java
xmlObj = xmlread('file.xml')
children = xmlObj.getChildNodes;
children = children.item(0);

xmlObj is Java object


getChildNodes is method ob xmlObj
children is another Java Object
MATLAB Data Types

Implicit Data types

Coercion is widespread

Can implicitly convert from MATLAB data
types to non-MATLAB types

In some cases explicit conversion is required
MATLAB

Many more interesting features:
function [x, y] foo (a)
x = 2 * a;
if x > 10
y = a + 5;
else
y=5
end
end
Multiple returns
 No semicolon – prints the output
 Many structures end with “end” keyword

MATLAB

Intuitive and easy to read


Somewhat slow


Somewhat confusing when accessing other
languages
Especially when allocating memory
Have been in use for many years
Delphi

Object Oriented

Dialect of Object Pascal

Object Pascal originally developed by Apple
Delphi IDE
Delphi

Based On Pascal

Has many pascal features


begin... end blocks
:= assignment operator common for languages
of the era
Delphi

Strongly typed

Flexible with Enumerated types

Can define sets of primitives of Enums

Sub-ranges of Primitives or Enums
Delphi
var
SmallNums : Set of 0..55;
// Set of the 56 set members
begin
// We have a range of 0 to 55 values that we can set
SmallNums := [3..12,23,30..32]; // Set some of the
members on
if 12 in SmallNums
then ShowMessage('12 is in SmallNums')
else ShowMessage('12 is NOT in SmallNums');
if 13 in SmallNums
then ShowMessage('13 is in SmallNums')
else ShowMessage('13 is NOT in SmallNums')
Result:
12 is in SmallNums
13 is NOT in SmallNums
Delphi

Delphi does not provide a garbage collection


Programer responsible for memory
deallocation
Supports functional programming

No variables/objects

Less memory leaks
Delphi RAD

Often used for RAD and Prototyping

Rapid Application Development

Delphi IDE has tools for RAD

Languages facilitates RAD

Modular structure

Verbose declarations

Easy to read code
Delphi

Easy to read

Yet hard to write

Fast to develop

Have been in use for 20+ years