- Strength to Increase Rep
- +3
- Strength to Decrease Rep
- -0
- Upvotes Received
- 14
- Posts with Upvotes
- 11
- Upvoting Members
- 7
- Downvotes Received
- 2
- Posts with Downvotes
- 2
- Downvoting Members
- 2
Main occupation : e-Learning researcher.
Meanwhile : Computer science teacher basically : algorithmics, information systems, software design and theory of organizations.
- Interests
- Software development, Java, JVM languages
- PC Specs
- Dell Inspiron N5050
44 Posted Topics
Re: Hi, I'm not really sur but isn't there a "public" directory or this is something usual in JNode. Also, you may add Javascript tag instead of Java tag. | |
Re: Hi, 1. This algorithme will have a O(n) complexity : you will check all the tree, so the "binary" particularity doesn't change things. 2. cout excutes : 1+3+6+10+15+21+... Sum of (1+m)(m/2) and m changes from 1 to n To simplify, it will b a O(n³) (I think) | |
Re: Both answers (one table, many tables) are correct but you must choose the right one. So, you must answer this question : "Does Category have any useful additional information ?" If Yes then you must create it as a table. If No then you must keep it simple and use … | |
Re: Hi, The first code seems correct, not really pretty, but correct. I would write : public boolean addIfAbsent(UserBean userBean) { if (users.stream().anyMatch(x -> x.getUsername().equals(userBean.getUsername()))) { return false; } else { users.add(userBean); return true; } } } And I would call it in the if statement. The second code seems to … | |
Re: Hi, It's a parsing code, and as Venkat Subramaniam said : "don't show your parsing code to any one, it is always ugly" :) So, start by looking in "seminar.txt". | |
Re: Hi, You have two characters here : The 0A (10) is the "new line" character, The 0D (13) is the "return to start" character. You're not in a binary file, you're in a text file so you must check the ASCII code to know which charcter has the displayed value … | |
Re: Hi, You must check your CSS selector here : img.resize means the tag img with the class name .resize somthing like : `<img src="/path/to/image" class="resize" />` Otherwise it won't work. Check [this course](https://www.w3schools.com/cssref/css_selectors.asp) | |
Re: Hi, I highly doubt it's possible. If we don't know the class structure than we can't use it after parsing. I have seen (in Groovy) examples where the JSON object is converted into a map and you can, after that, get all keys and values easily. I have found some … | |
Re: I will assume that this is your first try and you are new to this so let's start together : *StrongTEETH4U is a private dental clinic that is well known and has an excellent reputation in the area. All patients in the clinic have their details stored in a ClinicBook … | |
Re: In addition to what stultuske has said, you can use t and c directly because they are the content of the JTable row. | |
Re: Two methods in the same class : JOptionPane.showInputDialog() JOptionPane.showMessageDialog() Documentation here : https://docs.oracle.com/javase/7/docs/api/javax/swing/JOptionPane.html But, as others have said, you must be able to : convert from String to int, manipulate arrays (small ones at least) and may be loops to write a proper solution. | |
Re: And I will add the following : in the begining, the first version of your code, it is recommanded to not mix actions; separate reading from checking. Read what you need to read then check the result in the while condition even if that means you need to put the … | |
Re: In the first loop, you have a block so, I think it must be : do { // }while( //condition); In the second loop, I don't get the first line : mark += ranges.length; I think you must rethink a good part of the program. | |
Re: First, choice2 is supposed to be an integer (int) but in the while condition, we can read (choice2=true) Second, choice2=true is not a comparaison, it is always true. I think you should use choice2==true and here again choice2 is supposed to be compared to an int value not a boolean … | |
Re: Well, start by creating a new project, kept the "Main class" option checked, open your main class and we will continue from there. | |
Re: Hi, The statement : printStream = new PrintStream(new FileOutputStream(fileName, append), autoflush); Creates the file but does not write into it. You must write in the file using : printStream.print() [More details](https://docs.oracle.com/javase/7/docs/api/java/io/PrintStream.html) | |
Re: Hi, I think you're juste starting so let's be simple : 1. You already have the statement that generates the random number, 2. All you need to do is an if...else to check if the random number is > 90 && < 100 to display A 3. Start by one … | |
Re: Hi, If it must run in a web browser then you must learn (or search codes in) J2EE (Servlets/JSP) not simply Java (J2SE). Good Luck. | |
Re: Hi, If I get it right, your problem is on the front end : how to format the display ? First, the most used format are XML and JSON because they allow us to use in-built parsers , so you won't be stuck in string processing. To create a JSON … | |
Re: Hi, In this particular case, personally, I don't use any APIs, I simply generate a csv file which [can be opened directy in Excel](https://support.office.com/en-gb/article/Import-or-export-text-txt-or-csv-files-5250ac4c-663c-47ce-937b-339e391393ba) like any other Excel file. [CSV format](https://en.wikipedia.org/wiki/Comma-separated_values) is a text format wich means a simple FileWriter can be used without any external APIs. The generation takes … | |
Re: I agree with JamesCherill, it can be a design problem, and the solution you propose is probably false : restarting a server aims to clear the cache or to erase temporary data; disconnecting and reconnecting the client can't guarantee that. | |
Re: Hi, I don't think isValidateRoot() means what you think it means; I don't think you need it here. You have two JTextField, one for the inputs, the other for the result, so what's the problem? All buttons will use the same JTextField. | |
Re: Hi, I don't know if I came too late, but there's a simple solution, especially if the exercise concerns loops, you can make successive subtraction of 2 util the value is less than 2, if the final result is 0 then the number is even, otherwise the number is odd. | |
Re: Hi, We can't do your homework, you will learn nothing. But, some hints may help you ; 1. It's evident that you need to use a loop inside another one : The first loop is to create many lines, The second one is to print many stars or dots. 2. … | |
Re: The java code seems correct, check the SQL query in your jrxml file. | |
Re: Interesting, I see the java famous "import" and "string" is a data type, the main method is almost the java one, but without creating a class to test few lines of code. | |
Re: Hi, JamesCherill is right, you must use the size variable not the DEFAULT_SIZE, but you need to initialize it : public Queue(int capacity) { elements = new int[capacity]; size = capacity; } Annother probleme : before adding an element you must check if the queue is full or not, and … | |
Re: To resolve this, you must use the try-catch differently : your methods must throw exceptions not catch them, and the try-catch bloc will be in the enterJButtonActionPerformed method. [A simple tutorial here](https://weblogs.java.net/blog/manningpubs/archive/2013/06/13/using-throws-and-throw-statements-java) | |
Re: Hi, `private class KellyCoffee<Order> extends Queue implements OrderLineInterface` Otherwise, the declaration seems wrong : a class can't extend herself. | |
Re: I'm not sure I understand what you want to do here (first of all, the code is not readable"), but what I know, your "perm" array is not a matrix. | |
Re: If you know Java then you know Eclipse. Eclipse is an IDE which can make your life easier, it helps you when you compile, build and manage your project. It can help you with code completion and refactoring (renaming variables, etc.). It has also some plug-ins to connect to databases, … | |
Re: Hi, If I understood your request, you're searching how to create and manage advanced data structures in Java. If that's it, you may look toward "Java Collections" also called "Collection API" : [Offical Doc on Oracle website](http://docs.oracle.com/javase/tutorial/collections/) Good reading. | |
Re: Hi, I agree with all what have been said here. I want to add a tiny trick : in applications with GUI, the developer might have put some `.printStackTrace()` from the `Exception` class. [Click Here](http://docs.oracle.com/javase/6/docs/api/java/lang/Throwable.html#printStackTrace%28%29http://www.) This method uses the console as an output which is invisible from a "double-click" launching, … | |
Re: Hi, I agree with Ewald, but if you search a simple solution (if there is no message to passe from the first applet to the second) you can make a simple redirection to the html page wich contains the second applet. In this solution, you will have two web pages, … | |
Re: Hi, To disable or enable a button in java, you can use the setEnabled method : [Click Here](http://docs.oracle.com/javase/7/docs/api/javax/swing/AbstractButton.html#setEnabled%28boolean%29) Now, to detect changes in the frame, you must add a listener to the components you want to watch, every component has its own events. | |
Re: Hi, I found you this quick tuto, may be it'll help you : https://blogs.oracle.com/roumen/entry/setting_up_derby_database_in | |
Re: Hi, And what's the problem, you have the GUI Building tools in Eclipse and NetBeans, a few mouse click and you'll have it done. | |
Hi, I'm Tarek, I have a Master Degree in IT, I worked on e-Learning technologies. Currently, I teach programing basics in Pascal, Delphi, C and Java (only the basics :) ) and of course I like to program and to learn new things. Happy to be with you. ![]() | |
Re: Hi, Yous are applying the style "on the next letter" not "the last letter", and that's why you have the style is "applyed late". So, you must use the other setCharacterAttributes : http://docs.oracle.com/javase/7/docs/api/javax/swing/text/DefaultStyledDocument.html#setCharacterAttributes(int,%20int,%20javax.swing.text.AttributeSet,%20boolean) | |
Re: Hi, You have to do this on two steps : read lines then extract the 1 and 0 after. // This code isn't ready to be ran, put it in a method // Openning the file FileReader fr = new FileReader("transa.txt"); BufferedReader buffer = new BufferedReader(fr); int digits[][] = new … | |
Re: Hi, To not complicate things and to avoid adding an if..else you can try to stop the loop before the end of the array : for(int i=0 ; i < myArray.length - 1 ; i++){ System.out.print(myArray[i]+","); } Then, write the last element : System.out.print(myArray[myArray.length - 1]); | |
Re: Hi, There is my try : public double calculate(double hours) throws Exception{ double fees = 0; if(hours <= 3){ fees = 2.00; }else{ if(hours > 3 && hours <= 24){ fees = 2.00 + (hours - 3) * (0.50); if(fees >= 10) fees = 10; }else{ if(hours > 24) throw … | |
Re: Hi, You can use the "add" method in the ArrayList class : http://docs.oracle.com/javase/6/docs/api/java/util/ArrayList.html // Add an exam in the end of the array list myExams.add(e); // Add an exam in a specific position in the array list int position = 3; // Example myExams.add(position, e); |
The End.