Compare commits
6 Commits
e8e867b878
...
main
Author | SHA1 | Date | |
---|---|---|---|
9bf3a922b2 | |||
6ceeffac0e | |||
8b6d447574 | |||
e35f36db4b | |||
7c72e94d8d | |||
a9782efcdd |
@@ -3,18 +3,10 @@ import java.sql.DriverManager;
|
|||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
public class Database {
|
public class Database {
|
||||||
|
|
||||||
//Countries
|
|
||||||
public static String COUNTRY_ID = "id";
|
|
||||||
public static String COUNTRY_NAME = "name";
|
|
||||||
|
|
||||||
//Votes table
|
|
||||||
public static String VOTES_COMPETITOR_ID = "competitor_id";
|
|
||||||
public static String VOTES_VOTER_ID = "voter_id";
|
|
||||||
public static String VOTES_POINTS = "points";
|
|
||||||
|
|
||||||
private Connection connection;
|
private Connection connection;
|
||||||
|
|
||||||
public Database() {
|
public Database() {
|
||||||
@@ -33,13 +25,23 @@ public class Database {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ResultSet getVotesFromCompetitor(String country) {
|
public Votes getVotesFromCompetitor(String country) {
|
||||||
try {
|
try {
|
||||||
PreparedStatement query = this.connection.prepareStatement(
|
PreparedStatement query = this.connection.prepareStatement(
|
||||||
"SELECT Countries.name, Countries.points FROM Votes INNER JOIN Countries ON Votes.competitor_id = Countries.id WHERE Votes.competitor_id = Countries.id"
|
"SELECT Voters.name, Votes.points " +
|
||||||
|
"FROM Votes " +
|
||||||
|
"JOIN Countries AS Competitors ON Votes.competitor_id = Competitors.id " +
|
||||||
|
"JOIN Countries AS Voters ON Votes.voter_id = Voters.id " +
|
||||||
|
"WHERE Competitors.name = ?;"
|
||||||
);
|
);
|
||||||
|
query.setString(1, country);
|
||||||
|
|
||||||
ResultSet result = query.executeQuery();
|
ResultSet result = query.executeQuery();
|
||||||
|
ArrayList<Vote> voteList = new ArrayList<>();
|
||||||
|
|
||||||
|
while(result.next()) {
|
||||||
|
voteList.add(new Vote(result.getString("name"), result.getInt("points")));
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
query.close();
|
query.close();
|
||||||
@@ -47,9 +49,9 @@ public class Database {
|
|||||||
System.err.println("Error while trying to close the query.");
|
System.err.println("Error while trying to close the query.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return new Votes(country, voteList);
|
||||||
} catch(SQLException exception) {
|
} catch(SQLException exception) {
|
||||||
System.err.println("Error while trying to prepare or execute the query.");
|
System.err.println("Error while trying to prepare or execute the query (" + exception.getMessage() + ").");
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
@@ -1,26 +1,18 @@
|
|||||||
import java.sql.ResultSet;
|
|
||||||
import java.sql.SQLException;
|
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Database database = new Database();
|
Database database = new Database();
|
||||||
|
|
||||||
String country = "France";
|
Votes votesForItaly = database.getVotesFromCompetitor("Pays-Bas");
|
||||||
ResultSet result = database.getVotesFromCompetitor(country);
|
|
||||||
|
|
||||||
try {
|
System.out.println("Vote " + votesForItaly.getCompetitorName() + " :");
|
||||||
while(result.next()) {
|
for(Vote vote : votesForItaly.getVoters()) {
|
||||||
System.out.println(country + " -> " + result.getString("name") + " : " + result.getInt("points"));
|
System.out.println(vote.getVoterName() + " " + vote.getPoints());
|
||||||
}
|
|
||||||
} catch(SQLException exception) {
|
|
||||||
System.err.println("Error while read the data from the result.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
System.out.println("-------------------");
|
||||||
result.close();
|
System.out.println("Total " + votesForItaly.getTotalPoints());
|
||||||
} catch(SQLException exception) {
|
|
||||||
System.err.println("Error while trying to close the result.");
|
database.close();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
18
DEV/DEV3.1/TP01/Exercise1/Vote.java
Normal file
18
DEV/DEV3.1/TP01/Exercise1/Vote.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
public class Vote {
|
||||||
|
|
||||||
|
private String voter;
|
||||||
|
private int points;
|
||||||
|
|
||||||
|
public Vote(String voter, int points) {
|
||||||
|
this.voter = voter;
|
||||||
|
this.points = points;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVoterName() {
|
||||||
|
return this.voter;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getPoints() {
|
||||||
|
return this.points;
|
||||||
|
}
|
||||||
|
}
|
30
DEV/DEV3.1/TP01/Exercise1/Votes.java
Normal file
30
DEV/DEV3.1/TP01/Exercise1/Votes.java
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Votes {
|
||||||
|
|
||||||
|
private String competitor;
|
||||||
|
private ArrayList<Vote> voters;
|
||||||
|
|
||||||
|
public Votes(String competitor, ArrayList<Vote> voters) {
|
||||||
|
this.competitor = competitor;
|
||||||
|
this.voters = voters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCompetitorName() {
|
||||||
|
return this.competitor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public ArrayList<Vote> getVoters() {
|
||||||
|
return this.voters;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getTotalPoints() {
|
||||||
|
int sum = 0;
|
||||||
|
|
||||||
|
for(Vote vote : this.voters) {
|
||||||
|
sum += vote.getPoints();
|
||||||
|
}
|
||||||
|
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
}
|
@@ -1,2 +1,3 @@
|
|||||||
|
rm -rf *.class
|
||||||
javac Main.java;
|
javac Main.java;
|
||||||
java -cp "/export/documents/mariadb-client.jar" Main;
|
java -cp ".:/export/documents/mariadb-client.jar" Main;
|
68
DEV/DEV3.1/TP01/Exercise2/Database.java
Normal file
68
DEV/DEV3.1/TP01/Exercise2/Database.java
Normal file
@@ -0,0 +1,68 @@
|
|||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Database {
|
||||||
|
|
||||||
|
private Connection connection;
|
||||||
|
|
||||||
|
public Database() {
|
||||||
|
try {
|
||||||
|
Class.forName("org.mariadb.jdbc.Driver");
|
||||||
|
|
||||||
|
this.connection = DriverManager.getConnection(
|
||||||
|
"jdbc:mariadb://dwarves.iut-fbleau.fr/baudrier",
|
||||||
|
"baudrier",
|
||||||
|
"baudrier"
|
||||||
|
);
|
||||||
|
} catch(ClassNotFoundException exception) {
|
||||||
|
System.err.println("Class 'org.mariadb.jdbc.Driver' not found.");
|
||||||
|
} catch(SQLException exception) {
|
||||||
|
System.err.println("Error while trying to connect to the database");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public Votes getVotesFromCompetitor(String country) {
|
||||||
|
try {
|
||||||
|
PreparedStatement query = this.connection.prepareStatement(
|
||||||
|
"SELECT VoterVotes.points " +
|
||||||
|
"FROM Votes " +
|
||||||
|
"JOIN Countries AS Competitors ON Votes.competitor_id = Competitors.id " +
|
||||||
|
"JOIN Countries AS Voters ON Votes.voter_id = Voters.id " +
|
||||||
|
"WHERE Competitors.name = ?;"
|
||||||
|
);
|
||||||
|
query.setString(1, country);
|
||||||
|
|
||||||
|
ResultSet result = query.executeQuery();
|
||||||
|
ArrayList<Vote> voteList = new ArrayList<>();
|
||||||
|
|
||||||
|
while(result.next()) {
|
||||||
|
voteList.add(new Vote(result.getString("name"), result.getInt("points")));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
query.close();
|
||||||
|
} catch(SQLException exception) {
|
||||||
|
System.err.println("Error while trying to close the query.");
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Votes(country, voteList);
|
||||||
|
} catch(SQLException exception) {
|
||||||
|
System.err.println("Error while trying to prepare or execute the query (" + exception.getMessage() + ").");
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close() {
|
||||||
|
try {
|
||||||
|
this.connection.close();
|
||||||
|
} catch(SQLException exception) {
|
||||||
|
System.err.println("Error while trying to close the connection.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,5 +1,3 @@
|
|||||||
package Part2;
|
|
||||||
|
|
||||||
public class Main {
|
public class Main {
|
||||||
|
|
||||||
}
|
}
|
5
DEV/DEV3.1/TP01/Exercise2/ScoreBoardWindow.java
Normal file
5
DEV/DEV3.1/TP01/Exercise2/ScoreBoardWindow.java
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
import javax.swing.JFrame;
|
||||||
|
|
||||||
|
public class ScoreBoardWindow extends JFrame {
|
||||||
|
|
||||||
|
}
|
BIN
DEV/DEV3.1/TP02/.DS_Store
vendored
Normal file
BIN
DEV/DEV3.1/TP02/.DS_Store
vendored
Normal file
Binary file not shown.
@@ -1,87 +0,0 @@
|
|||||||
import java.io.File;
|
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
import javax.swing.JLabel;
|
|
||||||
|
|
||||||
public class ImageWindow extends JFrame {
|
|
||||||
|
|
||||||
private ImageIcon[] images;
|
|
||||||
private int cursor;
|
|
||||||
|
|
||||||
private JLabel label;
|
|
||||||
|
|
||||||
public ImageWindow() {
|
|
||||||
this.setSize(1024, 1024);
|
|
||||||
this.setLocationRelativeTo(null);
|
|
||||||
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
|
||||||
|
|
||||||
File resourcesDirectory = new File("../resources/");
|
|
||||||
|
|
||||||
if(resourcesDirectory.exists() && resourcesDirectory.isDirectory()) {
|
|
||||||
File[] files = resourcesDirectory.listFiles();
|
|
||||||
|
|
||||||
if(files != null) {
|
|
||||||
this.images = new ImageIcon[files.length];
|
|
||||||
this.cursor = 0;
|
|
||||||
|
|
||||||
for(File file : files) {
|
|
||||||
this.images[this.cursor] = new ImageIcon(file.getPath());
|
|
||||||
this.cursor++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
this.addMouseListener(new ClickSwapImageEvent(this));
|
|
||||||
|
|
||||||
this.cursor = 0;
|
|
||||||
|
|
||||||
this.nextImage();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void nextImage() {
|
|
||||||
if(this.images.length == 0) return;
|
|
||||||
|
|
||||||
if(this.label != null) {
|
|
||||||
this.remove(this.label);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.label = new JLabel(this.images[cursor]);
|
|
||||||
this.label.setVerticalAlignment(JLabel.CENTER);
|
|
||||||
this.label.setHorizontalAlignment(JLabel.CENTER);
|
|
||||||
|
|
||||||
if(this.cursor + 1 >= this.images.length) {
|
|
||||||
this.cursor = 0;
|
|
||||||
} else {
|
|
||||||
this.cursor++;
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println(this.cursor);
|
|
||||||
|
|
||||||
this.add(label);
|
|
||||||
this.revalidate();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void lastImage() {
|
|
||||||
if(this.images.length == 0) return;
|
|
||||||
|
|
||||||
if(this.label != null) {
|
|
||||||
this.remove(this.label);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.label = new JLabel(this.images[cursor]);
|
|
||||||
this.label.setVerticalAlignment(JLabel.CENTER);
|
|
||||||
this.label.setHorizontalAlignment(JLabel.CENTER);
|
|
||||||
|
|
||||||
if(this.cursor - 1 < 0) {
|
|
||||||
this.cursor = this.images.length - 1;
|
|
||||||
} else {
|
|
||||||
this.cursor--;
|
|
||||||
}
|
|
||||||
|
|
||||||
System.out.println(this.cursor);
|
|
||||||
|
|
||||||
this.add(label);
|
|
||||||
this.revalidate();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,5 +0,0 @@
|
|||||||
package Part2;
|
|
||||||
|
|
||||||
public class ClickSwapImageEvent {
|
|
||||||
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
import java.io.File;
|
|
||||||
|
|
||||||
import java.awt.CardLayout;
|
|
||||||
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JFrame;
|
|
||||||
|
|
||||||
public class ImageWindow extends JFrame {
|
|
||||||
|
|
||||||
private CardLayout card;
|
|
||||||
|
|
||||||
public ImageWindow() {
|
|
||||||
this.card = new CardLayout();
|
|
||||||
|
|
||||||
File resourcesDirectory = new File("../resources/");
|
|
||||||
|
|
||||||
if(resourcesDirectory.exists() && resourcesDirectory.isDirectory()) {
|
|
||||||
File[] files = resourcesDirectory.listFiles();
|
|
||||||
|
|
||||||
if(files != null) {
|
|
||||||
for(File file : files) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
23
DEV/DEV3.1/TP02/Part1/ClickSwapImageEvent.java
Normal file
23
DEV/DEV3.1/TP02/Part1/ClickSwapImageEvent.java
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
|
||||||
|
public class ClickSwapImageEvent extends MouseAdapter {
|
||||||
|
|
||||||
|
private ImageWindow window;
|
||||||
|
|
||||||
|
public ClickSwapImageEvent(ImageWindow window) {
|
||||||
|
this.window = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void mouseClicked(MouseEvent event) {
|
||||||
|
System.out.println(this.window.manager.cursor);
|
||||||
|
if(event.getX() > this.window.getWidth() / 2) {
|
||||||
|
this.window.nextImage();
|
||||||
|
System.out.println(this.window.manager.cursor);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.window.previousImage();
|
||||||
|
System.out.println(this.window.manager.cursor);
|
||||||
|
}
|
||||||
|
}
|
49
DEV/DEV3.1/TP02/Part1/ImageManager.java
Normal file
49
DEV/DEV3.1/TP02/Part1/ImageManager.java
Normal file
@@ -0,0 +1,49 @@
|
|||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
|
||||||
|
public class ImageManager {
|
||||||
|
|
||||||
|
private ImageIcon[] images;
|
||||||
|
public int cursor;
|
||||||
|
|
||||||
|
public ImageManager() {
|
||||||
|
File resourcesDirectory = new File("../resources/");
|
||||||
|
|
||||||
|
if(resourcesDirectory.exists() && resourcesDirectory.isDirectory()) {
|
||||||
|
File[] files = resourcesDirectory.listFiles();
|
||||||
|
|
||||||
|
if(files != null) {
|
||||||
|
this.images = new ImageIcon[files.length];
|
||||||
|
this.cursor = 0;
|
||||||
|
|
||||||
|
for(File file : files) {
|
||||||
|
this.images[this.cursor] = new ImageIcon(file.getPath());
|
||||||
|
this.cursor++;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.cursor = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageIcon getNextImage() {
|
||||||
|
if(this.cursor >= this.images.length - 1) {
|
||||||
|
this.cursor = 0;
|
||||||
|
} else {
|
||||||
|
this.cursor++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.images[this.cursor];
|
||||||
|
}
|
||||||
|
|
||||||
|
public ImageIcon getPreviousImage() {
|
||||||
|
if(this.cursor <= 0) {
|
||||||
|
this.cursor = this.images.length - 1;
|
||||||
|
} else {
|
||||||
|
this.cursor--;
|
||||||
|
}
|
||||||
|
|
||||||
|
return this.images[this.cursor];
|
||||||
|
}
|
||||||
|
}
|
46
DEV/DEV3.1/TP02/Part1/ImageWindow.java
Normal file
46
DEV/DEV3.1/TP02/Part1/ImageWindow.java
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
|
||||||
|
public class ImageWindow extends JFrame {
|
||||||
|
|
||||||
|
public ImageManager manager;
|
||||||
|
private JLabel label;
|
||||||
|
|
||||||
|
public ImageWindow() {
|
||||||
|
this.manager = new ImageManager();
|
||||||
|
|
||||||
|
this.setSize(1024, 1024);
|
||||||
|
this.setLocationRelativeTo(null);
|
||||||
|
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
|
||||||
|
|
||||||
|
this.addMouseListener(new ClickSwapImageEvent(this));
|
||||||
|
|
||||||
|
this.nextImage();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void nextImage() {
|
||||||
|
if(this.label != null) {
|
||||||
|
this.remove(this.label);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.label = new JLabel(this.manager.getNextImage());
|
||||||
|
this.label.setVerticalAlignment(JLabel.CENTER);
|
||||||
|
this.label.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
|
||||||
|
this.add(label);
|
||||||
|
this.revalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void previousImage() {
|
||||||
|
if(this.label != null) {
|
||||||
|
this.remove(this.label);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.label = new JLabel(this.manager.getPreviousImage());
|
||||||
|
this.label.setVerticalAlignment(JLabel.CENTER);
|
||||||
|
this.label.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
|
||||||
|
this.add(label);
|
||||||
|
this.revalidate();
|
||||||
|
}
|
||||||
|
}
|
19
DEV/DEV3.1/TP02/Part2/ApprovedButtonPressedEvent.java
Normal file
19
DEV/DEV3.1/TP02/Part2/ApprovedButtonPressedEvent.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import javax.swing.JDialog;
|
||||||
|
|
||||||
|
public class ApprovedButtonPressedEvent implements ActionListener{
|
||||||
|
|
||||||
|
private JDialog dialog;
|
||||||
|
|
||||||
|
public ApprovedButtonPressedEvent(JDialog dialog) {
|
||||||
|
this.dialog = dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent event) {
|
||||||
|
this.dialog.dispose();
|
||||||
|
this.dialog.getOwner().dispose();
|
||||||
|
}
|
||||||
|
}
|
18
DEV/DEV3.1/TP02/Part2/CancelButtonPressedEvent.java
Normal file
18
DEV/DEV3.1/TP02/Part2/CancelButtonPressedEvent.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
|
||||||
|
import javax.swing.JDialog;
|
||||||
|
|
||||||
|
public class CancelButtonPressedEvent implements ActionListener{
|
||||||
|
|
||||||
|
private JDialog dialog;
|
||||||
|
|
||||||
|
public CancelButtonPressedEvent(JDialog dialog) {
|
||||||
|
this.dialog = dialog;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent event) {
|
||||||
|
this.dialog.dispose();
|
||||||
|
}
|
||||||
|
}
|
37
DEV/DEV3.1/TP02/Part2/CloseVerificationWindow.java
Normal file
37
DEV/DEV3.1/TP02/Part2/CloseVerificationWindow.java
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import java.awt.BorderLayout;
|
||||||
|
import java.awt.GridLayout;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JDialog;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
public class CloseVerificationWindow extends JDialog {
|
||||||
|
|
||||||
|
public CloseVerificationWindow(ImageWindow parent) {
|
||||||
|
super(parent, true);
|
||||||
|
|
||||||
|
this.setSize(parent.getWidth() / 3, parent.getHeight() / 3);
|
||||||
|
this.setLocationRelativeTo(parent);
|
||||||
|
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||||
|
this.setLayout(new GridLayout(2, 1));
|
||||||
|
|
||||||
|
JLabel text = new JLabel("Are you sure you want to close the window?");
|
||||||
|
text.setVerticalAlignment(JLabel.CENTER);
|
||||||
|
text.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
this.add(text);
|
||||||
|
|
||||||
|
JPanel panel = new JPanel();
|
||||||
|
panel.setLayout(new BorderLayout());
|
||||||
|
|
||||||
|
JButton approveButton = new JButton("Yes");
|
||||||
|
approveButton.addActionListener(new ApprovedButtonPressedEvent(this));
|
||||||
|
panel.add(approveButton, BorderLayout.WEST);
|
||||||
|
|
||||||
|
JButton cancelButton = new JButton("No");
|
||||||
|
cancelButton.addActionListener(new CancelButtonPressedEvent(this));
|
||||||
|
panel.add(cancelButton, BorderLayout.EAST);
|
||||||
|
|
||||||
|
this.add(panel);
|
||||||
|
}
|
||||||
|
}
|
55
DEV/DEV3.1/TP02/Part2/ImageWindow.java
Normal file
55
DEV/DEV3.1/TP02/Part2/ImageWindow.java
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import java.io.File;
|
||||||
|
|
||||||
|
import java.awt.CardLayout;
|
||||||
|
|
||||||
|
import javax.swing.ImageIcon;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JPanel;
|
||||||
|
|
||||||
|
public class ImageWindow extends JFrame {
|
||||||
|
|
||||||
|
private CardLayout cards;
|
||||||
|
private JPanel imagePanel;
|
||||||
|
|
||||||
|
public ImageWindow() {
|
||||||
|
this.setSize(1024, 1024);
|
||||||
|
this.setLocationRelativeTo(null);
|
||||||
|
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
|
|
||||||
|
File resourcesDirectory = new File("../resources/");
|
||||||
|
|
||||||
|
if(resourcesDirectory.exists() && resourcesDirectory.isDirectory()) {
|
||||||
|
File[] files = resourcesDirectory.listFiles();
|
||||||
|
|
||||||
|
if(files != null) {
|
||||||
|
|
||||||
|
this.cards = new CardLayout();
|
||||||
|
this.imagePanel = new JPanel();
|
||||||
|
this.imagePanel.setLayout(this.cards);
|
||||||
|
|
||||||
|
for(File file : files) {
|
||||||
|
JLabel label = new JLabel(new ImageIcon(file.getPath()));
|
||||||
|
label.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
label.setVerticalAlignment(JLabel.CENTER);
|
||||||
|
this.imagePanel.add(new JLabel(new ImageIcon(file.getPath())), file.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
this.add(this.imagePanel);
|
||||||
|
|
||||||
|
this.addMouseListener(new ClickSwapImageEvent(this));
|
||||||
|
this.addWindowListener(new WindowClosedEvent(this));
|
||||||
|
|
||||||
|
this.nextImage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void nextImage() {
|
||||||
|
this.cards.next(this.imagePanel);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void lastImage() {
|
||||||
|
this.cards.previous(this.imagePanel);
|
||||||
|
}
|
||||||
|
}
|
6
DEV/DEV3.1/TP02/Part2/Main.java
Normal file
6
DEV/DEV3.1/TP02/Part2/Main.java
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
public class Main {
|
||||||
|
public static void main(String[] args) {
|
||||||
|
ImageWindow window = new ImageWindow();
|
||||||
|
window.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
16
DEV/DEV3.1/TP02/Part2/WindowClosedEvent.java
Normal file
16
DEV/DEV3.1/TP02/Part2/WindowClosedEvent.java
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
|
||||||
|
public class WindowClosedEvent extends WindowAdapter {
|
||||||
|
|
||||||
|
private ImageWindow window;
|
||||||
|
|
||||||
|
public WindowClosedEvent(ImageWindow window) {
|
||||||
|
this.window = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent event) {
|
||||||
|
(new CloseVerificationWindow(this.window)).setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
3
DEV/DEV3.1/TP02/Part2/start.sh
Executable file
3
DEV/DEV3.1/TP02/Part2/start.sh
Executable file
@@ -0,0 +1,3 @@
|
|||||||
|
rm -rf *.class
|
||||||
|
javac Main.java
|
||||||
|
java Main
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
86
DEV/DEV3.1/TP03/Exercise1/GridWindow.java
Normal file
86
DEV/DEV3.1/TP03/Exercise1/GridWindow.java
Normal file
@@ -0,0 +1,86 @@
|
|||||||
|
import java.awt.Dimension;
|
||||||
|
import java.awt.GridBagConstraints;
|
||||||
|
import java.awt.GridBagLayout;
|
||||||
|
import java.awt.Insets;
|
||||||
|
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JFrame;
|
||||||
|
|
||||||
|
public class GridWindow extends JFrame {
|
||||||
|
|
||||||
|
public GridWindow() {
|
||||||
|
this.setSize(200, 200);
|
||||||
|
this.setLocationRelativeTo(null);
|
||||||
|
this.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
|
||||||
|
|
||||||
|
this.getContentPane().setLayout(new GridBagLayout());
|
||||||
|
|
||||||
|
this.placeButtons();
|
||||||
|
|
||||||
|
this.addWindowListener(new GridWindowClosedEvent(this));
|
||||||
|
}
|
||||||
|
|
||||||
|
private void placeButtons() {
|
||||||
|
GridBagConstraints constraints = new GridBagConstraints();
|
||||||
|
|
||||||
|
JButton one = new JButton("1");
|
||||||
|
constraints.gridx = 0;
|
||||||
|
constraints.gridy = 0;
|
||||||
|
constraints.gridwidth = 2;
|
||||||
|
constraints.gridheight = 1;
|
||||||
|
constraints.fill = GridBagConstraints.BOTH;
|
||||||
|
constraints.insets = new Insets(0, 0, 0, 0);
|
||||||
|
constraints.weightx = 1.0;
|
||||||
|
constraints.weighty = 1.0;
|
||||||
|
|
||||||
|
this.getContentPane().add(one, constraints);
|
||||||
|
|
||||||
|
JButton two = new JButton("2");
|
||||||
|
constraints.gridx = 2;
|
||||||
|
constraints.gridy = 0;
|
||||||
|
constraints.gridwidth = 1;
|
||||||
|
constraints.gridheight = 2;
|
||||||
|
constraints.fill = GridBagConstraints.BOTH;
|
||||||
|
constraints.insets = new Insets(0, 0, 0, 0);
|
||||||
|
constraints.weightx = 1.0;
|
||||||
|
constraints.weighty = 1.0;
|
||||||
|
|
||||||
|
this.getContentPane().add(two, constraints);
|
||||||
|
|
||||||
|
JButton three = new JButton("3");
|
||||||
|
constraints.gridx = 1;
|
||||||
|
constraints.gridy = 2;
|
||||||
|
constraints.gridwidth = 2;
|
||||||
|
constraints.gridheight = 1;
|
||||||
|
constraints.fill = GridBagConstraints.BOTH;
|
||||||
|
constraints.insets = new Insets(0, 0, 0, 0);
|
||||||
|
constraints.weightx = 1.0;
|
||||||
|
constraints.weighty = 1.0;
|
||||||
|
|
||||||
|
this.getContentPane().add(three, constraints);
|
||||||
|
|
||||||
|
JButton four = new JButton("4");
|
||||||
|
constraints.gridx = 0;
|
||||||
|
constraints.gridy = 1;
|
||||||
|
constraints.gridwidth = 1;
|
||||||
|
constraints.gridheight = 2;
|
||||||
|
constraints.fill = GridBagConstraints.BOTH;
|
||||||
|
constraints.insets = new Insets(0, 0, 0, 0);
|
||||||
|
constraints.weightx = 1.0;
|
||||||
|
constraints.weighty = 1.0;
|
||||||
|
|
||||||
|
this.getContentPane().add(four, constraints);
|
||||||
|
|
||||||
|
JButton five = new JButton("5");
|
||||||
|
constraints.gridx = 1;
|
||||||
|
constraints.gridy = 1;
|
||||||
|
constraints.gridwidth = 1;
|
||||||
|
constraints.gridheight = 1;
|
||||||
|
constraints.fill = GridBagConstraints.NONE;
|
||||||
|
constraints.insets = new Insets(0, 0, 0, 0);
|
||||||
|
constraints.weightx = 0.0;
|
||||||
|
constraints.weighty = 0.0;
|
||||||
|
|
||||||
|
this.getContentPane().add(five, constraints);
|
||||||
|
}
|
||||||
|
}
|
19
DEV/DEV3.1/TP03/Exercise1/GridWindowClosedEvent.java
Normal file
19
DEV/DEV3.1/TP03/Exercise1/GridWindowClosedEvent.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
import java.awt.event.WindowAdapter;
|
||||||
|
import java.awt.event.WindowEvent;
|
||||||
|
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
|
||||||
|
public class GridWindowClosedEvent extends WindowAdapter {
|
||||||
|
|
||||||
|
private GridWindow window;
|
||||||
|
|
||||||
|
public GridWindowClosedEvent(GridWindow window) {
|
||||||
|
this.window = window;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void windowClosing(WindowEvent event) {
|
||||||
|
int result = JOptionPane.showConfirmDialog(this.window, "Are you sure you want to close this window?", "Close current window", JOptionPane.YES_NO_OPTION);
|
||||||
|
if(result == JOptionPane.YES_OPTION) this.window.dispose();
|
||||||
|
}
|
||||||
|
}
|
7
DEV/DEV3.1/TP03/Exercise1/Main.java
Normal file
7
DEV/DEV3.1/TP03/Exercise1/Main.java
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
public class Main {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
GridWindow window = new GridWindow();
|
||||||
|
window.setVisible(true);
|
||||||
|
}
|
||||||
|
}
|
18
DEV/DEV3.1/TP03/Exercise2/Champ.java
Normal file
18
DEV/DEV3.1/TP03/Exercise2/Champ.java
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
public class Champ {
|
||||||
|
|
||||||
|
private String code;
|
||||||
|
private String[] modules;
|
||||||
|
|
||||||
|
public Champ(String code, String[] modules) {
|
||||||
|
this.code = code;
|
||||||
|
this.modules = modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return this.code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String[] getModules() {
|
||||||
|
return this.modules;
|
||||||
|
}
|
||||||
|
}
|
44
DEV/DEV3.1/TP03/Exercise2/Database.java
Normal file
44
DEV/DEV3.1/TP03/Exercise2/Database.java
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.DriverManager;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class Database {
|
||||||
|
|
||||||
|
private Connection connection;
|
||||||
|
|
||||||
|
public Database() {
|
||||||
|
try {
|
||||||
|
Class.forName("org.mariadb.jdbc.Driver");
|
||||||
|
|
||||||
|
this.connection = DriverManager.getConnection(
|
||||||
|
"jdbc:mariadb://dwarves.iut-fbleau.fr/baudrier",
|
||||||
|
"baudrier",
|
||||||
|
"baudrier"
|
||||||
|
);
|
||||||
|
} catch(ClassNotFoundException exception) {
|
||||||
|
System.err.println("Class 'org.mariadb.jdbc.Driver' not found.");
|
||||||
|
} catch(SQLException exception) {
|
||||||
|
System.err.println("Error while trying to connect to the database");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public Champ[] getAllData() {
|
||||||
|
PreparedStatement query = this.connection.prepareStatement("SELECT id, code FROM Champ");
|
||||||
|
ResultSet result = query.executeQuery();
|
||||||
|
|
||||||
|
while(result.next()) {
|
||||||
|
query = this.connection.prepareStatement("SELECT code FROM Modules WHERE champId = " + result.getInt("id"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void close() {
|
||||||
|
try {
|
||||||
|
this.connection.close();
|
||||||
|
} catch(SQLException exception) {
|
||||||
|
System.err.println("Error while trying to close the connection.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
1
DEV/DEV3.1/TP03/Exercise2/Main.java
Normal file
1
DEV/DEV3.1/TP03/Exercise2/Main.java
Normal file
@@ -0,0 +1 @@
|
|||||||
|
|
21
DEV/DEV3.1/TP03/Exercise2/schema.sql
Normal file
21
DEV/DEV3.1/TP03/Exercise2/schema.sql
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
CREATE TABLE Champ (
|
||||||
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
code VARCHAR(20)
|
||||||
|
);
|
||||||
|
|
||||||
|
CREATE TABLE Module (
|
||||||
|
id INT PRIMARY KEY AUTO_INCREMENT,
|
||||||
|
champId INT REFERENCES Champ(id),
|
||||||
|
code VARCHAR(20)
|
||||||
|
);
|
||||||
|
|
||||||
|
INSERT INTO Champ(code) VALUES ("APL");
|
||||||
|
INSERT INTO Champ(code) VALUES ("WIM");
|
||||||
|
|
||||||
|
INSERT INTO Module(champId, code) VALUES (1, "M1102");
|
||||||
|
INSERT INTO Module(champId, code) VALUES (1, "M1103");
|
||||||
|
INSERT INTO Module(champId, code) VALUES (1, "M3103");
|
||||||
|
INSERT INTO Module(champId, code) VALUES (2, "M1105");
|
||||||
|
INSERT INTO Module(champId, code) VALUES (2, "M3104");
|
||||||
|
INSERT INTO Module(champId, code) VALUES (2, "M4103C");
|
||||||
|
INSERT INTO Module(champId, code) VALUES (2, "M4104C");
|
11
SCR/SCR3.1/TP02/Exercise1/answer.txt
Normal file
11
SCR/SCR3.1/TP02/Exercise1/answer.txt
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Explications techniques
|
||||||
|
|
||||||
|
Fonctions standards (fopen, fread, fwrite) :
|
||||||
|
Ces fonctions utilisent une mémoire tampon (buffer) en interne. Même si tu demandes de lire/écrire un octet à la fois,
|
||||||
|
la bibliothèque C va lire ou écrire plusieurs octets (souvent 4096, la taille d’un bloc) d’un coup en interne,
|
||||||
|
ce qui réduit le nombre d’appels système réels et accélère le programme.
|
||||||
|
Vérifie avec strace : un seul appel read ou write pour plusieurs appels fread/fwrite d’un octet !
|
||||||
|
|
||||||
|
Appels systèmes (open, read, write, close) :
|
||||||
|
Ici, chaque appel à read() ou write() provoque un appel système pour chaque octet.
|
||||||
|
Le passage du mode utilisateur au noyau (syscall) est coûteux, donc le programme est beaucoup plus lent.
|
10
SCR/SCR3.1/TP03/Exercise1/answer.txt
Normal file
10
SCR/SCR3.1/TP03/Exercise1/answer.txt
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
PID PPID COMMAND S
|
||||||
|
4331 1423 bash S
|
||||||
|
4732 4331 \_ a.out S
|
||||||
|
4733 4732 \_ a.out S
|
||||||
|
4736 4733 | \_ a.o S
|
||||||
|
4737 4733 | \_ a.o S
|
||||||
|
4734 4732 \_ a.out S
|
||||||
|
4735 4732 \_ a.out S
|
||||||
|
|
||||||
|
-> Il y aura donc 6 appels à a.out.
|
16
SCR/SCR3.1/TP03/Exercise1/main.c
Normal file
16
SCR/SCR3.1/TP03/Exercise1/main.c
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
# include <sys/types.h>
|
||||||
|
# include <unistd.h>
|
||||||
|
|
||||||
|
int main() {
|
||||||
|
fork();
|
||||||
|
|
||||||
|
if (fork()){
|
||||||
|
fork();
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("A\n");
|
||||||
|
|
||||||
|
sleep(20);
|
||||||
|
}
|
6
SCR/SCR3.1/TP03/Exercise2/answer.txt
Normal file
6
SCR/SCR3.1/TP03/Exercise2/answer.txt
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[baudrier@salle229-06 Exercise2]$ gcc ex1-stdio.c
|
||||||
|
[baudrier@salle229-06 Exercise2]$ ./a.out
|
||||||
|
NONOUI
|
||||||
|
NON[baudrier@salle229-06 Exercise2]$ gcc ex1-syscall.c
|
||||||
|
[baudrier@salle229-06 Exercise2]$ ./a.out
|
||||||
|
NONOUI
|
12
SCR/SCR3.1/TP03/Exercise2/ex1-stdio.c
Normal file
12
SCR/SCR3.1/TP03/Exercise2/ex1-stdio.c
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
printf("NON");
|
||||||
|
if (fork()) {
|
||||||
|
printf("OUI\n");
|
||||||
|
}
|
||||||
|
}
|
14
SCR/SCR3.1/TP03/Exercise2/ex1-syscall.c
Normal file
14
SCR/SCR3.1/TP03/Exercise2/ex1-syscall.c
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
|
||||||
|
int main(){
|
||||||
|
|
||||||
|
//printf("NON");
|
||||||
|
write(STDOUT_FILENO,"NON",3);
|
||||||
|
if (fork()) {
|
||||||
|
//printf("OUI\n");
|
||||||
|
write(STDOUT_FILENO,"OUI\n",4);
|
||||||
|
}
|
||||||
|
}
|
15
SCR/SCR3.1/TP03/Exercise3/answer.txt
Normal file
15
SCR/SCR3.1/TP03/Exercise3/answer.txt
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
-> Le code de cet exercice permet de copier le contenu d'un fichier dans un autre fichier.
|
||||||
|
|
||||||
|
-> Quand on décommente le fork(), il y a des entrelacements possibles duent à l'exécution simultanée des processus.
|
||||||
|
|
||||||
|
Lecture Père = LP
|
||||||
|
Ecriture Père = EP
|
||||||
|
|
||||||
|
Lecture Fils = LF
|
||||||
|
Ecriture Fils = EF
|
||||||
|
|
||||||
|
Il y a plusieurs combinaisons possibles qui peuvent arriver :
|
||||||
|
|
||||||
|
- LP (a) -> LF (b) -> EF (b) -> EP (a)
|
||||||
|
- LP (a) -> EP (a) -> LF (b) -> EF (b)
|
||||||
|
- etc...
|
45
SCR/SCR3.1/TP03/Exercise3/copy1byte.c
Normal file
45
SCR/SCR3.1/TP03/Exercise3/copy1byte.c
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
#include <sys/types.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include<stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include<assert.h>
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define msg1 "je suis le pere"
|
||||||
|
#define msg2 "je suis le fils !!!"
|
||||||
|
|
||||||
|
int main(int argc,char * argv[]){
|
||||||
|
|
||||||
|
int infd,outfd;
|
||||||
|
ssize_t nbread;
|
||||||
|
char buf[1];
|
||||||
|
pid_t p;
|
||||||
|
|
||||||
|
if (argc != 3){
|
||||||
|
|
||||||
|
printf("%s infile outfile\n",argv[0]);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
infd = open(argv[1],O_RDONLY);
|
||||||
|
assert(infd >= 0);
|
||||||
|
outfd = open(argv[2],O_WRONLY|O_CREAT|O_TRUNC,0644);
|
||||||
|
assert(outfd >= 0);
|
||||||
|
|
||||||
|
p=fork(); // <- decommentez cette ligne
|
||||||
|
|
||||||
|
while(1){
|
||||||
|
|
||||||
|
nbread=read(infd,buf,sizeof(buf));
|
||||||
|
if (nbread <=0 ) break;
|
||||||
|
write(outfd,buf,sizeof(buf));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
close(infd);
|
||||||
|
close(outfd);
|
||||||
|
}
|
1
SCR/SCR3.1/TP03/Exercise3/test
Normal file
1
SCR/SCR3.1/TP03/Exercise3/test
Normal file
@@ -0,0 +1 @@
|
|||||||
|
je m'appelle nathan
|
1
SCR/SCR3.1/TP03/Exercise3/testdetest
Normal file
1
SCR/SCR3.1/TP03/Exercise3/testdetest
Normal file
@@ -0,0 +1 @@
|
|||||||
|
je map'pelle nathan
|
12
SCR/SCR3.1/TP03/Exercise4/rebours.c
Normal file
12
SCR/SCR3.1/TP03/Exercise4/rebours.c
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
|
||||||
|
int main(int argc, char* argv[]) {
|
||||||
|
assert(argc == 2);
|
||||||
|
|
||||||
|
long i = strtol(argv[1], NULL, 10);
|
||||||
|
|
||||||
|
return EXIT_SUCCESS;
|
||||||
|
}
|
Reference in New Issue
Block a user