administrative notes february 9 2017
play

Administrative Notes February 9, 2017 Feb 10: Project proposal - PowerPoint PPT Presentation

Administrative Notes February 9, 2017 Feb 10: Project proposal resubmission (optional) Feb 13: Art and Images reading quiz on Connect Feb 17: In the News call #2 Computational Thinking The image part with relationship ID rId20


  1. Administrative Notes February 9, 2017 • Feb 10: Project proposal resubmission (optional) • Feb 13: Art and Images reading quiz on Connect • Feb 17: In the News call #2 Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  2. Data Representation: Part 1, continued finish up hex representation, relationship with decimal and binary representations Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  3. Recall: Hex to bits and back again Because each hex digit corresponds to a 4-bit sequence, it's easy to translate between hex and binary • Hex à binary : replace each hexadecimal digit by the four corresponding binary digits in the conversion table F A B 4 1111 1010 1011 0100 • Binary à hex : put extra 0’s at the left of the binary number as necessary so that the total number of digits is a multiple of 4, then reverse the hex à binary conversion process 0010 1011 1010 1101 2 B A D Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  4. Hex à binary à decimal An easy way to convert Convert A0C to binary first, then to decimal: Hex: A 0 C Binary: 1010 0000 1100 Place 2048 1024 512 256 128 64 32 16 8 4 2 1 # 1 0 1 0 0 0 0 0 1 1 0 0 2048+512+8+4=2572 Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  5. Decimal à binary à hex Decimal à binary # to 3850 1802 778 266 10 10 10 10 10 2 2 0 convert place 2048 1024 512 256 128 64 32 16 8 4 2 1 value # leftover 1802 778 266 10 10 10 10 10 2 2 0 0 binary # 1 1 1 1 0 0 0 0 1 0 1 0 Binary à hex Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  6. Which of the following hex numbers is the largest? Recall: clicker exercise A. 0F B. FF C. F0 D. 100 Computational Thinking The image part with relationship 6 ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  7. Which of the following hex numbers is the largest? Recall: clicker exercise A. 0F Bin: 0000 0000 1111 B. FF Bin: 0000 1111 1111 C. F0 Bin: 0000 1111 0000 D. 100 Bin: 0001 0000 0000 Computational Thinking The image part with relationship 7 ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  8. Which of the following hex numbers is the largest? Recall: clicker exercise A. 0F Bin: 0000 0000 1111 Decimal: 15 B. FF Bin: 0000 1111 1111 Decimal: 255 C. F0 Bin: 0000 1111 0000 Decimal: 240 D. 100 Bin: 0001 0000 0000 Decimal: 256 Computational Thinking The image part with relationship 8 ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  9. From hex to decimal and back (Each place is 16* the previous) Hex à decimal place/column 256 16 1 # to convert A 0 C 10*256 + 0 *16 + 12 *1 = 2572 Decimal à hex # to convert 3850 10 10 place value 256 16 1 # to subtract 256*15=3840 - 1*10 # left over 10 - 0 hex # F 0 A Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  10. Summary: Learning goal, number representation • [CT Building Block] Students will be able to translate numbers between binary, hexadecimal, and decimal. Computational Thinking The image part with relationship 10 ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  11. Data Representation: Part 2 Text representation Colour representation Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  12. Learning goals Text representation • [CT Building Block] Given a list of ASCII codes, students will be able to decode an ASCII representation of a short text document. • [CT Building Block] Students will be able to explain why opening a non-ASCII file (e.g., a Word document) in a text editor results in a different display than when the same document is opened in its intended application. Computational Thinking The image part with relationship 12 ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  13. How do we store letters in hex (or binary)? ASCII – 128 values (7 bits, since 2 7 = 128) Computational Thinking The image part with relationship https://en.wikipedia.org/wiki/ASCII ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  14. How do we store letters in hex (or binary)? ASCII – 128 values (7 bits, since 2 7 = 128) • ACSII (American Standard Code for Information Interchange) was developed in the 1960’s • In addition to letters and numbers, punctuation, spaces and other special control characters are encoded; each encoded item is sometimes called a code point • Why 7 bits? An extra “check” bit was included that could be used to detect certain errors that might arise, e.g., when sending data over a modem • Extended ASCII uses 8 bits (or one byte ), allowing for characters with accents (Á, ë and others) Computational Thinking The image part with relationship https://en.wikipedia.org/wiki/ASCII ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  15. Translating from ASCII to text The image part with relatio nship ID rId9 Example was not found in the file. Hex Binary Symbol 41 01000001 A 42 01000010 B 43 01000011 C 44 01000100 D 45 01000101 E 46 01000110 F 47 01000111 G Binary 01000110 01000001 01000011 01000101 Hex 46 41 43 45 Text Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  16. Translate from ASCII to text Group exercise Hex Symbol 41 A 42 B 43 C 44 D 45 E 46 F 47 G Binary 01000010 01000001 01000100 01000111 01000101 Hex 42 41 44 47 45 Text Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  17. Translate from ASCII to text • You can use online hex editors to translate from text to ASCII: https://www.onlinehexeditor.com/ or https://hexed.it/ • At https://hexed.it/, open a file that's in plaintext (using Open file in the top toolbar) • Edit by changing the entry called "8-bit integer" Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  18. Extended ASCII: an 8-bit representation If regular ASCII represents 128 values in 7 bits, how many values can we represent in a byte (8 bits)? DEC HEX BIN Symbol 128 80 10000000 € a. 8 … … … … 192 C0 11000000 À b. 129 193 C1 11000001 Á c. 256 194 C2 11000010 Â 195 C3 11000011 Ã d. None of the above 196 C4 11000100 Ä 197 C5 11000101 Å 198 C6 11000110 Æ … … … … 255 FF 11111111 ÿ Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  19. What about other languages, like Chinese? • Unicode is a text representation standard, maintained by the Unicode Consortium since the 1980s • With 1,112,064 code points, Unicode covers most of the world’s modern and historic writing systems • There are different implementations, including UTF-8 and UTF-16 • UTF stands for Unicode Transformation Format Computational Thinking The image part with relationship ID rId20 was not https://en.wikipedia.org/wiki/Unicode found in the file. www.ugrad.cs.ubc.ca/~cs100

  20. What about other languages, like Chinese? Both and UTF-8 and UTF-16 are variable-length encodings: • UTF-8 is consistent with ASCII representation, using one byte, but uses up to four bytes for other characters • UTF-16 uses 16 bits or 32 bits per code point Computational Thinking The image part with relationship ID rId20 was not https://en.wikipedia.org/wiki/Unicode found in the file. www.ugrad.cs.ubc.ca/~cs100

  21. Are ASCII, UTF-8 and UTF-16 forms of encryption ? Clicker question A. Yes B. No Computational Thinking The image part with relationship ID rId20 was not https://en.wikipedia.org/wiki/Unicode found in the file. www.ugrad.cs.ubc.ca/~cs100

  22. What about formatting? How does Word store its data? Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  23. What about formatting? How does Word store its data? • Uploading a Word document into the online Hex editor suggests that the document is not in ASCII representation • In fact it is a zipped collection of files! If you unzip a word document, you can see these files (and even change some things in them…) Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

  24. What about formatting? How does Word store its data? • Most of the files that comprise a Word document are in XML (Extensible Markup Language) format; they describe metadata such as the font style and size, document creator, etc. • The files • The files may also contain information about tracked changes to the document, collaborators, privacy and security settings, and more Computational Thinking The image part with relationship ID rId20 was not found in the file. www.ugrad.cs.ubc.ca/~cs100

Recommend


More recommend