Informačné technológieInformation Technologies / Týždeň 1Week 1

Technológie, ktoré budeme používaťThe technologies we will use

Nástroje, s ktorými pracujeme celý semester, sa ukážu na prednáške a nastavia na prvom cvičení. Postup krok za krokom je v Návodoch a nástrojoch, tu je prehľad toho, ako predmet funguje, čo si na prvom cvičení pripravíš, a tabuľka pojmov.

The tools we work with all semester are shown in the lecture and set up in the first lab. Step-by-step instructions are in Guides and tools; this page gives an overview of how the course works, what you prepare in the first lab, and the table of terms.

Ako to fungujeHow it works

Celý semester staviaš jednu aplikáciu. Na prednáške sa každý týždeň vysvetlí jedna téma a ukáže sa na vzorovom projekte, ktorý rastie rovnako ako tvoj. Na cvičení tú istú vec doplníš do vlastného projektu. Vzorový projekt sú recepty; tvoj projekt má inú tému, ale rovnakú stavbu. Preto je návrh dátového modelu v 2. týždni taký dôležitý: ak má tvoja databáza rovnaký tvar ako vzor, každý týždeň vieš prenášať postup zo vzoru do svojho projektu bez toho, aby si musel vymýšľať niečo iné.

Kód píšeš vo VS Code v Kubeflow. Každé uloženie v editore ide cez SFTP na sigma.tuke.sk samo, súbory mimo editora doplní Upload Folder; na sigma.tuke.sk aplikácia beží so skutočným PHP 8.1 a databázou MariaDB. Odovzdávanie je commit a push na GitHub. sigma.tuke.sk a GitHub o sebe nevedia, obidve dostávajú kód z Kubeflow. Na sigma.tuke.sk sa nič neupravuje.

Vo webovom priestore na sigma.tuke.sk aj v Kubeflow používaš rovnakú štruktúru priečinkov: it/cv01, it/cv02, … pre týždenné zadania a it/projekt pre semestrálne zadanie. Priečinok ~/web v Kubeflow je zrkadlom ~/public_html na sigma.tuke.sk.

Po prvom cvičení sa dá celý pracovný postup overiť tromi krokmi. Ak niektorý nefunguje, rieš ho skôr, než pôjdeš ďalej.

1. V Kubeflow ulož súbor  ~/web/it/test.php
   → na sigma.tuke.sk sa objaví   ~/public_html/it/test.php     (SFTP, samo pri uložení)
   → v prehliadači beží   https://sigma.tuke.sk/student/meno.priezvisko/it/test.php

2. GitHub: si v organizácii tuke-fberg-stehlikova
   → ssh -T git@github.com v termináli Kubeflow odpovie tvojím GitHub menom

3. Adminer: https://sigma.tuke.sk/student/meno.priezvisko/adminer.php
   → prihlásenie do databázy meno_priezvisko, zatiaľ bez tabuliek

You build one application for the whole semester. Each week the lecture explains one topic and demonstrates it on a sample project, which grows the same way yours does. In the lab you add the same thing to your own project. The sample project is recipes; your project has a different topic but the same structure. That is why the data model design in week 2 matters so much: if your database has the same shape as the sample, every week you can transfer the procedure from the sample to your project without inventing something different.

You write code in VS Code in Kubeflow. Every save in the editor goes over SFTP to sigma.tuke.sk by itself; files outside the editor are added with Upload Folder; on sigma.tuke.sk the application runs with real PHP 8.1 and a MariaDB database. Submitting means commit and push to GitHub. sigma.tuke.sk and GitHub do not know about each other; both receive the code from Kubeflow. Nothing is edited on sigma.tuke.sk.

In your web space on sigma.tuke.sk and in Kubeflow you use the same folder structure: it/cv01, it/cv02, … for weekly assignments and it/projekt for the semester project. The folder ~/web in Kubeflow mirrors ~/public_html on sigma.tuke.sk.

After the first lab the whole workflow can be checked in three steps. If any of them fails, fix it before going further.

1. In Kubeflow save the file   ~/web/it/test.php
   → it appears on sigma.tuke.sk as    ~/public_html/it/test.php     (SFTP, by itself on save)
   → it runs in the browser at https://sigma.tuke.sk/student/name.surname/it/test.php

2. GitHub: you are in the organization tuke-fberg-stehlikova
   → ssh -T git@github.com in the Kubeflow terminal replies with your GitHub username

3. Adminer: https://sigma.tuke.sk/student/name.surname/adminer.php
   → sign in to the database name_surname, no tables yet

Prvé cvičenieThe first lab

Na prvom cvičení si pripravíš všetko, s čím budeš pracovať celý semester. Každý krok má svoj návod; tu je len poradie a kontrola, že sa podaril.

  1. GitHub konto, 2FA, pozvánka do organizácie – návod 01 GitHub. Kontrola: vidíš organizáciu tuke-fberg-stehlikova.
  2. Kubeflow a VS Code – návod 02 Kubeflow: notebook, rozšírenia, nastavenie Git, SSH kľúč pre GitHub. Kontrola: ssh -T git@github.com v termináli odpovie tvojím GitHub menom.
  3. sigma.tuke.sk a SFTP – návod 03 Sigma: public_html, v ňom priečinok it, SSH kľúč na sigma.tuke.sk, nastavenie SFTP vo VS Code. Kontrola: súbor uložený v ~/web/it/ sa objaví v ~/public_html/it/ a dá sa otvoriť v prehliadači.
  4. Adminer – návod 05 Databáza: adminer.php v public_html, prihlásenie do databázy meno_priezvisko. Heslo dostaneš na cvičení. Kontrola: Adminer ukáže prázdnu databázu.
  5. Zadanie od prijatia po odovzdanie – návod 04 Odovzdávanie si prečítaj, od 2. týždňa ho používaš pri každom cvičení.

Prvý týždeň nemá zadanie ani body. Kto nestihol všetko na cvičení, dokončí to podľa návodov do 2. týždňa.

In the first lab you prepare everything you will work with all semester. Every step has its guide; here is only the order and the check that it worked.

  1. GitHub account, 2FA, invitation to the organization – guide 01 GitHub. Check: you can see the organization tuke-fberg-stehlikova.
  2. Kubeflow and VS Code – guide 02 Kubeflow: notebook, extensions, Git configuration, SSH key for GitHub. Check: ssh -T git@github.com in the terminal replies with your GitHub username.
  3. sigma.tuke.sk and SFTP – guide 03 Sigma: public_html with the folder it in it, SSH key on sigma.tuke.sk, SFTP set up in VS Code. Check: a file saved in ~/web/it/ appears in ~/public_html/it/ and opens in the browser.
  4. Adminer – guide 05 Database: adminer.php in public_html, sign-in to the database name_surname. You get the password in the lab. Check: Adminer shows an empty database.
  5. An assignment from accepting to submitting – read guide 04 Submitting; from week 2 on you use it in every lab.

The first week has no assignment and no points. If you did not finish everything in the lab, complete it with the guides before week 2.

Pojmy a termínyTerms and definitions

Tabuľka pojmov celého predmetu. Každý týždeň do nej pribudnú nové, na konci semestra bude úplná. Týždenné stránky pojmy neopakujú, len na túto tabuľku odkazujú.

Pojem English Vysvetlenie Týž.
Kubeflow Kubeflow školský cloud, v ktorom beží náš VS Code; otvára sa v prehliadači 1
VS Code VS Code editor, v ktorom píšeme kód 1
sigma sigma server, na ktorom beží tvoja aplikácia (Apache, PHP 8.1, MariaDB) 1
SSH SSH bezpečné pripojenie na vzdialený počítač cez príkazový riadok 1
SFTP SFTP prenos súborov cez to isté bezpečné pripojenie; VS Code ním kopíruje súbory na sigma.tuke.sk pri každom uložení 1
VPN VPN tunel do školskej siete; bez neho sa na sigma.tuke.sk z domu nedostaneš 1
Git Git nástroj, ktorý sleduje zmeny v súboroch 1
GitHub GitHub web, kam sa zmeny z Gitu posielajú a kde sa odovzdávajú zadania 1
repozitár (repo) repository (repo) priečinok projektu spravovaný Gitom 1
commit commit uložená verzia zmien s popisom 1
push push odoslanie commitov na GitHub 1
clone clone stiahnutie repozitára z GitHubu do Kubeflow 1
2FA two-factor authentication pri prihlásení okrem hesla aj kód z mobilu 1
zadanie (Classroom 50) assignment úloha od učiteľa; po prijatí dostaneš vlastný repozitár 1
Adminer Adminer práca s databázou v prehliadači; jeden PHP súbor v tvojom public_html 1
MariaDB MariaDB databázový server na sigma.tuke.sk, kompatibilný s MySQL 1
semestrálne zadanie semester project tvoja aplikácia, ktorá rastie celý semester v priečinku it/projekt 1
vzorový projekt sample project aplikácia z prednášok (recepty), z ktorej prenášaš postup do svojho projektu 2
míľnik milestone týždeň, v ktorom musí aplikácia fungovať v danom rozsahu; každý míľnik sa obhajuje 1
obhajoba defence rozhovor pri tvojom počítači: vysvetli, uprav, zdôvodni 1
live coding live coding úprava kódu naživo pred učiteľom 1
dátový model data model zoznam tabuliek a vzťahov medzi nimi 2
entita entity vec, o ktorej aplikácia ukladá údaje; v databáze jedna tabuľka 2
hlavná entita main entity tabuľka, okolo ktorej sa aplikácia točí; používateľ do nej pridáva a upravuje záznamy 2
číselník lookup table malá tabuľka s pevným zoznamom hodnôt, z ktorých sa vyberá 2
prepojka pivot table, junction table tabuľka, ktorá spája dve tabuľky vo vzťahu M:N 2
primárny kľúč primary key stĺpec id, ktorý jednoznačne určuje záznam 2
cudzí kľúč foreign key stĺpec s id záznamu z inej tabuľky 2
vzťah 1:N one-to-many jeden záznam patrí k mnohým; cudzí kľúč na strane N 2
vzťah M:N many-to-many mnoho k mnohým; potrebuje prepojku 2
ON DELETE ON DELETE pravidlo, čo sa stane so závislými záznamami pri mazaní: RESTRICT, CASCADE, SET NULL 2
atribút attribute stĺpec tabuľky; atribút prepojky je údaj o dvojici, napr. množstvo 2
README README súbor README.md v repozitári s popisom projektu; v cv01 je v ňom tvoja téma a dátový model 2
Composer Composer nástroj, ktorý sťahuje knižnice a vyrába autoloader; riadi sa súborom composer.json 3
vendor vendor priečinok s cudzím kódom a autoloaderom, vyrobí ho composer install; nejde do repository 3
autoloader autoloader súbor vendor/autoload.php, vďaka ktorému PHP nájde triedu samo, bez require_once 3
namespace namespace adresa triedy, napr. App\Model; plné meno triedy je App\Model\RecipeModel 3
use use riadok na začiatku súboru, ktorým povieš, ktorú triedu z ktorej adresy používaš 3
PSR-4 PSR-4 dohoda: namespace = priečinok, meno triedy = názov súboru; App\ je src/ 3
interface interface zoznam metód, ktoré trieda musí mať; bez kódu 3
abstraktná trieda abstract class trieda len na dedenie, new sa na ňu nedá použiť 3
singleton singleton trieda, ktorá dovolí jediný objekt; u nás Database s jedným PDO 3
DSN DSN (data source name) reťazec, kam sa pripojiť: mysql:host=localhost;dbname=...;charset=utf8mb4 3
schema.sql schema.sql súbor s CREATE TABLE pre všetky tabuľky; dá sa spustiť opakovane 3
seed.sql seed.sql súbor s testovacími dátami (INSERT) 3
.gitignore .gitignore zoznam súborov, ktoré Git do repository nedáva: config.php, vendor/ 3
.htaccess .htaccess súbor s nastavením servera Apache pre jeden priečinok; u nás chráni kód a heslo 3

The table of terms for the whole course. New terms are added every week; by the end of the semester it will be complete. Weekly pages do not repeat the terms, they only link to this table.

Term (SK) English Explanation Wk
Kubeflow Kubeflow the university cloud where our VS Code runs; opens in the browser 1
VS Code VS Code the editor we write code in 1
sigma sigma the server your application runs on (Apache, PHP 8.1, MariaDB) 1
SSH SSH a secure connection to a remote computer through the command line 1
SFTP SFTP file transfer over the same secure connection; VS Code uses it to copy files to sigma.tuke.sk on every save 1
VPN VPN a tunnel into the university network; without it you cannot reach sigma.tuke.sk from home 1
Git Git a tool that tracks changes in files 1
GitHub GitHub the website Git changes are sent to and where assignments are submitted 1
repozitár (repo) repository (repo) a project folder managed by Git 1
commit commit a saved version of changes with a description 1
push push sending commits to GitHub 1
clone clone downloading a repository from GitHub into Kubeflow 1
2FA two-factor authentication at sign-in a code from your phone in addition to the password 1
zadanie (Classroom 50) assignment a task from the teacher; accepting it gives you your own repository 1
Adminer Adminer database work in the browser; a single PHP file in your public_html 1
MariaDB MariaDB the database server on sigma.tuke.sk, compatible with MySQL 1
semestrálne zadanie semester project your application, which grows all semester in the folder it/projekt 1
vzorový projekt sample project the application from the lectures (recipes) from which you transfer the procedure to your project 2
míľnik milestone a week in which the application must work to a given extent; every milestone is defended 1
obhajoba defence a conversation at your computer: explain, modify, justify 1
live coding live coding changing code live in front of the teacher 1
dátový model data model the list of tables and the relationships between them 2
entita entity a thing the application stores data about; one table in the database 2
hlavná entita main entity the table the application revolves around; the user adds and edits its records 2
číselník lookup table a small table with a fixed list of values to choose from 2
prepojka pivot table, junction table a table that connects two tables in an M:N relationship 2
primárny kľúč primary key the column id that identifies a record uniquely 2
cudzí kľúč foreign key a column holding the id of a record from another table 2
vzťah 1:N one-to-many one record belongs to many; the foreign key is on the N side 2
vzťah M:N many-to-many many to many; needs a pivot table 2
ON DELETE ON DELETE the rule for dependent records on delete: RESTRICT, CASCADE, SET NULL 2
atribút attribute a column of a table; a pivot attribute is data about the pair, e.g. amount 2
README README the file README.md in the repository describing the project; in cv01 it holds your topic and data model 2
Composer Composer the tool that downloads libraries and generates the autoloader; driven by composer.json 3
vendor vendor the folder with third-party code and the autoloader, created by composer install; not in the repository 3
autoloader autoloader the file vendor/autoload.php thanks to which PHP finds a class itself, without require_once 3
namespace namespace the address of a class, e.g. App\Model; the full class name is App\Model\RecipeModel 3
use use a line at the top of a file saying which class from which address you use 3
PSR-4 PSR-4 the convention: namespace = folder, class name = file name; App\ is src/ 3
interface interface a list of methods a class must have; no code 3
abstraktná trieda abstract class a class meant only to be inherited; new cannot be used on it 3
singleton singleton a class that allows only one object; here Database with one PDO 3
DSN DSN (data source name) the string saying where to connect: mysql:host=localhost;dbname=...;charset=utf8mb4 3
schema.sql schema.sql the file with CREATE TABLE for all tables; can be run repeatedly 3
seed.sql seed.sql the file with test data (INSERT) 3
.gitignore .gitignore the list of files Git keeps out of the repository: config.php, vendor/ 3
.htaccess .htaccess the Apache server settings file for one folder; here it protects the code and the password 3