S3 Computer Literacy - Computer Network PDF
Document Details
Uploaded by Jamievil_
Sacred Heart Canossian College
Tags
Summary
This document provides an overview of computer networks, focusing on local area networks (LANs) and the Internet. It details the components of a network, including network interface cards and communication media, as well as concepts like IP addresses and URLs.
Full Transcript
Sacred Heart Canossian College S3 Computer Literacy Computer Network The Internet The Internet is the global system of interconnected computer networks (e.g. LAN) that use the Internet protocol suite (TCP/IP) to lin...
Sacred Heart Canossian College S3 Computer Literacy Computer Network The Internet The Internet is the global system of interconnected computer networks (e.g. LAN) that use the Internet protocol suite (TCP/IP) to link devices worldwide. It is a network of networks that consists of private, public, academic, business, and government networks of local to global scope, linked by a broad array of electronic, wireless, and optical networking technologies. The Internet carries information resources and services, such as web page, electronic mail, telephony, and video streaming. Local Area Network A computer network is a group of interconnected computers. A local-area network (LAN) is a computer network covering a small geographic area such as a residence, school, university campus or office building. Ethernet (wired) and Wi-Fi (wireless) are the two most common transmission technologies in use for local area networks. The network diagram of a LAN set up at school is shown below: Optical Tablet Fiber AP Router ONT Computer Internet LAN cable Connection Mobile Radio wave LAN Radio wave Phone LAN Laptop AP Computer Network interface An access point (AP) creates a Wi-Fi network. It connects to a router via a LAN cable, and projects a Wi-Fi signal to a designated area. A router forwards data packets between computer networks. Routers perform the traffic directing functions on the Internet. An optical network terminal (ONT) converts optical signals (laser) into electrical signals, and vice-versa. 1 Mobile Network Besides local-area network, we can also connect a computer to the Internet through 4G and 5G mobile networks, which provide radio coverage over a wide geographic area such as a city. A mobile network or cellular network is a communication network where the last link is wireless. The network is distributed over land through cells where each cell includes at least one fixed-location transceiver known as base station. These cells together provide radio coverage over a wide geographic area. Mobile phone is therefore able to communicate even if it is moving through cells during transmission. When a mobile phone moves from one cell to another, the connection must be transferred from one base station to another. This is called handover. Components of a Computer Network 1. Network Interface Card The network interface card is an interface between a computer and the network. Its main function is to convert data of a computer into electrical signals that travel through the network. 2. Communication Media In a network, the communication media are wires, cables or other means by which data is transmitted. In general, there are two groups of media type, wired (LAN cables, optical fiber) and wireless (radio wave, microwave). LAN cable is mainly used in local area network. Optical fiber permits fast data transmission over long distances and it forms the backbone of the Internet. Radio wave is used in Wi-Fi and cellular network. Microwave is used for satellite communication. 2 3. Connecting Devices A router is a networking device that forwards data packets between computer networks. Routers perform the traffic directing functions on the Internet. Data sent through the internet, such as a web page or email, is in the form of data packets. A packet is typically forwarded from one router to another router through the networks that constitute an internetwork (e.g. the Internet) until it reaches its destination node. IP address An IP address is a unique address that computers use in order to identify and communicate with each other on the Internet. Any participating network device (including routers, computers, network printers, etc) can have its own address that is unique within the scope of the computer network. The IP address of our web server is 210.3.239.228. Typing “http://210.3.239.228” and “http://computer.shcc.edu.hk” in the web browser will get the same web page. Uniform Resource Locator The Uniform Resource Locator (URL) is used to identify not only the location of the computer but also the location of the resources in the computer. A URL consists of four main parts, namely protocol, address, path and file name. For example: https://www.shcc.edu.hk/computer/database/index.html 1. https is the protocol (rules of communication) 2. www.shcc.edu.hk is the host name (address of the web server) 3. computer/database is the path (folders) 4. index.html is the file name (web page) How to configure a Wi-Fi Router? 1. Type " http://192.168.1.1 " in a web browser and login the router. 2. Select your connection type. Then, enter the username and password of your Internet connection. 3. Set a service set identifier (SSID) to identify the router and change its password. 4. Select an encryption protocol for your wireless connection. 5. Generate a password that will need to be used by any computers connecting to your router through Wi-Fi. 3 Client–server model The client-server model is a computing model that partitions workloads between the providers of a service, called servers, and service requesters, called clients. Often clients and servers communicate over a computer network on separate hardware. A server machine is a host that is running one or more server programs (e.g. web server, mail server, ftp server, database server), which share their resources with clients. A client does not share any of its resources, but requests a server's content or service function. Cloud computing Cloud computing is the on-demand delivery of IT resources over the Internet with pay-as-you-go pricing. Instead of buying, owning, and maintaining physical data centers and servers, you can access computing services, such as processing power, storage, databases, networking, software, analytics, and intelligence, on an as-needed basis from a cloud services provider. Examples: Apple iCloud, Google Drive, Google Apps, Zoom Microsoft Azure, Amazon Web Services Multimedia Networking FaceTime is a telecommunication program that specializes in providing video chat and voice calls through the Internet. FaceTime uses VoIP technology. Voice over Internet Protocol (VoIP) technology lets you use the Internet to make and receive telephone calls. With VoIP, analog voice calls are converted into packets of data. The packets travel like any other type of data, such as e-mail, over the public Internet. Streaming means listening to music or watching video in ‘real time’ (e.g. YouTube), instead of downloading a file to your computer and watching it later. Live streaming, which refers to content delivered live over the Internet, requires a source media (video camera), a media encoder (application program) to digitize the content, a media publisher (streaming server), and a content delivery network (the Internet) to distribute and deliver the content. 4 Sacred Heart Canossian College S3 Computer Literacy 5G and IoT What is 5G? 5G is the 5th generation mobile network. It enables a new kind of network that is designed to connect virtually everyone and everything together including machines, objects, and devices. What benefits will it bring? The main benefits of 5G are expected to be that it will be much faster – some are saying as much as 100 times faster. You will be able to download - not merely stream - a full HD movie in less than 10 seconds on a 5G network. The same task would take closer to 10 minutes on 4G. It will also have much lower latency, which means you’ll see very little delay or lag when you do things on your phone or other device – we are talking milliseconds, which are undetectable as a user. That will help not just with existing things such as online gaming, but could also be vital for things like self-driving cars, where any delay could be the difference between life and death. Further, 5G will also have greater capacity, meaning the networks will be able to cope better with many high-demand applications all at once – from connected cars and IoT devices to virtual reality experiences and simultaneous HD video streaming. 5G is fundamental to autonomous cars because they will need a constant, guaranteed connection. Similarly, we might start seeing drones delivering our goods. 5G will be essential for other ‘critical’ scenarios too, such as remote surgery, with doctors controlling medical robots from across the world, and automated factories. Industrial equipment could also be controlled remotely, increasing worker safety, and holographic video could become a reality, allowing for 3D medical imaging and more. 5 Internet of things The Internet of things (IoT) describes physical objects (or groups of such objects) that are embedded with sensors, processing ability, software, and other technologies that connect and exchange data with other devices and systems over the Internet or other communications networks. There are numerous real-world applications of the internet of things. In the consumer segment, for example, smart homes that are equipped with smart thermostats, smart appliances and connected heating, lighting and electronic devices can be controlled remotely via computers and smartphones. In healthcare, IoT offers many benefits, including the ability to monitor patients more closely to use the data that's generated and analyze it. Hospitals often use IoT systems to complete tasks such as inventory management, for both pharmaceuticals and medical instruments. In agriculture, IoT-based smart farming systems can help monitor, for instance, light, temperature, humidity and soil moisture of crop fields using connected sensors. IoT is also instrumental in automating irrigation systems. In a smart city, IoT sensors and deployments, such as smart streetlights and smart meters, can help alleviate traffic, conserve energy, monitor and address environmental concerns and improve sanitation. The Internet of Things (IoT) and sensors have the ability to harness large volumes of data (Big Data), while artificial intelligence (AI) can learn patterns in the data to automate tasks for a variety of business benefits. 6 Sacred Heart Canossian College S3 Computer Literacy Artificial Intelligence Introduction Artificial intelligence (AI), in its broadest sense, is intelligence exhibited by machines, particularly computer systems. It is a field of research in computer science that develops and studies methods and software that enable machines to perceive their environment and use learning and intelligence to take actions that maximize their chances of achieving defined goals. How does AI work? While the specifics vary across different AI techniques, the core principle revolves around data. AI systems learn and improve through exposure to vast amounts of data (big data), identifying patterns and relationships that humans may miss. This learning process often involves algorithms (programs), which are sets of rules or instructions that guide the AI's analysis and decision-making. In machine learning, a popular subset of AI, algorithms are trained on labeled or unlabeled data to make predictions or categorize information. Deep learning, a further specialization, utilizes artificial neural networks with multiple layers to process information, mimicking the structure and function of the human brain. Through continuous learning and adaptation, AI systems become increasingly skillful at performing specific tasks, from recognizing images to translating languages and beyond. Applications Speech recognition – Convert spoken speech into written text. Computer vision – Identify objects and people in images and videos. Machine translation – Translate written or spoken words from one language into another. Natural language processing – Enable computers to understand and communicate with human language. 1 Neural Networks An artificial neural network is an interconnected group of nodes, inspired by a simplification of neurons in a brain. Here, each circular node represents an artificial neuron and an arrow represents a connection from the output of one artificial neuron to the input of another. Each artificial neuron receives signals from connected neurons, then processes them and sends a signal to other connected neurons. The "signal" is a real number, and the output of each neuron is computed by some non-linear function of the sum of its inputs, called the activation function. The strength of the signal at each connection is determined by a weight, which adjusts during the learning process. Neurons are aggregated into layers. Different layers may perform different transformations on their inputs. A network is called a deep neural network if it has at least two hidden layers. Training Neural networks learn by processing examples (big data), each of which contains a known input and a target output. The training of a neural network from a given example is usually conducted by determining the difference between the predicted output of the network and a target output. This difference is the error. The network then adjusts its weights according to a learning rule and using this error value. Successive adjustments will cause the neural network to produce predicted output that is increasingly similar to the target output. In a neural network, a parameter refers to the weights and biases that are learnt during the training process. Here's a breakdown: Weights: Each connection has a weight that determines the strength and direction of the signal between two neurons. Weights are adjusted during training to minimize the error in predictions. Biases: These are additional parameters added to each neuron’s output. They allow the model to fit the data better by shifting the activation function. Both weights and biases are essential for the network to learn from data and make predictions. They are continuously updated using algorithms during the training process. 2 Deep Learning Deep learning uses several layers of neurons between the network's inputs and outputs. Each level learns to transform its input data into a slightly more abstract and composite representation. In an image recognition application, the raw input may be a grid of pixels; the first representational layer may identify basic shapes such as lines and circles; the second layer may compose and encode arrangements of edges; the third layer may encode a nose and eyes; and the fourth layer may recognize that the image contains a face. “Neural network” models of AI process signals by sending them through a network of nodes. Signals pass from node to node along links. “Learning” improves the outcome by adjusting the weights that amplify or damp the signals each link carries. Nodes are typically arranged in a series of layers. Today’s computers can handle “deep-learning” networks with dozens of layers. Artificial intelligence = Computer Science + Mathematics 3 LLM A large language model (LLM) is a computational model notable for its ability to achieve language generation and classification. Based on language models, LLMs acquire these abilities by learning statistical relationships from vast amounts of text during a computationally intensive training process. LLMs can be used for text generation, a form of generative AI, by taking an input text and repeatedly predicting the next token or word. GPT Generative pre-trained transformers (GPT) are a type of large language model (LLM) and a prominent framework for generative artificial intelligence. They are artificial neural networks that are used in natural language processing tasks. GPTs are based on the transformer architecture, pre-trained on large data sets of unlabelled text, and able to generate novel human-like content. Hardware GPU is designed to handle the intensive computation required for artificial intelligence. It is optimized for the parallel processing that AI algorithms demand, allowing for more efficient data handling and faster computation times. CPUs are optimized for latency: to finish a task as fast as possible; GPUs are optimized for throughput: they are slow, but they operate on bulks of data at once. Smaller generative AI models with up to a few billion parameters can run on smartphones and embedded devices. Larger models with tens of billions of parameters can run on laptop or desktop computers. To achieve an acceptable speed, models of this size may require accelerators such as GPU chips or Neural Engines. Language models with hundreds of billions of parameters, such as GPT-4, typically run on datacenter computers equipped with arrays of GPUs or AI accelerator chips. These very large models are typically accessed as cloud services over the Internet. Software TensorFlow is a free and open-source software library for machine learning and artificial intelligence. It can be used in a wide variety of programming languages, including Python and C++. 4 Sacred Heart Canossian College S3 Computer Literacy AI and Python Procedure 1. Log in your Google account 2. Go to Sample Colab Notebooks (http://ict.etextbook.hk/eb1204) 3. Open the corresponding notebook 4. Click “Copy to Drive” 5. Enter the school id: shccR56 6. Click “Run” in this cell to download the certification and the required library Text-to-Speech import tts // page 19 tts.say("Hello world") import tts // page 25 import time tts.say("How are you") time.sleep(2) tts.say("你好嗎", lang="yue-HK") time.sleep(2) tts.say("你好嗎", lang="cmn-CN") time.sleep(2) Translation import cloudtranslation // page 29 cloudtranslation.translate("How are you?") import cloudtranslation // page 38 cloudtranslation.list_languages() import cloudtranslation x = input("Please input the text: ") y = input("In which language would you like the text to be translated: ") z = cloudtranslation.translate(x, lang=y) print(z) 1 Speech recognition import cloudspeech // page 43 print("Say something...") x = cloudspeech.recognise(lang="yue-HK") print(x) import cloudspeech // page 51 import display print("Say something...") x = cloudspeech.recognise() if x == None : print("Sorry I can't hear you.") if x == "on" : display.showImage("light_bulb_on.png") if x == "off" : display.showImage("light_bulb_off.png") Computer vision import cloudvision // page 83 cloudvision.recognise("faces02.jpg", "FACE") import cloudvision Teachable Machine is a no-coding cloudvision.recognise("faces01.jpg", "LANDMARK") machine learning platform introduced by Google. Users can import cloudvision train an AI model on the web cloudvision.recognise("image01.jpg", "OBJECT") browser in a few simple steps; after training, the model can import cloudvision identify the category of images, cloudvision.recognise("motto.jpg", "TEXT") sounds or poses page 88 Machine Learning import cloudvision // page 97 cloudvision.take_photo("photo.jpg", sec=1) class_name, score = cloudvision.predict("photo.jpg") print(class_name, score) 2 Sacred Heart Canossian College S3 Computer Literacy Web Programming – JavaScript JavaScript is the programming language of the Web. It is one of the 4 languages all web developers must learn: 1. HTML to define the content of web pages 2. CSS to specify the layout of web pages 3. JavaScript to program the behavior of web pages run on a web browser 4. PHP to make dynamic web pages run on a web server JavaScript Can Change HTML Content What Can JavaScript Do? JavaScript can change HTML content. Click Me! 1 JavaScript Can Change HTML Attribute Values What Can JavaScript Do? JavaScript can change HTML attribute values. In this case JavaScript changes the value of the src (source) attribute of an image. Turn on the light Turn off the light 2 JavaScript Can Change HTML Styles (CSS) What Can JavaScript Do? JavaScript can change the style of an HTML element. Click Me! JavaScript Variables let x, y, z; x = 5; y = 6; z = x + y; document.getElementById("demo").innerHTML = "The value of z is " + z + "."; 3 JavaScript If A time-based greeting const time = new Date().getHours(); let greeting; if (time < 10) { greeting = "Good morning"; } else if (time < 20) { greeting = "Good day"; } else { greeting = "Good evening"; } document.getElementById("demo").innerHTML = greeting; JavaScript While Loop let text = ""; let i = 0; while (i < 10) { text = text + "The number is " + i; i = i + 1; } document.getElementById("demo").innerHTML = text; 4 JavaScript Table td { width: 100px; text-align: center; } function changeContent(){ let x = document.getElementById("myTable"); x.rows.cells.innerHTML = "Hello"; } a b c d 5 JavaScript Form Validation function validateForm() { let x = document.forms["myForm"]["fname"].value; if (x == "") { alert("Name must be filled out"); return false; } return true; } JavaScript Validation Name: 6 Assignment 1. Complete the JavaScript so that it can change the content of a table according to user input. a td { b width: 100px; text-align: center; } c d function changeContent(){ let x, i, j, c; x = document.getElementById("______"); Row: i = document.forms["myForm"]["______"].value; Column: j = document.forms["myForm"]["______"].value; Content: c = document.forms["myForm"]["______"].value; } 7 2. Write the output of the following programs. Program 1 Program 2 let text = ""; let text = ""; let n = 12, i = 1; let i, j, k; while (i < n) i = 0; { while (i < 3) if (n % i == 0) { text = text + i + ", "; j=0 i = i + 1; while (j < 3) } { document.getElementById("demo").innerHTML = text; k = i * 3 + j; text = text + k + " "; j = j + 1; } text = text + ""; i = i + 1; } document.getElementById("demo").innerHTML = text; 8