I've been creating a small sample project to display my learnings in JavaFX, and it's completed as far as functionality. My problem now is that The lead instructor has asked me to show a database style relation between the student page and the faculty page, showing that a student has tried to add a course. I've got one page for the student where they can select a course from a table. I then have a faculty page that displays a current schedule table, and a tab on the pane that allows the faculty to add or delete a class. I'm wondering the best way without a database to show the s student has selected a course from the table which they choose to register for. I'm Using TableView for all tables, creating observable lists where I can add items and everything displays perfectly on the tables. I have the add and delete functions working perfectly well also. I only need to find a way to transfer the selection from the student to be viewable by the faculty, perhaps in a text file or something like that. Any suggestion or help is much appreciated.
There are indeed several ways. One you have suggested yourself.
You could write the data to a text file using the PrintWriter class (java.io.PrintWriter). You can recall the data by using the Scanner class.
If there is no need for the data to be stored after closing your program, the textile will be redundant. It would be better practice to store the data in an object/instance which can be aggregated by the faculty.
For a more specific answer, be more specific in your question.
Related
I'm not really sure how to word this without being vague I'm afraid so I shall explain what I have so far. I have implemented a CRUD view that allows users to edit, delete and add new categories. The idea is that a user can click on a category and they are then directed to a template displaying all comments that fall under the category, they can then upload their own comments to that specific category. My problem is that I am unsure how to implement a method that creates a new template based on the new category that was added, I sort of need one HTML template that has multiple different instances for each category if that makes sense? I would also like the comments a user adds to only be displayed for that specific category. In my database, I currently have a category table with a category ID, a comments table with a comment ID, these are linked to create a new table containing the category ID's along with the all the comment IDs that fall under that category. If anyone knows any guides to help achieve this or has any suggestions that would be highly appreciated. I have googled this but I am not really sure what exactly to type in
I was thinking that something like this would be possible to redirect to the specific categories view, however, I am not sure how to display only the comments that are associated with that category, as well as how to upload comments to only specific categories. Thanks
<a th:href="#{/viewDiscussion/} + ${category.id}">
I have an app, which takes input from a user (name, phone#, email) and generates a QR code. I used shared preferences to save the data so that the user does not have to fill out the fields every time. Right now, this only works for one person, and I want to add functionality for a second or third person.
Essentially, a main menu, that can open as many instances of the QR Generator as needed, and retrieve already open instances so that you can access the QR Codes of each person when you need it.
I have no idea where to start, so any help would be much appreciated. If you need to see the current code for the QR generator, I can attach that.
You should store the data in a database instead of sharedpreferences. And it should work smoothly. Database can store a lot of data and that too for multiple people. Which might help. You can store all the data of one person in one single row creating multiple columns for multiple attributes such as name, phone, email.
You can create multiple rows, and hence multiple people can store their data.
Database can used in two ways in android
Room persistence (also uses sqlite)
https://developer.android.com/training/data-storage/room
Raw SQLite database
https://developer.android.com/training/data-storage/sqlite
I am trying to add a feature on the "Bookshelf App for Java on App Engine Standard Environment" that lists books based on read or not read. The codes are available here https://github.com/GoogleCloudPlatform/getting-started-java
There is a Book.java file that defines the model a book. If I want to add the feature of read or not read do I add a boolean variable in Book.java? Is this a right approach? Or just keep a database table of bookID, user, readOrNot? Or the are some other smart approaches?
In general, a class like Book.java should only contains properties specific to a book like title, author, published date. If you want to add information like number of pages, you would add it to the book class. In the case of the read or not read feature, it is better to keep this information in a database where book IDs would be attached to a specific user. The user class could keep a book read list but I would recommend a database class that exposes an API to get a list of books for a user. The code would be more reusable.
I hope this help you a bit.
My goal with this project is to create a quiz app that has the ability to quiz from different banks of data. I would like the user to have the option to select which subjects they wish to be tested on, and then once selected the different banks can be combined and randomized for testing purposes. This is my first time utilizing databases and I was wondering if I could get a little input on the most economic way for this to happen. Are multiple tables my best option? Later down the road I hope to implement the ability to keep records of how well was done on each subject. If someone could point me in the right direction or give me suggestions for this I would be very appreciative.
I literally just finished creating my quiz app and I created one table to manage the questions and another to manage the scores. As long as you use a category column, you can set the cursor to read through questions with the categories you've selected. The cursor can return how many questions are in the categories selected, and you can also quite easily shuffle the numbers to get a random assortment of questions. If you've got any specific questions, just ask
(As for the how well people have done, I suggest putting that in another different database. It's easier as that database is probably never going to be upgraded, you don't have to modify it once it is created).
I created a database, in which one of the table name is Location which has 2 columns named Stadium and City. I want that data in each column should get retrieved in 2 JList, but I don't know how. Can you guys tell me how to do it?
The normal way to display a table from a database is of course a JTable. But if you want to opt for 2 JLists instead, it is basically the same principle.
Create a model based on the contents of the database (in this case a ListModel). You can probably just extend from AbstractListModel. Once you have your model, it is trivial to create a JList for it by just passing the model in the constructor.
See the How to use lists tutorial and pay special attention on the Creating a model part of that tutorial