Re: Aufgaben und UEbungen,

Image Screenshot_20240313_155526

<?php
session_start ();
?>

<form method="POST" action="./form20240313.php">
<input type="text" name="form20240313a"></input>
<input type="submit"></input>
</form>

<?php
echo session_id () . "<br>n";

setcookie ("form20240313b", "Dies ist Cookie 1", time () + 1200);

echo htmlentities (\$_POST ["form20240313a"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240313b"]) . "<br>n";
echo htmlentities (\$_COOKIE ["form20240313c"]) . "<br>n";

session_destroy ();
?>

POST http://localhost/mysql20240217/20240313/form20240313.php HTTP/1.1
host: localhost
Cookie: form20240313c=Hallo, ich bin Cookie 2
Content-Length: 43
Content-Type: application/x-www-form-urlencoded

form20240313a=Hallo, ich bin das erte Datum

Trying ::1...
Connected to localhost.
Escape character is '\^]'.
HTTP/1.1 200 OK
Date: Wed, 13 Mar 2024 15:04:59 GMT
Server: Apache/2.4.57 (Debian)
Set-Cookie: PHPSESSID=l4b6lg8vh3vd920dob42goiqpo; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate
Pragma: no-cache
Set-Cookie: form20240313b=Dies%20ist%20Cookie%201; expires=Wed, 13 Mar 2024 15:24:59 GMT; Max-Age=1200
Vary: Accept-Encoding
Content-Length: 236
Content-Type: text/html; charset=UTF-8


<form method="POST" action="./form20240313.php">
<input type="text" name="form20240313a"></input>
<input type="submit"></input>
</form>

l4b6lg8vh3vd920dob42goiqpo<br>
Hallo, ich bin das erte Datum<br>
<br>
Hallo, ich bin Cookie 2<br>

<?php
session_start ();

include ("/home/david/mysqldata.php");

\$db = new PDO ("mysql: host=localhost", \$MYSQL_USER, \$MYSQL_PASSWORD);

\$sql = "CREATE DATABASE mysql20240313" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "USE mysql20240313" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "CREATE TABLE a (x1 INTEGER, x2 INTEGER); ";
\$db->query (\$sql);

\$sql = "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, 1); INSERT INTO b (y1, y2) VALUES (1, 0); 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 LEFT 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 mysql20240313" . session_id () . "; ";
\$db->query (\$sql);

session_destroy ();
?>

0, 0; 0, 1; 1, 0; 1, 1; 2, 7; <br>
0, 1; 1, 0; 2, 7; <br>
0, 0, 0, 1; 0, 1, 0, 1; 1, 0, 1, 0; 1, 1, 1, 0; 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 quantity20240313" . session_id () . "; ";
\$db->query (\$sql);

\$sql = "USE quantity20240313" . 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 < 18;  \$i++) {
    \$sql = "INSERT INTO a (x) VALUES ("" . rand () % 32 . ""); ";
    \$sql .= "INSERT INTO b (x) VALUES ("" . rand () % 64 . ""); ";
    \$sql .= "INSERT INTO c (x) VALUES ("" . rand () % 48 . ""); ";
    \$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 "; ";

\$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 "; ";

\$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 "; ";

\$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 "; ";

\$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 "; ";

\$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 "; ";

\$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 "; ";

\$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 "; ";

\$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 "; ";

\$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 "; ";

\$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 "; ";

\$sql = "SELECT x FROM (
            SELECT x FROM (SELECT x FROM b INTERSECT SELECT x FROM a) x
                UNION
            SELECT x FROM (SELECT x FROM c INTERSECT SELECT x FROM a) x
    ) x; ";
\$stmt = \$db->query (\$sql);
while (\$row = \$stmt -> fetch ())
    echo \$row [0] . ", ";
echo "; ";

\$sql = "DROP DATABASE quantity20240313" . session_id () . "; ";
\$db->query (\$sql);

session_destroy ();
?>

16, 0, 28, 18, 4, 22, 8, 10, 14, 7, 6, 27, 26, 25, 5, 41, 57, 19, 30, 13, 35, 49, 59, 52, 58, 12, ; 16, 0, 28, 18, 4, 22, 8, 10, 14, 7, 6, 27, 26, 25, 5, 39, 46, 11, 20, 24, 43, 3, 33, 34, 44, 31, 45, 23, ; 41, 57, 19, 30, 13, 6, 0, 28, 35, 49, 59, 14, 52, 58, 22, 12, 39, 46, 27, 11, 20, 24, 43, 3, 33, 34, 44, 31, 45, 23, ; 0, 28, 22, 14, 6, ; 22, 6, 27, ; 6, 22, ; 22, 6, 27, ; 22, 6, 27, ; 0, 28, 22, 14, 6, ; 0, 28, 22, 14, 6, ; 6, 0, 28, 14, 22, 27, ; 6, 0, 28, 14, 22, 27, ;

Image 20240313_171548

1.) Rechne die Zahl in binaer Darstellung  in eine Dezimale Darstellung um
1111111010110100b 65204d
2.) Rechne die Zahl in dezimal darstellung in eine Binaerdarstellung um
6037 0001011110010101
3.) Addiere die drei Zahlen schriftlich
            58176
+            8247
+           47035
-----------------
           113458
4.) Subtrahiere die letzten drei Zahlen schriftlich von der ersten schriftlich
            62678
-           15665
-            3029
-            5450
-----------------
            38534
5.) Rechne die Zahl ins zweier komplement um, mit 8 Bit - und subtrahiere diese zahl von der ersten und rechne das Ergebnis nach dezimal
-20 -1 = -21
11101100 11111111 = 11101011
6.) Multipliziere die zwei Zahlen schriftlich
54549*52120 = 2843093880
7.) Dividiere die zwei Zahlen schriftlich
52560/65327 = 0
8.) Errechne x Logarithmisch mit dem Taschenrechner
33949\^x = 2072538817

Image 20240313_172548

Image 20240313_173521

Image 20240313_174319

Image Screenshot_20240313_180819

 0 0 0 0 0    1
 1 0 0 0 1    0
 2 0 0 1 0    1
 3 0 0 1 1    1
 4 0 1 0 0    1
 5 0 1 0 1    0
 6 0 1 1 0    0
 7 0 1 1 1    1
 8 1 0 0 0    1
 9 1 0 0 1    1
10 1 0 1 0    0
11 1 0 1 1    0
12 1 1 0 0    1
13 1 1 0 1    1
14 1 1 1 0    0
15 1 1 1 1    1


 0 0 0 0 0    1
 2 0 0 1 0    1
 3 0 0 1 1    1
 4 0 1 0 0    1
 7 0 1 1 1    1
 8 1 0 0 0    1
 9 1 0 0 1    1
12 1 1 0 0    1
13 1 1 0 1    1
15 1 1 1 1    1


Gruppe 0:
 0 0 0 0 0    1
Gruppe 1:
 2 0 0 1 0    1
 4 0 1 0 0    1
 8 1 0 0 0    1
Gruppe 2:
 3 0 0 1 1    1
 9 1 0 0 1    1
12 1 1 0 0    1
Gruppe 3:
 7 0 1 1 1    1
13 1 1 0 1    1
Grupppe 4:
15 1 1 1 1    1

0:2         0 0 - 0
0:4         0 - 0 0
0:8         - 0 0 0
2:3         0 0 1 -
4:12        - 1 0 0
8:9         1 0 0 -
8:12        1 - 0 0
3:7         0 - 1 1
9:13        1 - 0 1
12:13       1 1 0 -
7:15        - 1 1 1
13:15       1 1 - 1


0:2         0 0 - 0
13:15       1 1 - 1
2:3         0 0 1 -
8:9         1 0 0 -
12:13       1 1 0 -
0:4         0 - 0 0
8:12        1 - 0 0
3:7         0 - 1 1
9:13        1 - 0 1
0:8         - 0 0 0
7:15        - 1 1 1
4:12        - 1 0 0






0:2         0 0 - 0
13:15       1 1 - 1

2:3         0 0 1 -
8:9         1 0 0 -
12:13       1 1 0 -

0:4         0 - 0 0
8:12        1 - 0 0
9:13        1 - 0 1
3:7         0 - 1 1


0:8         - 0 0 0
4:12        - 1 0 0
7:15        - 1 1 1



Gruppe 0:
0:2         0 0 - 0
Gruppe 3:
13:15       1 1 - 1

Gruppe 1:
2:3         0 0 1 -
8:9         1 0 0 -
Gruppe 2:
12:13       1 1 0 -

Gruppe 0:
0:4         0 - 0 0
Gruppe 1:
8:12        1 - 0 0
Gruppe 2:
9:13        1 - 0 1
3:7         0 - 1 1


Gruppe 0:
0:8         - 0 0 0
Gruppe 1:
4:12        - 1 0 0
Gruppe 3:
7:15        - 1 1 1




Gruppe 0:
0:2                 0 0 - 0
Gruppe 3:
13:15               1 1 - 1

Gruppe 1:
2:3                 0 0 1 -
8:9         1 0 0 -
Gruppe 2:
12:13       1 1 0 -

8:9:12:13           1 - 0 -

Gruppe 0:
0:4         0 - 0 0
Gruppe 1:
8:12        1 - 0 0
Gruppe 2:
9:13        1 - 0 1
3:7         0 - 1 1

0:4:8:12            - - 0 0
1:12:9:13           1 - 0 -
3:7                 0 - 1 1


Gruppe 0:
0:8         - 0 0 0
Gruppe 1:
4:12        - 1 0 0
Gruppe 3:
7:15        - 1 1 1

0:8:4:12            - - 0 0
7:15                - 1 1 1







0:2                 0 0 - 0
13:15               1 1 - 1
2:3                 0 0 1 -
8:9:12:13           1 - 0 -
0:4:1:12            - - 0 0
1:12:9:13           1 - 0 -
3:7                 0 - 1 1
0:8:4:12            - - 0 0
7:15                - 1 1 1


0:2                 0 0 - 0
13:15               1 1 - 1
2:3                 0 0 1 -
8:9:12:13           1 - 0 -
1:12:9:13           1 - 0 -
0:4:8:12            - - 0 0
0:8:4:12            - - 0 0
3:7                 0 - 1 1
7:15                - 1 1 1




0:2                 0 0 - 0
13:15               1 1 - 1
2:3                 0 0 1 -
8:9:12:13           1 - 0 -
0:4:1:12            - - 0 0
3:7                 0 - 1 1
7:15                - 1 1 1

                    0   2   3   4   7   8   9   12  13  15
0:2                 *   *
13:15                                               *   *
2:3                     *   *
8:9:12:13                               *   *   *   *
0:4:8:12            *           *       *       *
3:7                         *       *
7:15                                *                   *




                    0   2   3   4   7   8   9   12  13  15
13:15                                               *   *
2:3                     *   *
8:9:12:13                               *   *   *   *
0:4:8:12            *           *       *       *
3:7                         *       *




13:15               1 1 - 1
2:3                 0 0 1 -
8:9:12:13           1 - 0 -
0:4:1:12            - - 0 0
3:7                 0 - 1 1


        y <= (x3 and x2 and x0) or
                (not x3 and not x2 and x1) or
                (x3 and not x1) or
                (not x1 and not x0) or
                (not x3 and x1 and x0);
        y <= not (
                (not x3 or not x2 or not x0) and
                (x3 or x2 or not x1) and
                (not x3 or x1) and
                (x1 or x0) and
                (x3 or not x1 or not x0)
            );

library ieee;
use ieee.std_logic_1164.all;

entity quine20240313 is
port (
    x3, x2, x1, x0: in std_logic;
    y: out std_logic
);
end;

architecture behaviour of quine20240313 is
begin
        y <= (x3 and x2 and x0) or
                (not x3 and not x2 and x1) or
                (x3 and not x1) or
                (not x1 and not x0) or
                (not x3 and x1 and x0);
end;

library ieee;
use ieee.std_logic_1164.all;

entity quine20240313testbench is
port (
    y: out std_logic
);
end;

architecture behaviour of quine20240313testbench is
    component quine20240313
    port (
        x3, x2, x1, x0: in std_logic;
        y: out std_logic
    );
    end component;
    signal x3, x2, x1, x0: std_logic;
begin
    q: quine20240313 PORT MAP (x3=>x3, x2=>x2, x1=>x1, x0=>x0, y=>y);

library ieee;
use ieee.std_logic_1164.all;

entity quine20240313 is
port (
    x3, x2, x1, x0: in std_logic;
    y: out std_logic
);
end;

architecture behaviour of quine20240313 is
begin
        y <= (x3 and x2 and x0) or
                (not x3 and not x2 and x1) or
                (x3 and not x1) or
                (not x1 and not x0) or
                (not x3 and x1 and x0);
end;

library ieee;
use ieee.std_logic_1164.all;

entity quine20240313testbench is
port (
    y: out std_logic
);
end;

architecture behaviour of quine20240313testbench is
    component quine20240313
    port (
        x3, x2, x1, x0: in std_logic;
        y: out std_logic
    );
    end component;
    signal x3, x2, x1, x0: std_logic;
begin
    q: quine20240313 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;

Zustand		Folge-Zustand fuer	Ausgang
			x=0	x=1
1			5	6				0
2			5	1				0
3			4	8				0
4			8	3				0
5			4	3				1
6			5	3				1
7			7	6				0
8			3	4				0


Zustand		Folge-Zustand fuer	Ausgang
			x=0	x=1
5			4	3				1
6			5	3				1

(5,6)		(4,5)		(3,3)

(5,6)		(4,5)


Zustand		Folge-Zustand fuer	Ausgang
			x=0	x=1
1			5	6				0
2			5	1				0
3			4	8				0
4			8	3				0
7			7	6				0
8			3	4				0

(1,2)		(5,5)		(6,1)
(1,3)		(5,4)		(6,8)
(1,4)		(5,8)		(6,3)
(1,7)		(5,7)		(6,6)
(1,8)		(5,3)		(6,4)
(2,3)		(5,4)		(1,8)
(2,4)		(5,8)		(1,3)
(2,7)		(5,7)		(1,6)
(2,8)		(5,3)		(1,4)
(3,4)		(4,4)		(8,3)
(3,7)		(4,7)		(8,6)
(3,8)		(4,3)		(8,4)
(4,7)		(8,7)		(3,6)
(4,8)		(8,3)		(3,4)
(7,8)		(7,3)		(6,4)


(1,2)		(6,1)
(1,3)		(5,4)		(6,8)
(1,4)		(5,8)		(6,3)
(1,7)		(5,7)
(1,8)		(5,3)		(6,4)
(2,3)		(5,4)		(1,8)
(2,4)		(5,8)		(1,3)
(2,7)		(5,7)		(1,6)
(2,8)		(5,3)		(1,4)
(3,4)		(8,3)
(3,7)		(4,7)		(8,6)
(3,8)		(4,3)		(8,4)
(4,7)		(8,7)		(3,6)
(4,8)		(8,3)		(3,4)
(7,8)		(7,3)		(6,4)


(1,2)		(1,6)
(1,3)		(4,5)		(6,8)
(1,4)		(5,8)		(3,6)
(1,7)		(5,7)
(1,8)		(3,5)		(4,6)
(2,3)		(4,5)		(1,8)
(2,4)		(5,8)		(1,3)
(2,7)		(5,7)		(1,6)
(2,8)		(3,5)		(1,4)
(3,4)		(3,8)
(3,7)		(4,7)		(6,8)
(3,8)		(3,4)		(4,8)
(4,7)		(7,8)		(3,6)
(4,8)		(3,8)		(3,4)
(5,6)		(4,5)
(7,8)		(3,7)		(4,6)


--(1,2)		--(1,6)
--(1,3)		--(4,5)		(6,8)
--(1,4)		--(5,8)		(3,6)
--(1,7)		--(5,7)
--(1,8)		--(3,5)		(4,6)
--(2,3)		--(4,5)		(1,8)
--(2,4)		--(5,8)		(1,3)
--(2,7)		--(5,7)		(1,6)
--(2,8)		--(3,5)		(1,4)
(3,4)		(3,8)
--(3,7)		(4,7)		--(6,8)
(3,8)		(3,4)		(4,8)
--(4,7)		(7,8)		--(3,6)
(4,8)		(3,8)		(3,4)
--(5,6)		--(4,5)
--(7,8)		--(3,7)		(4,6)



(3,4)		(3,8)
(3,8)		(3,4)		(4,8)
(4,8)		(3,8)		(3,4)

Zustand,Eingabe,Ausgabe,Folgezustand
1,0,0,1
1,1,1,4
2,0,0,4
2,1,1,3
3,0,0,3
3,1,1,1
4,0,0,2
4,1,1,2


z1+ := z1 and not x or z3 and x
z2+ := z4
z3+ := z2 and x or z3 and not x
z4+ := z1 and x or z2 and not x
y := x

Image 20240313_185650

Image automat20240313-1

Image asm20240313.jpeg-1

Image 20240313_193000

Image 20240313_193007

global          _start

section         .data
                tosrtarray:         db 'asdhjasdnasmdsadmads', 0x00
                ;;tosrtarray:         db 'jihgfedcab', 0x00
                strLen:             equ \$-tosrtarray
section         .text

                _start:

                mov esi, tosrtarray
                mov edi, tosrtarray


                old1:
                mov al, [esi]
                cmp al, 0x00
                je next1
                mov al, [esi]
                mov edi, esi
                inc edi
                old2:
                mov bl, [edi]
                cmp bl, 0x00
                je next2
                mov bl, [edi]
                cmp al, bl
                jle goon
                mov al, [esi]
                mov bl, [edi]
                mov [edi], al
                mov [esi], bl
                goon:
                inc edi
                jmp old2
                next2:
                inc esi
                jmp old1

                next1:

                mov edx, strLen
                mov ecx, tosrtarray
                mov ebx, 1
                mov eax, 4
                int 0x80

                mov ebx, 0
                mov eax, 1
                int 0x80

Image Screenshot_20240313_210327

Da ist