mirror of
https://github.com/kuhyx/WUT_Computer_Science.git
synced 2026-07-04 14:23:07 +02:00
feat: added exemplary program for psd zin2
This commit is contained in:
parent
9cf89176ca
commit
fc933376b7
@ -3,6 +3,7 @@ Właściwości i domowa produkcja
|
|||||||
Krzysztof Rudnicki
|
Krzysztof Rudnicki
|
||||||
|
|
||||||
@Kombucha_Mature.jpg
|
@Kombucha_Mature.jpg
|
||||||
|
DROŻDŻE!
|
||||||
|
|
||||||
Plan
|
Plan
|
||||||
• Historia
|
• Historia
|
||||||
@ -14,6 +15,7 @@ Plan
|
|||||||
Historia
|
Historia
|
||||||
|
|
||||||
@Emperor_Ingyo.jpg
|
@Emperor_Ingyo.jpg
|
||||||
|
Dr. Kombu
|
||||||
|
|
||||||
@Bohai_sea_sunset.jpg
|
@Bohai_sea_sunset.jpg
|
||||||
|
|
||||||
@ -201,4 +203,15 @@ Kombucha w ubranich
|
|||||||
|
|
||||||
@fashion.jpg
|
@fashion.jpg
|
||||||
|
|
||||||
|
Najbardziej liberałowy produkt w USA 2009
|
||||||
|
|
||||||
|
Źródła
|
||||||
|
• Britannica
|
||||||
|
• Wikipedia
|
||||||
|
• Grandviewresearch
|
||||||
|
• Forbes
|
||||||
|
• Slate
|
||||||
|
• OATAO University Toulouse
|
||||||
|
• ResearchGate
|
||||||
|
|
||||||
Pytania
|
Pytania
|
||||||
110
Programming/PSD/zin2/ProgramProject/.gitignore
vendored
Normal file
110
Programming/PSD/zin2/ProgramProject/.gitignore
vendored
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
target/
|
||||||
|
pom.xml.tag
|
||||||
|
pom.xml.releaseBackup
|
||||||
|
pom.xml.versionsBackup
|
||||||
|
pom.xml.next
|
||||||
|
release.properties
|
||||||
|
dependency-reduced-pom.xml
|
||||||
|
buildNumber.properties
|
||||||
|
.mvn/timing.properties
|
||||||
|
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
|
||||||
|
.mvn/wrapper/maven-wrapper.jar
|
||||||
|
|
||||||
|
# Eclipse m2e generated files
|
||||||
|
# Eclipse Core
|
||||||
|
.project
|
||||||
|
# JDT-specific (Eclipse Java Development Tools)
|
||||||
|
.classpath
|
||||||
|
|
||||||
|
.eslintcache
|
||||||
|
.cache
|
||||||
|
scalastyle-output.xml
|
||||||
|
.classpath
|
||||||
|
.idea/*
|
||||||
|
!.idea/vcs.xml
|
||||||
|
!.idea/icon.png
|
||||||
|
.metadata
|
||||||
|
.settings
|
||||||
|
.project
|
||||||
|
.version.properties
|
||||||
|
filter.properties
|
||||||
|
logs.zip
|
||||||
|
.mvn/wrapper/*.jar
|
||||||
|
.mvn/maven.config
|
||||||
|
target
|
||||||
|
tmp
|
||||||
|
*.class
|
||||||
|
*.iml
|
||||||
|
*.swp
|
||||||
|
*.jar
|
||||||
|
*.zip
|
||||||
|
*.log
|
||||||
|
*.pyc
|
||||||
|
.DS_Store
|
||||||
|
build-target
|
||||||
|
**/dependency-reduced-pom.xml
|
||||||
|
flink-runtime-web/web-dashboard/node/
|
||||||
|
flink-runtime-web/web-dashboard/node_modules/
|
||||||
|
flink-runtime-web/web-dashboard/web/
|
||||||
|
flink-runtime-web/web-dashboard/.angular/
|
||||||
|
flink-python/dist/
|
||||||
|
flink-python/apache-flink-libraries/dist/
|
||||||
|
flink-python/build/
|
||||||
|
flink-python/apache-flink-libraries/build
|
||||||
|
flink-python/pyflink.egg-info/
|
||||||
|
flink-python/apache_flink.egg-info/
|
||||||
|
flink-python/apache-flink-libraries/apache_flink_libraries.egg-info/
|
||||||
|
flink-python/docs/_build
|
||||||
|
flink-python/.tox/
|
||||||
|
flink-python/dev/download
|
||||||
|
flink-python/dev/.conda/
|
||||||
|
flink-python/dev/log/
|
||||||
|
flink-python/dev/.stage.txt
|
||||||
|
flink-python/.eggs/
|
||||||
|
flink-python/apache-flink-*.dev*/
|
||||||
|
flink-python/apache-flink-libraries/apache_flink_libraries-*.dev*/
|
||||||
|
flink-python/**/*.c
|
||||||
|
flink-python/.idea/
|
||||||
|
flink-python/**/*.so
|
||||||
|
atlassian-ide-plugin.xml
|
||||||
|
out/
|
||||||
|
/docs/api
|
||||||
|
/docs/.bundle
|
||||||
|
/docs/.rubydeps
|
||||||
|
/docs/ruby2/.bundle
|
||||||
|
/docs/ruby2/.rubydeps
|
||||||
|
/docs/.jekyll-metadata
|
||||||
|
*.ipr
|
||||||
|
*.iws
|
||||||
|
tools/flink
|
||||||
|
tools/flink-*
|
||||||
|
tools/releasing/release
|
||||||
|
tools/japicmp-output
|
||||||
|
/docs/go.mod
|
||||||
|
/docs/go.sum
|
||||||
|
/docs/.hugo_build.lock
|
||||||
|
|
||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.nar
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
replay_pid*
|
||||||
62
Programming/PSD/zin2/ProgramProject/pom.xml
Normal file
62
Programming/PSD/zin2/ProgramProject/pom.xml
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<groupId>com.example</groupId>
|
||||||
|
<artifactId>ProgramProject</artifactId>
|
||||||
|
<version>1.0-SNAPSHOT</version>
|
||||||
|
<properties>
|
||||||
|
<maven.compiler.source>1.8</maven.compiler.source>
|
||||||
|
<maven.compiler.target>1.8</maven.compiler.target>
|
||||||
|
<flink.version>1.19.0</flink.version>
|
||||||
|
<scala.binary.version>2.11</scala.binary.version> <!-- Match this with your Flink's Scala version -->
|
||||||
|
<slf4j.version>1.7.30</slf4j.version> <!-- Ensure compatibility with Flink's SLF4J version -->
|
||||||
|
</properties>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Flink dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.flink</groupId>
|
||||||
|
<artifactId>flink-java</artifactId>
|
||||||
|
<version>1.19.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.flink</groupId>
|
||||||
|
<artifactId>flink-runtime-web</artifactId>
|
||||||
|
<version>${flink.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.flink</groupId>
|
||||||
|
<artifactId>flink-streaming-java</artifactId>
|
||||||
|
<version>1.19.0</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-classic</artifactId>
|
||||||
|
<version>1.2.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>ch.qos.logback</groupId>
|
||||||
|
<artifactId>logback-core</artifactId>
|
||||||
|
<version>1.2.3</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.flink</groupId>
|
||||||
|
<artifactId>flink-clients</artifactId>
|
||||||
|
<version>${flink.version}</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.slf4j</groupId>
|
||||||
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
|
<version>${slf4j.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<!-- Add other dependencies as necessary -->
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
||||||
@ -0,0 +1,34 @@
|
|||||||
|
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
|
||||||
|
import org.apache.flink.streaming.api.datastream.DataStream;
|
||||||
|
import org.apache.flink.api.common.functions.FilterFunction;
|
||||||
|
|
||||||
|
public class Example {
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
final StreamExecutionEnvironment env =
|
||||||
|
StreamExecutionEnvironment.getExecutionEnvironment();
|
||||||
|
DataStream<Person> flintstones = env.fromElements(
|
||||||
|
new Person("Fred", 35),
|
||||||
|
new Person("Wilma", 35),
|
||||||
|
new Person("Pebbles", 2));
|
||||||
|
DataStream<Person> adults = flintstones.filter(new FilterFunction <Person> () {
|
||||||
|
@Override
|
||||||
|
public boolean filter(Person person) throws Exception {
|
||||||
|
return person.age >= 18;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
adults.print();
|
||||||
|
env.execute();
|
||||||
|
}
|
||||||
|
public static class Person {
|
||||||
|
public String name;
|
||||||
|
public Integer age;
|
||||||
|
public Person() {}
|
||||||
|
public Person(String name, Integer age) {
|
||||||
|
this.name = name;
|
||||||
|
this.age = age;
|
||||||
|
}
|
||||||
|
public String toString() {
|
||||||
|
return this.name.toString() + ": age " + this.age.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,53 @@
|
|||||||
|
import org.apache.flink.streaming.api.datastream.DataStream;
|
||||||
|
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;
|
||||||
|
import org.apache.flink.streaming.api.functions.source.SourceFunction;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
public class TemperatureSensor {
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
final StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
|
||||||
|
|
||||||
|
// Generating random temperature data
|
||||||
|
DataStream<SensorReading> input = env.addSource(new SourceFunction<SensorReading>() {
|
||||||
|
private boolean running = true;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(SourceContext<SensorReading> ctx) throws Exception {
|
||||||
|
Random rand = new Random();
|
||||||
|
|
||||||
|
while (running) {
|
||||||
|
Thread.sleep(1000); // Sleep for a second before generating more data
|
||||||
|
ctx.collect(new SensorReading("sensor_1", rand.nextDouble() * 25 - 10));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void cancel() {
|
||||||
|
running = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// Processing temperature data to find values below 0
|
||||||
|
input
|
||||||
|
.filter(reading -> reading.temperature < 0)
|
||||||
|
.print();
|
||||||
|
|
||||||
|
env.execute("Temperature Sensor Processing");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Data type for sensor readings
|
||||||
|
public static class SensorReading {
|
||||||
|
public String sensorId;
|
||||||
|
public double temperature;
|
||||||
|
|
||||||
|
public SensorReading() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public SensorReading(String sensorId, double temperature) {
|
||||||
|
this.sensorId = sensorId;
|
||||||
|
this.temperature = temperature;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue
Block a user