html, matlab & delphi aleksey charapko 11/3/13. html markup language created at cern for...

29
HTML, MATLAB & Delphi Aleksey Charapko 11/3/13

Upload: angelica-eaton

Post on 16-Jan-2016

228 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

HTML, MATLAB & Delphi

Aleksey Charapko11/3/13

Page 2: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

HTML

Markup Language Created at CERN for scientific purposes No executable code Controls the “look” of the document

Page 3: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

HTML

Widely used on the Internet Many versions exist

Most current version is HTML5 Still not an official standard Widely used Not fully supported

Page 4: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

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>

Page 5: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

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

Page 6: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

HTML

Parsing Many parsers exists – Browsers HTML is parsed into DOM (Document

Object Model) Tree structure, can be manipulated with

JavaScript

Page 7: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

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>

Page 8: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

HTML Parsing

Most parsers are not “Strict” Allow for errors in HTML Have error correction mechanisms Degrades readability

Makes developers careless

Page 9: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

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>

Page 10: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

HTML Parsing

How much of HTML is correct? validator.w3.org

www.unf.edu? www.unf.edu/~ree/ ? www.google.com ?

Page 11: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

HTML

Time Proven 20+ years

Easy to use Hard to follow standards

Page 12: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

MATLAB

Scientific language Used in research, engineering and education

Interpreted Procedural OOP

Page 13: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

MATLAB

Comes bundled with MATLAB software Available for Windows, Linux, Mac OS Mobile app availability

Runs calculations in a cloud.

Page 14: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

MATLAB Matrices

MATrix LABoratory Matrix manipulation 2x3 Matrix:

MyMatrix = [4 5 7; 3 8 2]

Matrix Operations Must adhere to rules of matrix operations

Page 15: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

MATLAB MatricesmyMatrix = [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 76 81 78

Page 16: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

MATLAB Matrices

Matrix is not an array Can hold only numeric data types

MATLAB supports cells which can hold non-numeric data types

Page 17: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

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

Page 18: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

MATLAB & Java

Seamless integration with Java

xmlObj is Java object getChildNodes is method ob xmlObj

children is another Java Object

xmlObj = xmlread('file.xml')children = xmlObj.getChildNodes;children = children.item(0);

Page 19: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

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

Page 20: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

MATLAB

Many more interesting features:function [x, y] foo (a)

x = 2 * a;if x > 10

y = a + 5;else

y = 5end

end

Multiple returns No semicolon – prints the output Many structures end with “end” keyword

Page 21: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

MATLAB

Intuitive and easy to read Somewhat confusing when accessing other

languages Somewhat slow

Especially when allocating memory Have been in use for many years

Page 22: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

Delphi

Object Oriented Dialect of Object Pascal

Object Pascal originally developed by Apple

Page 23: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

Delphi IDE

Page 24: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

Delphi

Based On Pascal Has many pascal features

begin... end blocks := assignment operator common for languages

of the era

Page 25: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

Delphi

Strongly typed Flexible with Enumerated types

Can define sets of primitives of Enums Sub-ranges of Primitives or Enums

Page 26: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

Delphivar SmallNums : Set of 0..55; // Set of the 56 set membersbegin // We have a range of 0 to 55 values that we can set SmallNums := [3..12,23,30..32]; // Set some of the members onif 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 SmallNums13 is NOT in SmallNums

Page 27: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

Delphi

Delphi does not provide a garbage collection Programer responsible for memory

deallocation Supports functional programming

No variables/objects Less memory leaks

Page 28: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

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

Page 29: HTML, MATLAB & Delphi Aleksey Charapko 11/3/13. HTML Markup Language  Created at CERN for scientific purposes  No executable code  Controls the “look”

Delphi

Easy to read Yet hard to write

Fast to develop Have been in use for 20+ years