absolute bruh moment

This commit is contained in:
2024-02-02 15:12:56 -06:00
parent ad38d64219
commit 31f634c637
11 changed files with 615 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8"?>
<actions>
<action>
<actionName>run</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs></exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs></exec.appArgs>
<exec.mainClass>${packageClassName}</exec.mainClass>
<exec.executable>java</exec.executable>
</properties>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs>-agentlib:jdwp=transport=dt_socket,server=n,address=${jpda.address}</exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.appArgs></exec.appArgs>
<exec.mainClass>${packageClassName}</exec.mainClass>
<exec.executable>java</exec.executable>
<jpda.listen>true</jpda.listen>
</properties>
</action>
<action>
<actionName>profile</actionName>
<packagings>
<packaging>jar</packaging>
</packagings>
<goals>
<goal>process-classes</goal>
<goal>org.codehaus.mojo:exec-maven-plugin:3.1.0:exec</goal>
</goals>
<properties>
<exec.vmArgs></exec.vmArgs>
<exec.args>${exec.vmArgs} -classpath %classpath ${exec.mainClass} ${exec.appArgs}</exec.args>
<exec.mainClass>${packageClassName}</exec.mainClass>
<exec.executable>java</exec.executable>
<exec.appArgs></exec.appArgs>
</properties>
</action>
</actions>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<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>edu.slcc.asdv.caleb</groupId>
<artifactId>Multithreading_CalebFontenot</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx</artifactId>
<version>20</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-graphics</artifactId>
<version>20</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>20</version>
<classifier>linux</classifier>
</dependency>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.4</version>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<exec.mainClass>edu.slcc.asdv.caleb.multithreading_calebfontenot.Multithreading_CalebFontenot</exec.mainClass>
</properties>
</project>

View File

@@ -0,0 +1,86 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.slcc.asdv.caleb.multithreading_calebfontenot;
/**
*
* @author caleb
*/
import javafx.application.Application;
import javafx.application.Platform;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class FlashText extends Application
{
private String text = "";
@Override // Override the start method in the Application class
public void start(Stage primaryStage)
{
StackPane pane = new StackPane();
Label lblText = new Label("Programming is fun");
pane.getChildren().add(lblText);
Thread t1 = new Thread(
new Runnable()
{
public void run()
{
try
{
while (true)
{
if (lblText.getText().trim().length() == 0)
text = "Welcome";
else
text = "";
Platform.runLater(
new Runnable()
{
@Override
public void run()
{
lblText.setText(text);
}
});
/*
Thread t2 =new Thread( new Runnable() {
@Override
public void run()
{
lblText.setText(text);
}
});
*/
Thread.sleep(300);
}
}
catch (InterruptedException ex)
{
}
}
});
t1.start();
// Create a scene and place it in the stage
Scene scene = new Scene(pane, 200, 50);
primaryStage.setTitle("FlashText"); // Set the stage title
primaryStage.setScene(scene); // Place the scene in the stage
primaryStage.show(); // Display the stage
}
public static void main(String[] args)
{
launch(args);
}
}

View File

@@ -0,0 +1,59 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.slcc.asdv.caleb.multithreading_calebfontenot;
/**
*
* @author caleb
*/
public class PrintChar implements Runnable{
private char charToPrint;
private int times;
public PrintChar(char charToPrint, int times)
{
this.charToPrint = charToPrint;
this.times = times;
}
@Override
public void run()
{
for (int i = 0; i < times; ++i) {
System.out.println(charToPrint);
}
}
public static void main(String[] args)
{
for (int i = 0; i < 1000; ++i) {
System.out.println("lmao");
}
}
}
class PrintNum implements Runnable {
private int lastNum;
public PrintNum(int lastNum)
{
this.lastNum = lastNum;
}
public void run()
{
for (int i = 1; i <= lastNum; ++i) {
System.out.print(" " + i);
Thread.yield();
if (i % 10 == 0) {
System.out.println();
}
}
}
}

View File

@@ -0,0 +1,15 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.slcc.asdv.caleb.multithreading_calebfontenot;
/**
*
* @author caleb
*/
public class RunFlash {
public static void main(String[] args) {
FlashText.main(args);
}
}

View File

@@ -0,0 +1,29 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package edu.slcc.asdv.caleb.multithreading_calebfontenot;
/**
*
* @author caleb
*/
public class Threads {
public static void main(String[] args)
{
// Create tasks
Runnable printA = new PrintChar('a', 100);
Runnable printB = new PrintChar('b', 100);
Runnable print100 = new PrintNum(100);
// Create threads
Thread thread1 = new Thread(printA);
Thread thread2 = new Thread(printB);
Thread thread3 = new Thread(print100);
// Start threads
thread1.start();
thread2.start();
thread3.start();
}
}

View File

@@ -0,0 +1,20 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
*/
package edu.slcc.asdv.caleb.multithreading_calebfontenot;
import java.io.IOException;
/**
*
* @author caleb
*/
public class forkbomb
{
public static void main(String[] args) throws IOException
{
Runtime.getRuntime().exec(new String[]{"java", "-cp", System.getProperty("java.class.path"), "forkbomb"});
}
}