1 Computers and Representations Ascii vs. Binary Files Over the last few million years, Earth has experienced numerous ice ages when vast regions of the.

Slides:



Advertisements
Similar presentations
Data Transfer Chapter 10. File conversion When we upgrade a file after a big time of use, usually it is necessary to change the format of the file. For.
Advertisements

Computer Science 101 Picture Files. Computer Representation of Pictures Common representation is as a bitmap. Common representation is as a bitmap. Two.
Data Representation COE 202 Digital Logic Design Dr. Aiman El-Maleh
Information Processing Session 5B Binary Arithmetic Slide
Introduction to Computers and Programming. Some definitions Algorithm: –A procedure for solving a problem –A sequence of discrete steps that defines such.
Binary Expression Numbers & Text CS 105 Binary Representation At the fundamental hardware level, a modern computer can only distinguish between two values,
Chapter 1 Data Storage. 2 Chapter 1: Data Storage 1.1 Bits and Their Storage 1.2 Main Memory 1.3 Mass Storage 1.4 Representing Information as Bit Patterns.
Data Representation in Computers
Introduction to Computers and Programming. Some definitions Algorithm: Algorithm: A procedure for solving a problem A procedure for solving a problem.
Computer Arithmetic: Binary, Octal and Hexadecimal Presented by Frank H. Osborne, Ph. D. © 2005 ID 2950 Technology and the Young Child.
Homework Reading –Finish K&R Chapter 1 (if not done yet) –Start K&R Chapter 2 for next time. Programming Assignments –DON’T USE and string library functions,
Floyd, Digital Fundamentals, 10 th ed EET 2259 Unit 13 Strings and File I/O  Read Bishop, Chapter 9.  Lab #13 and Homework #13 due next week.
(2.1) Fundamentals  Terms for magnitudes – logarithms and logarithmic graphs  Digital representations – Binary numbers – Text – Analog information 
Programmable Logic Controllers
Homework Reading Programming Assignments
MATH 224 – Discrete Mathematics
Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as.
Agenda Data Representation – Characters Encoding Schemes ASCII
C Programming Lecture 3. The Three Stages of Compiling a Program b The preprocessor is invoked The source code is modified b The compiler itself is invoked.
Aloha Aloha What you see: What the computer sees: binary number columns binary number columns
Spreadsheets and Microsoft Excel. Introduction n A spreadsheet (called a worksheet in Excel) is a two-dimensional array of cells containing data to be.
Computer science Kieran elder. What is computer science What is binary Binary maths What is hexadecimal Hexadecimal numbers programs for programming Different.
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
CS 102 Computers In Context (Multimedia)‏ 01 / 23 / 2009 Instructor: Michael Eckmann.
Computer Science 101 Introduction to Programming.
1 Computers and Representations Ascii vs. Binary Files Over the last few million years, Earth has experienced numerous ice ages when vast regions of the.
EX_01.1/46 Numeric Systems. EX_01.2/46 Overview Numeric systems – general, Binary numbers, Octal numbers, Hexadecimal system, Data units, ASCII code,
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
Hans-Peter Plag October 9, 2014 Session 2 Storing Information File Formats Accessing Information Processing Information.
Data Representation and Storage Lecture 5. Representations A number value can be represented in many ways: 5 Five V IIIII Cinq Hold up my hand.
1 Problem Solving using computers Data.. Representation & storage Representation of Numeric data The Binary System.
Introduction to Computer Design CMPT 150 Section: D Ch. 1 Digital Computers and Information CMPT 150, Chapter 1, Tariq Nuruddin, Fall 06, SFU 1.
Text and Graphics September 26, Unit 3.
CS161 Computer Programming Instructor: Maria Sabir Fall 2009 Lecture #1.
Chapter 1 Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
Computer Science Binary. Binary Code Remember the power supply that is inside your computer and how it sends electricity to all of the components? That.
Data Representation Conversion 24/04/2017.
Chapter Three The UNIX Editors.
Data as the computer sees it 1.  Number systems Number systems  Data storage Data storage  Glossary Glossary 2.
Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
Chapter 3 The Power of HEX Finding Slivers of Data.
MECH1500 Chapter 3.
Data Storage © 2007 Pearson Addison-Wesley. All rights reserved.
1 Problem Solving using Computers “Data....Representation, and Storage.
1) the value you want to look up Vlookups are really easy......just remember you need 4 things: 2) The table range you want to look up to 3) The column.
09/06/ Data Representation ASCII, Binary Denary Conversion, Integer & Boolean data types.
CHAPTER 3 BINARY NUMBER SYSTEM. Computers are electronic machines which operate using binary logic. These devices use two different values to represent.
Chapter 3: Mastering Editors Chapter 3 Mastering Editors (Emacs)
1.4 Representation of data in computer systems Character.
Programmable Logic Controller
Binary Representation in Text
Binary Representation in Text
Unit 2.6 Data Representation Lesson 2 ‒ Characters
EET 2259 Unit 13 Strings and File I/O
Lec 3: Data Representation
Data Transfer ASCII FILES.
What is Binary? Binary is a two-digit (Base-2) numerical system, which computers use to process and store data. The reason computers use the binary system.
Variables and Primative Types
Guide To UNIX Using Linux Third Edition
Other Kinds of Arrays Chapter 11
Chapter 1 Data Storage.
Data Representation Conversion 05/12/2018.
Fundamentals of Data Representation
Presenting information as bit patterns
Homework Reading Programming Assignments Finish K&R Chapter 1
Abstraction – Number Systems and Data Representation
EET 2259 Unit 13 Strings and File I/O
Chapter 3 - Binary Numbering System
Digital Representation of Data
Presentation transcript:

1 Computers and Representations Ascii vs. Binary Files Over the last few million years, Earth has experienced numerous ice ages when vast regions of the continents were glaciated and sea level was lower as a result.. How much did sea level drop during these glaciations? Prepared by Fred Annexstein University of Cincinnati Some Rights Reserved Supporting Issues Number sense Numerical Computations Algorithms CS100: Into to Computer Science Core Quantitative Issue Number Representations

2 Overview Most people classify files in two categories: binary files and ASCII (text) files. You've actually worked with both. Most programs you work (Excel and Powerpoint) store representations in binary format. On other hand, Web pages, XML files, and computer programs are stored as ASCII files. An ASCII file is defined as a file that consists of ASCII characters. It's usually created by using a text editor like emacs, pico, vi, Notepad, etc. There are fancier editors out there for writing code, but they may not always save it as ASCII. As an aside, ASCII text files seem very "American-centric". After all, the 'A' in ASCII stands for American. However, the US does seem to dominate the software market, and so effectively, it's an international standard. Computer science is all about creating good abstractions. Sometimes it succeeds and sometimes it doesn't. Good abstractions are all about presenting a view of the world that the user can use. One of the most successful abstractions is the text editor. Another successful abstractions is the spreadsheet.

3 The Difference between ASCII and Binary Files An ASCII file is confusingly a binary file that stores ASCII codes. ASCII code is a 7-bit code stored in a one byte. To be more specific, there are 128 different ASCII codes, which means that only 7 bits are needed to represent an ASCII character. The minimum workable size in computers is 1 byte, and those 7 bits are the low 7 bits of an 8-bit byte. The most significant bit is set to 0. That means, in any ASCII file, you're wasting 1/8 of the bits. In particular, the most significant bit of each byte is not being used. Hence an ASCII file is a special kinds of binary files where each byte is written in ASCII code. General binary file has no such restrictions. What makes a file a binary file is the fact that each byte of a binary file can be one of 256 bit patterns. They're not restricted to the ASCII codes.

4 Suppose you're editing a text file with a text editor like Notepad. Because you're using a text editor, you're pretty much editing an ASCII file. In this brand new file, you type in "cat". That is, the letters 'c', then 'a', then 't'. Then, you save the file and quit. In Excel you are editing a binary file rather than ASCII. Let’s look at the issue of ASCII encoding. If you look up an ASCII table on the web, you will discover the ASCII codes are written in different formats, including decimal (base 10), Hexadecimal (base 16), and binary (base 2) Here's how it may look: Text 'c' 'a' 't' Decimal Hex 0x63 0x61 0x74 Binary Each time you type in an ASCII character and save it, an entire byte is written which corresponds to that character. This includes punctuations, spaces, and so forth. Thus, when you type a 'c', it's being saved as to a file. Next we look at a table and build such in Excel spreadsheet. Example of ASCII files

5 An ASCII TABLE

6 We can switch between numbers and characters using two special functions: CODE() and CHAR(). Using CONCATENATE() you can put together the string of odd/even values as the binary representation of N CODE(‘A’) -> 65 CHAR(65) -> ‘A’ Building An ASCII Table Start with a number N=65 and repeatedly divide it by 2… For each column we determine whether it is odd or even using MOD()…

7 Recreate the spreadsheet below to calculate the drop in sea level if the ice volume at the last glacial maximum was 70 million km 3, in contrast to the current volume of 25 million km 3. Building Table The only input value is F2 = ‘A’ -- all other cells are functions! =Concatenate(M2,L2,…) =CHAR(G1+1) =CODE(F1) =INT(G1/2)

8 Expanding: Now Replace the ‘A’ in the first row with a space character ‘ ‘ to obtain a full ASCII table for the usual text characters. Translation: You can use function VLOOKUP() to translate an ASCII-BINARY encoded message into text string and visa versa. Type in sentence ‘The fat cat.’ with one character per cell. Underneath produce the ASCII equivalent representation in binary, as follows. Expanding your Table and Translation The fat cat

9 1.Find a small poem or quotation. Translate each character into ASCII automatically in your worksheet. 2.In the Communication tools post it to web as comma separated values. 3.Import one such quote from another student and translate it using VLOOKUP() function. 4.Turn in your spreadsheet to Bb. Assignment