<?php session_start (); ?> <form method="POST" action="./form20240317.php"> <input type="text" name="form20240317a"></input> <input type="submit"></input> </form> <?php setcookie ("form20240317b", "Hallo, ich bin das erste Cookie", time () + 800); echo session_id () . "<br>n"; echo htmlentities (\$_POST ["form20240317a"]) . "<br>n"; echo htmlentities (\$_COOKIE ["form20240317b"]) . "<br>n"; echo htmlentities (\$_COOKIE ["form20240317c"]) . "<br>n"; session_destroy (); ?>
Trying ::1... Connected to localhost. Escape character is '\^]'. HTTP/1.1 200 OK Date: Sun, 17 Mar 2024 10:18:58 GMT Server: Apache/2.4.57 (Debian) Set-Cookie: PHPSESSID=6otcd9sd4g14ia6erpu3fvsn50; path=/ Expires: Thu, 19 Nov 1981 08:52:00 GMT Cache-Control: no-store, no-cache, must-revalidate Pragma: no-cache Set-Cookie: form20240317b=Hallo%2C%20ich%20bin%20das%20erste%20Cookie; expires=Sun, 17 Mar 2024 10:32:18 GMT; Max-Age=800 Vary: Accept-Encoding Content-Length: 230 Content-Type: text/html; charset=UTF-8 <form method="POST" action="./form20240317.php"> <input type="text" name="form20240317a"></input> <input type="submit"></input> </form> 6otcd9sd4g14ia6erpu3fvsn50<br> Hallo, ich das Datum<br> <br> Dies ist das zweite Cookie<br>
POST http://localhost/mysql20240217/20240317/form20240317.php HTTP/1.1 host: localhost Cookie: form20240317c=Dies ist das zweite Cookie Content-Length: 34 Content-Type: application/x-www-form-urlencoded form20240317a=Hallo, ich das Datum
global _start section .data arrayToSort: db 'asdhjasdnasmdsadmads', 0x00 arrayToSortLen: equ \$-arrayToSort section .text _start: mov esi, arrayToSort loop1: mov al, [esi] cmp al, 0x00 je loop1end mov al, [esi] mov edi, esi inc edi loop2: mov bl, [edi] cmp bl, 0x00 je loop2end mov bl, [edi] cmp al, bl jle noexchange mov al, [esi] mov bl, [edi] mov [edi], al mov [esi], bl noexchange: mov al, [esi] inc edi jmp loop2 loop2end: inc esi jmp loop1 loop1end: mov edx, arrayToSortLen mov ecx, arrayToSort mov ebx, 1 mov eax, 4 int 0x80 mov ebx, 0 mov eax, 1 int 0x80
david@laptop-peaq:~\$ david@laptop-peaq:~\$ nasm -f elf32 -g x86_20240317.asm david@laptop-peaq:~\$ ld -m elf_i386 -g x86_20240317.o david@laptop-peaq:~\$ ./a.out aaaaadddddhjmmnsssssdavid@laptop-peaq:~\$
Jetzt mache ich weiter Aufgaben, und zwar erst Mal schriftliche Sachen - und IEEE754-Umrechnung 1.) IEEE754-Umrechnung.
12.78125 12/6 = 2 Rest 0 6/2 = 3 Rest 0 3/2 = 1 Rest 1 1/2 = 0 Rest 1 0.78125 * 2 = 1.56250 1 0.56250 * 2 = 1.1250 1 0.125 * 2 = 0.25 0 0.25 * 2 = 0.5 0 0.5 * 2 = 1.0 1 0.78125 * 2 = -------------- 1.56250 0.5625 * 2 = 1.1250 1100.11001b 1100.11001b = 1,10011001b * 2\^3 127 + 3 = 130 130 / 2 = 65 Rest 0 65 / 2 = 32 Rest 1 32 / 2 = 16 Rest 0 16 / 2 = 8 Rest 0 8 / 2 = 4 Rest 0 4 / 2 = 2 Rest 0 2 / 2 = 1 Rest 0 1 / 2 = 0 Rest 1 [0] Vorzeichenzeichen [10000010] Exponent (1,10011001b) = [10011001], normalisierte Mantisse [0][10000010][10011001] 0100.0001.0100.1100.1000.0000.0000 0x414C800 Richtig
Jetzt habe ich dieses Beispiel von der Fernuni Hagen immer wieder Gerechnet. Ich sollte mir jetzt selber ein Programm generieren
Der witz ist - dass ich bei der Nachkommastelle keine seltsame Zahl haben will - also ich moechte kein 0.712831233333 haben, weil, dann kriege ich probleme mit der Rundung
Und deswegen muss ich mir jetzt ein sinngemaesses Programm schreiben
Die Frage ist wie
wenn ich zum Beispiel
1/4 geht 1/8 geht 1/16 geht
Das koennte man so machen.
das man einfach
n als Zufallszahl nimmt und so oft zwei miteinander multipliziert. n sollte nicht groesser als 8 sein
Und dann teilt man 1 dadurch
Ok und fuer das vor dem Komma, nimmt einfach eine Zahl zwischen
1 und 21̂5
Das funktioniert schon mal ganz gut Rechne die Zahl in IEEE-754 um 30148.031250 Rechne die Zahl in IEEE-754 um 23287.031250 Rechne die Zahl in IEEE-754 um 5402.125000 Rechne die Zahl in IEEE-754 um 23607.007812
#include <stdio.h> #include <stdlib.h> #include <time.h> int main (void) { time_t t; int n; float f1 = 1; float f2; srand ((unsigned )time (\&t)); f2 = (float) (rand () % (8192 * 4)); n = (rand () % 8) + 2; while (n > 0) { f1 = f1 / 2; n--; } f2 = f2 + f1; printf ("Rechne die Zahl in IEEE-754 um %fn", f2); return 0; }
Jetzt mache die Schriftlichen Aufgaben.
1.) Rechne die Zahl in binaer Darstellung in eine Dezimale Darstellung um 1111111010110111b 65207d 2.) Rechne die Zahl in dezimal darstellung in eine Binaerdarstellung um 21514 0101010000001010 3.) Addiere die drei Zahlen schriftlich 62758 + 8634 + 27769 ----------------- 99161 4.) Subtrahiere die letzten drei Zahlen schriftlich von der ersten schriftlich 6534 - 1457 - 5547 - 741 ----------------- -1211 5.) Rechne die Zahl ins zweier komplement um, mit 8 Bit - und subtrahiere diese zahl von der ersten und rechne das Ergebnis nach dezimal -103 -24 = -127 10011001 11101000 = 10000001 6.) Multipliziere die zwei Zahlen schriftlich 56885*340 = 19340900 7.) Dividiere die zwei Zahlen schriftlich 38673/15591 = 2 8.) Errechne x Logarithmisch mit dem Taschenrechner 64764\^x = 1739002694
0 0 0 0 0 0 1 0 0 0 1 1 2 0 0 1 0 0 3 0 0 1 1 1 4 0 1 0 0 1 5 0 1 0 1 1 6 0 1 1 0 1 7 0 1 1 1 1 8 1 0 0 0 0 9 1 0 0 1 1 10 1 0 1 0 0 11 1 0 1 1 1 12 1 1 0 0 0 13 1 1 0 1 1 14 1 1 1 0 0 15 1 1 1 1 1 1 0 0 0 1 1 3 0 0 1 1 1 4 0 1 0 0 1 5 0 1 0 1 1 6 0 1 1 0 1 7 0 1 1 1 1 9 1 0 0 1 1 11 1 0 1 1 1 13 1 1 0 1 1 15 1 1 1 1 1 Gruppe 1: 1 0 0 0 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7:13:15 - 1 - 1 9:11:13:15 1 - - 1 1:5:9:13 - - 0 1 1:5:3:7 0 - - 1 9:13:11:!5 1 - - 1 3:7:11:15 - - 1 1 4:9:5:13 - - 0 1 4:9:3:11 - 0 - 1 5:13:7:15 - 1 - 1 3:11:7:15 - - 1 1 4:5:6:7 0 1 - - 4:6:5:7 0 1 - - 1:3:9:11 - 0 - 1 4:9:3:11 - 0 - 1 5:7:13:15 - 1 - 1 5:13:15 - 1 - 1 9:11:13:15 1 - - 1 9:13:11:!5 1 - - 1 1:5:3:7 0 - - 1 3:7:11:15 - - 1 1 3:11:7:15 - - 1 1 4:9:5:13 - - 0 1 1:5:9:13 - - 0 1 4:5:6:7 0 1 - - 1:3:9:11 - 0 - 1 5:7:13:15 - 1 - 1 9:11:13:15 1 - - 1 3:7:11:15 - - 1 1 4:9:5:13 - - 0 1 3:7:11:15:1:9:5:13 - - - 1 4:5:6:7 0 1 - - 1 0 0 0 1 1 3 0 0 1 1 1 4 0 1 0 0 1 5 0 1 0 1 1 6 0 1 1 0 1 7 0 1 1 1 1 9 1 0 0 1 1 11 1 0 1 1 1 13 1 1 0 1 1 15 1 1 1 1 1 y <= (x0) or (not x3 and x2) y <= not (not(x0) and (x3 or not x2)) library ieee; use ieee.std_logic_1164.all; entity quine20240317 is port ( x3, x2, x1, x0: in std_logic; y: out std_logic ); end; architecture behaviour of quine20240317 is begin y <= (x0) or (not x3 and x2); end; library ieee; use ieee.std_logic_1164.all; entity quine20240317testbench is port ( y: out std_logic ); end; architecture behaviour of quine20240317testbench is component quine20240317 port ( x3, x2, x1, x0: in std_logic; y: out std_logic ); end component; signal x3, x2, x1, x0: std_logic; begin q: quine20240317 PORT MAP (x3=>x3, x2=>x2, x1=>x1, x0=>x0, y=>y);
library ieee; use ieee.std_logic_1164.all; entity quine20240317 is port ( x3, x2, x1, x0: in std_logic; y: out std_logic ); end; architecture behaviour of quine20240317 is begin y <= (x0) or (not x3 and x2); end; library ieee; use ieee.std_logic_1164.all; entity quine20240317testbench is port ( y: out std_logic ); end; architecture behaviour of quine20240317testbench is component quine20240317 port ( x3, x2, x1, x0: in std_logic; y: out std_logic ); end component; signal x3, x2, x1, x0: std_logic; begin q: quine20240317 PORT MAP (x3=>x3, x2=>x2, x1=>x1, x0=>x0, y=>y); x0 <= '0' after 0 ns, '1' after 10 ns, '0' after 20 ns, '1' after 30 ns, '0' after 40 ns, '1' after 50 ns, '0' after 60 ns, '1' after 70 ns, '0' after 80 ns, '1' after 90 ns, '0' after 100 ns, '1' after 110 ns, '0' after 120 ns, '1' after 130 ns, '0' after 140 ns, '1' after 150 ns; x1 <= '0' after 0 ns, '0' after 10 ns, '1' after 20 ns, '1' after 30 ns, '0' after 40 ns, '0' after 50 ns, '1' after 60 ns, '1' after 70 ns, '0' after 80 ns, '0' after 90 ns, '1' after 100 ns, '1' after 110 ns, '0' after 120 ns, '0' after 130 ns, '1' after 140 ns, '1' after 150 ns; x2 <= '0' after 0 ns, '0' after 10 ns, '0' after 20 ns, '0' after 30 ns, '1' after 40 ns, '1' after 50 ns, '1' after 60 ns, '1' after 70 ns, '0' after 80 ns, '0' after 90 ns, '0' after 100 ns, '0' after 110 ns, '1' after 120 ns, '1' after 130 ns, '1' after 140 ns, '1' after 150 ns; x3 <= '0' after 0 ns, '0' after 10 ns, '0' after 20 ns, '0' after 30 ns, '0' after 40 ns, '0' after 50 ns, '0' after 60 ns, '0' after 70 ns, '1' after 80 ns, '1' after 90 ns, '1' after 100 ns, '1' after 110 ns, '1' after 120 ns, '1' after 130 ns, '1' after 140 ns, '1' after 150 ns; end;
<?php session_start (); include ("/home/david/mysqldata.php"); \$db = new PDO ("mysql: host=localhost", \$MYSQL_USER, \$MYSQL_PASSWORD); \$sql = "CREATE DATABASE mysql20240317" . session_id () . "; "; \$db->query (\$sql); \$sql = "USE mysql20240317" . session_id () . "; "; \$db->query (\$sql); \$sql = "CREATE TABLE a (x1 INTEGER, x2 INTEGER); CREATE TABLE b (y1 INTEGER, y2 INTEGER); "; \$db->query (\$sql); \$sql = "INSERT INTO a (x1, x2) VALUES (0, 0); INSERT INTO a (x1, x2) VALUES (0, 1); INSERT INTO a (x1, x2) VALUES (1, 0); INSERT INTO a (x1, x2) VALUES (1, 1); INSERT INTO a (x1, x2) VALUES (2, 7); INSERT INTO b (y1, y2) VALUES (0, 0); INSERT INTO b (y1, y2) VALUES (1, 1); INSERT INTO b (y1, y2) VALUES (2, 7); "; \$db->query (\$sql); \$sql = "SELECT x1, x2 FROM a; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", " . \$row [1] . "; "; echo "<br>n"; \$sql = "SELECT y1, y2 FROM b; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", " . \$row [1] . "; "; echo "<br>n"; \$sql = "SELECT x1, x2, y1, y2 FROM a INNER JOIN b ON a.x1 = b.y1; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", " . \$row [1] . ", " . \$row [2] . ", " . \$row [3] . "; "; echo "<br>n"; \$sql = "DROP DATABASE mysql20240317" . session_id () . "; "; \$db->query (\$sql); session_destroy (); ?>
0, 0; 0, 1; 1, 0; 1, 1; 2, 7; <br> 0, 0; 1, 1; 2, 7; <br> 0, 0, 0, 0; 0, 1, 0, 0; 1, 0, 1, 1; 1, 1, 1, 1; 2, 7, 2, 7; <br>
<?php session_start (); include ("/home/david/mysqldata.php"); \$db = new PDO ("mysql: host=localhost", \$MYSQL_USER, \$MYSQL_PASSWORD); \$sql = "CREATE DATABASE q20240318" . session_id () . "; "; \$db->query (\$sql); \$sql = "USE q20240318" . session_id () . "; "; \$db->query (\$sql); \$sql = "CREATE TABLE a (x INTEGER); CREATE TABLE b (x INTEGER); CREATE TABLE c (x INTEGER); "; \$db->query (\$sql); for (\$i = 0; \$i < 24; \$i++) { \$sql = "INSERT INTO a (x) VALUES (" . rand () % 32 . "); INSERT INTO b (x) VALUES (" . rand () % 64 . "); INSERT INTO c (x) VALUES (" . rand () % 128 . "); "; \$db->query (\$sql); } \$sql = "SELECT x FROM (SELECT x FROM a UNION SELECT x FROM b) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "SELECT x FROM (SELECT x FROM a UNION SELECT x FROM c) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "SELECT x FROM (SELECT x FROM b UNION SELECT x FROM c) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM c) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "SELECT x FROM ( SELECT x FROM (SELECT x FROM a UNION SELECT x FROM b) x INTERSECT SELECT x FROM c ) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "SELECT x FROM ( SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM c ) x UNION SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM c ) x ) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "SELECT x FROM ( SELECT x FROM (SELECT x FROM a UNION SELECT x FROM c) x INTERSECT SELECT x FROM b ) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "SELECT x FROM ( SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x UNION SELECT x FROM (SELECT x FROM c INTERSECT SELECT x FROM b) x ) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "SELECT x FROM ( SELECT x FROM (SELECT x FROM b UNION SELECT x FROM c) x INTERSECT SELECT x FROM a ) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "SELECT x FROM ( SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM b) x UNION SELECT x FROM (SELECT x FROM a INTERSECT SELECT x FROM c) x ) x; "; \$stmt = \$db->query (\$sql); while (\$row = \$stmt -> fetch ()) echo \$row [0] . ", "; echo "; <br>n"; \$sql = "DROP DATABASE q20240318" . session_id () . "; "; \$db->query (\$sql); session_destroy (); ?>
9, 1, 24, 19, 31, 0, 8, 16, 27, 21, 25, 4, 13, 20, 6, 5, 46, 2, 30, 37, 28, 32, 14, 49, 55, 58, 7, 40, 63, 53, ; <br> 9, 1, 24, 19, 31, 0, 8, 16, 27, 21, 25, 4, 13, 20, 6, 71, 112, 29, 45, 65, 38, 117, 14, 34, 47, 70, 40, 17, 89, 55, 60, 118, 46, 58, 75, 90, ; <br> 4, 5, 46, 27, 2, 30, 37, 28, 32, 14, 0, 49, 20, 55, 58, 1, 7, 40, 63, 53, 71, 112, 29, 45, 65, 38, 117, 34, 6, 47, 70, 17, 89, 19, 60, 118, 75, 90, ; <br> 1, 0, 27, 4, 20, ; <br> 19, 6, ; <br> 46, 14, 55, 58, 40, ; <br> 19, 6, 46, 14, 55, 58, 40, ; <br> 19, 6, 46, 14, 55, 58, 40, ; <br> 1, 0, 27, 4, 20, 14, 40, 55, 46, 58, ; <br> 1, 0, 27, 4, 20, 14, 40, 55, 46, 58, ; <br> 4, 27, 0, 20, 1, 6, 19, ; <br> 1, 0, 27, 4, 20, 19, 6, ; <br>
Zustand Folge-Zustand fuer Ausgang x=0 x=1 1 2 1 1 2 3 8 0 3 8 2 0 4 2 6 0 5 8 6 0 6 3 1 0 7 2 6 1 8 2 3 0 1 2 1 1 7 2 6 1 2 3 8 0 3 8 2 0 4 2 6 0 5 8 6 0 6 3 1 0 8 2 3 0 (2,3) (3,8) (8,2) (2,4) (3,2) (8,6) (2,5) (3,8) (8,6) (2,6) (3,3) (8,1) (2,8) (3,2) (8,3) (3,4) (8,2) (2,6) (3,5) (8,8) (2,6) (3,6) (8,3) (2,1) (3,8) (8,2) (2,3) (4,5) (2,8) (6,6) (4,6) (2,3) (6,1) (4,8) (2,2) (6,3) (5,6) (8,3) (6,1) (5,8) (8,2) (6,3) (6,8) (2,2) (3,3) (1,7) (1,6) (2,3) (3,8) (2,8) (2,4) (2,3) (6,8) (2,5) (3,8) (6,8) (2,6) (1,8) (2,8) (3,8) (3,4) (2,8) (2,6) (3,5) (2,6) (3,6) (3,8) (1,2) (3,8) (2,8) (2,3) (4,5) (2,8) (4,6) (2,3) (1,6) (4,8) (3,6) (5,6) (3,8) (1,6) (5,8) (2,8) (3,6) (6,8) --(1,7) --(1,6) (2,3) (3,8) (2,8) --(2,4) (2,3) --(6,8) --(2,5) --(3,8) --(6,8) --(2,6) --(1,8) (2,8) (3,8) --(3,4) (2,8) --(2,6) --(3,5) --(2,6) --(3,6) (3,8) --(1,2) (3,8) (2,8) (2,3) (4,5) (2,8) --(4,6) (2,3) --(1,6) --(4,8) --(3,6) --(5,6) (3,8) --(1,6) --(5,8) (2,8) --(3,6) (2,3) (3,8) (2,8) (2,8) (3,8) (3,8) (2,8) (2,3) (4,5) (2,8)