diff options
Diffstat (limited to 'comp/work')
-rw-r--r-- | comp/work/57/question | 35 | ||||
-rw-r--r-- | comp/work/57/starter | 0 | ||||
-rw-r--r-- | comp/work/58/example.c | 54 | ||||
-rw-r--r-- | comp/work/58/libraylib.a | bin | 0 -> 2766972 bytes | |||
-rw-r--r-- | comp/work/58/starter | 27 | ||||
-rw-r--r-- | comp/work/58/test.s | 35 | ||||
-rw-r--r-- | comp/work/59/ed.hup | 2 | ||||
-rwxr-xr-x | comp/work/60/question | bin | 0 -> 20728 bytes | |||
-rw-r--r-- | comp/work/60/question.hi | bin | 0 -> 776 bytes | |||
-rw-r--r-- | comp/work/60/question.hs | 18 | ||||
-rw-r--r-- | comp/work/60/question.o | bin | 0 -> 8864 bytes | |||
-rw-r--r-- | comp/work/60/starter | 8 | ||||
-rw-r--r-- | comp/work/60/test | 12 | ||||
-rw-r--r-- | comp/work/61/question | 8 | ||||
-rw-r--r-- | comp/work/62/starter | 19 | ||||
-rw-r--r-- | comp/work/63/final | 90 |
16 files changed, 308 insertions, 0 deletions
diff --git a/comp/work/57/question b/comp/work/57/question new file mode 100644 index 0000000..9ee9079 --- /dev/null +++ b/comp/work/57/question @@ -0,0 +1,35 @@ +5.1) It avoids the worry of running out of IP addresses on the local +network (1) + +5.2) Because the external ip address of the computer will be the +same for the entire network, meaning each lan only takes up 1 IP address +(2) + +5.3) By blocking websites that may contain malware on a blacklist basis. +By blocking all comunications through specific ports that could be holding +dangerous info. By inspecting all incoming data and blocking it if it +is dangerous. By redirecting some sites to other ones, avoiding tracking +sites. +(3) + +5.4) A subnet mask will be used to check if the 2 computers are +connected to eachother via the same router, or if they can comunicate +via a chain of local routers. The packets will be set over a network by +first sending them down the link (physcal) connection, to the router, +they will have been processed to work with the ip protocol, and tcp or +udp, and a applications specific formating. The packet will be sent to +the routher which will check if the device that is going to recive the +data is on the same network, if it is, it will send it straight to it, +otherwise it will be sent over the internet. Packet switching will be +used to ensure that the data is sent quickly. The packet will be broken +into many peices and sent accorss many different wires accross the world. +When the data is recived on the otherside it will be put back together in +the right order. The data will have been sent with a checksum, this can +be checked by the recipient. It will contain some form of information, +in a known format (like the number of 1's in the data) and check if +that value matches what was recived in the packet. If it is not, then +the data was currupted, and the recipient will ask for it to be resent. +When it is sent properly the process ends. +(8) + +2)a) diff --git a/comp/work/57/starter b/comp/work/57/starter new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/comp/work/57/starter diff --git a/comp/work/58/example.c b/comp/work/58/example.c new file mode 100644 index 0000000..1fb81b8 --- /dev/null +++ b/comp/work/58/example.c @@ -0,0 +1,54 @@ +#include <stdio.h> +#include <stdlib.h> + +typedef enum op { + ADD, + SUB, + MUL, + DIV, +} op; + +struct operation { + int a, b; + op o; + int (*funcs[2][2])(int, int); +}; + +int add(int a, int b) { + return a + b; +} +int sub(int a, int b) { + return a - b; +} +int mul(int a, int b) { + return a * b; +} +int Div(int a, int b) { + return a / b; +} + +int runop(struct operation *o) { + switch (o->o) { + case ADD: return o->funcs[0][0](o->a, o->b); + case SUB: return o->funcs[0][1](o->a, o->b); + case MUL: return o->funcs[1][0](o->a, o->b); + case DIV: return o->funcs[1][1](o->a, o->b); + } + return -1; +} + +struct operation *initop(int a, int b, op ope) { + struct operation *o = malloc(sizeof(struct operation)); + o->a = a; + o->b = b; + o->funcs[0][0] = &add; + o->funcs[0][1] = ⊂ + o->funcs[1][0] = &mul; + o->funcs[1][1] = &Div; + o->o = ope; +} + +int main() { + struct operation *o = initop(5, 5, MUL); + printf("%d\n", runop(o)); +} diff --git a/comp/work/58/libraylib.a b/comp/work/58/libraylib.a Binary files differnew file mode 100644 index 0000000..8af9033 --- /dev/null +++ b/comp/work/58/libraylib.a diff --git a/comp/work/58/starter b/comp/work/58/starter new file mode 100644 index 0000000..0261da9 --- /dev/null +++ b/comp/work/58/starter @@ -0,0 +1,27 @@ +130 | R1 | R2 | R3 | R4 + 83 | 83 | 0 | | 0 + | | 1 | 1 | + | | | | 1 + | 41 | | | + | | 2 | 1 | + | | | | 2 + | 20 | | | + | | 3 | 0 | + | 10 | | | + | | 4 | 0 | + | 5 | | | + | | 5 | 1 | 3 + | 2 | | | + | | 6 | 0 | + | 1 | | | + | | 7 | 1 | 4 + | 0 | | | + | 83 | | | 0 + | 211| | | + 211| | | | + +It adds a parity bit to the number + +faster, lower level access + +not OO or functional diff --git a/comp/work/58/test.s b/comp/work/58/test.s new file mode 100644 index 0000000..cbf161f --- /dev/null +++ b/comp/work/58/test.s @@ -0,0 +1,35 @@ +.text +.global _start + +_start: + push %rbp + mov %rsp, %rbp + + mov $100, [rsp - 4] + mov $100, (rsp - 8) + push $name + call InitWindow + + add $16, %rsp + pop %rbp + ret + + mov $0, %r12 +loop: + push %rbp + mov %rsp, %rbp + call WindowShouldClose + pop %rbp + ret + + cmp %r12, %rax + je loop + + push $1 + call exit + +.data +name: +.asciz "testing" + + diff --git a/comp/work/59/ed.hup b/comp/work/59/ed.hup new file mode 100644 index 0000000..3607ff5 --- /dev/null +++ b/comp/work/59/ed.hup @@ -0,0 +1,2 @@ +1) A,D +2) -0.017578125 diff --git a/comp/work/60/question b/comp/work/60/question Binary files differnew file mode 100755 index 0000000..30d3673 --- /dev/null +++ b/comp/work/60/question diff --git a/comp/work/60/question.hi b/comp/work/60/question.hi Binary files differnew file mode 100644 index 0000000..ff75cdd --- /dev/null +++ b/comp/work/60/question.hi diff --git a/comp/work/60/question.hs b/comp/work/60/question.hs new file mode 100644 index 0000000..b8970a7 --- /dev/null +++ b/comp/work/60/question.hs @@ -0,0 +1,18 @@ +temps = [50, 68, 95, 86] + +fu a = (a - 32) * 5 / 9 + +fv b = map fu b + +fw [] = 0 +fw (x:xs) = 1 + fw (xs) + +fx [] = 0 +fx (x:xs) = x + fx (xs) + +fy c = fx(c) / fw(c) + +fz d = fy(fv(d)) + +main = do + print (fz temps) diff --git a/comp/work/60/question.o b/comp/work/60/question.o Binary files differnew file mode 100644 index 0000000..e7de03e --- /dev/null +++ b/comp/work/60/question.o diff --git a/comp/work/60/starter b/comp/work/60/starter new file mode 100644 index 0000000..f83dd6a --- /dev/null +++ b/comp/work/60/starter @@ -0,0 +1,8 @@ +call no | arg | ret +1 | [4,2,5,3] | 52 +2 | [2,5,3] | 24 +3 | [5, 3] | 11 +4 | [3] | 3 +5 | [] | 0 + + diff --git a/comp/work/60/test b/comp/work/60/test new file mode 100644 index 0000000..ce8a64c --- /dev/null +++ b/comp/work/60/test @@ -0,0 +1,12 @@ +11.1)1) 192.168.192.1 +11.1)2) 192.168.64.1 +11.1)3) 192.168.64.16 + +11.2) C + +11.3) To avoid running out of avalibe ip addresses, as IPV4 has a "low" limit +comapared to IPV6 + +11.4) star + +11.5) balls diff --git a/comp/work/61/question b/comp/work/61/question new file mode 100644 index 0000000..3084b0f --- /dev/null +++ b/comp/work/61/question @@ -0,0 +1,8 @@ +0 | 1 | 2 | 3 | 4 | 5 | 6 +------------------------- +1 | - | 2 | 5 | 3 | - | 8 +2 | 2 | - | 1 | - | - | - +3 | 5 | 1 | - | - | - | 4 +4 | 3 | - | - | - | 1 | - +5 | - | - | - | 1 | - | 5 +6 | 8 | - | 4 | - | 5 | - diff --git a/comp/work/62/starter b/comp/work/62/starter new file mode 100644 index 0000000..67dc3c5 --- /dev/null +++ b/comp/work/62/starter @@ -0,0 +1,19 @@ +The transport layer will format the packet with the send address and return address, this is the IP part of the protocol. It will package the data up in such a way that it can be sent down many different routes. The transport layer is the section that desides the route, sending many packets down different routes is called packet switching. + +To act as a connection point for all the devices. + +IMAP -- recives mail from the internet and stores it in a "mail box", this can be retrieved by many devices, allowing mail to be synced between them. + +SMTP -- sends mail, will send it to another users mail box. + +A well known port is a port that all applications implementing a spceific protocol will use. + +This is to ensure that these applications are cross compatibe with eachother, and that communication can be automatic (no need to have a different port for every person you want to talk too). + +Computer A has a private key +The email will be sent with a public key +The private key is used to encrypt the data +The public key can decrypt the data +Computer B will recive the email and attempt to decrypt it with the public key +If it can do this, then it means the email must have been sent from computer A +If not, then it couldn't have been sent from computer A diff --git a/comp/work/63/final b/comp/work/63/final new file mode 100644 index 0000000..22c4a47 --- /dev/null +++ b/comp/work/63/final @@ -0,0 +1,90 @@ +1) +less repeted code -- code can be writen once and used many times +allows for recursion -- subroutines can call themselfs +creates more maintainable code -- allows for only 1 point to be changed to edit the whole program + +2) +avoid un-reputable websites +use https only +keep backups so systems with viruses can be wiped without lossing anything +don't click on links in emails + +3) +protocol -- http +domain name -- loveapug.org.uk + +4) +it can be slow to query +duplicate data takes up extra space + +5) +it is faster to run +it provides lower level hardware access + +6) +the set real numbers + +7) +no side effects or global state meaning any server can run a function to get the same output +because everything is a function, a program can be executed accross many servers at once + +8) +NO + +9) +lifetime +packet id + +10) +the data can be checked if it matches the checksum, which can tell the system if there was an error in transmition. It will be calculated from the data on the senders side, and will be attached to the packet + +11) +sjeydchdj + +12) +the key must be the same length as the input, the key must not repeat + +13) +2 + +14) +all the lines of data are sent using a shared clock, and are recvied at the same time + +15) +bt: O(log n) +bs: O(n^2) +ls: 0(n) +ms: O(nlog n) + +16) +sending many lines of data at once, to achieve a faster speed + +17) +you only need 1 wire + +18) +B + +19) +to tell the other end of the signal to start reading data + +20) +to tell the other end of the signal to stop reading data + +21) +to manage system reasores +to provide a simple programming interface for programmers + +22) + + + + + + + + + + + + |