Posts by rrr • 625 points
29 posts
-
1
votes1
answer270
viewsQ: Threaded barriers - Output snippet code
I have the following code snippet. Can anyone explain to me the following question? In the main when I create the two threads, I go to the Boat and I can tell he’s sleeping for a second. Why main…
-
1
votes1
answer64
viewsA: File. jar command console - client server program
Basically when there is a client-server type program the solution in creating a runnable jar with two Mains is to separate and create two jar’s apart. A jar with the server, and another jar with the…
-
-2
votes1
answer64
viewsQ: File. jar command console - client server program
I have developed a client server program, in which I have two Mains: one to run the server other to run several customers To extract the file . jar from ecplise I export runnable Jar File. I can run…
-
3
votes2
answers223
viewsQ: Comparator - Priorityqueue
I’m building a comparator to then use inside a Priorityqueue. private PriorityQueue<Conta> listaOrdenada = new PriorityQueue<Conta>(new ComparadorConta()); The object I want to sort is…
-
1
votes2
answers131
viewsA: Scanner - Split regardless of the number of columns
public void lerFicheiro(){ try { Scanner scanner = new Scanner(ficheiro); while(scanner.hasNextLine()){ //quando numero de campos for igual a 4 String…
-
2
votes2
answers131
viewsQ: Scanner - Split regardless of the number of columns
public void lerFicheiro(){ try { Scanner scanner = new Scanner(ficheiro); while(scanner.hasNextLine()){ //quando numero de campos for igual a 4 String designacaoAeronave = scanner.next(); String…
-
-1
votes3
answers3735
viewsQ: Generate random number between two numbers with Math.Random
I need to generate a random number between 1000 and 9999, found the following formula: (int) (min + Math.random() * (max+1)) Code: int numeroAleatorio = (int) (1000 + Math.Random() * 10000);…
-
0
votes2
answers1961
viewsQ: Practical example List and Arraylist
I’m creating a list of Estudantes, but I find myself in the following situation. In point 2 gives me error because it says I have to take the Student inside the List but when I do point 1 is already…
-
1
votes0
answers107
viewsQ: Remove file from a Jlist and from the computer
I have a frame, with a list of values where several files are displayed. At this time I am doing the delete button sentry (last part code), where the goal is to delete the file from disk, and jlist.…
-
2
votes1
answer195
viewsQ: Start a thread again
I have an event on the start button, every time I press 3 threads are generated that start the count from 30 to 0, to which reach 1º to 0 wins. But however I press the start button a few times and…
-
0
votes2
answers79
viewsA: Jlist - does not update when I log in again
My own question contained no errors, I was only accepting files in the program that ended in ". rtf" and was creating a ". txt". In this case I created a folder inside the project that is called…
-
1
votes2
answers79
viewsQ: Jlist - does not update when I log in again
private DefaultListModel model = new DefaultListModel<>(); //modelo da lista de ficheiros private JList listaFicheiros = new JList<>(model); new1.addActionListener(new ActionListener(){…
-
2
votes2
answers100
viewsQ: Read Jlist files and display content in a Jtextarea
JTextArea caixaTexto = new JTextArea(); try { String[] arrayLinhas = null; int i = 0; BufferedReader br = new BufferedReader(new FileReader(diretoriaExecucao + "/" + valorSelecionado));…
-
1
votes1
answer32
viewsQ: Java Iterator | Increment within a sentinel
public void actionPerformed(ActionEvent e) { i++; ImageIcon icon = new ImageIcon(files[i].getAbsolutePath()); imagem.setIcon(icon); frame.add(imagem, BorderLayout.CENTER); } }); I have an array of…
-
3
votes0
answers74
viewsQ: Client-Server, Threads, client error while online
I’m developing an application cliente-servidor, the server has two threads (one in and another out) well-implemented. I walk the server (all right), I walk the first client and I put it online (all…
-
6
votes1
answer527
viewsQ: Threads Server Client
In the following class SocketServidor send a single thread with the out and the in, but this class is supposed to be able to send two threads when running. You’re supposed to do this: The server…
-
1
votes1
answer33
viewsQ: Role interpretation
How does this function look without the for? cycle using Objectoutputstream? private synchronized void adicionarListaContactosOnline(){ Set<String> listaContactosOnline = new…
-
6
votes2
answers84
viewsQ: Doubt interpretation function
I have a Hashmap users: private Map<String, ObjectOutputStream> utilizadores = new HashMap<String, ObjectOutputStream>(); Can anyone tell me what this function does exactly? Here under…
-
1
votes1
answer79
viewsQ: Client Server error sending messages
I have the following code however when I run the Server and client and try to send messages from the client (Frame window) of me error! Can anyone help me? The error is supposed to be the class…
-
2
votes1
answer51
viewsQ: Jframes Editing
I have the following code that corresponds to the Header Panel but does not give me the desired output that is in the image. Can anyone help me? public class PainelEstadoContacto extends JPanel{ /**…
-
2
votes1
answer46
viewsQ: Client - Console error server
I have a client and server working to send messages from a Chat application but an error on my console when I try to write a message. Can someone explain to me the mistake? Error on console Cliente…
-
7
votes1
answer730
viewsQ: Client-Server Chat application with Sockets does not work
I’m doing a project and I got to the communication part between the server and the client and I couldn’t get the output I wanted (image output). The goal is for the server and client to communicate…
-
0
votes1
answer259
viewsQ: Update. csv file when edited in Java
I have a . csv file that contains information, but when I delete information (in this case contacts) from the console output the file . csv is not being updated. How to resolve? private void…
-
2
votes1
answer1208
viewsQ: Call method when Enter key is pressed
How to call send message method when key Enter was pressured? Code @Override public void keyPressed(KeyEvent e) { String messageSent = "User: " + writingTextField.getText(); if(e.getKeyCode() ==…
-
0
votes1
answer892
viewsQ: Import CSV files to Mysql using LOAD DATA LOCAL INFILE
I used the following script to import a file .csv to Mysql using the MySQL WorkBench: USE test; LOAD DATA LOCAL INFILE 'exemplo1.csv' INTO TABLE tabela1 fields terminated by ';' lines terminated by…
-
0
votes1
answer9249
viewsQ: Import . csv files to Mysql Workbench
I have a. csv file in column A: Product1 Product2 ... In column B I have: 1 2 ... if you want to put in the column The row 1 written Produ1 how do I proceed in the script? And what type of variable…
-
0
votes1
answer361
viewsA: Import CSV files to Mysql Workbench
The following code works for Mac, if using Windows put '/n' instead of '/r': use test; LOAD DATA LOCAL INFILE 'local' INTO TABLE tabela1 fields terminated by ';' lines terminated by '\r'; ;…
-
0
votes1
answer361
viewsQ: Import CSV files to Mysql Workbench
I have a file .csv which contains in columns (vertically): Product.1 (line1) Product.2 (Linha2) But when I do this query: use test; LOAD DATA LOCAL INFILE 'local' INTO TABLE tabela1; Always give me…
-
1
votes1
answer821
viewsQ: Import Mysql CSV files
I am using Xampp as a server and Mysqlworkbench as a database, how can I import a csv file for various experiments (file size, upload time, etc)?