Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats Accessing Information...

16

Transcript of Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats Accessing Information...

Page 1: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.
Page 2: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

Hans-Peter Plag October 9, 2014

Session 2Storing InformationFile Formats

http://www.mari.odu.edu

Accessing InformationProcessing Information

Page 3: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

Hardware: (smart phone, tablet,) laptop/PC, work station, main frame, clusters, cloud

Operating system: “An operating system (OS) is software that manages computer hardware and software resources and provides common services for computer programs. The operating system is an essential component of the system software in a computer system. Application programs usually require an operating system to function.”

User interface: •non-interactive•teletype (command line)•button/keys•graphical user interface (GUI)

Application: Application software is a set of one or more programs designed to carry out operations for a specific application. Application software cannot run on itself but is dependent on system software to execute. Examples of application software include MS Word, MS Excel, a console game, a library management system, a spreadsheet system etc.

User: •type: human, program, equipment,•level: low to highly experienced, experts•constraints: concepts, value systems, capabilities, ...

User InterfaceUser InterfaceUser InterfaceUser Interface

User InterfaceUser InterfaceUser InterfaceUser Interface

Page 4: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.
Page 5: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.
Page 6: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

Information is stored in files

How is information stored in files? We’ll come back to this

Previously: most operating system did not use file name as information

Today: many operating system, GUIs and applications use file type as information:.txt, .doc, .docx, .ppt, .pdf, .jpg, .exe, .py, .f90, ...

Page 7: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

Files are organized in file systems

Linux/Unix:/directory/sub-directory/sub-directory/...

File system control:Linux: mainly up to userMac: some predefined directories needed for GUI/applications to work

Discussion:In system-controlled file systems, it can be difficult to find somethingIn user-controlled systems, users need to have organization skills

Page 8: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

Information is stored in files

How is information stored in files?

Basics about number systems

Decimal number, can be represented as:

Any decimal number can be represented as:Any number to basis b can be represented as:

Page 9: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

Information is stored in files

How is information stored in files?

Basics about number systemsSpecial basis is b = 2:

Example:

binary number system

Other important systems:b = 8: Octalb = 16: Hex

Page 10: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

How is information stored in files?

Basics element in a computer is a switch with two states: 0 and 1

All information is stored using the binary number system

Byte: 8 bits

bitbitbitbitbytebytebytebyte

Can represent numbers from 0 to 255

Can also be used to represent 256 symbols, characters, codes

Page 11: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

How is information stored in files?

Fundamental coding is ASCII

ASCII: American Standard Code for Information Interchange: is a character-encoding scheme. Originally based on the English alphabet, it encodes 128 specified characters into 7-bit binary integers. The characters encoded are, numbers 0 to 9; lower case letters a to z; uppercase letters A to Z; basic punctuation symbols; control codes that originated with Teletype machines; and space.

Page 12: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

How is information stored in files?

Fundamental coding is ASCII

Extended ASCII (or high ASCII) is eight-bit or larger character encodings that include the standard seven-bit ASCII characters as well as others. The use of the term is sometimes criticized,[1][2][3] because it can be mistakenly interpreted that the ASCII standard has been updated to include more than 128 characters or that the term unambiguously identifies a single encoding, both of which are untrue.

Page 13: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

How is information stored in files?

File coding:- ASCII/extended ASCII: source code, text files, data, ... - can be edited in a text editor, printed, displayed in screen, ...- binary: executable programs, application files (word, excel, ...), graphics, databases, ... - cannot be edited in text editor, printed, viewed; require program to read/decode

Page 14: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

How is information stored in files?

ASCII File structure:- depends on programming language- earlier languages: record based- today: many systems make no assumptions about structure

Binary files: - operating system, program language, user dependent

- Unix/Linux - Mac OS Classic - Windows (MS Dos)

Page 15: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

Basic operations to access information stored in a file are:- opening a file- reading a file- decoding information- processing information- writing information to file- closing a file

Input from keyboard/screen can be consider similar to input from files- Fortran: reads records, not individual characters- C/C++: can read characters and records- PHP/Python: read full files or parts

Page 16: Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats  Accessing Information Processing Information.

Use a simple syntax to outline a procedure:- read an ASCII file (generated in an editor)- Separate the contents into logical record indicated by the string ‘\n’ - Write a file with records separated by ‘|’

Use a simple syntax to outline a procedure that can decode a command line consisting of:command-name p1=value p2=value ... pn=value