notes
unknown
python
2 years ago
12 kB
3
Indexable
Never
import os import threading import requests import json def main_definitions(): os.system("cls") print("In a computer, storage is the place where data is held in an electromagnetic or optical form for access by a computer processor. There are two general usages: ") print("1) Storage is frequently used to mean the devices and data connected to the computer through input/output operations - that is, hard disk and tape systems and other forms of storage that don't include computer memory and other in-computer storage. For the enterprise, the options for this kind of storage are of much greater variety and expense than that related to memory. This meaning is probably more common in the IT industry than meaning than the second meaning.") print("2) In a more formal usage, storage has been divided into: (1) primary storage, which holds data in memory (sometimes called random access memory or RAM) and other built-in devices such as the processor's L1 cache (2) secondary storage, which holds data on hard disks, tapes, and other devices requiring input/output operations.") print("Primary storage is much faster to access than secondary storage because of the proximity of the storage to the processor or because of the nature of the storage devices. On the other hand, secondary storage can hold much more data than primary storage. ") print("In addition to RAM, primary storage includes read-only memory (ROM) and L1 and L2 cache memory. In addition to hard disks, secondary storage includes a range of device types and technologies, including diskettes, Zip drives, redundant array of independent disks (RAID) systems, and holographic storage. Devices that hold storage are collectively known as storage devices. ") print("A somewhat antiquated term for primary storage is main storage and a somewhat antiquated term for secondary storage is auxiliary storage. Note that, to add to the confusion, there is an additional meaning for primary storage that distinguishes actively used storage from backup storage. ") def formats(): def text(): print("Text can be represented easily by assigning a unique numeric value for each symbol used in the text. For example, the widely used ASCII code (American Standard Code for Information Interchange) defines 128 different symbols (all the characters found on a standard keyboard, plus a few extra), and assigns to each a unique numeric code between 0 and 127. In ASCII, an 'A' is 65, ' B' is 66, 'a' is 97, 'b'' is 98, and so forth. When you save a file as 'plain text', it is stored using ASCII. ASCII format uses 1 byte per character 1 byte gives only 256 (128 standard and 128 non-standard) possible characters. The code value for any character can be converted to base 2, so any written message made up of ASCII characters can be converted to a string of 0's and 1's. ") def graphics(): print("Graphics that are displayed on a computer screen consist of pixels: the tiny 'dots' of color that collectively 'paint' a graphic image on a computer screen. The pixels are organized into many rows on the screen. In one common configuration, each row is 640 pixels long, and there are 480 such rows. Another configuration is 800 pixels per row with 600 rows, which is referred to as a 'resolution of 800x600.' Each pixel has two properties: its location on the screen and its color. A graphic image can be represented by a list of pixels. Imagine all the rows of pixels on the screen laid out end to end in one long row. This gives the pixel list, and a pixel's location in the list corresponds to its position on the screen. A pixel's color is represented by a binary code, and consists of a certain number of bits. In a monochrome (black and white) image, only 1 bit is needed per pixel: 0 for black, 1 for white, for example. A 16 bit color image requires 4 bits per pixel. Modern display hardware allows for 24 bits per pixel, which provides an astounding array of 16.7 million possible colors for each pixel! ") def compression(): print("Files today are so information-rich that their size may become very large. This is particularly true of graphics files. With so many pixels in the list, and so many bits per pixel, a graphic file can easily take up over a megabyte of storage. Files containing large software applications can require 50 megabytes or more! This causes two problems: it becomes costly to store the files (requires many floppy disks or excessive room on a hard drive), and it becomes costly to transmit these files over networks and phone lines because the transmission takes a long time. In addition to studying how various types of data are represented, you will have the opportunity today to look at a technique known as data compression. The basic idea of compression is to make a file shorter by removing redundancies (repeated patterns of bits) from it. This shortened file must of course be de-compressed - have its redundancies put back in - in order to be used. However, it can be stored or transmitted in its shorter compressed form, saving both time and money.") def animation(): print("Somewhere between the motionless world of still images and the real-time world of video images lies the flip-book world of computer animation. All of the animated sequences seen in educational programs, motion CAD renderings, and computer games are computer-animated (and in many cases, computer-generated) animation sequences. ") print("Traditional cartoon animation is little more than a series of artwork cells, each containing a slight positional variation of the animated subjects. When a large number of these cells are displayed in sequence and at a fast rate, the animated figures appear to the human eye as if they are moving. ") print("A computer-animated sequence works in exactly the same manner. A series of images are created of a subject; each image contains a slightly different perspective on the animated subject. ") print("When these images are displayed (played back) in the proper sequence and at the proper speed (frame rate), the subject appears to move. ") print("Computerized animation is actually a combination of both still and motion imaging. Each frame, or cell, of an animation is a still image that requires compression and storage. An animation file, however, must store the data for hundreds or thousands of animation frames and must also provide the information necessary to play back the frames using the proper display mode and frame rate. ") def digital_video(): print("One step beyond animation is broadcast video. Your television and video tape recorder are a lot more complex than an 8mm home movie projector and your kitchen wall. There are many complex signals and complicated standards that are involved in transmitting those late-night reruns across the airwaves and cable. Only in the last few years has a personal computer been able to work with video data at all. ") print("Video data normally occurs as continuous, analog signals. In order for a computer to process this video data, we must convert the analog signals to a non-continuous, digital format. In a digital format, the video data can be stored as a series of bits on a hard disk or in computer memory. ") print("The process of converting a video signal to a digital bit stream is called analog-to-digital conversion (A/D conversion), or digitizing. A/D conversion occurs in two steps: ") print("1. Sampling captures data from the video stream.") print("2. Quantizing converts each captured sample into a digital format.") print("Each sample captured from the video stream is typically stored as a 16-bit integer. The rate at which samples are collected is called the sampling rate. The sampling rate is measured in the number of samples captured per second (samples/second). For digital video, it is necessary to capture millions of samples per second. ") def digital_audio(): print("All multimedia file formats are capable, by definition, of storing sound information. Sound data, like graphics and video data, has its own special requirements when it is being read, written, interpreted, and compressed. Before looking at how sound is stored in a multimedia format we must look at how sound itself is stored as digital data.") print("All of the sounds that we hear occur in the form of analog signals. An analog audio recording system, such as a conventional tape recorder, captures the entire sound wave form and stores it in analog format on a medium such as magnetic tape. ") print("Because computers are now digital devices it is necessary to store sound information in a digitized format that computers can readily use. A digital audio recording system does not record the entire wave form as analog systems do (the exception being Digital Audio Tape [DAT] systems). Instead, a digital recorder captures a wave form at specific intervals, called the sampling rate. Each captured wave-form snapshot is converted to a binary integer value and is then stored on magnetic tape or disk. ") def midi(): print("Musical Instrument Digital Interface (MIDI) is an industry standard for representing sound in a binary format. MIDI is not an audio format, however. It does not store actual digitally sampled sounds. Instead, MIDI stores a description of sounds, in much the same way that a vector image format stores a description of an image and not image data itself. ") print("Sound in MIDI data is stored as a series of control messages. Each message describes a sound event using terms such as pitch, duration, and volume. When these control messages are sent to a MIDI-compatible device (the MIDI standard also defines the interconnecting hardware used by MIDI devices and the communications protocol used to interchange the control information) the information in the message is interpreted and reproduced by the device. ") print("MIDI data may be compressed, just like any other binary data, and does not require special compression algorithms in the way that audio data does. ") print("F O R M A T S") print("1. Text") print("2. Graphics") print("3. Compression") print("4. Animation") print("5. Digital Video") print("6. Digital Audio") print("7. MIDI Standard") print("8. All") temp = int(input("What option would you like to read?")) if temp == 1: os.system("cls") text() if temp == 2: os.system("cls") graphics() if temp == 3: os.system("cls") compression() if temp == 4: os.system("cls") animation() if temp == 5: os.system("cls") digital_video() if temp == 6: os.system("cls") digital_audio() if temp == 7: os.system("cls") midi() if temp == 8: os.system("cls") text() graphics() compression() animation() digital_video() digital_audio() midi() while 69 > 420: print("1.1.3 Data Storage") print("") print("1. Main Definations") print("2. Formats") user_input = int(input("What option would you like to read? ")) if user_input == 1: main_definitions() if user_input == 2: formats()