38 ColorCommandLine
38 ColorCommandLine
Day 38
Review - Numbering Systems
• Binary – Base 2
• Digits: 0, 1
• a Bit (Basic Unit of Information) is a single Binary digit, and the smallest
unit of data measurement.
• All data in a computer is stored in sequences of 0s and 1s
• Each digit placement is equivalent to a power of 2
• Decimal – Base 10
• Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
• Mathematical standard
• Each digit placement is equivalent to a power of 10
• Hexadecimal – Base 16
• Digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
• Allows for large values to be represented by a single digit
• Each digit placement is equivalent to a power of 16
Fall 2024 2
Review - Numbering System place values
Base x n7 n6 n5 n4 n3 n2 n1 n0
Bin: 2x 128 64 32 16 8 4 2 1
Dec: 10x 10,000,000 1,000,000 100,000 10,000 1,000 100 10 1
Hex: 16x 16,777,216 2,097,152 262,144 16,384 4,096 256 16 1
Fall 2024 3
Review- Data Representation: Byte or 1 character
• A grouping of eight bits together is a Byte, and represents a
single character
• kilobyte: KB = 1024 bytes or about 1 thousand bytes.
• megabyte: MB = 1,048,576 bytes or about 1 million bytes.
• gigabyte: GB = 1,073,741,824 bytes or about 1 billion bytes.
• Characters are converted (encoded) to a numbering system value, so
that it can be stored into memory.
• Most common character encoding standard is the American Standard Code
for Information Interchange (ASCII).
Fall 2024 4
Data Representation - Encoding
• American Standard Code for Information Interchange (ASCII)
• Link to character set http://www.asciitable.com/
• Numeric values from 0-127
• Numbers < Uppercase letters < Lowercase letters
• Extended ASCII Characters
• Link to character set: https://www.lookuptables.com/text/extended-ascii-table
• Numeric values 128-255
• the CP437 (Code Page 437) version are from the original IBM PC, based on characters used in
Wang word processing machines.
• Unicode Characters
• Link to character set: https://www.lookuptables.com/text/unicode-characters
• contains almost 150,000 characters and is continually being updated by the Unicode
Consortium.
• covers current and historical scripts, alphabets, symbols, emojis and non-printable codes for
controlling and formatting.
Fall 2024 5
Data Representation - Encoding
Encoding of each character in the string "CS 1301!" in Binary, Decimal, and
Hexadecimal.
ASCII Char Binary (base 2) Decimal (base 10) Hexadecimal (base 16)
C 01000011 (1*26 +1*21 + 1*20) = 64+2+1 67 (6*101 + 7*100)= 60+7 43 (4*161 + 3*160) = 64+3
S 01010011 83 53
(space) 00100000 32 20
1 00110001 49 31
3 00110011 51 33
0 00110000 48 30
1 00110001 49 31
! 00100001 33 21
Fall 2024 6
Color Representation – Hexadecimal
• Allows for large number representation in small amounts of
memory
• Only two Hex digits needed to make a byte
• Most common use is for a memory address or RGB color
• Example when attempting to print an object, or display of an OS error
messages
• Example when designing web pages with Hex codes for RGB colors
Fall 2024 7
Color Representation – RGB colors
• RGB color space or RGB color system, constructs all the colors
from the combination of Red, Green and Blue pixels.
• Format: # followed by two hex digits for each color pixel
• The red, green and blue use 8 bits each (two Hex digits), which have
integer values from 0 to 255. This makes 256*256*256 = 16,777,216
possible colors.
• When a color pixel is set to 0016 (010 , 000000002), the pixel is turned
fully off.
• When a color pixel is set to FF16 (25510 , 111111112), the pixel is
turned fully on.
Fall 2024 8
Color Representation – RGB colors
Color name RGB Color Hex Color
Red (255, 0, 0) #FF0000
Green (0, 255, 0) #00FF00
Blue (0, 0, 255) #0000FF
Yellow (255, 255, 0) #FFFF00
Cyan (0, 255, 255) #00FFFF
Magenta (255, 0, 255) #FF00FF
Black (0, 0, 0) #000000
Gray (128, 128, 128) #808080
White (255, 255, 255) #FFFFFF
Fall 2024 9
Miniquiz – ASCII and Colors
Fall 2024 10
Command Line
Fall 2024 11
Command Line Vocabulary
• Path: The route to get to a folder on your computer. Often looks
something like
C:\Users\John\Folder\ex.txt
Fall 2024 12
Command Line: WIN Command Prompt
To quickly open Command
Prompt in Windows, type
cmd
in the Windows search bar
and press enter.
Fall 2024 13
Command Line: MAC Terminal
To open the Mac Terminal, go
to your Launchpad and find
Terminal
or use the Spotlight
shortcut (Command & Space)
from any screen and type in
Terminal. It will look
something like this:
Fall 2024 14
Command Line: Basic commands
• File listing: ls (MAC) dir (WIN)
• Change directory: cd directoryname
• Displays the name of or changes the current directory
• Use .. as the path to go up a directory (towards root)
• Use / to continue through directories
• Use the TAB key to autocomplete directory/file names
• Simply use cd to go back to your home directory
• Make a directory: mkdir directoryname
• Remove a directory: rmdir directoryname (can’t undo!)
Fall 2024 15
Command Line: Basic commands
Fall 2024 16
Command Line
Command Description Windows Macs
Fall 2024 17
Miniquiz – Command Line
Fall 2024 18