uni

University stuff
git clone git://git.margiolis.net/uni.git
Log | Files | Refs | README | LICENSE

commit ba873087968796ad622f7968a39711ed974e7a5f
parent d062deeb5b3053f7f563d602dc0105953298f624
Author: Christos Margiolis <christos@FreeBSD.org>
Date:   Wed,  5 Jun 2024 23:57:23 +0200

more stuff coming

Diffstat:
Mconcurrent_programming/rps_client.c | 81+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
Mconcurrent_programming/rps_server.c | 41++++++++++++++++++++++++++++++++++++++++-
Aecommerce/ex1/doc.aux | 17+++++++++++++++++
Aecommerce/ex1/doc.pdf | 0
Aecommerce/ex1/doc.tex | 302++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Aecommerce/ex1/doc.toc | 8++++++++
Aecommerce/ex1/res/mysql.png | 0
Aecommerce/ex1/res/phpinfo.png | 0
Aecommerce/ex1/res/sqlite.png | 0
Aecommerce/ex1/res/uniwalogo.png | 0
Ajava_development/population/bin/population/Chart.class | 0
Ajava_development/population/bin/population/Column.class | 0
Ajava_development/population/bin/population/Country.class | 0
Ajava_development/population/bin/population/ExcelParser.class | 0
Ajava_development/population/bin/population/Main.class | 0
Ajava_development/population/bin/population/MainWindow.class | 0
Ajava_development/population/bin/population/Toast.class | 0
Ajava_multimedia/VideoStreaming/.classpath | 15+++++++++++++++
Ajava_multimedia/VideoStreaming/.project | 17+++++++++++++++++
Ajava_multimedia/VideoStreaming/.settings/org.eclipse.core.resources.prefs | 2++
Ajava_multimedia/VideoStreaming/.settings/org.eclipse.jdt.core.prefs | 14++++++++++++++
Ajava_multimedia/VideoStreaming/bin/module-info.class | 0
Ajava_multimedia/VideoStreaming/bin/video_streaming/Main.class | 0
Ajava_multimedia/VideoStreaming/src/module-info.java | 7+++++++
Ajava_multimedia/VideoStreaming/src/video_streaming/Main.java | 19+++++++++++++++++++
Mweb_applications/main.js | 10++++------
Mweb_applications/style.css | 2+-
27 files changed, 521 insertions(+), 14 deletions(-)

diff --git a/concurrent_programming/rps_client.c b/concurrent_programming/rps_client.c @@ -1,9 +1,17 @@ #include <err.h> +#include <sys/socket.h> +#include <sys/types.h> + +#include <arpa/inet.h> +#include <netdb.h> +#include <netinet/in.h> + #include <locale.h> #include <ncurses.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <unistd.h> #define ARRLEN(x) (sizeof(x) / sizeof(x[0])) @@ -17,8 +25,10 @@ static void cmd_play(char *); static void cmd_msg(char *); static void cmd_list(char *); static void cmd_quit(char *); +static void cmd_help(char *); static int init_curses(void); static struct command *parse_command(char **); +static void usage(void); static struct command commands[] = { { "challenge", cmd_challenge }, /* /challenge <name|id> */ @@ -26,11 +36,13 @@ static struct command commands[] = { { "msg", cmd_msg }, /* /msg <message> */ { "list", cmd_list }, /* /list */ { "quit", cmd_quit }, /* /quit */ + { "help", cmd_help }, /* /help */ }; static int ymax; static int xmax; -static volatile bool f_quit = false; +static int f_quit = 0; +static int fd; static void cmd_challenge(char *args) @@ -54,10 +66,24 @@ cmd_list(char *args) { } +/* TODO return int... */ static void cmd_quit(char *args) { - f_quit = true; + f_quit = 1; + if (send(fd, &f_quit, sizeof(f_quit), 0) < 0) + ; /* TODO */ +} + +static void +cmd_help(char *args) +{ + printf("Available commands:\n"); + printf("/challenge <id|name>\t\tChallenge a player\n"); + printf("/play <rock|paper|scisssor>\tMake a move\n"); + printf("/msg <message>\t\t\tSend a message to the global chat\n"); + printf("/quit\t\t\t\tQuit the game\n"); + printf("/help\t\t\t\tShow this help message\n"); } static int @@ -141,7 +167,8 @@ parse_command(char **args) for (i = 0; i < ARRLEN(commands); i++) { if (strncmp(cmd, commands[i].name, strlen(commands[i].name)) == 0) { - *args = strdup(*args); + if (*args != NULL) + *args = strdup(*args); return (&commands[i]); } } @@ -150,14 +177,54 @@ parse_command(char **args) return (NULL); } +static void +usage(void) +{ + fprintf(stderr, "usage: %1$s [-p port] <hostname|ipv4_addr>\n", + getprogname()); + exit(1); +} + int main(int argc, char *argv[]) { + struct sockaddr_in sin; + struct hostent *hp; struct command *cmd; char *args; + int port = 9999; + int ch; + + while ((ch = getopt(argc, argv, "p:")) != -1) { + switch (ch) { + case 'p': + if ((port = atoi(optarg)) < 1024) + errx(1, "cannot user port number < 1024"); + break; + case '?': + default: + usage(); + } + } + argc -= optind; + argv += optind; + + if (argc < 1) + usage(); + + if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) + err(1, "socket(AF_INET)"); + memset(&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_port = htons(port); + if (!inet_aton(*argv, &sin.sin_addr)) { + if ((hp = gethostbyname(*argv)) == NULL) + errx(1, "gethostbyname(%s) failed", *argv); + memcpy(&sin.sin_addr, hp->h_addr, hp->h_length); + } + if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) + err(1, "connect"); - /* TODO command line network options */ - /* TODO signals */ /* TODO nickname selection (server keeps asking until unique) */ if (!setlocale(LC_ALL, "")) @@ -174,8 +241,10 @@ main(int argc, char *argv[]) continue; /* TODO connect to server */ cmd->func(args); - free(args); + if (args != NULL) + free(args); } + close(fd); /*(void)endwin();*/ diff --git a/concurrent_programming/rps_server.c b/concurrent_programming/rps_server.c @@ -12,11 +12,29 @@ #include <string.h> #include <unistd.h> -static void usage(void); +static int srv(int); static void sighandler(int); +static void usage(void); static volatile sig_atomic_t f_quit = 0; +static int +srv(int fd) +{ + int quit; + + for (;;) { + if (recv(fd, &quit, sizeof(quit), 0) < 0) + break; + if (quit) { + printf("%s(): quit triggered\n", __func__); + break; + } + } + + return (0); +} + static void sighandler(int sig) { @@ -40,6 +58,7 @@ main(int argc, char *argv[]) int backlog = 10; int port = 9999; int sfd; + int cfd; int ch; while ((ch = getopt(argc, argv, "b:p:")) != -1) { @@ -121,10 +140,30 @@ main(int argc, char *argv[]) /* We caught a termination signal. */ if (f_quit) break; + if ((cfd = accept(sfd, NULL, NULL)) < 0) + continue; + printf("[%s] client connected: %d\n", getprogname(), cfd); + /* + * Create a child process to serve the client so the parent can + * continue waiting for another client to serve. + */ + switch (fork()) { + case -1: + err(1, "fork"); + case 0: + if (srv(cfd) < 0) + warnx("srv failed"); + printf("[%s] client disconnected: %d\n", + getprogname(), cfd); + _exit(0); + default: + close(cfd); + } } /* Will get here only if a termination signal is caught. */ close(sfd); + close(cfd); return (0); } diff --git a/ecommerce/ex1/doc.aux b/ecommerce/ex1/doc.aux @@ -0,0 +1,17 @@ +\relax +\providecommand\babel@aux[2]{} +\@nameuse{bbl@beforestart} +\bibstyle{biblatex} +\bibdata{doc-blx} +\citation{biblatex-control} +\abx@aux@refcontext{nty/global//global/global} +\babel@aux{english}{} +\@writefile{toc}{\contentsline {section}{\numberline {1}Περίληψη εργασίας}{2}{}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {2}Α1: Εγκατάσταση Apache HTTP server}{2}{}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {3}Α2: Εγκατάσταση PHP και διασύνδεση με το Apache}{2}{}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {4}Α3: Εγκατάσταση SQLite και διασύνδεση με την PHP}{4}{}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {5}Α4: Εγκατάσταση MySQL/MariaDB και διασύνδεση με την PHP}{5}{}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {6}Α5: Εγκατάσταση Perl και διασύνδεση με Apache και SQLite η MySQL}{6}{}\protected@file@percent } +\@writefile{toc}{\contentsline {section}{\numberline {7}Προσάρτημα}{6}{}\protected@file@percent } +\abx@aux@read@bbl@mdfivesum{nobblfile} +\gdef \@abspage@last{7} diff --git a/ecommerce/ex1/doc.pdf b/ecommerce/ex1/doc.pdf Binary files differ. diff --git a/ecommerce/ex1/doc.tex b/ecommerce/ex1/doc.tex @@ -0,0 +1,302 @@ +\documentclass[12pt]{article} +\usepackage[utf8]{inputenc} +\usepackage[greek,english]{babel} +\usepackage{alphabeta} +\usepackage{fancyhdr} +\usepackage{listings} +\usepackage{mathtools} +\usepackage{xcolor} +\usepackage{float} +\usepackage{siunitx} +\usepackage[margin=0.5in]{geometry} +\usepackage[backend=bibtex]{biblatex} + +\lstset { + basicstyle=\ttfamily, + columns=fullflexible, + breaklines=true, + keepspaces=true, + showstringspaces=false +} + +\title{Εργαστήριο Ηλεκτρονικού Εμπορίου και Επιχειρηματικότητας -- Εργασία 1} +\author{Χρήστος Μαργιώλης -- 19390133} +\date{Μάιος 2024} + +\begin{document} + +\begin{titlepage} + \maketitle + \begin{figure}[t!] + \begin{center} + \includegraphics[scale=0.3]{./res/uniwalogo.png} \\ + \Large + \textbf{Πανεπιστήμιο Δυτικής Αττικής} \\ + \large + Τμήμα Μηχανικών Πληροφορικής και Ηλεκτρονικών Υπολογιστών + \end{center} + \end{figure} +\end{titlepage} + +\renewcommand{\contentsname}{Περιεχόμενα} +\tableofcontents +\pagebreak + +%\includegraphics[width=\textwidth]{res/aslr.png} \\ + +\section{Περίληψη εργασίας} + +ΠΡΟΣΟΧΗ: Η εργασία έγινε σε FreeBSD αντί για Windows, διότι βρίσκομαι εκτός Ελλάδας κατά την συγγραφή την +εργασίας και δεν έχω πρόσβαση σε Windows υπολογιστή. + +Η παρούσα εργασία έχει ως στόχο την εξοικείωση στην εγκατάσταση, διασύνδεση και +χρήση διαφόρων βασικών τεχνολογιών που χρησιμοποιούνται στον τομέα του +προγραμματισμού διαδικτυακών εφαρμογών. + +\section{Α1: Εγκατάσταση Apache HTTP server} + +Εγκατάσταση Apache 2.4: + +\begin{lstlisting} +# pkg install apache24 +\end{lstlisting} + +Δημιουργία root directory για την ιστοσελίδα μας και ανάθεση του χρήστη +\lstinline{www} (Apache server) ως κατόχου του directory: + +\begin{lstlisting} +# mkdir ecom1 +# chown -R www ecom1/ +\end{lstlisting} + +Τροποποίηση των απαραίτητων \lstinline{DocumentRoot} στο αρχείο +\lstinline{http.conf}, ώστε ο server να βρει το directory της ιστοσελίδας και +να κάνει χρήση της σωστής IP: + +\begin{lstlisting} +# nvim /usr/local/etc/apache24/httpd.conf +... +ServerName localhost:80 +... +DocumentRoot "/usr/home/christos/ecom1" +<Directory "/usr/home/christos/ecom1"> +\end{lstlisting} + +Επιβεβαίωση της ορθότητας του config αρχείου: + +\begin{lstlisting} +# httpd -t +Syntax OK +\end{lstlisting} + +Εκκίνηση του server: + +\begin{lstlisting} +# service apache24 onestart +Performing sanity check on apache24 configuration: +Syntax OK +Starting apache24. +\end{lstlisting} + +Επιβεβαίωση ότι ο server ακούει στο port 80: + +\begin{lstlisting} +# sockstat -4 -l -P tcp -p 80 +USER COMMAND PID FD PROTO LOCAL ADDRESS FOREIGN ADDRESS +www httpd 23853 4 tcp4 *:80 *:* +www httpd 23852 4 tcp4 *:80 *:* +www httpd 23851 4 tcp4 *:80 *:* +www httpd 23850 4 tcp4 *:80 *:* +www httpd 23849 4 tcp4 *:80 *:* +root httpd 23848 4 tcp4 *:80 *:* +\end{lstlisting} + +\section{Α2: Εγκατάσταση PHP και διασύνδεση με το Apache} + +Εγκατάσταση της PHP 8.2 και του Apache module: + +\begin{lstlisting} +# pkg install php82 mod_php82 +\end{lstlisting} + +Δημιουργία \lstinline{php.ini} αρχείο, βασισμένο στo +\lstinline{php.ini-development}: + +\begin{lstlisting} +# cp /usr/local/etc/php.ini-development /usr/local/etc/php.ini +\end{lstlisting} + +Επιβεβαίωση ότι το πρόγραμμα κελύφους \lstinline{php} τρέχει χωρίς προβλήματα: + +\begin{lstlisting} +# php -v +PHP 8.2.19 (cli) (built: May 21 2024 02:10:26) (NTS) +Copyright (c) The PHP Group +Zend Engine v4.2.19, Copyright (c) Zend Technologies +\end{lstlisting} + +Τροποποίση \lstinline{httpd.conf} ώστε να γίνει η διασύνδεση του Apache με την +PHP: + +\begin{lstlisting} +# nvim /usr/local/etc/apache24/httpd.conf +... +<IfModule dir_module> + DirectoryIndex index.html index.php +<FilesMatch "\.php$"> + SetHandler application/x-httpd-php +</FilesMatch> +<FilesMatch "\.phps$"> + SetHandler application/x-httpd-php-source +</FilesMatch> +</IfModule> +\end{lstlisting} + +Δημιουργία αρχείο δοκιμής στην ιστοσελίδα, ώστε να επιβεβαιώσουμε την +διασύνδεση Apache - PHP: + +\begin{lstlisting} +# echo "<?php phpinfo(); ?>" > ecom1/info.php +\end{lstlisting} + +Επανεκκίνηση του Apache: + +\begin{lstlisting} +# httpd -t +# service apache24 onerestart +\end{lstlisting} + +Σε ένα παράθυρο browser, πηγαίνουμε στην διεύθυνση +\lstinline{localhost:80/info.php} για να δούμε αν το αρχείο δοκιμής λειτουργεί +όπως περιμένουμε: + +\includegraphics[width=\textwidth]{res/phpinfo.png} \\ + +\section{Α3: Εγκατάσταση SQLite και διασύνδεση με την PHP} + +Εγκατάσταση SQLite3 και του PHP module: + +\begin{lstlisting} +# pkg install sqlite3 php82-sqlite3 +\end{lstlisting} + +Επιβεβαίωση λειτουργίας: + +\begin{lstlisting} +# sqlite3 --version +3.45.1 2024-01-30 16:01:20 e876e51a0ed5c5b3126f52e532044363a014bc594cfefa87ffb5b82257ccalt1 (64-bit) +\end{lstlisting} + +Δημιουργία βάσης δεδομένων από την γραμμή εντολών: + +\begin{lstlisting} +# sqlite3 ecom1/foo.db +SQLite version 3.45.1 2024-01-30 16:01:20 +Enter ".help" for usage hints. +sqlite> .databases +main: /usr/home/christos/ecom1/foo.db r/w +sqlite> create table users (id integer, name text); +sqlite> +\end{lstlisting} + +Υλοποίηση προγράμματος PHP το οποίο δημιουργεί μια βάση δεδομένων και τυπώνει +τα περιεχόμενά της: + +\begin{lstlisting} +# cat > ecom1/sqlite.php +<?php + +$db = new SQLite3("foo.db"); +$db->exec("INSERT INTO users (id, name) VALUES (1, 'christos')"); +$db->exec("INSERT INTO users (id, name) VALUES (2, 'john')"); +$db->exec("INSERT INTO users (id, name) VALUES (3, 'mark')"); +$res = $db->query("SELECT * FROM users"); +while (($row = $res->fetchArray(SQLITE3_ASSOC)) != false) + print_r($row); +$db->exec("DELETE FROM users"); + +?> +^D +\end{lstlisting} + +Επανεκκίνηση του Apache: + +\begin{lstlisting} +# service apache24 onerestart +\end{lstlisting} + +Εκτέλεση προγράμματος \lstinline{sqlite.php} στον browser: + +\includegraphics[width=\textwidth]{res/sqlite.png} \\ + +\section{Α4: Εγκατάσταση MySQL/MariaDB και διασύνδεση με την PHP} + +Εγκατάσταση της MySQL 8.4 και του κατάλληλου PHP module: + +\begin{lstlisting} +# pkg install mysql84-server php82-mysqli +\end{lstlisting} + +Εκκίνηση της MySQL: + +\begin{lstlisting} +# service mysql-server onestart +# mysql_secure_installation +\end{lstlisting} + +Επιβεβαίωση λειτουργίας της MySQL: + +\begin{lstlisting} +# mysql --version +mysql Ver 8.4.0 for FreeBSD14.0 on amd64 (Source distribution) +\end{lstlisting} + +Επανεκκίνηση του Apache: + +\begin{lstlisting} +# service apache24 onerestart +\end{lstlisting} + +Υλοποίηση προγράμματος PHP το οποίο δημιουργεί μια βάση δεδομένων και τυπώνει +τα περιεχόμενά της: + +\begin{lstlisting} +# cat > ecom1/mysql.php +<?php +$conn = new mysqli("localhost", "root", "foobar123#", "foo"); +if ($conn->connect_error) + die("Connection failed: " . $conn->connect_error); + +$conn->query("CREATE TABLE users (id INTEGER, name TEXT)"); +$conn->query("INSERT INTO users (id, name) VALUES (1, 'christos')"); +$conn->query("INSERT INTO users (id, name) VALUES (2, 'john')"); +$conn->query("INSERT INTO users (id, name) VALUES (3, 'mark')"); + +$res = mysqli_query($conn, "SELECT * FROM users"); +while ($row = mysqli_fetch_assoc($res)) + print_r($row); + +$conn->close(); +?> +^D +\end{lstlisting} + +Εκτέλεση προγράμματος \lstinline{mysql.php} στον browser: + +\includegraphics[width=\textwidth]{res/mysql.png} \\ + +\section{Α5: Εγκατάσταση Perl και διασύνδεση με Apache και SQLite η MySQL} + +Εγκάτασταση του Apache Pearl module: + +\begin{lstlisting} +# pkg install ap24-mod_perl2 +\end{lstlisting} + +\section{Προσάρτημα} + +Το μόνο αρχείο που χρειάστηκε τροποποίηση είναι το \lstinline{httpd.conf}, του +οποίου οι αλλαγές φαίνονται στις παραπάνω ενότητες. Τα υπόλοιπα αρχεία +δημιουργήθηκαν/τροποποιήθηκαν αυτόματα κατά την εγκατάσταση των προγραμμάτων. + +\end{document} diff --git a/ecommerce/ex1/doc.toc b/ecommerce/ex1/doc.toc @@ -0,0 +1,8 @@ +\babel@toc {english}{}\relax +\contentsline {section}{\numberline {1}Περίληψη εργασίας}{2}{}% +\contentsline {section}{\numberline {2}Α1: Εγκατάσταση Apache HTTP server}{2}{}% +\contentsline {section}{\numberline {3}Α2: Εγκατάσταση PHP και διασύνδεση με το Apache}{2}{}% +\contentsline {section}{\numberline {4}Α3: Εγκατάσταση SQLite και διασύνδεση με την PHP}{4}{}% +\contentsline {section}{\numberline {5}Α4: Εγκατάσταση MySQL/MariaDB και διασύνδεση με την PHP}{5}{}% +\contentsline {section}{\numberline {6}Α5: Εγκατάσταση Perl και διασύνδεση με Apache και SQLite η MySQL}{6}{}% +\contentsline {section}{\numberline {7}Προσάρτημα}{6}{}% diff --git a/ecommerce/ex1/res/mysql.png b/ecommerce/ex1/res/mysql.png Binary files differ. diff --git a/ecommerce/ex1/res/phpinfo.png b/ecommerce/ex1/res/phpinfo.png Binary files differ. diff --git a/ecommerce/ex1/res/sqlite.png b/ecommerce/ex1/res/sqlite.png Binary files differ. diff --git a/ecommerce/ex1/res/uniwalogo.png b/ecommerce/ex1/res/uniwalogo.png Binary files differ. diff --git a/java_development/population/bin/population/Chart.class b/java_development/population/bin/population/Chart.class Binary files differ. diff --git a/java_development/population/bin/population/Column.class b/java_development/population/bin/population/Column.class Binary files differ. diff --git a/java_development/population/bin/population/Country.class b/java_development/population/bin/population/Country.class Binary files differ. diff --git a/java_development/population/bin/population/ExcelParser.class b/java_development/population/bin/population/ExcelParser.class Binary files differ. diff --git a/java_development/population/bin/population/Main.class b/java_development/population/bin/population/Main.class Binary files differ. diff --git a/java_development/population/bin/population/MainWindow.class b/java_development/population/bin/population/MainWindow.class Binary files differ. diff --git a/java_development/population/bin/population/Toast.class b/java_development/population/bin/population/Toast.class Binary files differ. diff --git a/java_multimedia/VideoStreaming/.classpath b/java_multimedia/VideoStreaming/.classpath @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/JavaFX"> + <attributes> + <attribute name="module" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"> + <attributes> + <attribute name="module" value="true"/> + </attributes> + </classpathentry> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/java_multimedia/VideoStreaming/.project b/java_multimedia/VideoStreaming/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>VideoStreaming</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/java_multimedia/VideoStreaming/.settings/org.eclipse.core.resources.prefs b/java_multimedia/VideoStreaming/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/<project>=UTF-8 diff --git a/java_multimedia/VideoStreaming/.settings/org.eclipse.jdt.core.prefs b/java_multimedia/VideoStreaming/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,14 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=11 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=11 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning +org.eclipse.jdt.core.compiler.release=enabled +org.eclipse.jdt.core.compiler.source=11 diff --git a/java_multimedia/VideoStreaming/bin/module-info.class b/java_multimedia/VideoStreaming/bin/module-info.class Binary files differ. diff --git a/java_multimedia/VideoStreaming/bin/video_streaming/Main.class b/java_multimedia/VideoStreaming/bin/video_streaming/Main.class Binary files differ. diff --git a/java_multimedia/VideoStreaming/src/module-info.java b/java_multimedia/VideoStreaming/src/module-info.java @@ -0,0 +1,6 @@ +module video_streaming { + exports video_streaming; + requires transitive javafx.controls; + requires javafx.fxml; + requires javafx.graphics; +} +\ No newline at end of file diff --git a/java_multimedia/VideoStreaming/src/video_streaming/Main.java b/java_multimedia/VideoStreaming/src/video_streaming/Main.java @@ -0,0 +1,19 @@ +package video_streaming; + +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.layout.StackPane; +import javafx.stage.Stage; + +public class Main extends Application { + @Override + public void start(Stage stg) throws Exception { + stg.setTitle("Video Streaming Client"); + stg.setScene(new Scene(new StackPane(), 350, 230)); + stg.show(); + } + + public static void main(String[] args) { + launch(args); + } +} diff --git a/web_applications/main.js b/web_applications/main.js @@ -15,19 +15,17 @@ const pics = [ "water2.png", "water3.png", "yinyang.png", -]; +].filter(s => s.startsWith(element)); var p_phrase = document.createElement("p"); var p_element = document.createElement("p"); var img = document.createElement("img"); -p_phrase.innerHTML = "<p><big>Phrase: " + phrase + "</big></p>"; -p_element.innerHTML = "<p><big>Element: " + element + "</big></p>"; -img.src = "res/" + pics[Math.floor(Math.random() * - (pics.filter(s => s.startsWith(element)).length))]; +p_phrase.innerHTML = "Phrase: " + phrase; +p_element.innerHTML = "Element: " + element; +img.src = "res/" + pics[Math.floor(Math.random() * pics.length)]; img.style = "width: 50%; border: 8px solid black;"; - document.getElementById("topright").style.transform = "rotate(" + (phrase.length * 10) % 360 + "deg)"; diff --git a/web_applications/style.css b/web_applications/style.css @@ -1,6 +1,6 @@ @font-face { font-family: Helvetica; - src: url('Helvetica.ttf'); + src: url('res/Helvetica.ttf'); } body, input, button, select {