RGB Scheme (red green blue) Values are from 0 to 255. All 0 values = Black All 255 values = White To make grey, all RGB values are equal (white and black are extreme shades of grey) example of getting and setting RGB values for each pixel in a for loop: for (pixel: image) { pixel.setRed(pixel.getRed() * 10); pixel.setGreen(pixel.getGreen() * 5); pixel.setBlue(pixel.getBlue() * 20); } -- algorhythm for getting the average of color values: avg = (pixel.getRed() + pixel.getGreen() + pixel.getBlue())/3; --- Lines of code inside braces {} are special in that they are run more than once or when called at a later time by a function for example. Lines of code with no {} are just run once and aren't special in any way. ----- Moore's Law: Transistors get smaller every 18-24 mo. and you can fit twice as many per chip. *This can mean that chips/computers that were once very expensive become more inexpensive and are cheaper to make. ---------- Bits and Bytes: Bit - the smallest type of information in a computer. it is made of of 0s and 1s. It can be in a state that sticks (i.e. it is in one state (1) or the other state (2) ). too small to be useful. Must be grouped into a byte. Byte - stores 8 bits. 8 bits have 256 possible patterns of 0s and 1s. A byte can hold numbers 0 through 255 for example with a pattern assigned to each number. -------- Compiler: a program that translates the sourcecode into machine code and puts those instructions in an .exe file for example. Note; the .exe cannot be translated accurately back into source code. A compiler takes all the code in bulk and translates it for later use by the computer. Dynamic (interpreter) Languages: Java, Javascript, Python, etc. These languages are interpreted by an interpreter (in a browser for example) to the computer. An interpreter looks at the source code one line at a time, line by line, and does it (it is synchronous). Compiled code tends to run faster (alot of the decision making by the computer is taken out, etc.) Dynamic Languages offer more features for the programmer vs. compiled languages. Dynamic language code tends to run slower on the computer than compiled languages. Dynamic langauges generally have automatic memory management (decides when to clear memory of data or store it for later use). Some languages require user input to determine when to clear memory (C, C++). JIT: Just In Time compiler. gets best of both worlds - takes parts of code and compiles them on the fly. All modern browsers have JITs for Javascript code for example. Runs closer to performance on compiled code. ---------------- NETWORKING: The way data is sent over a network, it is broken into packets. i.e. a large file is sent in smaller chunks (packets). Each computers on the LAN has a unique address. This is know as its MAC address (Media Access Control). The MAC address is burned in at the factory There can only be one transmission of send data at one time on the wire. To avoid a collision of data when two computers send at the same time, if packets are sent at the same time and collide, senders follow a "wait/re-transmit" protocol to re-send packets -- wait a random amount of time -- one of Metcalfe's breakthrough ideas -- and then try again when the wire is quiet. Checksum: a feature to check that the byte data is complete. If there is an error the receiver asks the sender to resend the packet in question. Ethernet Design: Computers are all connected to and share one wire/cable. The computer sending has a to:address designation that the other computers listen for as the data is broadcast on the wire. The computers check if the to: address is to them. All computers are listening to the wire all the time. Data is sent when the wire 'goes quiet'. ------ TCP/IP Every computer has an address of 4 bytes (0-255), i.e. 255.255.1.24 -the left part of the address indicates location. The Domain name is a representation of the address using characters instead of numbers in 4 bytes. i.e. www.something.com is translated to an ip address later. Special local addresses: 10.x.x.x or 192.168.x.x These addresses are not out on the internet - they are only for local use. note: the router ends in x.x.x.1 if the computer on the local network is 255.170.70.24, then the router would probably be 255.170.70.1 DHCP - tells the computer to do whatever the router says Ping - a ping packet sends out a packet to ask if the receiver is there. This can be used to indicate that the receiver machine is on and that the network is working. command line: ping www.google.com (or an ip address) TRACEROUTE: maps out the path that your packet takes to get to the destination (lists the hops to the different routers to the end). -------------- TABLE DATA formatted in two sets: Field (that's the column/the category) and Row (the row). csv - comma separated values - a format for storing table data in text format. ---------------- Digital vs. Analogue: Digitization - take in the signal and take samples (i.e. 44,000 per second) and convert them to numbers (for ex. based on height above or below an average line). 2 possible errors: if the signal at the time of sampling is in between a measurement unit used in the sampling system, then it will be reduced or increased to the nearest measuring unit and will not be represented 100% accurately when digitized - this is a very small error. If the signal spikes or varies significantly in between the sampling intervals, then it will not be recorded - most sampling on audio cds is 44,000 times per second, so if there is a spike in between the interval of 44/1000th of a second, the human ear will not be able to detect it. Digital to Audio Conversion: A chip (D/A Converter) receives the numbers from digitization of the audio, and draws a straight line between each number recreating the shape of the audio signal, and then sends the electrical equivalent signal to a speaker which turns it into sound through the cone (of the amplifier for ex.). On a CD, a laser would read encoded 1s and 0s encoded on the disc surface to get the digital numeric data to construct the electrical signal to send to a speaker. Even though there is noise (from specs of dust, or whatever on the surface) on the 1s and 0s collected by the laser - it is able to identify a 1 or a 0 easily, and so when recreating the signal it is preserved perfectly without the noise degrading it. COMPRESSION: Use redundancy - take two sets of data, compare what is the same and save that and just modify data that is different (usually slightly different). Delta Encoding Scheme: Recording a delta number (base number) and additions or subtractions for the following samples that are close in value to it instead of the entire numbers: i.e. instead of recording samples: 12000,12002,12006,12007 You record: 12000,+2,+4,+1 This saves space in the bytes that hold the numbers, so it takes less memory space. LOSSLESS compression - the fidelity is preserved, only the memory required to store the data is decreased. PNG or GIF is an image format that is lossless. These formats are optimized for logos or images with sharp boundaries and well defined colors. More common compression is LOSSY compression: rearranges data so it takes up a lot less space, but on playback some of the fidelity is lost (it is still close enough to the original that it isn't easily noticeable). Some of the sample numbers are dropped or skipped to save space. JPEG is an example of a lossy compression method for images. mp3 for audio. JPEG is optimized for pictures with shades of color and less defined borders, etc. Audio formats: mp3 and AAC or licensed formats - you need to pay a licensing fee to legally play back data used in that format. Ogg Vorbis is open source - no license needed. Video: WebM is an open unlicensed format from google. h.264 is a popular and widely used compression format for video. (it is a codec). Adobe Flash is a product and not a standard for video playback. HTML5 Video tag creates a standard for video playback on the web that will not depend on Flash. ---------------------------- SPREADSHEETS: Standard format is .xlsx (Microsoft XML) Key commands and functions in spreadsheets: '=' - signifies a computation, i.e. =B15+B16 //this grabs the data from column B row 15 and adds it to col B row 16 to return a total. =SUM(B3:16) -- this computes the sum of data from col B rows 3 through 16. You can write =sum( and then click and drag to select the columns to add. =AVERAGE(B3:B16) -- gets the average of selected range of cells. FILL RIGHT feature: Select a group of cells (left to right) and go to the edit menu and select 'Fill Right' -- this will paste the formula/functions in the left most cells to the cells to the right. Useful for getting multiple totals/averages across multiple columns. MAKE A CHART: Select the data cells (including the title cell of the column) and select the Make A Chart option in the program you are using. ---------------------------------------- SECURITY: **Just avoid common mistakes and you should be alright for computer security. *Most hackers use bulk attacks that are looking for victims that take very little precautions. The attacks are low in sophistication but attempted many times. 'Spear Fishing' = sophisticated targeted attacks (rare). types of common attacks: 1) Password attacks: dictionary attacks going through possible permutations. *Make sure that the password is not just a word that is in the dictionary or a pun that is common on the internet or with people. If the password contains some random numbers/letters, then a dictionary attack will not work. Especially use good passwords for email, bank, or sites with your payment info. *Do not re-use important passwords - if where they are used is hacked, then it is a problem for other sites for you. A good password: pick something that is hard to guess and uncommon/random without pattern: 1) start with a word and misspell it a bit with cap letter in there: Mottens 2) add a comma or symbol and add random letters: Mottens,9erx ---------- PHISHING ATTACKS: -the victim is a fish and the hacker is putting out bait. -fake emails pretending to be Amazon, etc. or Fraud alerts etc. The emails look realistic -The trick to spotting a phishing email is to look at the links. The links do not lead to a page that is associated with the company that will prompt the user for a password and user info. Look at the urls and if you are directed to a page to enter password or info, then make sure the site is legit and be careful. Look at the url and make sure it is the company. **Type in the url for the company you want to communicate with in the URL and don't use the link in the email to be sure. HTTPS - ensures that the address belongs to the right company and verifies it (the company has certificates and paper work they have to confirm this). Also uses encryption. https does not protect against malware that is already on your machine. ----------------- MALWARE ATTACKS: *Programs that can be opened are dangerous! -Passive files are safe: .TXT .JPG etc. -Programs are potentially dangerous: i.e. .EXE if you open it. Note: .DOC can act like a program and is not totally passive. Types of techniques: 1) Trojan: disguising the program: i.e. FlowerpicJPEG.exe -SuperAntiVirus.exe - not really an antivirus -make sure that any program you open and run is confirmed by the author and you know where it comes from. 2) Vulnerability: Most dangerous ex: bug in a display program, i.e. Flash, that crashes the program and allows access to the computer. -just visiting a site can compromise the computer -users that update software regularly are safe from these attacks. -------------- FINAL CONCLUSION LECTURE: -Algorithm: names after Baghdad mathematician named al-Khwarizmi (also algebra named after him). -BUGS: Flaws between the intended correct algorithm and what the code actually says.