Compare commits

...

2 commits

9 changed files with 159 additions and 35 deletions

View file

@ -4,16 +4,14 @@
{% include "src/_includes/partials/header.njk" %} {% include "src/_includes/partials/header.njk" %}
<body> <body>
<section class="section"> {% include "src/_includes/partials/darktoggle.njk" %}
{% include "src/_includes/partials/darktoggle.njk" %}
{% include "src/_includes/partials/nav.njk"%} {% include "src/_includes/partials/nav.njk"%}
<div class="hero"> <div class="hero">
{{ content | safe }} {{ content | safe }}
</div> </div>
{% include "src/_includes/partials/footer.njk" %} {% include "src/_includes/partials/footer.njk" %}
</section>
</body> </body>
</html> </html>

View file

@ -1,9 +1,9 @@
--- ---
layout: "base.njk" layout: "base.njk"
--- ---
<main> <div class="main">
<h1 class="hero-title"> <h1 class="hero-title">
{{ title }} {{ title | safe }}
</h1> </h1>
<div class="page-content"> <div class="page-content">
@ -18,6 +18,6 @@ layout: "base.njk"
{%- endfor -%} {%- endfor -%}
</ul> </ul>
#} #}
</main> </div>
{% include "src/_includes/partials/blob.html" %} {% include "src/_includes/partials/blob.html" %}

View file

@ -1,7 +1,7 @@
--- ---
layout: "base.njk" layout: "base.njk"
--- ---
<main> <div class="main">
<h1 class="hero-title"> <h1 class="hero-title">
{{ title }} {{ title }}
</h1> </h1>
@ -11,4 +11,4 @@ layout: "base.njk"
<div class="page-content"> <div class="page-content">
{{ content | safe }} {{ content | safe }}
</div> </div>
</main> </div>

View file

@ -9,7 +9,6 @@
</script> </script>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ title }}</title> <title>{{ title }}</title>
<link rel="stylesheet" type="text/css" media="screen" href="{{ "/css/main.css" | url }}"> <link rel="stylesheet" type="text/css" media="screen" href="{{ "/css/main.css" | url }}">

Binary file not shown.

View file

@ -24,7 +24,7 @@ a {
transition: all 0.3s ease; transition: all 0.3s ease;
} }
main a { .hero a {
font-family: "Righteous"; font-family: "Righteous";
text-decoration: underline; text-decoration: underline;
color: #910c75; color: #910c75;
@ -312,12 +312,13 @@ a.card-link {
header { header {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
width: 100%; width: 100%;
margin-bottom: 10vh; margin-bottom: 10vh;
font-family: "Righteous"; font-family: "Righteous";
font-size: 20px; font-size: 1.3em;
margin-top: 2em; margin-top: 2em;
} }
@ -336,6 +337,8 @@ nav {
justify-content: center; justify-content: center;
align-items: center; align-items: center;
font-size: 1.3em;
gap: 3em; gap: 3em;
background: linear-gradient(to right, #151515 1px, transparent 1px) 0 0, background: linear-gradient(to right, #151515 1px, transparent 1px) 0 0,
linear-gradient(to right, #151515 1px, transparent 1px) 0 100%, linear-gradient(to right, #151515 1px, transparent 1px) 0 100%,
@ -350,17 +353,17 @@ nav {
} }
.hero-title { .hero-title {
line-break: anywhere;
margin-top: 10vh; margin-top: 10vh;
font-size: 5em; font-size: 3.5em;
} }
.page-content { .page-content {
font-size: 20px;
margin: 0 20px; margin: 0 20px;
} }
main { .main {
max-width: 75em; max-width: 100%;
align-self: center; align-self: center;
} }
@ -369,7 +372,7 @@ main {
} }
p { p {
max-width: 45vw; max-width: 55vw;
} }
.link { .link {
@ -453,6 +456,7 @@ transition: opacity 0.3s ease;
background-color: hsl(220, 13%, 18%); background-color: hsl(220, 13%, 18%);
color: hsl(220, 14%, 71%); color: hsl(220, 14%, 71%);
border-radius: 0.3em; border-radius: 0.3em;
font-size: 1.3em;
white-space: nowrap; /* prevent line breaks in inline code */ white-space: nowrap; /* prevent line breaks in inline code */
} }

34
src/sp1/hausaufgaben.md Normal file
View file

@ -0,0 +1,34 @@
---
title: "How-To: Hausaufgaben"
layout: "blog-post.njk"
date: 2025-05-05
---
Der Ablauf der Bearbeitung einer Aufgabe am Beispiel "Aufgabe 0 - epoche"
1. Aufgaben-Repository erstellen (muss im cip ausgeführt werden)
```sh
/proj/i4sp1/bin/mkrepo epoche
```
Das Repo ist dann im [Gitlab](https://gitlab.cs.fau.de/) der FAU zu finden zu funden
2. Das Repo clonen (lokal herunterladen). Die URL findet ihr unter dem blauen "Code" button auf dem Repo in Gitlab.
```sh
git clone [REPO-URL]
```
3. Lokale Änderungen durchführen
4. Die Änderungen und neuen Dateien dem lokalen commiten
```sh
git add . # Änderungen in den Staging bereich schieben
git commit -m "[COMMIT_MESSAGE]" # Die Änderungen mit einem deskriptiven kommentar zu einem commit zusammenfasssen
```
5. Alle commmits zu dem FAU Gitlab pushen (**SEHR WICHTIG**). Es kann nur bewertet werden, was vor der deadline gepushed wurde
```sh
git push
```
möglicherweise funktioniert das nicht auf anhieb und es muss einmal folgender command ausgeführt werden:
```sh
git push --set-upstream origin main
```

View file

@ -4,14 +4,15 @@ layout: blog-page.njk
page_for: "sp1-lesson" page_for: "sp1-lesson"
--- ---
## Meine Übungen ## Meine Übungen
- Tafelübung (T02) Montags 14:15 - 15:45 im [Seminarraum 0.031-113](https://www.campo.fau.de:443/qisserver/pages/startFlow.xhtml?_flowId=showRoomDetail-flow&roomId=788&roomType=3&context=showRoomDetail&navigationPosition=organisation,searchroom) - Tafelübung (T02) Montags 14:15 - 15:45 im [Seminarraum 0.031-113 (Aquarium)](https://www.campo.fau.de:443/qisserver/pages/startFlow.xhtml?_flowId=showRoomDetail-flow&roomId=788&roomType=3&context=showRoomDetail&navigationPosition=organisation,searchroom)
- Rechnerübung Donnerstags 16:15 - 18:45 im [CIP1](https://www.campo.fau.de/qisserver/pages/startFlow.xhtml?_flowId=showRoomDetail-flow&roomId=3349&roomType=3&context=showRoomDetail&navigationPosition=organisation,searchroom) - Rechnerübung Donnerstags 16:15 - 18:45 im [CIP1](https://www.campo.fau.de/qisserver/pages/startFlow.xhtml?_flowId=showRoomDetail-flow&roomId=3349&roomType=3&context=showRoomDetail&navigationPosition=organisation,searchroom)
## Wichtige Infos ## Wichtige Infos
- <a href="./hausaufgaben">How-To: Hausaufgaben</a>
- Unter `/proj/i4sp1/bin/` im CIP finden sich nützliche SP1-related Programme und scripts, wie - Unter `/proj/i4sp1/bin/` im CIP finden sich nützliche SP1-related Programme und scripts, wie
- `mkrepo` zum Aufgaben-Repo erstellen - `mkrepo` zum Aufgaben-Repo erstellen
- `deadline` zum Abgabetermine nachschauen - `deadline` zum Abgabetermine nachschauen
- Vorgegebene Compiler-Flags: `-std=c11 -pedantic -D_XOPEN_SOURCE=700 -Wall -Werror -fsanitize=undefined -fno-sanitize-recover -g` - Vorgegebene Compiler-Flags: `-std=c11` `-pedantic` `-D_XOPEN_SOURCE=700` `-Wall` `-Werror` `-fsanitize=undefined` `-fno-sanitize-recover` `-g`
## Wichtige Links ## Wichtige Links
- [Aufgaben](https://sys.cs.fau.de/lehre/ss25/sp1/uebung#aufgaben) - [Aufgaben](https://sys.cs.fau.de/lehre/ss25/sp1/uebung#aufgaben)
@ -33,8 +34,13 @@ page_for: "sp1-lesson"
- Mail an mich: <a href="mailto:nova.ruff@fau.de" class="link">nova.ruff@fau.de</a> - Mail an mich: <a href="mailto:nova.ruff@fau.de" class="link">nova.ruff@fau.de</a>
- [SP-FAQ](https://sys.cs.fau.de/lehre/ss25/sp1/faq) - [SP-FAQ](https://sys.cs.fau.de/lehre/ss25/sp1/faq)
## Andere Tutoren
## Weitere Links
- [SP1 Website](https://sys.cs.fau.de/lehre/ss25/sp1) - [SP1 Website](https://sys.cs.fau.de/lehre/ss25/sp1)
- [Lukas (T03)](https://wwwcip.cs.fau.de/~uk16isyq/)
- [Julian (T08)](https://jzbor.de/tut/sp1/) - [Julian (T08)](https://jzbor.de/tut/sp1/)
- [Stefan (T09)](https://wwwcip.cs.fau.de/~ok73ozus/sp)
- [Luca (T11)](https://wwwcip.cs.fau.de/~am99ihig/sp)
- [Philip (ehemalig)](https://wwwcip.cs.fau.de/~oj14ozun/sp1/) - [Philip (ehemalig)](https://wwwcip.cs.fau.de/~oj14ozun/sp1/)
## Hilfreiche Links
- [cdecl.org](https://cdecl.org/) um zu entziffern, was bei Pointern passiert

View file

@ -7,6 +7,8 @@ date: 2025-05-04
## Manual-Pages ## Manual-Pages
Mit dem Programm `man` kann die Dokumentation von verschiedenen Bibliotheksfunktionen nachgelesen werden: `man 3p printf` Mit dem Programm `man` kann die Dokumentation von verschiedenen Bibliotheksfunktionen nachgelesen werden: `man 3p printf`
Oft findet ihr die schreibweise `time(3p)`, d.h. es wird auf die manpage von time aus der section 3p verwiesen: `man 3p time`
## Workflow mit git ## Workflow mit git
- `git clone [URL]` - Remote Repo lokal herunterladen - `git clone [URL]` - Remote Repo lokal herunterladen
- `git pull` - Neuester Stand eines Repos herunterladen - `git pull` - Neuester Stand eines Repos herunterladen
@ -16,23 +18,83 @@ Mit dem Programm `man` kann die Dokumentation von verschiedenen Bibliotheksfunkt
- `git commit -m "[COMMMIT_MESSAGE]"` - Änderungen zu dem Repo committen - `git commit -m "[COMMMIT_MESSAGE]"` - Änderungen zu dem Repo committen
- `git push` - Neue Commits an das remote Repo kommunizieren (**wichtig zur Übungsabgabe**) - `git push` - Neue Commits an das remote Repo kommunizieren (**wichtig zur Übungsabgabe**)
## Beispiel Program aus der Präsenzübung ## Die C Programmiersprache
- Die "main" funktion in C bekommt immer 2 argumente:
- `int argc`: enthält 1 + die Anzahl der Argumente, die dem Program gegeben wurden
- `char *argv[]`: ein array von char-pointern (also ein char-pointer-pointer)
- Das ende von char-arrays (string) wird mit dem Zeichen `'\0'` gekennzeichnet
- Array-Zugriff: `arr[1]` ist gleichbedeutend mit `*(arr + 1)`
- Struct-Zugriff: `myStruct->value` ist gleichbedeutend mit `(*myStruct).value`
- <a href="{{ "/assets/Pointer-Diagramm.pdf" | url }}">Nützliches Pointer Diagramm</a>
## Fehlerbehandlung (wichtig)
Funktionen können in C fehlschlagen und fehler müssen **immer** abgefangen und behandelt werden (außer in einer bereits laufenden Fehlerbehandlung).
Was der Rückgabewert einer Funktion ist, wenn sie fehlschlägt, steht in dem "RETURN VALUE" Abschnitt der zugehörigen manpage.
z.B. steht in malloc(3p), dass im Fehlerfall ein "null pointer" returned wird; Wir müssen uns also nach jedem malloc-Aufruf versichern, dass der Rückgabewert nicht ein null pointer war:
```c ```c
#include <stdio.h> #include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]) { int main(int argc, char *argv[]) {
// using strlen() // wir wollen 5 ints abspeichern
for (int i = 1; i < argc; i++) { int *p = malloc(sizeof(int) * 5);
char *curr_arg = argv[i]; if (p == NULL) {
for (int l = 0; l < strlen(curr_arg); l++) { // es gab einen fehler
printf("%c\n", curr_arg[l]); return -1;
} }
// kein fehler -> es kann weitergemacht werden ...
}
```
## malloc und free
Wichtig ist, dass mit `malloc` allokierter speicher auch wieder manuell mit der Funktion `free()` freigegeben werden **muss** (`free()` kann nicht fehlschlagen und benötigt so auch keine Fehlerbehandlung):
```c
#include <stdlib.h>
int main(int argc, char *argv[]) {
int *p = malloc(sizeof(int) * 5);
if (p == NULL) {
return -1;
} }
// alternative // ... do something with p ...
free(p);
}
```
## Beispiel Programme aus der Präsenzübung
### Alle dem Program gegebenen Argumente drucken
```c
#include <stdio.h>
int main(int argc, char *argv[]) {
// iterate over arguments passed to program
for (int i = 1; i < argc; i++) { for (int i = 1; i < argc; i++) {
// get reference to char-array for given argument
char *curr_arg = argv[i]; char *curr_arg = argv[i];
// alternative schreibweise:
// char *curr_arg = *(argv + i);
printf("%s\n", curr_arg);
}
}
```
### Jeden char der Argumente auf eine eigene Zeile drucken
Bei diesem Program wurde benutzt, dass in C, char-arrays mit einem '\0'-byte terminiert sind
```c
#include <stdio.h>
int main(int argc, char *argv[]) {
// iterate over arguments passed to program
// start at i = 1, because i = 0 is the name of the program
for (int i = 1; i < argc; i++) {
// get reference to char-array for given argument
char *curr_arg = argv[i];
// iterate over the current argument, until '\0' is reached (end of string)
int l = 0; int l = 0;
while (curr_arg[l] != '\0') { while (curr_arg[l] != '\0') {
printf("%c\n", curr_arg[l]); printf("%c\n", curr_arg[l]);
@ -41,3 +103,24 @@ int main(int argc, char *argv[]) {
} }
} }
``` ```
### Speicher für structs anlegen
```c
#include <stdio.h>
struct listelement {
int value;
struct listelement *next;
};
int main(int argc, char *argv[]) {
struct listelement *element1 = malloc(sizeof(struct listelement));
if (element1 == NULL) {
// fehlerbehandlung ...
}
// ... rest vom program
free(element1)
}
```