[This page was last updated on Nov 10 2020] [ indicates those watching the forum (kudos 👍)]
@itssodium
(40 posts)1. PPP dashboard
The image below says that I have added 30 lines in the PPP but the status is still 'no'. Do you mind explaining why?
2. PPP deadline
May I know when the deadline is for PPP?
3. DG update
Are we allowed to edit directly on the github account of the team repo or do we have to create PRs?
4. Smoke-test CATcher
Hi, wat does it mean by "dummy bug reports" given in the instruction.
5. Unable to change colour of text
>Label fx:id="roomNumber" textFill="black" alignment="CENTER" contentDisplay="CENTER" styleClass="cell_big_label"/>
This is my code on java fxml, but the text is still white.
6. Smoke-test CATcher deadline
May I know when the deadline is for the Smoke-test CATcher is? The website says before the deadline but I can't seem to find the deadline.
7. Dont know how to change header of Json file
In the file above, I am not sure how to change the value of "patients". Been stuck at it for a few hours.
8. Issue Tracker
Are we allowed to extend deadlines and if all our PRs manage to be within the extended deadline is it considered late?
9. Unable to push tutorial branches
I am unable to push my branches as my teammates made changes to the master branch which I have not pulled yet. Should I pull them and then push my branches?
10. Recess Week
Is this week recess week for CS2103/T or next week?
11. Unable to launch app in tp
I am getting this error when I try to launch the app.
Sep 18, 2020 3:47:26 PM seedu.address.MainApp init
INFO: ===[ Initializing AddressBook ]=
Sep 18, 2020 3:47:26 PM seedu.address.MainApp initConfig
INFO: Using config file : config.json
Sep 18, 2020 3:47:26 PM seedu.address.commons.util.JsonUtil readJsonFile
INFO: Json file config.json not found
Sep 18, 2020 3:47:26 PM seedu.address.MainApp initPrefs
INFO: Using prefs file : preferences.json
Sep 18, 2020 3:47:26 PM seedu.address.commons.util.JsonUtil readJsonFile
INFO: Json file preferences.json not found
Sep 18, 2020 3:47:26 PM seedu.address.commons.core.LogsCenter init
INFO: currentLogLevel: INFO
Sep 18, 2020 3:47:26 PM seedu.address.commons.util.JsonUtil readJsonFile
INFO: Json file data/addressbook.json not found
Sep 18, 2020 3:47:26 PM seedu.address.MainApp initModelManager
INFO: Data file not found. Will be starting with a sample AddressBook
Sep 18, 2020 3:47:26 PM seedu.address.MainApp start
INFO: Starting AddressBook V0.6.0ea
Sep 18, 2020 3:47:26 PM seedu.address.ui.UiManager start
INFO: Starting UI...
Exception in Application start method
Sep 18, 2020 3:47:26 PM seedu.address.MainApp stop
INFO: ============================ [ Stopping Address Book ] =============================
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:973)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:198)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.NullPointerException: Input stream must not be null
at javafx.graphics/javafx.scene.image.Image.validateInputStream(Image.java:1117)
at javafx.graphics/javafx.scene.image.Image.>init>(Image.java:701)
at seedu.address.ui.UiManager.getImage(UiManager.java:55)
at seedu.address.ui.UiManager.start(UiManager.java:41)
at seedu.address.MainApp.start(MainApp.java:171)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:919)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(PlatformImpl.java:449)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(PlatformImpl.java:418)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:417)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
12. JAR File tag
I realised i didnt tag my JAR File as A-Release and I used another name. But I realised that the ip-dashboard doesn't care about it. Do i need to change my name of JAR File tag?
13. Import Statement move after committing
My import statements are moving after I commit my changes. Is there a way to stop this?
14. Unable to push branch
I am unable to push a branch-A-codequality after i merged master to it.
15. JavaFX cannot be recognised by IntelliJ suddenly
I was coding and suddenly all the files which contains JavaFx statements turned red, indicating that JavaFX cannot be identified. However, when I run my launcher class I still can get a GUI. I don't really understand this behaviour.
16. Cannot capture everything after the size of output exceeds the size of window
After I have many inputs on my app, the output from the previous and current Duke comments is being cut short.
17. Merging
Are we supposed to merge after completing each level or do we complete all levels and then merge them? Sorry I'm confused.
18. No test were found error while test is present while doing Junit
I have the following dummy code below, but when I want to run it it gives me No test were found. Do you mind helping
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class test {
@Test
public void test(){
assertEquals(2,2);
}
}
💡 You can use Markdown to format your text
19. Conflicting Changes and hence unable to commit
Remember to give sufficient details e.g.,
Your development environment (IntelliJ version, Java version, OS, ...)
Relevant code, error message, stack trace
Relevant code snippet (an example given below), or link to the relevant code on your GitHub repo
String value = "Some code here"
💡 You can use Markdown to format your text
20. Testing
Even if I type in a simple System.out.println(123) and the EXPECTED.TXT contains 123, I am getting a Failed message being printed
My runtest.sh file is this:
#!/usr/bin/env bash
# create bin directory if it doesn't exist
if [ ! -d "../bin" ]
then
mkdir ../bin
fi
# delete output from previous run
if [ -e "./ACTUAL.TXT" ]
then
rm ACTUAL.TXT
fi
# compile the code into the bin folder, terminates if error occurred
if
! (
find ../src/main/java -name "*.java" >sources.txt
javac -cp ../src -Xlint:none -d ../bin @sources.txt
)
then
echo "********** BUILD FAILURE **********"
exit 1
fi
# run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT
java -classpath ../bin Duke < input.txt > ACTUAL.TXT
# compare the output to the expected output
diff ACTUAL.TXT EXPECTED.TXT
if [ $? -eq 0 ]
then
echo "Test result: PASSED"
exit 0
else
echo "Test result: FAILED"
exit 1
fi
This is my error message:
Noorul-Azlina:text-ui-test hidayadullaubayathulla$ /bin/bash /Users/hidayadullaubayathulla/ip/text-ui-test/runtest.sh
0a1
123
Test result: FAILED
My main method just contains: System.out.println(123)
21
public static void main(String[] args) {
try {
System.out.println("123");
}catch (Exception e){
}
}
this is my main method, and I thought the ACTUAL.TXT would get filled by itself according to the textbook:
Run the program as given below, which will redirect the text in input.txt as the input to AddressBook and similarly, will redirect the output of AddressBook to a text file output.txt. Note that this does not require any code changes to AddressBook.
22
My ACTUAL.TXT file remains empty, thats why I dont know but when I run Duke.main, I get the output I want... Im confused
23
So we are supposed to mark the main as the module?
24
Okay thanks!
25
Yeap that works! thanks!
26
27
This is the error im getting. I tried pulling too but it didnt work.
28
Right, cause my iP dashboard is all green as of now. So I don't have to make changes right?
29
Alright thanks!
30
31
Oh okay, so the quiz bonus deadline is also pushed to 28 September?
32
Yes prof, i made that mistake. Thank you!
33
No I tried changing that yesterday, but it doesn't work.
34
I also tried to search for the word patients but I can't find the code to which is responsible for that header. The @JsonProperty("patients") thing is used for reading not writing.
35
36
I changed it, but it is still patients.
37
I managed to change it thank you!
38
Okay thank you.
39
Okay thank you.
40
Okay thanks Prof!
@qwoprocks
(39 posts) 1. [External Software Permission Request] PlantUML Github Action
Dependency: Git Auto Commit Action
Automatically generate and commit PlantUML pngs when .puml files are updated, so as to eliminate the manual labor of exporting each .puml file as an image whenever they are changed. Also, this allows people reviewing the PR to see the visual result of the UML changes on GitHub itself, which is convenient sometimes.
I've uploaded a sample .yml file as a .txt file here for those that want to use this as well, if approved
Edit: After some tinkering, I've updated the .yml file to fix some issues, you can get it here
PlantUML GitHub Action has no license indicated, but it runs the PlantUML tool which is under the GPL License
Git Auto Commit Action: MIT License
2. Walking skeleton for tP
I would like to ask if the walking skeleton approach conflicts with the instructions for our breadth-first iterative approach?
From the images below, the breadth-first approach says that "Adding all data classes first" is a bad thing, but it seems that a walking skeleton would be basically doing that, albeit just creating dummy data classes, unless my understanding of a walking skeleton is wrong.
The walking skeleton also doesn't really make the product a "slightly better working version" as there will technically be no functionality change, so would creating the walking skeleton not be considered a proper, independent task to be assigned and committed to the master
branch? Is it just a separate branch/dummy code that team members should refer to when implementing their feature?
3
Hi, you probably need to install dos2unix on your laptop. (Not a mac user but I think you can use homebrew to install it)
The random numbers indicate the places where differences in the ACTUAL and EXPECTED files are found, which in this case is probably the line endings and indentations.
4
Assuming your runtest.bat resides in the text-ui-test folder, it would mean that the working directory when you run it is inside the text-ui-test folder. Thus, to access the src folder you need to move one level up, which would mean just changing the filepath to "..\src\main\java\data\list.txt" (just prepend a dot)
5
I'm guessing that it's most likely because of the multiple creation of the Scanner object in your code, since you are creating a new Scanner every time you call the readCommand function.
The better practice is to just create one Scanner object and use it for the entirety of the program to read inputs.
6
Maybe you can also try adding a check for sc.hasNextLine() before you do sc.nextLine(), to get rid of the error temporarily and from there check if your program is reading the file properly and where it fails to find a nextLine
7
Hmmmm that's weird, maybe the input file has some kind of issue? Could you try to recreate a smaller input.txt file in intellij by typing out like 3 commands and test it on that?
8
From the website, the example path given is [project_root]/data/duke.txt, so in your case the mkdir should be run in the ip folder
9
I think the method described in the link below is pretty simple and elegant
10
@iamgenechua can you try the solution detailed at the end of this issue thread?
11
@tohyuting Are you using Windows? Because I can't find it on my screen.
You can see it in the top right side of your photo, almost directly below the close [X] button
12
Hi if you're using the checkstyle and suppress xmls from ab3, you can change your checkstyle version (in build.gradle as well) to 8.1 and it'll get rid of the 'FileContentsHolder' error. As for the config_loc, you can just ignore it and click next as it doesn't seem to affect the operation of checkstyle
13
Yup works now, thank you! Would the older version affect our iP?
Nope, I don't think it will, unless the checkstyle.xml file in ab3 is outdated
14
You can try removing all mentions of the shadow plugin from from your build.gradle file
15
I got this error when I tried running 2 instances of the program at the same time. Maybe you could check if a process is already running? The red stop button in the top toolbar of intellij should be lit up and if so, and you can just press it to stop your instances.
If the above doesn't work, you can also try running grade clean
16
For this week's tasks it is not needed. It's simpler to remove it first then add it back later on when needed.
17
I think you can refer to issue #125
18
#125
19
Maybe you can take a look at the stack trace? The java.lang.XXXException tab usually doesn't give any information, you can try clicking on the Launcher.main() lines to see if there are more details on why these exceptions were thrown.
Usually its due to some kind of uninitialized fields or a naming issue which leads to FXML and your java code not meshing together (or maybe you forgot to set the controller, etc.)
20
There has been a similar discussion in issue #100, please refer to the reply by Prof
21
Have you tried addressing the error shown by renaming your duke/Todo.java to duke/ToDo.java?
22
You can just remove the new ImageView
from the handleUserInput()
function. The two getDialog
functions are expecting an Image
and not an ImageView
.
23
Are you using gradle run
to run the app? If not, could you try that and see if the error still appears?
24
Could you try changing it to ./seedu/duke/todo.txt
instead and see if it works?
25
I think you are reading too much into the word 'skeleton' 😃
Walking skeleton is basically the minimal system that can do something useful (i.e., just enough bones/muscles to be able to walk!) -- skeleton doesn't mean add all classes in dummy form.
In other words, it's exactly the breadth-first approach.
Sorry, I'm still a little confused about what exactly the skeleton means 😅
So for example if we were to create a walking skeleton for v1.2, would it be adding all the fields, methods and classes required for the features we are adding for v1.2 into the repo, but leaving the implementation out (returning some default value or doing some default action)? Or would it be something else?
26
So for example if we were to create a walking skeleton for v1.2, would it be adding all the fields, methods and classes required for the features we are adding for v1.2 into the repo, but leaving the implementation out (returning some default value or doing some default action)? Or would it be something else?
That's going too low level. 'Components' here means higher level things, not low level things such as fields and methods. For example, if you expect the network communication to be handled by a separate component and there isn't any yet, you can add an empty Network class as a place holder for that component. By the time you are done with v1.2, it could evolve in to a component consisting of a bunch of other internal classes and many methods/fields., but that's later. So, the skeleton referred to here is an architecture-level skeleton.
Given you are starting off with an existing code base, the skeleton may already be there. Perhaps you only need to do a bit of refactoring (rename a few things), or in rare cases, add a place holder for a new component that you need but not present in the current one.
Ah ok I think I get it now thank you for the detailed clarification Prof!
27
I'm guessing you need to find and change @JsonProperty("patients") in your code. You can use Ctrl-Shift-F
to find all instances of the word "patients" in your code.
28
I also tried to search for the word patients but I can't find the code to which is responsible for that header. The @JsonProperty("patients") thing is used for reading not writing.
Hmmmm from the jackson github I don't think its only used for reading. Was the @JsonProperty("patients") you changed in JsonSerializableAddressBook? Could you try adding a @JsonProperty(>new name here>) before the private final List>> patients in the same file?
29
Did you try starting afresh (moving your current json to another folder and regenerating by adding some data back using the app)? Does it still give you patients?
Another thing you might wanna try would be changing the variable name itself to rooms?
30
Maybe try re-running the CI? There's a small chance that its just some weird temporary bug
31
hi @CodyChew I cloned your code and figured out the issue. Try moving/temporarily deleting your data
folder at your project root and re-run gradle test
, I think you should be able to debug from there 😃
Remember that the data folder is gitignored
32
WOAH, thanks so much @qwoprocks I didn't notice it! How did you manage to figure it out?
No problem 😄. I just did a clone of your repo and immediately ran the tests, which failed due to the lack of the data
folder. Then I did a quick trace through the errors to see that the file validation portion of your Reference class was failing.
33
You can refer to the java documentation here and see that the java.awt.HeadlessException is being caused by your Desktop.getDesktop().
This is because the CI workflows run in a headless environment, and the awt Desktop is not supported there. I would probably skip the tests in the CI by wrapping the whole thing in an if (Desktop.isDesktopSupported())
, since as far as I can see there's no practical workaround that allows you to open files in this headless environment, besides using Runtime exec and tailoring to each OS maybe?
Not sure if anyone else knows of an easy way to circumvent this limitation?
34
Thanks for the reply.
I have followed your suggestion, everything passes but macOS CI.
This is really strange. Could this be because of the OpenGL renderer used in macOS CI?
Why is the CI desktopSupported anyways? =(
Unable to create basic Accelerated OpenGL renderer.
Core Image is now using the software OpenGL renderer. This will be slow.
seedu.address.logic.commands.OpenCommandIntegrationTest > execute_openValidTag_success() FAILED
java.lang.AssertionError at OpenCommandIntegrationTest.java:38
Caused by: seedu.address.logic.commands.exceptions.CommandException at OpenCommandIntegrationTest.java:38
Caused by: java.io.IOException at OpenCommandIntegrationTest.java:38
seedu.address.logic.commands.OpenCommandTest > execute_tagNameInModel_success() FAILED
java.lang.AssertionError at OpenCommandTest.java:69
Caused by: seedu.address.logic.commands.exceptions.CommandException at OpenCommandTest.java:69
Caused by: java.io.IOException at OpenCommandTest.java:69
I believe that the MacOS fails because you can't run .bat files in Mac, which is why the IOException is thrown 😦
35
You can view the results of the checks here
As shown on that page, the issue that's causing your CI to fail is the following error:
ERROR:../config/checkstyle/suppressions.xml:9: no newline at EOF.
36
I'm not 100% sure, but it looks like you're on Windows and tried to run the jar file from your WSL CLI. WSL operates in a virtual environment of sorts and does not offer proper GUI support, thus it will be unable to run this GUI application. You need to run the same command in powershell / cmd
37
Hi, I faced the same problem and if I recall correctly I solved it by downloading and using the 32-bit version of graphviz. The result of running dot -v
on my computer gives this:
dot - graphviz version 2.44.1 (20200629.0800)
38
As the error suggests, this is caused by different java versions being used for compiling and running. You can refer to these issues for more info: #25, #181, #247, #266
39
@GeNiaaz could you try changing public static final String VALID_TEAMMATE_GIT_USERNAME_A = "Sparrow32";
in TeammateTestUtil.java
to public static final String VALID_TEAMMATE_GIT_USERNAME_A = "Sparrow";
and see if this passes the checks?
If it does pass, I suspect that your validation regex for git usernames is incorrect.
@XIA-LIYI
(30 posts)1. Link of RepoSense failed
Hi prof,
Yesterday, when I pasted link of RepoSense in PPP, it worked. But just now when I test it, it failed to link me to RepoSense, does it matter? Will it affect grading?
Thanks!
2. How to do assertion task in tp
Hi guys,
Anyone knows the instruction for that assertion task? I add one assert into code but it does not become green. So I feel confused.
Thanks for any help given!
3. Unable to get Codecov report
Hi,
Our group fails to pass CI due to codecov error. Does anyone know how to solve this problem?
4. How about if we use Trello instead of GitHub issues?
Hi prof, if our group is using trello to manage the project, is it ok? But we see that there is one task regarding GitHub issues although it is not compulsory initially.
5. Is there any good JSON package in Java?
Hi,
I am implementing login function to my iP. I want to use JSON to store user information. So is there any good JSON package in Java? Any help will be appreciated.
6. Why I cannot run jar well.
Hi, I run duke.jar in powershell but got this error. The structure of the project is compliant with instructions. Anyone knows the reason? Thank you for any help given.
7. Two ways to delete tags on remote in command line💡
In command line, if you want to delete tags on remote, you can try push origin :/refs/tags/tagname
.
Also, you may try an unsafe way push origin localTageName:tagName
. This has the possibility of deleteing the whole branch. But I used this since the first method fails. I haven't found the reason why the first method does not work. Any help will be appreciated.
8. The powershell fails to display tick and x under UTF-8 and UTF-16
I tried chcp 65001
to display the tick and x symbol but I got ?
in powershell. Then I tried chcp 1200
to switch to UTF-16 but it reported Invalid Code Page
. I don't know how to fix this bug.
Any help will be appreciated.
Thanks!
9
No but I gave up so just use IDEA to run the code. It works well.
10
Thank you for both of your suggestions! The problem has been solved.
11
You probabaly need to download the checkstyle and suppressions file from AB3 and paste it into your own project.
12
Thanks.
13
Thanks prof
14
I spent four hours solving this problem and found that it failed because not all tasks have been run. I deleted all of tests before so no report was created.
But I feel confused is it necessary to write tests for main code at the same time when I write main class? Or I can write tests after main part is almost done. If so, JavaCI cannot pass because original tests cannot work as long as of original classes is changed. Is it not friendly to a project which is based on modifying other projects.
15
ok thanks!
16
Hi,
I mean why in tp dashboard, it does not show asserts found in my code base.
17
I have already put assert in my code and merge into master branch.
18
@damithc Hi prof. RepoSense failed to detect my commits after 13 Oct.
19
In tp progress, it detects those commits but RepoSense failed to do so. How can I solve these issues?
20
Yes, I am using a new device. So if I configure again in local device, will it be detected?
Attached is author name of current device.
21
Or I need to write an assertion after configuring and push again?
22
It should be SimonXIA0316.
23
So commits written by SimonXIA0316 in the future can be detected right?
24
Okie, thanks prof!
25
BTW, when can I see the update info on RepoSense report?
26
Okay thanks prof!
27
Hi prof, @damithc I wrote the assertions on 21 Oct, but the tab of assertions is still red although it can be detected in RepoSense.
Also for overdue task, if I do it now, will it be green again?
28
Prof, you mean which question? The assertion tab?
29
Okay thanks for reply!
30
Thanks prof!
@erisjacey
(27 posts) 1. Keep part of code that prints output in terminal after JavaFX?
I'm not sure whether this is a discussion worth having, but I have this small query:
I have integrated JavaFX into my project and now have a fully functional (albeit ugly-looking) GUI. I'm assuming this is the main platform users will be interacting on/with.
Does that mean the part of the code that deals with printing output onto the terminal (i.e. how we've been interacting with the user prior) is now rendered obsolete? Should I remove it to prevent unncessary bloat in my code?
The only purpose I see in keeping it right now is the fact that if I remove it, it'd be hard to do semi-automated testing using the provided .bat
/.sh
file, but I think unit testing using JUnit seems far more efficient as a form of automated testing.
Could anyone shed some light on this? Any comments would be appreciated!
2
I had a lot of trouble with getting my .bat
file to work as well, and this is what worked for me:
If you're like me and have a very long and convoluted file path (with lots of whitespaces) to your source files, you can try using the following method:
SET MY_PATH=>your_really_long_path_here>
Hereafter you can refer to your path by simply calling %MY_PATH%
wherever you need it.
Here's an example of what I'm talking about:
Let me know if this helps 😃
3
Regarding this line:
SET MY_PATH="my_file_location"
Did you encase your location path in double quotes (")? If you did, try removing the double quotes.
i.e. Suppose my path is something like C:\Users\blah\CS2103\ip
. Then that line would be:
SET MY_PATH=C:\Users\blah\CS2103\ip
The former (I just tried) gave me a similar error in your post while the latter worked just fine.
4
First issue regarding the cmd window closing:
Try putting a PAUSE
command at the end of the script, so something like:
Second issue regarding the .bat
not working properly:
I'm not sure where your respective directories are but here's what you should be inputting for each command javac
and java
:
javac -cp <your_source_code_directory> Xlint:none -d <destination_directory> <file(s)_to_compile>
-cp <your_source_code_directory>
: (classpath) your .java
files should be in this specified directory.
-d <destination_directory>
: (destination directory) where your .java
files will end up in after compilation (as .class
files).
java -classpath <your_source_code_directory> <file_to_run> < input.txt > ACTUAL.TXT
classpath <your_source_code_directory>
: note this should match the directory where your .class
files ended up after compilation.
As a reference here is what my .bat
file looks like atm:
Hope this helps!
Edit: fixed typo
5
You can try the following:
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\*.java
But iirc if you compile your top-level class first (in terms of dependencies) every other relevant class should be compiled as well. Hence why calling javac
on just Duke.java
works for me
6
It may be something to do with javac PATH
not having been set properly.
See: https://www.edureka.co/community/4800/unable-resolve-error-recognized-internal-external-command
7
It should be in the parent directory of src
, so in your case that would be in ip
.
To clarify: ..
means navigate to parent directory. So if your current directory is something like C:\Users\blah\text-ui-test
, a script inside calling for the path ..\src
implies C:\Users\blah\src
. (blah
is the parent directory here)
8
Upon closer inspection of your .bat
file, go to line 10 and change -d ..\src\bin
to -d ..\bin
.
9
Can you elaborate (and maybe provide an example) of case 2? Not sure I fully understand it.
Nevertheless, to emphasize the notion of encapsulation, what I personally did was create a separate exception class that handles logic specific to an empty todo (or any other task for that matter) description (aptly named DukeInvalidTaskDescriptionException
). This class extends from DukeException
.
By doing so I ensure that neither Task
nor any exceptions related to the class (or its subclasses) know about each other (because imo they shouldn't). All of the logic with respect to exception handling would then be handled by the overarching driver class (Duke
by default). This includes throwing the relevant exceptions in try-catch blocks, etc.
10
I faced a similar issue previously.
I solved it by placing my scanner object as a field within the Ui
class so that way I only have one scanner object per Ui object (as @qwoprocks has kindly suggested). Thereafter your readCommand
body can just look something like this:
public String readCommand() {
return scanner.nextLine();
}
11
If by testing you mean continuing to use .bat
or .sh
files to script testing, the way I did it was pretty rudimentary:
I created a feature to support the "delete all"
user input command. This command (as its name suggests) deletes all existing tasks (if any) in the list of tasks.
All I did afterwards was make sure this command was the first line of my input.txt
. This allowed the task list to "reset" every time the script is run.
A cool side effect to adding this command is that users of my Duke chatbot will be able to use it in normal circumstances as well (because I think the default implementation of delete 2
, etc. can be quite clunky especially for substantially big lists).
I'm sure there are more clever ways to go about doing this though.
12
Changing your -cp
directory in line 18 to -cp ../src/main/java
(where your sources root is) should fix the issue I believe
13
In the build.gradle
file (should be in your root folder), I think you will need to make the following change:
Change the class name according to your main class name (and package).
Hope this helps!
14
This is a similar issue to #101 I believe
15
Assuming you have been doing the project on Intellij, then like (me and many others) yours should fall under Scenario 2!
As per the instructions in A-Gradle, merge the branch that "added gradle support" into your current master branch and follow the instructions in Scenario 2 from there.
16
Thanks prof!
17
I think this is a similar issue to the one in #125
18
Okay, sorry, I realised I had to either change the main class in the build gradle file.
@yanbingtao You could try the solution posed in #101. Hope this helps!
19
Updated my GUI a little bit so it looks like this now:
Thanks @tankangliang for the resources to integrating CSS into JavaFX!
20
It's covered under week 5's topics.
21
Do you have a Duke constructor that takes in 0 parameters? (i.e. new Duke()
)
If not, try implementing one.
I had a similar issue and I managed to solve it by implementing one.
22
#160
23
This seems similar to #176, you might wanna try the solutions posted there
24
Try the solutions posted in #125, I think the problems there are similar
25
Go to the [root]/build.gradle
file, you should see this:
Hope this helps!
26
This seems to be a common issue across the board (see #375 ). My team is also experiencing the same problem, I suspect the issue is on the GitHub/Codecov server side
27
Which block are you referring to?
Under .github/workflow/gradle.yml
, I commented out the following block:
- uses: codecov/codecov-action@v1
if: runner.os == 'Linux'
with:
file: $/build/reports/jacoco/coverage/coverage.xml
fail_ci_if_error: true
and my team's repo CI starting passing again.
@luo-git
(25 posts) 1. Is this a bug or a limitation of JavaFX?
This is an issue regarding Desktop.getDesktop().open()
.
Desktop.getDesktop().open()
passes all JUnit testing and can open files in linux . However, when this method is called under JavaFX (I've only tested on KDE Ubuntu and KDE Manjaro), the JavaFX application freezes.😢
This seems to be long term concurrency issue with JavaFX, and the solution I found on StackOverflow does not seem to work well.
https://stackoverflow.com/questions/23176624/javafx-freeze-on-desktop-openfile-desktop-browseuri
Should this be considered a bug or a limitation of JavaFX?
2. Getting java.awt.HeadlessException on GitHub CI
Platform: Windows
As my group is doing a file management app, we need to open files that are stored under some directory.
We implemented that using java.awt.Desktop
.
However, after we wrote tests to assert success and failure of opening some dummy files, the tests pass locally but fails Java-CI on GitHub.
Has anyone encountered this issue before? Is there anyway to resolve this issue?
https://github.com/AY2021S1-CS2103T-F12-1/tp/pull/91
seedu.address.logic.commands.OpenCommandTest > execute_tagNameInModelFileNotFound_throwCommandException() FAILED
org.opentest4j.AssertionFailedError at OpenCommandTest.java:76
Caused by: java.awt.HeadlessException at OpenCommandTest.java:77
seedu.address.logic.commands.OpenCommandTest > execute_tagNameInModel_success() FAILED
java.awt.HeadlessException at OpenCommandTest.java:65
seedu.address.logic.commands.OpenCommandIntegrationTest > execute_openValidTag_success() FAILED
java.awt.HeadlessException at OpenCommandIntegrationTest.java:32
seedu.address.logic.commands.OpenCommandIntegrationTest > execute_openInvalidTag_throwCommandException() FAILED
org.opentest4j.AssertionFailedError at OpenCommandIntegrationTest.java:47
Caused by: java.awt.HeadlessException at OpenCommandIntegrationTest.java:47
214 tests completed, 4 failed, 3 skipped
3. How should we modify the code in AB3?
My group is doing something completely unrelated to AddressBook3 in terms of functionality, so we need to modify a lot of classes.
We plan to remove all the irrelevant classes before putting in our own code.
Is this approach efficient? Or should we modify existing code before removing the irrelevant code?
4. Strange Bug in Linux
My program works fine in windows. However, I encountered a strange bug when testing it in Manjaro Linux.
This bug only happens when I set the stage as not resizable.
stage.setResizable(false);
My window doesn't seem to appear. It is only a vertical line.
It also appears to be running in the taskbar.
This bug is mentioned in some other issue reports:
https://github.com/defold/editor2-issues/issues/2602
https://github.com/javafxports/openjdk-jfx/issues/222
Has anyone encountered the same bug before?
I think the issue is platform dependent, so should I try to rectify the bug or should I leave it as it is?
5. Intellij static analysis smartness versus verbose code
Intellij is very smart and recommends me to simplify my code here because "it is always true".
However, I feel that my way is clearer to the average reader (myself).
My question is that while I think we are able to reason in our head that some of the code is true, should we still value readability and write verbose code?
Should we use obvious assertions?
Where do we draw the line?
6. My teammate and I did the same extension. Is it allowed?
It was my fault for failing to read the requirement of iP this week, which states:
Discuss with your team members to ensure that each member picks a different extension.
I want to ask if my teammate and I are allowed to implement the same extension.
7. How to parse date and time flexibly (Level 8)
I can't think of any other way except checking time string against multiple regex, and my regex is pretty bad.
For example here's one:
Pattern p = Pattern.compile("(?>year>\\d{4})[\\s\\-.](?>month>\\d{1,2})[\\s\\-.](?>day>\\d{1,2})"
+ "[\\s\\-.T](?>hour>\\d{1,2})[\\s\\-.:]?(?>minute>\\d{2})");
Matcher m = pattern.matcher(timeString);
m.matches();
Matcher.group(groupName)
can then be used to access the individual capture groups.
If the pattern cannot be matched then I just store the raw string as time.
It will be great if anyone can share a elegant approach for parsing date and time.
Thanks in advance!
8. Clarification on phrasing of quiz question (Week 3 Quiz)
One of the questions in the quiz is phrased as follows:
When wrapping a long statement (an example given below), one should indent lines using two tabs instead of the usual one tab.
totalSum = a + b + c
+ d + e;
In the context of this question, does "tab" mean four spaces or an unexpanded tab?
9
Thank you! @damithc
10
This is gold!
I think the method described in the link below is pretty simple and elegant
11
I had the same issue. Searched around and found it could be some non-printable control characters that are causing the problem.
Maybe you can try my_string.replaceAll("\\p{Cntrl}", " ");
on both expected string and actual string to see if it helps.
I got mine to work after fixing a few extra newline characters in my Ui class.
12
I have learnt in CS2030 that classes are better if they are immutable, so I kept all my classes immutable.
For example, the list object can be immutable if we create a new list using the old list every time.
Is immutability no longer strictly desirable in higher level programming modules?
13
Just a caution: don't rely on a lot of additional configurations to get the correct app behavior. Keep in mind that the end users will simply be running the jar file without any additional set up. The only requirement is that they have Java 11 runtime.
So the correct way of doing things is to stop using those Unicode characters?
14
Thank you prof!
15
Yes there seems to be some UI problem as well if I set resizable to false. Some UI elements are cut off.
This is a clean fork of AB3 with only the above modification.
@Override
public void start(Stage primaryStage) {
logger.info("Starting AddressBook " + MainApp.VERSION);
primaryStage.setResizable(false);
ui.start(primaryStage);
}
16
I guess that would work.
I wanted to limit the user's ability to resize since the inner elements are not resizable. And it works in windows but just not KDE linux.
17
Thank you for your reply.
We want to make a file manager, where the user can tag files and open files using tags.
Since this is no longer related to person. we thought that we should delete everything related to person as well as the unused Command and Parser, before working on our implementations of Tag class, commands and parsers. We will need to delete all the relevant tests as well.
Is this the right way? Or should we modify AB3 gradually?
Thank you for your kind attention!
18
Thank you for your detailed advice! =)
19
Thanks for the reply.
I have followed your suggestion, everything passes but macOS CI.
This is really strange. Could this be because of the OpenGL renderer used in macOS CI?
Why is the CI desktopSupported anyways? =(
Unable to create basic Accelerated OpenGL renderer.
Core Image is now using the software OpenGL renderer. This will be slow.
seedu.address.logic.commands.OpenCommandIntegrationTest > execute_openValidTag_success() FAILED
java.lang.AssertionError at OpenCommandIntegrationTest.java:38
Caused by: seedu.address.logic.commands.exceptions.CommandException at OpenCommandIntegrationTest.java:38
Caused by: java.io.IOException at OpenCommandIntegrationTest.java:38
seedu.address.logic.commands.OpenCommandTest > execute_tagNameInModel_success() FAILED
java.lang.AssertionError at OpenCommandTest.java:69
Caused by: seedu.address.logic.commands.exceptions.CommandException at OpenCommandTest.java:69
Caused by: java.io.IOException at OpenCommandTest.java:69
20
Wow I didn't realise that! Thank you very much!
21
This is very strange because all these issues with freezing, concurrency and threads only happens under linux.
22
Running the code below under JavaFX will cause the freeze in Linux. It is not dependent on what file is being opened.
try {
Desktop.getDesktop().open(new File("/"));
} catch (IOException e) {
}
23
I think you can find that option under .github/workflow/gradle.yml.
uses: codecov/codecov-action@v1
24
Hello, have you checked if Desktop is supported?
Maybe this can help but I am not sure.
if(!Desktop.isDesktopSupported()){
System.out.println("Desktop is not supported");
return;
}
Desktop desktop = Desktop.getDesktop();
if(file.exists()) {
desktop.open(file);
}
Yes the platform is desktop supported.
I think the main issue is because JavaFX's thread is blocked by Desktop.getDesktop().open()
.
A walk-around that my team used was to run Desktop.getDesktop().open()
on a separate thread.
new Thread(() -> {
try {
Desktop.getDesktop().open(file);
} catch (IOException e)
e.printStackTrace();
}
}).start();
25
Hi @luo-git ! My team faced a similar issue and I think this will help you.
try {
if (SystemUtils.IS_OS_LINUX) {
// Workaround for Linux because "Desktop.getDesktop().browse()" doesn't work on some Linux implementations
if (Runtime.getRuntime().exec(new String[] { "which", "xdg-open" }).getInputStream().read() != -1) {
Runtime.getRuntime().exec(new String[] { "xdg-open", urlString });
} else {
showAlert("Browse URL", "xdg-open not supported!", true);
}
} else {
if (Desktop.isDesktopSupported())
{
Desktop.getDesktop().browse(new URI(urlString));
} else {
showAlert("Browse URL", "Desktop command not supported!", true);
}
}
} catch (IOException | URISyntaxException e) {
showAlert("Browse URL", "Failed to open URL " + urlString , true);
}
This is a workaround I found on the internet.
Thank you for the suggestion Kevin! Have you tested this solution on MacOS?
@MarcTzh
(25 posts)1. How is the DG/UG marked
it states on the module website that each individual should come up with 1 page of the UG and 3 pages of DG, can i clarify if we are supposed to indicated author of each section of the UG/DG?
2. How to view checkstyle errors in console rather than in web browser?
Used to be able to view all checkstyle errors in my console and have a link to go to the line with the error but now I have to view the html file on my web browser (see below), is this an issue with the settings?
3. Penalty for not following coding principles
I am currently writing test cases for a new object similar to tasks, it is quite cumbersome to write so many classes for the sole purpose of testing e.g. TaskBuilder, TypicalTask. If I were to write test cases that are effective but not as well written as those in AB will I be penalised?
An example of such code is as follows:
4. What is considered a bug?
If my team is implementing a find feature in an application similar to iP, would an input of
find date:01-01-202
(note that the year is 202 not 2020) which returns results even if the date is not in a "correct" format considered a bug?
If we state how the find function is intended to work in the UG/DG then it will no longer be considered a bug.
5. [Tutorial] Activity diagram
I have 2 questions to ask:
For each activity does the actor(person carrying out activity) need to be stated?
Do we need to include the activity of customer making payment?
i.e. Is the diagram below preferred over the answer given in the tutorial?
6. What is the project notes document
7. Gradle build stuck loading forever
Does anyone know what may cause the gradle build
to run indefinitely? Running gradle clean test
shows that all test cases passes and the application is able to run, CI on git also passes but build runs indefinitely.
My teammate has tried deleting .idea and importing the project from build.gradle and the problem perisists.
Attached is the output before reimporting the project
This is the build that runs indefinitely
8. Is this notation correct for an activity diagram
The circled part seems wrong
9. Visibility of classes in class diagrams
If a class is private do we need to add the '-' sign beside its name?
10. Does it matter if multiplicity is written on the top or bottom of the association line?
For example, is the example above correct as well?
11. Checkstyle issues after changing attribute name
Changed name
to title
Application runs
Checkstyle fails
Checkstyle version in both tool settings and build.gradle is 8.29
Help is appreciated
12. tP individual task
Hi does anyone know how to complete this last task? I have:
a PR to my team's repo with milestone v1.1 tagged to it
PR contains issue that is also tagged with milestone v1.1 and assigned to me
Thank you
13. How to safe delete use cases in intelliJ?
OS: MacOS
I was trying to follow this tutorial but I am unsure how to execute step 1.
14. Bidirectional arrows represent navigability but how does it look like in code?
15
As seen in the screenshot, after jumping to the source code the safe delete option is not available under refactor
16
Ok, thanks prof, I just figured it out
17
Thank you @ktaekwon000
18
Found the mistake, there were changes made to the checkstyle file thank you prof!
19
I would also like to clarify if rating=POOR
should be written as rating=Rating.POOR
20
Ok thanks prof, I was confused as I thought this did not follow the standard notation
21
Thank you for the suggestion professor but the rest of the team does not have this issue, we suspect it has something to do with one of the .gitignore files but reimporting the project after cloning it from git does not solve this issue
22
Thank you Prof.
23
Ok noted, thank you prof.
24
Thanks prof
25
Ok, thanks prof
@ianyong
(24 posts) 1. Clarification on demo video file size
File size: Recommended to keep below 200Mb. You can use a low resolution as long as the video is in usable quality.
Hi Prof @damithc, can I confirm that the demo video file size limit is 200Mb and not 200MB?
2. [External Software Permission Request] Jekyll Spaceship
For beautiful documentation. 😂
Licensed under the MIT License.
3. [External Software Permission Request] git-hooks-gradle-plugin
For sharing git hooks without having to add .git/hooks
to the working tree, or for each developer to manually set up the hooks locally. Unfortunately, the previous library (#201) which we had intended to use is incompatible with Windows.
Licensed under the MIT License.
4. [External Software Permission Request] IDEA inspection plugin
For running IDEA inspections during Gradle build.
Licensed under the Apache License 2.0.
5. [External Software Permission Request] Gradle plugin for PIT Mutation Testing
Gradle plugin for PIT Mutation Testing
For performing mutation testing.
Licensed under the Apache License 2.0.
6. [External Software Permission Request] Gradle Git Hook
For sharing git hooks without having to add .git/hooks
to the working tree, or for each developer to manually set up the hooks locally.
Licensed under the Apache License 2.0.
7
You can redirect stderr
to stdout
by appending 2>&1
to the back of the command:
Duke < input.txt > ACTUAL.TXT 2>&1
This should work for both bash and cmd.
8
What does your build.gradle
look like?
9
Could you try using a version of Shadow that's listed here instead of 5.1.0
?
Edit: Never mind, 5.1.0
does seem to be available in the Gradle plugin repo. It might help to show your build.gradle
file, as well as the output when running with --stacktrace
.
10
I'm able to clone @yuming7144's repo, checkout the branch with Gradle and get it working on my end. After getting her to try some things out on her end, I'm fairly certain it's a network issue (as opposed to some error in config or setting up). Anyone have any other suggestions?
11
Added a dark theme! Unfortunately, it doesn't seem like setting the colour of the title bar is possible without implementing a custom one. 😦
12
Does rebuilding the project solve the issue?
13
@damithc Hi Prof, do you want permission request threads to remain open? Or should they be closed once approval is given/rejected? Thank you!
14
This is due to the IntelliJ console picking out ERROR:
as a keyword and thus showing the supposed error in another window.
Just click on the topmost window to get back to your program.
Alternatively, run your application from a terminal that doesn't have this keyword flagging feature.
15
I noticed from your Ui.png
that you're running Windows. This seems like a Unix permission issue; more specifically, gradlew
is not set to be executable (x
).
Try running the following command, then commit and push:
git update-index --chmod=+x gradlew
16
Try specifying the following in your build.gradle
:
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
17
I think you might have made a spelling error with sourceCompatibility
.
18
Approved. Keep us posted if the plugin works out. We might want to adopt it for AB3. The plantUML support is especially interesting.
GitHub Pages runs in safe
mode and only allows the following whitelisted dependencies. As such, I'm planning on adding a CI job to build the site without having to adhere to the safe
mode restrictions, and then pushing the generated static files to a separate branch which will then be deployed.
I'm not sure whether I have to seek permission if I use pre-configured GitHub Actions, but this seems to do exactly what I want. If permission is required, I can open a new issue for it.
As for AB3 adoption, I think it wouldn't be too big a concern as long as the teaching team adds the necessary GitHub workflows to support whatever was described above in the base repo, since this proposed GitHub Pages deployment process is rather involved.
19
@damithc Hi Prof, just a quick update. We didn't end up using that GitHub Action as it only works with personal access tokens, and not the GITHUB_TOKEN
secret that is automatically generated for every repository. It felt wrong to have to use personal access tokens for a team repo.
Also, it turns out that the github-pages
gem handles a lot of things in the background, such as setting the name of the repo as the base URL. If anyone else is planning on doing this, do keep in mind that there will be a lot of troubleshooting involved. This was the GitHub workflow that we came up with: https://github.com/AY2021S1-CS2103T-W16-3/tp/blob/master/.github/workflows/build-jekyll.yml.
If we were to adopt it, it will be for future semesters, not this one. Let's see how it goes for your team. We can decide at the end of the semester.
As for whether it was worth all the trouble, we'll get back to you at the end of the semester. 😄
20
What sort of path syntax is this?
This is a refspec; a mapping of references between a remote and a local repository.
does anyone know what does the
fetch = +refs/heads/*:refs/remotes/origin/*
mean? can't really seem to find much on google... I assume it means something like fetch all head refs + and all refs in remote/origin.
Fetch all references under refs/heads
from the remote repository and map them to refs/remotes/origin
in the local repository. The +
allows for the references to be updated even if it isn't a fast-forward (such as when the commit history is rewritten).
More information can be found here.
21
I've taken a few examples out of your failing CI:
ERROR:../src/main/java/seedu/address/logic/commands/RemarkCommand.java:98: no newline at EOF.
This means that your RemarkCommand.java
file does not have a newline at the end of file. To resolve this, simply add an empty line at the bottom of the file.
ERROR:../src/main/java/seedu/address/model/person/Person.java:54: trailing whitespace.
This means that at line 54 of your Person.java
file, you have extra whitespace. To resolve this, delete off the additional whitespace at the end of the line. You can see the additional whitespace if you select it.
22
Hello, you're in luck! This is something that my group wanted to do as well, so I came up with the following solution.
Feel free to reference our implementation, but do give credit so as not to run afoul of plagiarism rules.
23
@howtoosee Thanks for alerting me to this! I didn't realise that the styling was being applied to all ordered lists. D:
Fix is here.
24
Hi, change line 23 in UiManager.java
to
private static final String ICON_APPLICATION = "/images/salon_icon.png";
I suspect that different OSes have different load orders. Due to the icon being set both via MainWindow.fxml
and programmatically in UiManager.java
, you end up with different icons on different OSes.
@GeNiaaz
(24 posts) 1. Question about the PE
When doing the PE, say a bug is discovered in a program. If the bug affects other areas of operation of the program and causes them to behave unexpectedly, are the "derived" errors considered bugs too and cause us to be marked down? Or are we only graded based on the "root" bugs in our program.
For example, if the time is not validated, and leads to many other functions behaving unexpectedly, are we marked down for all the subsequent errors? Or simply for the initial bug of time not being validated.
2. Recording of demo video
For the recording of our demo, are we allowed to record using Zoom's screen record function? That way we can get everyone to contribute.
3. Are we allowed to modify README?
Are we allowed to make any changes to the README during these few days?
4. My testcases cannot pass on Github (Ubuntu Windows pass, Mac fails)
I am not sure what is causing this issue, since the tests pass on my machine. I have added lines to clear details in static classes to maybe clear the memory, but nothing is working and I do not know what else I can try.
The fail message is as shown:
Here is a snippet of the failing testcases:
The PR is linked below:
5. Codecov issue
My test is suddenly failing at Codecov, and I have no idea why. Does anyone have a fix for this? I have rerun several times.
6. Question about MVC
Why is there a line from view -> controller -> user after displayStudentData
executes? Shouldn;t it go straight from View back to the user?
7. Are we allowed to deviate from using PlantUml?
My team and I have had issues with PlantUml, and want to use draw.io
to create our diagrams. Would that be okay? To replace our diagrams with draw.io
8. 💡 Pesky checkstyle warnings ruining your commits?
Settings > Checkstyle
Press the + sign and browse for a checkstyle file.
From there open tP > config > checkstyle > checkstyle.xml
Name the checkstyle anything you wish eg. checkstyle_is_a_2_MC_mod
For scan scope, select Only Java sources (including tests)
Click apply
and ok
Close the settings menu and click the checkstyle tab at the bottom:
Simply select the correct Rules, and press the folder icon on the left to run checkstyle on all your java files.
Simply double click each error to navigate to the error! 👍
9. v1.3 duedate clarification
Regarding v1.3, it is due in Week 11 right? And the JAR file for the mock practical exam is due in Week 10?
10. FXML file generates wrong path for package
I was refactoring Address to ProjectDescription, and inadvertently changed a lot of files unintentionally. Among those changed were some 'seedu.address...' changed to 'seedu.ProjectDescription'.
In the process of refactoring, I encountered many of these issues and subsequently fixed them.
However, I face one last issue now. The 'validFile.fxml' and 'validFileWithFxRoot.fxml' have an import statement as seen below:
'>?import seedu.projectDescription.ui.TestFxmlObject?>
>TestFxmlObject xmlns:fx="http://javafx.com/fxml/1" fx:id="validFileRoot">Hello World!>/TestFxmlObject>'
I tried looking line by line for any other accidental change, even going over to Github and combing over every change line by line, However, I cannot seem to solve this error.
Since the issue arises when building, I realised this file is created from elsewhere in the code, and once I find that file I can change it and solve this issue
I would like to implore any kind soul who has gotten this far in my issue to please point me in the right direction. I have spent plenty of time on this issue and would like to resolve it as soon as possible.
11
@LeeEnHao Hi EnHao, I am facing an issue regarding my fxml files too. They are created when the project is built, can I ask where exactly it is constructed? I'm not sure about this and have been trying to solve this issue for ages.
12
I solved it! 👍
The issue was that I did not know where the file was being generated by when the program builds. The fxml files are in fact copied from test\resources
. SO once I changed those files, the files generated in Build worked too (since they are simply copied over on build)
13
Yea, prof mentioned that the script only detects code in the tP fork's master branch
14
Alright, thanks prof
15
I believe its before your tutorial Week 10 if I'm not wrong, since it's supposed to facilitate the mock Practical Exam
16
Alright, thanks prof!
17
Right, I missed that. Thanks
18
I should think that the A
class could have another dedicated method like getItemStringVal()
.
Though on balance, it may be impractical to implement that especially if there are many such method calls for a lot of attributes. So maybe this is the ideal way to do it since it would eliminate the need for potentially double the methods in the A
class.
I'd guess that the right call here is to simply be consistent with either path chosen while considering the architecture of the over all program.
19
Ahhh i see, time to refactor my own code then
20
Does it just not show up in the IntelliJ view window? Because that happens sometimes. You should test out by checking it out on Github itself to view it there.
21
Can you click on "Details" for the MacOS job to view the error message, and let us know exactly what the issue was?
Sure!
22
Thanks!
23
Thanks
24
Ah alright, thanks for the clarification
@richardcom
(22 posts) 1. CATcher Test
Hi Prof and TAs,
I am very sorry to disturb you. I have just received an email saying that CATcher was not done. However, I have already created two issues according to project requriements.
I wonder could u please help me with this, thank u so much!
2. Tests failing after deleting Address usage in tp tutorial 2
Hi, I have met the problem after I deleted all address usages in tp by following tutorial 2. 8 of the test cases have failed but I am a bit confused because it seems that they are not relevant to "address" tests. I have attached the screenshot below and I wonder has anyone met the same issue?
3. Will we get penalized for creating Level-9 branch from branch-A-CodingStandard instead of master branch.
Hi! When I was adding Increments as parallel branches: A-JavaDoc, A-CodingStandard, Level-9, I made a mistake. A-JavaDoc and A-Coding Standard branches are all created from the master branch, however, Level-9 branch was created from A-Coding standard branch instead. I only realized this after I have merged all three branches to the master branch, as shown below. I wonder will I get penalized because of this or do I need to reset these branches and commits? Thank you very much for your help!
4. Question about the order of commit and tag
Hi! When I was doing the ip, it was mentioned on the website that we shall commit and tag according to the order specified.
However, I am wondering that if after I have finished level 6, I realized that I wanted to make some small improvements on the previous levels that I have finished, can I make other commits about previous levels again after Level-6? If so, do I also need to change the tag of previous levels? And will we get penalized because of this? Thank you very much in advance!
5
I also encountered this problem when I ran runtest.bat on windows. As mentioned on the CS2103 website, "The likely cause that the line endings are different (not visible to the naked eye) because the two files were created in two different operating systems." Thus, I ran the runtest file using git bash again and it finally solved the problem. (in git bash, we should run runtest.sh instead, and remember to update the directory path)
6
Hii! I think maybe you can try the method mentioned in issue #5, which is adding set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
in runtest.sh, just like this. Hope it helps! : )
7
Hii! I think maybe you can try the method mentioned in issue #5, which is adding
set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
in runtest.sh, just like this. Hope it helps! : )
if i'm not wrong
JAVA_TOOL_OPTIONS
is only available on Windows .-.
Ohh, sorry, my mistake
8
Thanks @richardcom @wakululuu for helping @howtoosee
Thanks Prof! : )
9
Thanks a lot Prof! : )
10
Hi Prof, thank you so much for your reply! I will be more careful next time : )
11
Hi, I think maybe you can try delete the corrupted cache and restart Intellij again. I also met some strange issues after I imported gradle. But I solved them by first close the project, delete the .idea folder, then re-import and project and rebuild the project. Hope it helps.
12
Hi, sorry but what do you mean by corrupted cache?
I think you can try to delete the .idea folder and re-import the project, then rebuild the project. Hope it helps! : )
13
Hi, sorry but what do you mean by corrupted cache?
I think you can try to delete the .idea folder and re-import the project, then rebuild the project. Hope it helps! : )
Hi, thanks for the advice. But when I delete the .idea file and restart the intellij project, it still tells me that zip END header not found. And another issue that arises by deleting .idea and restarting the project is that intellij now cannot run the java files(i.e, the java files are not recognized as runnable). so I am very confused about it..
Ohh, I think that after you re-import the project, you need to reconfigure the compiler to Java 11 again, maybe can try out the solutions mentioned here
14
Hi, I have met the same issue yesterday when I used IntelliJ to build the new Jar file. However, I later tried to use shadowJar in Gradle to produce the new jar file and it finally worked. Hope it helps!
15
Hi, I have met the same issue yesterday when I used IntelliJ to build the new Jar file. However, I later tried to use shadowJar in Gradle to produce the new jar file and it finally worked. Hope it helps!
Thanks! I have generated the jar file by using gradle!
No problem! : )
16
I can successfully run the project after deletion, but it seems that only these 8 tests have failed.
17
Use the debugger (one of the topics of this week) to investigate what exactly causes the failure? 😃
Got it, thanks Prof! I will try to use the debugger to find out the problem : )
18
Problem solved. Thanks to Prof @damithc 's advice. I used the debugger and traced the program carefully. I finally found that I accidently deleted one of the example emails in TypicalPersons.java.
19
Problem solved. Thanks to Prof @damithc 's advice. I used the debugger and traced the program carefully. I finally found that I accidently deleted one of the example emails in TypicalPersons.java.
Great to hear that @richardcom 💯
Thanks Prof! 😃
20
Did you create those issues using CATcher or created them manually via the GitHub user interface? You need to create them using CATcher.
Ohh, thanks a lot Prof Damith! I first created the repo using CATcher app however then I created the issues on Github initially. I will immediately created them again using the applicaiton. I am very sorry for this and I wonder if my participation marks would be deducted and I am truly sorry that I have made mistakenly used Github to create them directly.
21
We'll restore your participation points, as it was an honest mistake.
Thank you so much Prof Damith! : ) I will be much careful next time! : )
22
In case anyone is still struggling with Graphviz installation:
- Simply go to download link to install the zip file
- Extract the folder to your Program Files
- Open your command prompt, navigate to the location of the bin folder and type
dot -c
- Type
dot -v
and you should see the version of Graphviz that you've installed.
- Follow Step 2 in the diagram below and everything should work fine.
Thanks a lot! Just to add on, we need to run the command prompt as admin. Initially I did not run it as admin and it fails to run dot -c.
@Persdre
(19 posts)1. Why PublishedUG isnt be marked done?
But I already uploaded my user guide... https://persdre.github.io/ip/
2. Do I need to make changes to the given gradle.yml example?
I am doing A-CI. But after I uploading the gradle.yml file, the build failed in ./gradlew check part. However, I ran it correctly locally. So I feel confused. Could you give me some advice? Thanks!
3. When you do auto tests, pay attention to the position of your cursor💡
The auto testing is so strict. As I pressed the enter key after entering all my expected output, I was stuck in testing for about half of the day. 😦
4. A quiz question: whether a class-level member can be accessed by an instance of the class
The textbook says: class-level members are to be accessed using the class name rather than an instance of the class. But a question in the quiz asks whether a class-level member can be accessed by an instance of the class. From my experience, I actually once accessed a static variable from an object. So, I don't know this question's answer 😦
5
already solved! thanks!
6
You can click https://github.com/nus-cs2103-AY2021S1/forum/issues/27 for more information!
7
already be solved!
8
To add on,
9
Yeah, you didn't give enough information... I guess the reason you can't pull/push is that the branch you click doesn't exist? Or some sync problems...
So I suggest you fetch your code from your Github ip repository first, then try the easiest pull/push operations.
10
11
I think the constructor is a little from the other public methods, so I write it like this. 😃
12
You can refer to this: https://github.com/nusCS2113-AY1920S1/forum/issues/8
13
oh so sad😂. Have you solved it? But I think don't worry lah. I see your repository and all your branches and tags are there 😃
14
Yeah, but I think a better way is to click "compare", then create a pr 😃
15
The file name is right 😦
16
Looking at your repository, the file is still
Todo.java
. This may be caused by a case-insensitive filesystem like Windows / MacOS. You can try changing the file name to something different, staging it, then changing it to the correct filenameTodo.java
->Foo.java
->ToDo.java
. Alternatively, there are some steps outlined here that may help.
Thank you!
17
I pull a request about this. Thank you for pointing it!
18
Thank you for your reply! Now it is still not reflected in the dashboard 😦 @damithc
19
Thank you so much! @damithc
@HCY123902
(18 posts)1. Question about team project pull request
Hello, I created a team pull request to merge my master branch to the master branch of our team repository on Tuesday. However, it seems that the pull request is not detected by the script, because the individual progress dashboard shows that v1.2 PRs is not present.
I noticed that the dashboard was last updated on October 7, which is after I created and closed the pull request.
I am wondering whether this is caused by the fact that I closed the pull request before the script was run.
Can I ask what I should do?
2. Question about the displaying of check and cross
Hello, I have some issues regarding the displaying of check and cross in the individual project.
When I wrote
System.out.println("\u2713");
or
System.out.println("\u2718");
The question mark will be displayed instead of the check and cross.
This is quite strange because I did not have this issue previously and it appeared quite recently. Is it related to the configuration of the platform or is it related to something else?
Can I ask if anyone knows how to handle this issue?
3. Question about the individual project
Hello, I want to ask several questions regarding the project.
Firstly, do we need to keep the name of the chatbot, the greeting message, the format of the command, indentation, and response information exactly the same as the ones shown in the example? For example, can I show a different greeting message when the program runs? If a difference between the individual project and the example is allowed, will this difference affect the grading of the project?
Secondly, will the grading be based on the tags, or the commits in master branch, or both?
Thirdly, does the order of commits matter? For example, if I push the commit for level 6 first, and then I push the commit for level 5, will this cause any issues in the grading process?
Sorry but I seem to have quite a few questions to ask. I hope this will not disturb you.
4
Thank you professor for your clarification.
5
I may need to change the background a bit and replace the image.
6
Hello professor, I am wondering if there is a bidirectional navigability pointing from one class to the same class, will the following class be a valid representation of this bidirectional navigability? Will this class declaration lead to single direction navigability or bidirectional navigability?
class Animal {
Animal anotherAnimal;
}
7
Thanks a lot for the tip. I think this will be quite helpful especially in terms of improving the code quality.
8
Yeah I think one way to do it is to just clone the address book repository to the local computer, move the config directory to the individual project root directory, and change the version of the checkstyle in build gradle to 8.32.
9
Yeah I do think it will generate the conflict when the marker is added manually. By the way, git also has a default merge tool that can help to resolve merge conflict. To resolve a merge conflict, type
git mergetool
on the branch with the merge conflict to use the tool.
10
Maybe you can try to pull by allowing unrelated histories. Additionally, I remember that the name of the local branch needs to correspond to the name of the remote branch.
11
Can I ask if it is necessary to commit the new jar file this week to the remote repository?
12
Maybe you can change the path of the class in the runtest file a bit. It is necessary to include the package name in the class name in order to search for the class.
13
Hello, I had a similar issue. Have you solved the problem?
14
Thanks a lot. I think it is quite helpful especially in terms of arranging the order of tags in the remote repository.
15
Thanks for the reply. Let me check.
16
Uh so I need to create a pull request from a new branch where there is no previous pull request from that branch right.
17
OK. Thank you.
18
Hello, have you checked if Desktop is supported?
Maybe this can help but I am not sure.
if(!Desktop.isDesktopSupported()){
System.out.println("Desktop is not supported");
return;
}
Desktop desktop = Desktop.getDesktop();
if(file.exists()) {
desktop.open(file);
}
@gabrielsimbingyang
(18 posts)1. Is UG/DG submission due Monday (9th November) as well?
I believe there is a different dateline for CS2101 so I am checking here as well
2. 💡 Changing the theme/ Adopting a new Color Palette
Hi all,
I found these two links which I found to be immensely helpful when altering DarkTheme.css to suit a new theme. Hopefully, this will save you some time when coming up with a new design.
In general: try to keep to the 70-20-10% rule when using new colors so that everything blends nicely together. E.g. Use 70% of a primary color (for your base), 20% of a secondary color (for your features), and 10% of your last color for the accents (alerts/outlines/extras).
I hope this will save you some time when porting over to a new design
Regards,
Gabriel
3. TP Dashboard not tracking progress
Hi,
I noticed that the TP dashboard is not tracking my and my team's progress.
In particular, my team has completed the tasks :
v1.1 set up
DG adapted (partially, we have done use cases and NFRS)
updated readme
As for myself, I have done:
Tutorial task
v1.1 issues
v1.1 PRs and
Week 7 (I contributed to the master branch of the team repo)
Dashboard link: https://nus-cs2103-ay2021s1.github.io/dashboards/contents/tp-progress.html
My team is CS2103T-T09-4
Team github: https://github.com/AY2021S1-CS2103T-T09-4/tp
My admin number is A0184257X
My github: https://github.com/GabrielSimbingyang/tp
Regards,
Gabriel
4. Weird Compression With my GUI
Hi guys,
I am having some issues unique to me (my group members don't have this issue). My text seems to get compressed if it's too long. So for example, in the photo below, only listings 1-19 are shown (even though there are actually around 25 listings). Also, if I have too many dialogs in my gui then everything gets compressed to be about 4 lines (picture 2).
5. Advice to get started on Gradle💡
Hi,
If you are trying to do level A-Gradle, I suggest reusing your code from A-JUnit to ensure everything is working correctly. I actually did gradle first instead of the JUnit level so I understand how frustrating it can be.
If you had followed the non-gradle instructions from JUnit, then you can simply use that code to "test" that you have done A-Gradle first. Remember to create your build.gradle first (and intellij will automatically detect you are trying to install gradle). Below is a screenshot to show you how your setup should look like :
On your left, make sure your test files are in the right directory (root>src>test>java). Note the build.gradle file in the directory.
On the right, you can see the gradle toolbar. You can click the little elephant then type in "gradle test" and press enter
At the bottom is the gradle terminal after a successful test
6. runtext.bat not detecting my scripts
Hi,
I am running into some issue trying to run runtext.bat. For reference, I am using the same code as stated in https://se-education.org/guides/tutorials/textUiTesting.html .
This is my error message using the original file:
C:\Users\warlo\OneDrive\Desktop\IP> C:\Users\warlo\OneDrive\Desktop\IP\text-ui-test\runtest.bat
Could Not Find C:\Users\warlo\OneDrive\Desktop\IP\ACTUAL.TXT
error: file not found: ..\src\main\java\Duke.java
Usage: javac >options> >source files>
use --help for a list of possible options
This is my directory:
I have tried several variations of line 10 and 18 of runtext.bat such as using .\src\main instead of ..\src\main and using *.java instead of Duke.java on line 10
Now, I am stuck at this error:
C:\Users\warlo\OneDrive\Desktop\IP> C:\Users\warlo\OneDrive\Desktop\IP\text-ui-test\runtest.bat
Could Not Find C:\Users\warlo\OneDrive\Desktop\IP\ACTUAL.TXT
The system cannot find the file specified.
FC: cannot open ACTUAL.TXT - No such file or folder
Apparently my script isnt creating an ACTUAL.TXT file. I am not sure what is the issue. If anyone could help me that would be great (:
Alternatively, is there another way I can test my code before the dateline?
7. What is the run/debug configuration for intellij IDEA?
When I try to run Duke.java , intellij IDEA asks me to configure the run/debug configuration. May I know which is the right choice to use?
8
Hi prof,
This is what I see:
9
Hi Prof and Cody,
I am currently using JDK 11 and I am also using the latest version of intellij IDEA (ver 2019.3.3). I have also set the java file and as source root.
Also, I have previously used intellij for a nodeJS project, perhaps that caused some of the issues.
Currently, intellij is letting me know that I have no project compiler output. I am not sure how to solve this problem
10
This is the alert I get when I click "run Duke.java"
11
Hi Cody,
It works now. Thank you. Could I just check if this is how it is suppose to look like?
12
Hi Prof, thank you. Running the bat file outside of intelliJ has solved my issue.
May I know if the ACTUAL.TXT is supposed to contain the original inputs (such as todo, deadline, etc)?
This is my ACTUAL.TXT after experimenting with level 5 and the inputs are missing.
13
Hi,
Java should be the src folder and not main. You can see my post that I made to the forum to see if you're on the right track
Gabriel
14
Hi, could you give more details when you say intellij cant recognize your source file?
15
Thank you my friend!
16
Hi prof @damithc ,
The dashboard has been updated to the 23rd of September (it was 22nd September when I posted this).
I noticed some issues with the tracking
According to the dashboard, my team has not created a milestone called v1.1. However, if we look at the dashboard for individual tasks (A0184257X), it says that I have authored and merged a PR in milestone v1.1 which indicates that milestone v1.1 exists.
It also says that I had not done "v1.1 tasks" even though I had done it in the individual task "v1.1 PRs". I provided a link to an issue I had completed down below.
Our UG had also been completed, link below.
Link to my team's milestone : https://github.com/AY2021S1-CS2103T-T09-4/tp/milestones
Link to an issue that I had completed in the team repo: https://github.com/AY2021S1-CS2103T-T09-4/tp/issues/14
Dashboard link: https://nus-cs2103-ay2021s1.github.io/dashboards/contents/tp-progress.html
User guide link: https://ay2021s1-cs2103t-t09-4.github.io/tp/UserGuide.html#adding-a-new-entry-add
Regards,
Gabriel Sim
17
Hi Prof,
Understood, we will change it accordingly. Thanks for the help!
Regards,
Gabriel
18
Ok, thanks Prof @damithc
@howtoosee
(18 posts)1. CI CodeCov fail
Hi, my CI keeps failing on Ubuntu due to an error when running CodeCov. This error has been persistent despite re-running all jobs multiple times.
The error comes from the codecov.sh
file having a syntax error, but if im not wrong this file does not exist in our repository under the .github
directory.
Some background: I've only made commits to the UG...
Does anyone know how to solve it?
2. Markdown TOC: any ways to remove the bullet point?
Hai does anyone know how I can remove the bullet points at the front of the TOC?
I'm using the auto-generated table of contents placeholder in Markdown:
* Table of Contents
{\:toc}
My CS2101 tutor isn't very happy about my group having the bullet points together with numbering in my table of contents...
3. Jackson error reading datafile
Hi, my storage throws an error: Error reading from jsonFile file data/financeAccount.json: com.fasterxml.jackson.databind.JsonMappingException: Can not find a deserializer for non-concrete Collection type [collection type; class javafx.collections.ObservableList, contains [simple type, class nustorage.model.record.FinanceRecord]]
This occurs when trying to read from a json file (created by jackson itself).
The line that threw the error is Optional>JsonSerializableFinanceAccount> jsonFinanceAccount = JsonUtil.readJsonFile(filePath, JsonSerializableFinanceAccount.class);
Did anyone face a similar issue? I'm not sure if its a problem with the storage class.
FinanceRecords are stored in a class FinanceAccount, which uses ObservableList>FinanceRecords> to store the collection of records (similar to how AB3 stores Persons using the observable list).
4. Enumeration as object in object diagram
Why can enums be shown as instantiated objects in the object diagram? (bottom right corner green box) If i'm not wrong, no programming language allows for enumeration to be instantiated. (or are there?)
5. 💡Making Intellij follow this mods coding standard
Intellij supports code styles, and can be customers under Preferences > Editor > Code style > Java, or some other languages too.
I was fiddling around after doing the quiz question on switch-case indentation, so according to the code style, we should set up intelij like this, with "Indent 'case' branches" unchecked:
6. MacOS: ACTUAL.TXT ✓ and ✗ both rendered as ?
Using MacOS 10.15.6, JDK 11.0.8.
I'm using unicode escape sequence for ✓ and ✗, ("\u2713" and "\u2717") respectively. Not sure why the output renders these characters as "?" both.
(Lines starting with ">" are the output lines and that with ">" are expected lines)
Anyone experiencing similar issues?
7. Qn on how objects interact with one another in OOP
Hi, I would like to clarify on the wording of one of the quiz 1 questions (q6), which stated the main way for objects to interact with each other is by reading each others' data
.
However upon checking the textbook, I discovered it says that objects interact by sending each others messages
.
I would like to clarify if they mean the same thing, or is there a difference since one is active and the other is passive?
8
I think we can use both!
For example, when the parent method calls the child method, pass the string to the child method as an argument. In this way, the child method can throw an exception to be caught by the parent method, which can then do the exception handling, e.g. print out the "todo bad" message. Then we don't need to terminate the programme but still manage to use exceptions.
9
Hii! I think maybe you can try the method mentioned in issue #5, which is adding
set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
in runtest.sh, just like this. Hope it helps! : )
if i'm not wrong JAVA_TOOL_OPTIONS
is only available on Windows .-.
10
export LC_ALL=en_GB.UTF-8
That works! Thanksss!
11
If i'm not wrong, you can use sourcetree to move the tags from one commit to another. But you probably need to delete the tags before re-adding .-. Doing so might not be a real good idea for this mod though
12
Thankyou! Set us on the right direction!
13
I see. thankyou!
14
OOO THANK u sirrrrr
15
Hello, you're in luck! This is something that my group wanted to do as well, so I came up with the following solution.
Feel free to reference our implementation, but do give credit so as not to run afoul of plagiarism rules.
Hi Ian sorry, but this method seems to have removed some bullet points and numberings in the document body for me. Did it happen to yours too?
16
I am currently experiencing the same problem after I made some commits where I increased the number of JUnit tests.
My team rerun CI checks for old commits and now they are failing so i think it might be a github / codecov issue...
17
I think this is a github/codecov issue. i have the same problem #375
18
Is there a way to just disable it?
For now, I just remove the whole block.
I have try commenting out the whole block of code in
.github/workflow/gradle.yml.
but does not seem to work [Have other weird error].
Commenting out this section only worked for me
@MarcusTw
(17 posts) 1
I opened up EXPECTED.TXT and edit manually, finally it worked! Thanks for the headsup.
2
I had a lot of trouble with getting my
.bat
file to work as well, and this is what worked for me:
If you're like me and have a very long and convoluted file path (with lots of whitespaces) to your source files, you can try using the following method:
SET MY_PATH=>your_really_long_path_here>
Hereafter you can refer to your path by simply calling
%MY_PATH%
wherever you need it.
Here's an example of what I'm talking about:
Let me know if this helps 😃
Wow Eris it worked well! Thanks!
3
Do you have more than one java file? The above suggestion changing
Duke.java
to*.java
works for me.
Thanks!! Nesting all other classes in Duke works too, however, it is a rather bad practice.
4
Hi Prof, just a quick question: Does changing the class file (from "Duke.java" to "MyChosenName.java") affects the scripting?
5
Hi, can't view your image >>. Try restarting your IntelliJ client after changing your environment variables.
6
It seems that for case 1, throwing exceptions in constructors isn't a bad practice. In a way, throwing an error as early as possible can be useful as culprit is in the callstack and provide and explanation of the reason (prefer compile-time error to runtime error).
7
Open up a Linux terminal, navigate to your ip local directory. Navigate to your src/main/java.
Enter the commands:
//check if git remote found
git remote -v
//remove Command directory
git rm -r Command
git commit -m *Remove Command directory*
git push origin master
//check if removed
ls -l
8
I'm not sure if this is the right way but I fixed it by making sure that my code on github is the most updated version, then I used IntelliJ to "get from git version control" again. Then open up SouceTree and locate the new local repo I cloned. Go to remotes -> branches -> check out on all the branches and they will show up in the "branches" tab of your local repo, and I think it will show up when you click on push.
9
If I'm not wrong, the UI do not display each character in equal spacing, so a '-' and '_' will take up more space than '|'.
10
Actually spent too much time on this
Oh my! Kang Liang, may I ask how do you add backgrounds?
11
Do you have a Duke constructor that takes in 0 parameters? (i.e.
new Duke()
)
If not, try implementing one.
I had a similar issue and I managed to solve it by implementing one.
Thank you @erisjacey !
12
My guess would be close project and open again? Also, try rebuilding your build.gradle
13
Added background image and edited a simple dialog box.
14
Hi Luoyi, personally I feel that asserting two conditions that will always be true has no significance. I quote the textbook [W5.6] Assertions are used to define assumptions about the program state so that the runtime can verify them. .
Since there will be no change in the boolean values of your conditions in both compile time and runtime, then it does not fit the purpose of using Assert. I would suggest you to write in comments above the code for readers to take note of such condition.
15
Hi, I believe there is a way to set your codestyle on Intellij. The import statements will follow according to the checkstyle guide line. No more package.* imports!
Source: https://www.jetbrains.com/help/idea/configuring-code-style.html
16
Hi Khoongwk, I'm not too sure but I've checked my Jar file and it looks like this.
I compared your codebase and the file, it looks quite different from mine. Your ui and task package are together with your duke, whereas my ui and task packages are inside duke. You might want to try gradle clean shadowJar
instead.
17
Hi Matthias, I feel that it is fine for Parser
to be an interface because it provides a "contract" that promises what a Parser
can do. It specifies what methods a Parser
object should have!
As for Command
... I am not too sure as it currently does have any class fields. Well I guess maybe for the extensibility of the Command
class, where you may add properties to it? Let's say you define a constructor that takes in some primitives or objects as class fields in your addressbook.
Hope I'm making sense!
@aidoxe-123
(17 posts) 1. Week 7 topic typo in textbook
I think there is a typo in the textbook's week 7 topic, the design approaches section. "Approaches" is misspelled into "appraches"
@damithc
2. Cannot build gradle in Github action
When I try to implement CI/CD using GitHub Action, I got the following problem when building Gradle:
This is my gradle.yml file
# This workflow will build a Java project with Gradle
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
name: Java CI with Gradle
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Build with Gradle
run: ./gradlew build
- name: Perform JUnit test
run: gradle test
Does anyone have any ideas on how to fix this issue?
3. Failed to clean up stale outputs when running GUI
When I tried to build the GUI, I got the following error in processResources
Failed to clean up stale outputs
Couldn't delete [path to my directory]\build\resources]\main\images\DaDuke.png
Any ideas on how to fix this?
4. Plugin not found when building gradle
When I try to build the gradle project, I got this error:
Plugin [id: 'com.github.johnrengelman.shadow', version: '5.1.0'] was not found in any of the following sources:
Anyone knows how to fix it?
5
Hi, where did you find that trouble shooting slides?
6
Both ways work, I think
7
The problem lies in the line : String.format("%d.%s\n", i + 1, tasks.get(i).toString());
in your convertTaskListToString method.
Since your clearly state out that the end line is \n instead of System.lineSeparator(), the correct listMessage string should be:
String listMessage = "Here are the tasks in your list:\n" +
"1.[T][" + CROSS_ICON + "] t1\n" +
"2.[D][" + TICK_ICON + "] t2 (by: Aug 24 2020, 10:00)\n" +
"3.[D][" + CROSS_ICON + "] t3 (by: Aug 27 2020, 11:00)\n" +
"4.[E][" + TICK_ICON + "] t4 (at: Aug 24 2020, 11:00)\n" +
"5.[E][" + CROSS_ICON + "] t5 (at: Aug 27 2020, 12:00)";
Only use System.lineSeparator()
to represent line breaks that use System.out.println()
or strings that clearly refer to System.lineSeparator()
themselves.
8
Is there any thing that I have to note when implementing this shutdown hook? 'cause when I try to use it, I cannot pressing ctrl + c to terminate the program any more
9
Somehow I run this code in the terminal, then import the build.gradle again and it works
./gradlew assembleDebug
10
Maybe add this to your build.gradle might help
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
This doesn't work for me
11
Got it! Thanks, mate
12
#95
13
14
When I change to Java 11, the above error disappears, but I got this instead:
Edit: after digging some old issues, I have found the answer in #118
15
@keanecjy You go to File -> Settings -> Editor -> Code Style -> Java
, select Tabs and Indents
tab, then set continuation indent
to 4
16
I suppose this is what you are facing, where the checkstyle gives warning about the parenthesis on the start of a new line. If so, you can use these comments to temporarily turn off those checkstyle. Hope this helps
//CHECKSTYLE:OFF: SeparatorWrap
((Deadline) newTask).setTime(newTime);
//CHECKSTYLE:ON: SeparatorWrap
17
To automatically strip trailing white space in intellij, you can go to settings -> editor -> general
, then scroll to other
and change strip trailing white space on save
to all
@LeeEnHao
(17 posts)1. [External Library Permission Request] TestFX
For headless GUI testing
2. Robot Error for TestFX headless
This is with regards to setting up a headless environment using Monocle together with Javafx 8. I have included monocle and testfx in dependencies as well we created a task headless
to set systemProperties of test to the appropriate settings in build.gradle. I have made task test
to depend on headless
. However, on running gradlew clean test
or headless test
, the GUI test will fail. Somehow, the robot needed for headless is not being imported. Whats the workaround in build.gradle.
3. [External Software Permission Request] Font Awesome
Font Awesome
License FontAwesomeFX is licensed under the Apache 2.0 license. If this license is not suitable, please contact me to discuss an alternative license.}
4. [External Software Permission Request] autoupdate
https://github.com/marketplace/actions/auto-update
To remove the need to manually update the pull request if updates are pushed to destination. Does not resolve conflicts. Removes time spent waiting on checks if there are multiple pull requests affected by update.
chinthakagodawita/autoupdate is licensed under the
MIT License
5. Specifying specific build directory location for FXML.load()?
Every time I run gradle build, the view directory which I placed the fxml files appears in build/resources/main
instead of build/classes/java/main
is there any way to change the gradle setting for this. It is causing the FXML.load() to load the fxml files in a directory that does not exist in build/classes/java/main
This is my source tree.
ip
└───src
└───main
|___images
| .png files
|
|───java
| .java files and packages
|_____test
|
└───resources
|_______view
MainWindow.fxml
DialogBox.fxml
This is the build/out tree:
build
└───classes
| └───java
| |____test
| |
| |───main
| .class files and packages
|
|______resources
|______view
MainWindow.fxml
DialogBox.fxml
In the out tree the fxml file is out side of the project root which is have confirmed to be build/classes/java/main
. This is causing the fxml.load to be unable to find /view/*.fxml
files. How do I resolve this?
6. CheckstyleMain and checkstyletest failing.
CheckstyleMain task is returning some exceptions which I have never encountered before and I can't seem to find any relevant information on the web. It says:
Execution failed for task ':checkstyleMain'.
> Checkstyle rule violations were found. See the report at: file:///C:/projectroot/build/reports/checkstyle/main.html
Checkstyle files with violations: 2
Checkstyle violations by severity: [error:6]
This appears after the errors thrown by the project files failing the test. Similarly, checkstyletest is throwing somewhat same error but in a different directory:
Execution failed for task ':checkstyleTest'.
> Checkstyle rule violations were found. See the report at: file:///C:/projectroot/build/reports/checkstyle/test.html
Checkstyle files with violations: 1
Checkstyle violations by severity: [error:1]
Is there any way to resolve all these issues?
7. runshadow build failed?
Hi there, after running the shadowjar task, I attempted to runshadow, but that immediately triggered a warning:
> Task :runShadow FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':runShadow'.
> The value for task ':runShadow' property 'mainClass' is final and cannot be changed any further.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
I did a gradle clean runshadow command but it returns this error over and over again. Using the IDLE gradle runshadow task runs some form of truncated program where it opens and immediately exits by a bye command. Not sure what is happening so I came to ask for help.
There seems to be an issue with the runshadow command even though I have no problem running the normal jar file. There also seems to be a problem with installShadowDist when i tried to run it, it throws an error:
Failure to delete directory: ip\build\install\ip-shadow
Failed to delete some children. This might happen because a process has files open or has its working directory set in the target directory.
Is there something missing in my build.gradle?
plugins {
id 'java'
id 'application'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '5.1.0'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
String javaFxVersion = '11'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
showExceptions true
exceptionFormat "full"
showCauses true
showStackTraces true
showStandardStreams = false
}
}
application {
mainClassName = "duke.Duke"
}
sourceSets {
main {
java {
srcDirs 'src\\main'
}
}
test {
java {
srcDirs 'src\\test'
}
}
}
shadowJar {
archiveBaseName = "duke"
archiveClassifier = null
}
checkstyle {
toolVersion = '8.23'
}
run{
standardInput = System.in
}
8. How do I permanently prevent git from caching my login information?
I have a lot of problem switching accounts as I have to repeatedly delete the cache in windows credential manager. How do I disable this feature without uninstalling git?
9
Sick!! Thanks for sharing man!
10
You can try issuing a SIGQUIT instead
11
On a side note the hooks will not execute in the event of an unexpected termination of JVM, so its still a safer choice to save on add.
12
That's not helpful at all. The the idle or I don't know what is throwing a violation warning at the html file but the problem is not from the html file.
13
Could be due to the Image(getClass.getAsResource.xxxxxx). Remove this and see if the code launches? The exception is caused by a null pointer exception. So the cause is deeper into the stack trace. This is the best I can deduce without the stack trace.
14
What you said is most likely the cause The invocation target exception can be solved by resolving the null pointer. So maybe somewhere in your code you are accessing an absent resource?
15
Issue resolved.
16
Hi En Hao,
I am facing the same issue as you - my resources directory is not being built in the src/main folder. May I ask how you managed to solve this?
Hi, I think my issue was caused by the fx:controller to be set to just MainWindow when in fact I packaged MainWindow within another sub directory. You can try setting the fx:controller to >yourpackages.....>.MainWindow
17
Resolved.
@zhiayang
(17 posts)1. Linebreaks in UG/DG
Printing the UG and DG to pdf is pretty scuffed, since it likes to cut off text and/or tables at arbitrary places:
Will this be counted as a documentation defect during the PE and/or counted against us for grading? Thanks.
2. 1.3 milestone un-done
So I re-opened an issue assigned to 1.3 (realised it wasn't fully fixed), without re-assigning it to the 1.4 milestone, and looks like the progress-checking-script caught the repo with the issue open, so now my team's 1.3 wrap up is currently marked as un-done.
I already re-assigned the issue to 1.4, but hopefully there won't be a penalty for this?
3. Cherry-picking PRs
How does the script count teammembers' pull requests? Is it strictly through the github API? ie. if I manually clone the personal repo and cherry-pick + push commits to the main master, that teammate's PR will not be counted by the bot?
4. Strictness of import ordering
to what extent is the order of imports enforced? (both for ip and tp). i noticed that there's a rule for it in the AB3 checkstyle xml, but is it strictly necessary to follow that?
(by strictly necessary -> points docked for not following?)
edit: while i'm here, whitespace -- extra whitespace for alignment is supposed to be OK according to the style guide, but checkstyle complains about it as well.
5. Committing gradle files to the repository
Are we supposed to commit all the non-essential gradle files to the repository?
eg:
gradle/wrapper/*
gradlew and gradlew.bat
AFAIK for it to work you just need the checkstyle configs in config/checkstyle/*.xml
, right? i don't suppose intellij is actually using the wrappers to run gradle...
6. Regarding A-MoreOOP
This particular increment asks us to extract out classes for Storage
, Ui
, etc. Are they required to be objectified into those particular categories with those particular names? eg. if our code is already abstracted/encapsulated in some other way that "demonstrates" OOP (whatever that means), is it necessary to change it?
Thanks.
7. Customisation of testing scripts
In the other questions, it was stated that we are free to customise as much as possible, as long as we're not "subverting the learning goals".
So: regarding the testing scripts, I don't suppose there are going to be any automatic CI bots to run the scripts on our repos, so are we free to move/rename/edit/delete them, for example? As long as there is a script to run tests on the program, it should be sufficient yes?
8
okay, thank you!
9
nothing stops you from committing a file that still contains conflicts; you are free to lie that it's resolved, but of course bad things will happen.
10
try git config --global --unset credential.helper
.
alternatively you can set user.name
and user.email
for the specific repository instead of having to switch.
11
doesn't the error writing aborted; java.io.NotSerialisableException: ToDo
suggest that your class ToDo
does not implement the Serialisable
interface
12
actually IMO the whole concept of immutability in java is kinda pointless because it does not have "const-correctness" like other languages. Just because your taskList
is marked private final
, it doesn't mean the list itself is immutable, only that the reference to the list is immutable.
you can't reassign the list to another new list, but you are totally free to append/delete items to/from the list. in fact, having a getter allows other people to do list.getTasks().clear()
or something else to modify the list.
13
in general you should not treat what you learn in programming modules as dogmata (eg: cs2030 said immutable classes are good, so i should always use them) (eg: cs2103 said we should program in OOP style, so i should always program in OOP), but weigh their pros and cons as you deem fit. for example, if you know that your list is gonna have hundreds or thousands of items, then it doesn't make sense to die-die make your class immutable and force a copy every time you want to modify something.
(nb: even though you're only copying pointers, a copy is still a copy)
on the other hand, if your classes are small, and (imo) generally stored in lists or something like that, you might want to make them immutable, so you can hand out references with ease-of-mind that nobodoy will change things from under your feet. good examples here might include your various Task
classes.
anyway this problem is unique to java because of its lousy concept (or lack thereof) of "const-ness", as mentioned before. in a more sensible language you'd be able to create and pass around const references so the idea of having an "immutable class" wouldn't make sense.
14
okay thank you!
15
okay, guess i will have to add the wrapper files back to the repository... feels dirty to commit jar files >>
16
okay, thanks prof!
while i'm here, can we close the tutorial PRs? presumably the participation for those has already been counted right?
17
ok, thanks prof!
@CodyChew
(16 posts) 1. JAVA CI test failure
Anyone has experience with java CI tests failing on github. I am able to build and successfully run all tests with gradle in IntelliJ however after committing to a PR, the tests fail. Most come from java.lang.NoClassDefFoundError
. Any tips for debugging for this?
2. UnsupportedClassVersionError during testing
java.lang.UnsupportedClassVersionError: Duke has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" Comparing files ACTUAL.TXT and EXPECTED.TXT
Anyone encountered the above error while setting up the testing?
I've got this error after "javac not recognised as internal or external command" error and after adding the project JDK home path under the system environment path.
Currently I'm trying to tweak the settings in intelliJ project settings but I can't seem to solve it. My project SDK is also at java 11.
3
Thanks @bchenghi! I think mine was the same problem but i didn't catch it!
4
You can try the following:
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java*.java
But iirc if you compile your top-level class first (in terms of dependencies) every other relevant class should be compiled as well. Hence why calling
javac
on justDuke.java
works for me
@erisjacey do you know why we do not need to compile all the classes? I'm still confused on this, thanks!
5
This looks like a similar problem as "javac not recognized...", did you previously have this error? if not i think it has something to do with the environment path.
You can check if you get the same error in your command prompt by typing the FC command. then you would have to edit your path system variables under environment variables.
6
@GabrielSimbingyang I also had the same problem after setting up the project, you can
right click the java file > mark directory as > sources root
Hopefully this solves the issue
7
create an "output" folder in your repo and set that folder as your output path. I've always done that for my projects and it seems to work for me, but not sure why i always have to configure it too
8
yup it looks like that for mine too
9
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 java.lang.UnsupportedClassVersionError: Duke has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I had the same problem earlier #25. You probably have the Java 8 path in your environment path variable. Deleting it solves the problem for me. I think moving it up for higher priority will also work
10
I also have this problem for my .bat file but not too sure how to solve. Some sources tell me to download the JavaFX and include it in our project library following setting it up without gradle in the tutorial, however i think it'll mess up the gradle configuration.
https://www.jetbrains.com/help/idea/javafx.html#add-javafx-lib
Anyone one has faced this issue before? Or can we also move away from standard output and shift our testing to only JUnit tests for our classes. Or is the standard output still important for testing because now my Duke UI is only printing standard output for this .bat test. Appreciate any advice.
11
Hi! can i check if your main class in Manifest.MF is updated with the correct class too? since the problem seems to be coming from that file.
12
here's the link! Thank you
13
yes, i ran on intelliJ and used the terminal as well.
14
Yes, I'm on windows. But I'm able to run ./gradlew build
on SoureTree bash terminal. My team mate was also able to build on his Mac. At first I was thinking if it has something to do with different Java versions when compiling and building but it seems like the correct version is being used as well
15
i thought it might be that too @qwoprocks but i ran it several times today already 😦 would there be a way to see the report from the Java CI check? or maybe a 'proper' way to resolve merge conflicts from last build?
16
Thanks so much @qwoprocks I didn't notice it! How did you manage to figure it out?
@ktaekwon000
(16 posts)1. [External Library Permission Request] PrettyTime
Format dates in a more natural manner.
2. Codecov: codecov seems to be analyzing pull requests but is unable to show detailed reports.
Hi, our group was getting codecov reports generated for PRs, and found the feature useful as it showed which lines were not targeted by tests.
For my specific PR, codecov analyzed the code, commented on the PR with the change in coverage, and a link to the full report was generated. However, when this link is clicked, codecov throws an error, and no report is shown.
Has anyone experienced this problem before?
The following are links to the relevant PRs/reports.
Working codecov:
Broken codecov: PR, the codecov bot still analyzes the code and leaves relevant comments.
report, error in screenshot above is shown.
3. [External Software Permission Request] jfxtras (calendar)
Display a calendar and export iCalendar files from our program.
4. Website mentions now-removed tutorial
Hi, I noticed that the CS2103T website mentions a "Gradle tutorial at the Duke repo" for implementing Gradle into our project.
However, the relevant material seems to be removed at commit https://github.com/nus-cs2103-AY2021S1/ip/commit/71d7ea84f3d61821643e505e532051fcc09ec2b1. Am I looking for the tutorial at the wrong place?
5
@aidoxe-123: Hi, where did you find that trouble shooting slides?
The screenshot is from the se-education webpage: https://se-education.org/guides/tutorials/textUiTesting.html
6
Have you tried changing the version of javafx to 11.0.2 in the build.gradle file? According to the bug tracker for javafx the fix has been backported to version 11.0.2, but I am not able to test since I'm on Windows.
This version upgrade doesn't require a newer version of JDK.
Keep in mind you might have to restart your IDE for the changes in build.gradle to take effect.
7
I think I ran into a similar problem when copy pasting the code for the 4th tutorial. Have you placed the copy pasted code into a package? If so, go through the fxml files and make sure that all class names mentioned in those files have the proper naming for them, with the package name included. (For example, in MainWindow.fxml
check that fx:controller="MainWindow"
is changed to fx:controller="duke.MainWindow"
or whatever your package naming is.)
8
I noticed this message on the relevant commit with those tags, could you help me check whether these tags are to a commit on the master branch?
9
This seems to be a similar issue to https://github.com/nus-cs2103-AY2021S1/forum/issues/216. Try moving the tag to a commit on the master branch to see if it fixes the problem.
10
I also experienced the same issue, but what I did to fix it was change my JavaFX version in my build.gradle to 11.0.1
11
I guess my method might cause our build.gradle to deviate from the rest of the cohort? I'm not sure what downsides this will have, but I suspect its not very relevant because there's already people modifying their build.gradle to use external libraries and such.
About Adithya's method, I personally havent tried it myself so I'm not 100% sure, but I suspect you'll have to edit the .fxml file to change the version string every time you edit something in it with the scene builder. I don't have experience with this though so it would be nice if someone who did that could test it for me.
12
From how I cannot access https://weijie96.github.io/ip/, I suspect your Github Pages is not configured properly. Could you check that it's configured to serve /docs
like the screenshot below?
13
If you're having problems with Windows 10 Home, you can change your edition to Windows 10 Education which can run Windows Sandbox, and comes included with our NUS email.
Here are the instructions to get Windows 10 Education:
Go to https://portal.azure.com/ and log in with your NUS email.
Follow the steps as in the GIF below.
14
This issue might be relevant to your issue: https://github.com/nus-cs2103-AY2021S1/forum/issues/142
tl;dr: Update the javafx version in your build.gradle file to 11.0.2
15
I had the same problem and I got a response from the prof in the gitter chat. The PR from your fork needs to be from a branch other than master
. The reasoning was that the forking workflow needs each PR to the upstream repo to be from a different fork, and having all PRs from the master
branch prevents each member from making more than one PR.
16
The error seems to be on codecov's end, according to codecov's statuspage. We've actually been having this problem for the past couple of days so I'm not sure how relevant codecov's issue is, but I'll close this issue while I see if codecov's fixes fix this issue.
@WeiJie96
(15 posts)1. Object Deletion in Sequence Diagrams
May I ask when we should the object deletion symbol in sequence diagrams, in particular for AB3?
For delete command, only the parser gets deleted, but not the command itself.
Whereas for undo command, the command gets deleted.
2. What is the projects.yml file used for?
In the original AB3, there is file docs_data\projects.yml, which lists out a list of URLs related to AB3 (some may not be relevant).
I was wondering what this file is for, and how we can configure it for our own project?
3. Published UG and Ui.png not showing on iP Dashboard
Hi Prof,
I can see my Ui.png in the iP Showcase (CS2103-T16-2), and also my README.md can be accessed via https://weijie96.github.io/ip/README.html
I have uploaded them before 15 Sep (date of Dashboard refresh).
May I ask why the status is not updated?
Thank you
4. Link in Setting up and getting started page of AB3 developer guide points to another location
Hi Prof,
On the "Setting up and getting started" page of AB3 developer guide (https://nus-cs2103-ay2021s1.github.io/tp/SettingUp.html), the href for "[se-edu/guides] IDEA: Configuring the JDK" is pointed towards https://se-education.org/guides/tutorials/checkstyle.html, instead of https://se-education.org/guides/tutorials/intellijCodeStyle.html
Thank you
5. When should we write javadoc?
Should we write javadoc for obvious methods? E.g. getters/setters, one/two-liners that just prints out a string
Should we write javadoc for all non-private (includes package, protected, public) methods and classes, or just the public ones?
6. Implementing SLAP
Is this considered a violation of SLAP? Just concerned if indexing (or mathematical operations) and self-created methods can be put together in one method.
void method() {
String[] parts = doSomething();
String firstPart = parts[0];
String secondPart = parts[1];
doAnotherThing(firstPart);
doYetAnotherThing(secondPart);
}
7
Thank you Prof!
Can I ask another one with if-else statements? Also, for the part with (x + 2) > 0
, do we need to abstract it as well?
void method(int x) {
if ((x + 2) > 0) {
doSomething();
}
else {
doAnotherThing();
}
}
8
I see, thank you Prof for the explanation!
P.s. Pardon my brackets 😷
9
Thank you for the detailed explanation, Prof Damith!
10
Hi,
Yes, it does look like this:
My folder structure is
master branch
|-- docs/
| |-- images/
| | |-- Start.png
| |-- README.md
| |-- Ui.png
11
Hi Prof,
The URL works after I added an index.md file in the same folder. Would the autograder mark both tasks as done via this workaround?
12
Thank you Prof, I would check again tomorrow
13
Thank you Prof, it works now
14
Thank you, Jeffry!
15
Thank you, Prof!
@Marcon2509
(15 posts)1. .jar file can run on computer but unable to run on other computers
I tried using gradle to create a jar file using shadow and managed to create a jar file that launches and works fine on my computer. However, i cant load it on another comupter and get the following errors
I looked through some of the forum helps but alot of them specify the build.gradle has to updated to duke.Launcher which I tried and got error. But i think it is due to me deleting the duke class as I no longer had any code inside it. the build.gradle that works its shown below
Any help would be greatly appriciated
2. Unable to display all output text in window for Level-10
Ive managed to combine the window pop up with my duke but the dialog box is unable to display the entire list because i think it is too large? I am quite unfamiliar with scene builder and have tried to make it larger via that as shown in the image below
but it doesnt seem to affect it. Also i searched online on how to close the window pop up but come up with nothing. As of now the command "bye" just gives the see you soon dialogue but it doesnt exit the application so a small hint would be greatly appreciated!
3. merged add-gradle-support to main branch and now code doesnt work?
I am trying to do the A-gradle increment but after following the steps(Merge the branch, reimport using gradle.build) i managed to get the gradle thing working. However when i try to run my code, certain parts of it now fail. For example, [✓] or [✗] now gives [?] which i have previously never had issue with and the command find (example find book) now doesnt work despite the code still being the same. Please advice on the issue thank you!
4. NullPointerException when trying to save file to hardrive Level7.
I am attempting Level 7. Save and I am trying to use serialization to save an array which stores my list that is printed out. However my method saveData(ArrayList
Below is my SaveData method (Note not sure why the insert code button isnt working)
public void saveData(ArrayList<Task> listToSave) {
FileOutputStream fos = null;
try {
fos = new FileOutputStream(dataFile);
} catch (FileNotFoundException e) {
e.printStackTrace();
} finally {
if (fos != null) {
ObjectOutputStream oos = null;
try {
oos = new ObjectOutputStream(fos);
if (oos != null) {
oos.writeObject(listToSave);
}
assert oos != null;
oos.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
}
5
The image above shows the nullPointerException is coming from fos = new FileOutputStream(dataFile);
6
i think i do in the initFile method @wakululuu
7
@wakululuu added the system.out.println(datafile) and in the picture shows i intialise it at the begining
8
@zhiayang ah yes my bad that was the problem thank you
9
For some clarification i went to download my project from my own tag (Level-9) and tried running it normally and it works fine
10
Update: looked through my code and realized that there was duplicated variables due to the merging of Level9 AddJAvadocs that cause the find command to not work so that issue is fixed. However still having trouble with the [✓] or [✗] now gives [?] issue. Im on windows and am trying to fix using #64
11
Update2: fixed [✓] or [✗] now gives [?] issue but not sure if it was the legitimate way of to fix it
i now just used the actual symbol instead of \u2713. Tried to add set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 to runtest.bat but no luck
'public String getStatusIcon() {
return (isDone ? "✓" : "✗"); //return tick or X symbols "\u2713" : "\u2718"
}'
12
@tanweijie123 yeah that works thanks alot
13
@qwoprocks oh my bad i sint see that issue thanks!
14
@khoongwk i did try doing that it seems to be the correct and i checked with my friend who uses apple but it doesnt work on his
15
@damithc yes. Sorry I forgot to update the issues. The answer specified by @khoongwk was correct I had the wrong version on the other computer and my friend downloaded the wrong file.
@xnoobftw
(15 posts)1. Issues with new Jar file generated with shadow
Hi i've generated the new jar file with shadow via
adding id "com.github.johnrengelman.shadow" version "6.0.0" to plugins under build.gradle
refreshing gradle so it installs
typing gradlew shadowJar in intellij terminal
duke.jar appears under build/libs
but when i double click the jar file or even running it from cmd it says
Error: Could not find or load main class seedu.duke.Duke
Caused by: java.lang.ClassNotFoundException: seedu.duke.Duke
any solution?
Duke runs fine from intellij
2. JavaFX Tutorial part 4 how to Convert MainWindow to use the fx:root construct.
How does one do this? I don't know if the way i did it was correct but the program seems to run fine
I've tried
1 - ticking "Use fx:root construct" in MainWindow.fxml
2 - setting root in Main as shown below
3. JavaFX tutorial part 4 java.lang.ClassNotFoundException: MainWindow
Hi!! I've figured out where i went wrong but i don't know how to fix it.
It seems that the onAction is not able to import handleUserInput method from the MainWindow class
THINGS I'VE TRIED
import duke.MainWindow
removing #
Doesnt work D: anyone has any idea why
4. runtest.bat stopped working after implementing OOP
Hi, i've implemented the various classes in A-OOP but after doing so runtest.bat file stopped working. It tells me that my Scanner.nextLine() has no input. But when i run my Duke.java file as per normal it works!
me running duke.java
me running runtest.bat
this is how my Duke.java looks like
and how my Ui looks like
and how my input.txt looks like
anyone has any idea?
It works perfectly fine when i manually input but runtest.bat doesnt seem to take in strings from my input.txt
5. Automated testing of text UI runtest.bat
Hi! I'm getting this error
even after following some fixes that worked for others.
This is how my runtest.bat looks like
what am i doing wrong?
6
Now i'm having this error and i have no idea why. I've installed JDK11.0.8 and am using that in both intellij and my JAVA_HOME + Path already
7
Nvm it's fixed after i uninstalled the JDK14. Thanks!
8
Personally I did both!
Basically it's encased in a try catch block.
The try block tries a static method I declared in the Duke.java file
The catch block will catch my custom exception and inside my catch block is simply a
sys.out.println(e.getmessage())
This will allow the program to keep running while printing the error msg and having the method throw an exception
9
Hi i think you need to make sure JDK 11 is installed and JAVA_HOME and PATH variable is set properly
https://github.com/nus-cs2103-AY2021S1/forum/issues/8#issuecomment-674464491
refer
10
@qwoprocks tried it but it still gives the same error
Exception in thread "main" java.util.NoSuchElementException: No line found
at java.base/java.util.Scanner.nextLine(Scanner.java:1651)
at Ui.readCommand(Ui.java:12)
at Duke.run(Duke.java:18)
at Duke.main(Duke.java:32)
11
@qwoprocks i've confirmed that the scanner is only reading the first line in my input.txt which is jsut "todo" then it does not recongise any of the next lines
12
@qwoprocks @erisjacey
I've done what both of u did and there's still the issue D:
13
I'm guessing that
runtest.bat
is using an outdated version of theDuke.class
file. This might occur after you implement packaging.
First, try deleting all the files in
./bin/
, then running the batch file again. There should be some error about not being able to find theDuke
class, which you can then resolve by usingjava -classpath ..\bin duke.Duke > input.txt > ACTUAL.TXT
instead ofjava -classpath ..\bin Duke > input.txt > ACTUAL.TXT
Yeap you're right! This fixed it for me. Thanks!!!
14
NVM it somehow fixed itself when i shifted the MainWindow.java file from duke and back to duke package
15
Yes! omg sorry for dup thread
@khoongwk
(14 posts)1. Issue with FXMLLoader load(): Location is not set.
In intellij, my JavaFX runs fine but after creating the JAR using gradle's shadowjar and trying to run the jar, I get this:
The issue is with the load method of the FXMLLoader, but I can't seem to find out why this is happening only when I try to run the program in its JAR form. I tried opening jar file as an archive and noticed that the resources folder is not there:
So I suspect that gradle is not building my jar with my resources folder inside it. Any advice is appreciated!
2. No Main manifest attribute in generated JAR file
After creating of the JAR file, I keep getting the following error when trying to run it:
no main manifest attribute, in (my_directories)\iP\out\artifacts\iP_main_jar\iP.main.jar
I already made sure to select Launcher as my main class in the artifacts settings and edited build.gradle such that my main class is Launcher:
application {
mainClassName = "Launcher"
}
Did anyone face the same issue?
3. Read-Write of File works fine but exception triggered while running runtest.bat
I used the File, FileWriter and Scanner classes to read and write the text file for level 7. For some reason, there were no issues when i compile and run the program in the console but when i used runtest.bat, an IOexception is triggered:
java.io.IOException: The system cannot find the path specified
The following is a snippet of my code:
.....
File savedList = new File("src/main/data/taskList.txt");
if (!savedList.exists()) {
// Create new file if it does not exist.
savedList.createNewFile(); >--- exception is triggered here.
}
.....
Is this a problem with the working directory? Because runtest.bat uses the Duke.class file from the bin directory.
4
That solves my problem, thanks a lot!
5
Hi Ming Soon,
My Launcher class is not in any package. This is how it looks like:
6
Thanks Cody and Prof Damith for the comments. I have shifted the JavaFX classes into my duke package.
I don't think the issue is with my MANIFEST.MF file, because that file is auto-generated by Intellij when I set the settings under project structure -> artifacts
. Although my project has more than one psvm main() method, I made sure to select the Launcher class when building the JAR file.
Could my build.gradle be missing something / is configured wrongly?
7
@damithc
My bad, I was trying to build the JAR file using intellij's build artifacts function instead of Gradle. This resolves the issue.
On a side note, I tried running the generated shadowjar and got an FXML exception:
@kormingsoon I saw you had the same issue at #148 . May I know what you meant by "naming issue due to Package"?
8
Hi Ming Soon, my mainClassName is also set to duke.Launcher and my dependencies in gradle are the same. Seems like the core issue is related to these 2 lines of code:
FXMLLoader fxmlLoader = new FXMLLoader(Main.class.getResource("/view/MainWindow.fxml"));
AnchorPane ap = fxmlLoader.load();
There are no issues while running the project in Intellij and only when it is being run as a JAR file.
9
I had the same issue. Check your java version on your other computer and update it if it is outdated. If that still doesn't work, check the windows PATH and environment variables to see if windows is pointing to the correct java executable (there might more than 1 version of java installed on that computer).
10
Hi En Hao,
I am facing the same issue as you - my resources directory is not being built in the src/main folder. May I ask how you managed to solve this?
11
Solved. See #213
12
Issue solved. The problem was that getResource() returns null, causing FXMLLoader's load method to fail. Turns out that my 'view' folder under 'resources' was capitalized to 'View', and that was causing the issue.
But I think it's weird how my program works in Intellij despite this misspelling however, as though it corrects it automatically.
13
Thanks Marcus and Ming Soon for the advice, it's much appreciated. 😄
14
Thanks for the comment En Hao, I have solved my issue at #213 .
@Perpetual09
(13 posts)1. Are users allowed to use mouse to scroll a bar?
Hi! I am not sure whether users are allowed to use a mouse to scroll a bar? If not, are there any ways such that can add such keyboard shortcuts?
2. 💡Solve the problem that Lebel type will automatically use ... to omit long text.
Here is the problem:
Solved by setting MinHeight = "-Infinity" in DialogBox.fxml:
>fx:root alignment="TOP_RIGHT" maxHeight="-Infinity" minHeight="-Infinity"
3. 💡iP: Print ✓ and ✘ incorrectly in the output .txt file
I am using the Win10 PC. After running the runtest.bat, the output .txt file (UTF-8) shows "?" instead of "✓" or "✘". I solved the problem by replacing \u2713 and \u2718 by ✓ and ✘. I think there should be other ways to solve it as well. Hope this will help. : )
4
But I encountered another problem: the FC command seems does not recognize that symbol and consider the same symbol as different : (
5
I did not find a command to force FC to compare two files with UTF-8 encoding
6
problem solved!
7
The problem I think it is because of your format of setting MY_PATH, just like others said.
Instead of setting PATH, have you tried to use the .., which means go to the parent directory? i.e. javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\*.java
8
Hi, may I know is this a utf-8 encoding issue actually? Stuck over here as well and not sure what's the problem.
Hi! Now I realize it is not about utf-8, and here is the reason:
Try to copy the content in ACTUAL.txt into EXPECTED.txt EXACTLY, then you should pass the check.
9
Oh I see, thanks a lot!
no problem : )
10
Which task did you run? Besides, here is the link for this exception: https://docs.oracle.com/javase/7/docs/api/java/lang/reflect/InvocationTargetException.html
11
Are there any error messages? If not, try pull and push commands in Git GUI, and check the error messages.
12
Hi, this is my GUI for iP. Basically I followed the tutorial and implement that frame to my Duke and did not modify too much on design. Here is a screenshot:
13
Ok I see. Thank you prof!
@iamgenechua
(13 posts) 1. all tests passed (with errors) with gradle clean test
Hi managed to run gradle clean test via the gradle tab on the top right corner
I passed all the test cases but i got some error too. Does anyone know how to resolve this?
2. How do i (dynamically) expand my space for all my tasks?
As you can see, when i have more than 4 tasks, they just truncate my tasks for me. How do i show all tasks?
Appreciate your help!
3. runtest.sh not able to recognise some new commands
Hi, I just finished the A-Jar level.
I just added a 'clear' command to be able to clear all the existing tasks in the storage file so that I can execute runtest.sh without any side effects affecting the test.
When i type in the 'clear' command when running Duke normally through the terminal, it works as expected.
However, runtest.sh does not recognise this command.
Appreciate your advice on how to solve this!
4. How to have accurate expected-actual test after Level-7?
After level 7, we will be able to persist data on our harddrive.
Now, everytime we start up our program, we continue to have the tasks from before.
These tasks are ever changing, and the 'list' command will show different tasks depending on what i have done.
My expected output will behave as if it is the first time we run the program.
How do i do my testing accurately then?
5. Recommended way to push branches to fork?
The instructions above one me to push all branches to my fork.
But i also have to push my tags too.
I did a bit of googling.
So do i do this?
git push --all
git push --tags
in this order. So that i can push both my branches and tags.
6. Recommended location to store my hard disk data?
Hi! A screenshot of my working directory is here:
Where am I recommended to mkdir a directory and create the duke.txt file in?
7. Should we git tag after every single commit?
We're encouraged to commit frequently, but should we git tag after every commit?
Or is it better to git tag once we are ready to git push and increment our level?
8
so i must cd twice to the previous directory to go to the main iP folder directory. Then mkdir there ah.
9
Thanks. But I'm also considering this case:
If I create a new file on my local machine, it works fine and dandy. But because of the above message. I'll also have to find a way to create a file with my code if there isn't any file right?
What is the recommended approach for this?
10
Hi I'm not using the jar file for testing. I'm using the original runtest.sh file.
I added the duke package earlier and i wonder if that affected anything.
11
Thank you so much. lifesaver!
12
Prof @damithc, so should we have checkstyle version 8.23 or version 8.29?
13
agreed.
@CalistaIo
(13 posts) 1. Catcher update
Hi,
I opened my Catcher app a few minutes ago and it stated that my version (CATcher 3.3.2) is outdated. May I know if I am allowed to re-download Catcher again for tomorrow's PE dry run? Thank you.
2. Draw.io no newline at EOF error
I intend to use draw.io to create my UML diagrams. I created an empty draw.io document and placed it in the docs/diagrams folder before committing it. However, when I ran the build on Github, I encountered an error stating that there is no newline at EOF. I do not understand how to correct this error, since I am not uploading a text file, but a diagram. May I know if anyone has encountered and solved this error?
Thanks!
3. Collaborative project notes document
Hello,
May I ask where we can find the collaborative project notes document for doing the v1.2 demo?
4. Team project code contribution
My team recently received v1.2 feedback for the tp and it was reported that none of us contributed code to the project. However, for v1.2, we sent pull requests containing code changes to another branch, which we have not merged with the master branch. I am wondering if this might be causing the results in the tp feedback. May I know whether our code contributions will be tracked if we merge the changes in the other branch with the master branch?
5. Project milestone v1.1 functionality expectations
Hi,
My team is working on a flashcard application. Currently, we have planned the milestone tasks such that milestone v1.2 mainly involves simple CRUD operations, where flashcard is essentially the same entity as person but with extra fields removed. Because milestone v1.2 resembles much of the existing functionality in AB3, most of our work is removing unnecessary fields and renaming classes. May I ask if this is sufficient for v1.2 to be considered completed, or do we have to start implementing tasks in milestone v1.3 (which contains new functionality for my team)?
Thanks!
6. Add Command Tutorial fail test cases
Hi,
I am currently using Intellij Idea 2019.3.1 (community edition) on Windows Java 11. I am currently failing 5 test cases for the add command tutorial, which is affecting my Gradle build. The error messages are similar, but I do not understand why I am getting these errors because when I check the files that I changed in SourceTree, I can see that I did not change the code relevant to the error messages.
I think the error messages are similar because they indicate that the memory locations of the two Addressbook/AddCommand objects are different. The other error messages are similar so I never show them here. However, I am still confused as to why these errors are happening. May I have some advice as to where I am going wrong?
Thank you.
7
I have resolved the issue by removing the problematic lines of code. However, I am still a bit confused about why this problem pops up.
So previously I wrote this in the Person class:
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (!(other instanceof Person)) {
return false;
}
Person otherPerson = (Person) other;
return otherPerson.getName().equals(getName())
&& otherPerson.getPhone().equals(getPhone())
&& otherPerson.getEmail().equals(getEmail())
&& otherPerson.getAddress().equals(getAddress())
&& otherPerson.getTags().equals(getTags())
&& otherPerson.getRemark().equals(getRemark());
}
@Override
public int hashCode() {
// use this method for custom fields hashing instead of implementing your own
return Objects.hash(name, phone, email, address, tags, remark);
}
So the lines of code that I removed to make it work are && otherPerson.getRemark().equals(getRemark()), and I modified Objects.hash to exclude the remark field.
Clearly, I added the remark field to the object hash, and I also used it as a criterion for determining whether two objects are equal. But why is it that doing this will cause two objects to not be equal? May I have some advice about this? Thanks!
8
Oh, I understand what you mean, when I went back and added the remark to the hash and also the equals method, then I tweaked the test cases to have all the same default remark, the test cases passed.
Thanks!
9
Ok Prof, I understand. Thanks!
10
Hi, thanks for the reply. May I know if the merge will allow the script to track individual members' contributions, since each of us sent our pull requests to the branch?
11
Ok, I understand. Thanks!
12
Ok thanks!
13
Hi Prof, I found that the file is in XML format but I could edit it using Notepad. The gradle build works now. Thanks!
@Criss-Wang
(12 posts) 1. Deleting duplicating issue or closing it?
Hi prof,
Our team created some duplicated issues. May we know should we close them or simply delete them (we have enabled deletion in the setting)? Thanks!
2. Including Coming Soon Use Cases in the Developer Guide
Hi prof,
When our team was updating the developer guide, we found that certain commands we planned need to be modified or put into later iterations. However, we do have some of our members writing use cases for these features that are not going to be out in iteration 1.2. May I know is it okay to put these use cases in a [coming soon] section in the Developer Guide's requirement section? We try to acknowledge his effort and also plan for future iteration reference.
Thank you!
3. Are we supposed to start GUI by double-clicking .jar file
Hi all, I'm wondering whether we should be able to open the GUI from the .jar file created.
Currently I need to use cmd line to start duke and cannot open the GUI at all (double-clicking or java -jar don't work).
Is this natural, do I miss out something?
4. Comply with coding quality question: >30 LOC
Hi all, may I ask to comply with the coding quality, must the method be less than 30 lines?
It appears to be a basic guideline in coding quality, but I do find some of peer's main logic for command handing >= 30 lines with a relatively decent/correct logic. Should I point the issue out? Or is it okay to have a slightly >30 lines method if the logic is sound?
Thank you!
5
Hi, may I know is this a utf-8 encoding issue actually? Stuck over here as well and not sure what's the problem.
6
Oh I see, thanks a lot!
7
@li-s It's under the description in peer review task in Week 4 project.
8
@damithc I see, thanks prof!
9
Hmm not sure if Star War theme is allowed, but here is my try:
10
https://github.com/Criss-Wang/ip/blob/master/src/main/java/META-INF/MANIFEST.MF
If your main class has changed, you might need to change the manifest so that the JAR can find the correct main method.
Thanks for the help! I also modified the main class in build.gradle to make the application open upon double clicking.
11
Currently it seems that your json file location path is not correct...
Also, maybe its better if you can give the full log...
12
Thanks prof!
@onglijin
(12 posts) 1. Assertion not lighting up in tp tracker
Hi Prof, I did my assertions a while back (I did it before week 10, and it was recorded) but I deleted and replaced it in week 11, so the assertion turned red again. Could you help me take a look please? Thank you!
2. Merging PR shows red
Hello all, currently my MergingPR tag shows red even though i have merged the pr a few days back. Does anyone know if its an error on my part? Thank you.
3. Ui Testing: File not found
Hi all,
I am trying to run the runtest.bat file on terminal. However, I am running into various issues. The latest issue I have is shown in the picture.
According to my directory, the file is listed.
If it helps, here is my full directory,
Here is my code for runtest.bat:
I have tried various methods, including:
Placing the paths in double quotes
Replacing .. with %MY_PATH%
Replacing line 13 with
dir /s /B ..\src\main\java*.java > sources.txt
javac -cp ..\src -Xlint:none -d ../bin @sources.txt
Would gladly appreciate any help! Thank you.
4
Hi Prof, thanks for answering! If the picture above means it succeeded, then the solution worked, although I'm not sure since the the symbol didn't print right but there was no "build failure".
5
I managed to create the runtest file, needed to download the necessary plugins for intellij (prompted). However, I am getting the above error. Is it a directory issue in input.txt?
6
Is this what you meant?
7
This is what I got using DOS prompt
8
9
I tried by copying the original into runtest.bat, ran on the same dos prompt, but it leads to a full circle hahaha
which using the solution leads to
which leads to
10
I managed to solve this issue by recoding the project and testing each level as I went along. Thanks Prof!
11
Okay thanks prof! @damithc
12
I realised I couldn't find the code on my reposense report. I will insert another assertion then. Thanks prof!
@tankangliang
(12 posts) 1
Like the other users already mentioned, I do think throwing errors as early as possible would be better.
That said, you could look into having a private constructor and having a factory method to create instances of the class which would have checks before creating the object and thus, avoiding the problems with memory usage etc.
You could even look into other design patterns if you think this might not be proper encapsulation of Task's duties. There is a factory design pattern that seems useful and I've been reading up on.
https://www.tutorialspoint.com/design_pattern/factory_pattern.htm
2
I'm not sure if there's a proper solution to having two relative paths from different working directories point to the same one but you could create the directories to get the path you want if it isn't found. Then remember to remove the save files with your .bat files or your results will differ each time.
3
Assuming a layout of [project root]\src\test\java
The test
folder should be the one selected as Module
The java
folder should be the one marked as Test Source Root
You shouldn't touch main
as it is part of your source code and not the test cases.
4
When you normally run your program, IntelliJ runs it from the root directory and thus the src/main/data/taskList.txt
exists.
When you use runtest.bat, the working directory is currently in text-ui-test
and it cannot find the path text-ui-test/src/main/data/taskList.txt
.
You can also refer to #57 #47
5
Try using javac -cp ..\src\main\java\ -Xlint:none -d ..\bin ..\src\main\java\*.java
with the -cp
flag changed to ..\src\main\java\
6
Actually spent too much time on this
7
I faced this error too. If you took the FXML from the guide, make sure that the field fx:controller="MainWindow"
is changed to include the package name like fx:controller="duke.MainWindow"
.
8
Actually spent too much time on this
Oh my! Kang Liang, may I ask how do you add backgrounds?
I'm using CSS to customize the appearance. The background image -fx-background-image:url('/images/background.jpg');
is applied to the VBox
component and stylesheet is applied using scene.getStylesheets().add("path/stylesheet.css");
You can find out more about customizing CSS here https://docs.oracle.com/javafx/2/css_tutorial/jfxpub-css_tutorial.htm
9
Another point I would like to add on is that when using lambdas in streams, local variables need to be final or effectively final. I wanted to introduce streams into my code as well and felt that some workarounds for this tend to make code less readable. For example, a common workaround is using a final array to store a single variable that tricks the compiler into thinking that the variable is not modified. This could, however, lead to unpredictable results as detailed in this blog post here https://www.baeldung.com/java-lambda-effectively-final-local-variables
The restriction to effectively final variables prohibits access to dynamically-changing local variables, whose capture would likely introduce concurrency problems.
So if you find yourself needing to introduce such "anti-patterns" into your code, you should probably not use streams for that portion.
10
Looking at your repository, the file is still Todo.java
. This may be caused by a case-insensitive filesystem like Windows / MacOS. You can try changing the file name to something different, staging it, then changing it to the correct filename Todo.java
-> Foo.java
-> ToDo.java
. Alternatively, there are some steps outlined here that may help.
11
Try changing the mainClassName in your build.gradle to "Launcher"
12
I think this has been answered in #149
Can you check if this works for you?
@StopTakingAllTheNames
(12 posts) 1. Clarification on Composition
According to the textbook,
A composition is an association that represents a strong whole-part relationship. When the whole is destroyed, parts are destroyed too i.e., the part should not exist without being attached to a whole.
In AB3, the relationship between the Person
class and its components is considered a composition as shown in the diagram below:
However, as we have found by tracing the execution path that one time, calling the add command creates the parts (using the ParserUtil
methods) before the Person
itself. Additionally, when we call the edit command, a new Person
is created using the same containees from the previous Person
object, and those containees continue to exist despite the old Person
record being deleted. Is this still considered a composition in that case?
2. 💡 How-To: Rake symbol for PlantUML
I couldn't find a rake symbol in the PlantUML docs, but I did come across this here, and adapted it so it looks somewhat bigger and also works (because J is not a valid hexadecimal value).
Just include this in style.puml:
sprite $rake {
0000000000000000
0000000FF0000000
0000000FF0000000
0000000FF0000000
0000000FF0000000
0000000FF0000000
0000000FF0000000
000FFFFFFFFFF000
000FFEEFFFFFF000
000FF00FF00FF000
000FF00FF00FF000
000FF00FF00FF000
000FF00FF00FF000
000FF00FF00FF000
000FF00FF00FF000
0000000000000000
}
And when you want to use it in your activity diagram, just include !include style.puml
under @startuml
and reference it with <$rake>
(e.g :Do Something <$rake>;
and it should look this)
3. Missing primitive field - Jackson
If we store data as strings in json we can check if the data fields are there by checking if the input is null and throwing an IllegalValueException if so.
(e.g. below)
But is it possible to do something similar with booleans? After all, I cannot perform a boolean == null
in Java.
4. Necessity of merge nodes in activity diagrams
Are merge nodes actually needed? From the text book it would seem that the following is acceptable even though there is no merge before action B1:
In the quiz there was also a question where the alternate paths converged directly on the end node without having to merge too, so I was wondering if merge nodes are more of a "good-to-have" notation than a necessary one.
5. Codecov: No coverage uploaded for pull request base
One of my teammates raised a PR to our repo but Codecov threw this error message at us.
It says the error came from master@e6533c6
, which is the commit where we had merged another PR that had passed all the checks in gradle.yml
Unfortunately, the Codecov site I linked doesn't tell me how to resolve it, can anyone please help?
6. JavaFX runtime components missing (Gradle)
I followed the tutorial for setting up JavaFX via Gradle, but I am unable to run the application as I get the following error:
JavaFX runtime components are missing, and are required to run this application
How do I resolve this?
7
I've dug around some more and found this link over here
https://github.com/javafxports/openjdk-jfx/issues/236#issuecomment-426583174
The gist of it is that if the driver class extends Application
, it strongly requires JavaFX platform to be available as a module rather than a JAR. They recommend us to just create a different class with a main
method that does not inherit Application
.
8
It was discussed in here
javafxports/openjdk-jfx#236 (comment)
Simply put, just put the main method in a Launcher
class to avoid headaches. #128
9
Giving the link to the said PR might be useful here.
10
Thanks!
11
Hmmm... It seems that if it is a missing field Java will just assign a default value (false
), so I suppose I probably should stick to using strings instead
12
https://community.codecov.io/t/how-is-code-complexity-calculated/961
It is branch coverage. Perhaps try having tests that reach all possible decision points in a method's execution (e.g. if-else clauses or catch clauses).
@CodingCookieRookie
(12 posts)1. Issue with running jar file
Hi has anyone experienced this error before when trying to run a jar file? I am not sure what the issue is but my path seems correct when compared to my friend's. However when I tried to run the jar files of apps that work on other computers, the error below appeared on my computer. Thank you for your time to read nevertheless!
2. Coding practice dilemma
private void saveTasksToList(BufferedWriter bw, TaskList tasks) throws IOException{
for (int i = 0; i < tasks.size(); i++) {
Task task = tasks.get(i);
TaskType taskType = task.returnTaskType();
String taskInfo = task.returnTaskInfo();
String when = "";
switch(taskType.returnTaskSymbol()) {
case 'D' :
Deadlines deadline = (Deadlines) tasks.get(i);
when = " : " + deadline.returnTime().trim();
break;
case 'E' :
Events event = (Events) tasks.get(i);
when = " : " + event.returnTime().trim();
break;
default :
break;
}
String toWrite = taskType.returnTaskSymbol() + " : " + task.returnDoneStatus() + " : " + taskInfo.trim() + when;
bw.write(toWrite);
bw.newLine();
}
}
Hi everyone I just wanna ask about a question that I have encountered while doing the IP.
So what im doing here is typecasting the returned task to Deadlines because only my Deadlines and Events class got a returnTime() method. However, one of my teammates told me that a better way would be to have a returnTime() in the superclass Task, and then throw an exception in the returnTime() method of the Todos class. He claims that this saves code duplication which can be seen from the two cases above (can be combined into one in his method) and also allows for extension should there be more timed Tasks as well as removing typecasting (bad-coding habit). However, I was thinking that having a returnTime() method in Task breaks the polymorphism/inheritance law of including a method in the super class where one/some of the child do not use that method.
In this regard, which would be the better option?
3. javac not recognised as internal or external command
'''
Hi I changed my environment variables to 11.0 jdk bin already but it still doesn't work. May I ask what's the issue?
4
Ohh okay it works haha thanks!!! 😄
5
@Elgoh Hi May I ask what's the solution? Im facing this problem too haha
6
Hi prof just a question on the preferred tagging habit, if I have changed two tags simultaneously eg. A-OOP and A-Packaging, should we delete the old tags and retag them at the one updated commit or do we just leave the old tags where they are and write out the corresponding updates in the updated commit message?
7
Noted with thanks prof! 😃
8
My personal takeaway is (Do correct me if I'm wrong):
We should use assertions on private methods, to check if the else/default of a conditional statement is not reached (If it is not supposed to)
Generally, we should not use assertions for public methods and definitely not for plausible user input failures
Found this online, hope it helps 😃
Where to use Assertions
Arguments to private methods. Private arguments are provided by developer’s code only and developer may want to check his/her assumptions about arguments.
Conditional cases.
Conditions at the beginning of any method.
Where not to use Assertions
Assertions should not be used to replace error messages
Assertions should not be used to check arguments in the public methods as they may be provided by user. Error handling should be used to handle errors provided by user.
Assertions should not be used on command line arguments.
9
A little late but Poppins says better late than never 😉
10
Thank you @siangernlow and @Nahoyhp for your inputs and @damithc for the code edit. I felt that @siangernlow 's solution was most suited with my implementation and decided to adjust towards it. Will leave this open if it is ok for more ideas and inputs for anyone else facing the same issue 😃
11
I'm not 100% sure, but it looks like you're on Windows and tried to run the jar file from your WSL CLI. WSL operates in a virtual environment of sorts and does not offer proper GUI support, thus it will be unable to run this GUI application. You need to run the same command in powershell / cmd
Hi qwoprocks thank you for your reply but theres this other issue that pops out when I tried that.
12
@qwoprocks Thank you so much :DD Managed to finally work with post #25. Spent alot of time on this and it's finally resolved thank you lots!!!
@JinHao-L
(12 posts) 1
It might be that your tag for the levels does not point to commits in the main branch. Try checking if all the commits of the relevant tags can be found on your main branch.
2
Within a constructor, you can call other constructors of the class directly by using their corresponding signature.
So in your case, you can just use this in your no-argument constructor: this("./data", "./data/tasks.txt");
For your current solution, I believe you will be creating 2 Duke objects when u call your no-argument constructor
3
Try running the clean build on Gradle and then run your whole project again. It could be that the class files are not updated and hence the program does not reflect your changes to Main or Duke.
Let me know if it works 👍
4
5
If you are referring to displaying the check and cross on your GUI, you can refer to this: #159
6
Actually, I think you can just retag the appropriate commit. For me, I think of tags as a pointer and if it points to a commit that does not exist on main branch, you just have to manually change the tag to point to the correct one. (the correct one shd exist on the main branch)
This can be done by deleting the tag and creating a new tag. After that you can force push just the changed tag to update the remote github tag
7
These are not testcase errors, but expected error log output.
I think that these are the error logs that appears when error testing is done to ensure that the appropriate response is produced in certain scenarios.
If you refer to the Json file location, you can see that the file is actually in the test folder and named NonExistentFile.json. The error message corresponds to this file name.
8
If you click on the info icon at the ip dashboard, you can see what they are detecting to fulfill a particular requirement.
For Jar-released, they detect if a new release is made during this week time period. So the tag does not matter for this requirement.
9
Yep, don't have to make any changes. I did not use the A-Release tag too
10
Hi, I took a look at your codebase and I think that for JsonSerializableFinanceAccount
, the constructor should take in a ReadOnlyFinanceRecord
instead of FinanceRecord
.
A FinanceRecord
has an ObservableList
, while the interface just has the method.
I'm not really sure how Jackson reads the JSON object, but I think it is attempting to find an ObservableList
due to the parameter type in that constructor.
11
You can use the wrapper class Boolean
, it allows null assignment. (Not really sure if this is a good practise tho)
12
Not sure if this might help fix your issue, but you can try playing around with the VGrow
properties (setting it to always
for contents that should always increase in vertical height to max height, for example, your list of tasks)
Alternatively, you can directly put a VBox
into the ScrollPane
(if its the only item in your ScrollPane
)
@kc-98
(12 posts)1. JavaFXML file syntax
I realised alot of solutions for javaFX issues can be found on google, in a javaFX syntax. However, converting this into FXML style is really difficult, as it seems like there's literally almost no one using it and hence the lack of examples. Does anyone have like a FXML API or something? Any will be appreciated! Thanks!
2. Change in Duke constructor to suit JavaFX when extending from Application
Is this the correct way of using a no-argument constructor as needed when extending Duke from JavaFX Application?
3. Sourcetree hangs occassionally
Is anyone else experiencing sourcetree hanging often, especially on startup which it will take quite abit of time? I am running on a 4K laptop which might seem to be the issue but when I googled for help the fix doesnt work for me.
4. FC error
The following error occur when I run runtest.bat
These are how my files are arranged.
What might be causing the FC error?
5. Questions on customisation
To what extent customization is allowed? Can display messages be customized, e.g. instead of echoing "hello" with the input "hello" in level 1, I can change it to "Duke says: hello" to enhance the personality aspect, so long the functionality holds it will be accepted? Thanks!
6
For the NoSuchElementException, it might be the case that
sc.nextLine()
is called without checkingsc.hasNext()
. Since the test input.txt file is empty, it will throw an error when the scanner cannot find the next line.
I have editted this previously and resolved the issue! Thanks!
7
It might help to post the code of your Duke class (or whichever class that is using the Scanner object).
Only my duke class is using the Scanner object. I have emptied out my whole main method in Duke class but the FC error still exists.
8
I think my cmd somehow does not support the fc command line, i've tested on cmd on this laptop vs other pcs and only mine does not recognize fc
9
Only my duke class is using the Scanner object. I have emptied out my whole main method in Duke class but the FC error still exists.
This first error message usually occurs when you create the scanner object inside the loop. Instead, it should be created once (as a static variable) and reused for each loop. If not, the first scanner object will swallow all the lines from the input.txt and the subsequent scanner objects errors out with the error in your screenshot. That's why I wanted to see the code to confirm if that's the case.
The second error usually happens when you set the path variable inside the batch file, but instead of adding the JDK location to the existing path, you overwrite the path variable. In that case, Windows cannot locate the FC.exe anymore because Windows uses the path variable to locate exe files.
[RESOLVED] %SystemRoot%\system32 was missing from PATH in environment variables thus windows cannot call fc.exe
10
Thanks for the help!
11
Within a constructor, you can call other constructors of the class directly by using their corresponding signature.
So in your case, you can just use this in your no-argument constructor:
this("./data", "./data/tasks.txt");
For your current solution, I believe you will be creating 2 Duke objects when u call your no-argument constructor
Thanks! I am using that currently.
12
Try deleting the duke.jar file and build your jar file under Gradle tab -> shadow -> shadowJar.
@HynRidge
(12 posts) 1. How to delete unwanted directory from GitHub
[
](url)
I have some folder that I would like to delete in my remote repository. Currently in my local, I don't have all the directory that starts with the Capital letters, as I have refactor(by renaming) them to lower case. However, it seems that gitHub cannot detect that changes.
Anybody have an idea of how to delete the directory?
Thanks in advance
2. Forget to git push my code to the branch
Apparently, I forgot to push my local branch to remote branch and I only push my tag for branch level-7 and level-8. And I have merged both branch to the master too. I just want to know whether this is okay? If not, how can I solve this issue?
Thank you
3
Can you provide more context to your error?
4
I think it might be something about your path
5
you can do the following :
Type environment in your windows search bar
Then click on Environment Variables
Then on the System Variables section, click on Path and click Edit. Then, add your Java path (something like this C:\Program Files\Java\jdk-11.0.6\bin)
6
May I check that whether you run your runtest.bat when your directory is on the text-ui-test folder?
7
I had similar issue previously, and the problem is because I am running the "cmd.exe /c runtest.bat" command on the parent directory instead of text-ui-test directory
8
you might want to direct you terminal to text-ui-test folder (cd text-ui-test)
9
@damithc Prof, I was asked to execute this command "git push --set-upstream origin branch-Level-7"
Is this the correct command to do that?
10
Okay Prof..Thank you 😃
11
@MarcusTw Hi Marcus, thanks for the answer. Unfortunately, it doesn't work in my case because the Command folder/package is gone in my local repo. However, I tried running git rm -r Command
and it show an error message of "fatal: pathspec 'Command' did not match any files". May I know what is wrong with this?
12
@MarcusTw I am sorry, I was at the wrong directory previously. Now, the problem is resolved. Thank you!!
@florenciamartina
(11 posts)1. Cannot find symbol when running JUnit after merging and setting up the Gradle
I merged the add-gradle-support branch and set up the Gradle. However, when I tried to run the JUnit test with gradle, it keeps saying that it cannot find any class from my duke package. Any help would be appreciated. Thanks!
2. The runtest.bat cannot run because of an error and InvalidPathException eventhough I already followed all the steps
Please help! Thank you 😊
Originally posted by @florenciamartina in https://github.com/nus-cs2103-AY2021S1/forum/issues/6#issuecomment-674996725
3
hi! I followed the steps above but still got this error message:
Could Not Find MY_PATH\ip\src\text-ui-test\ACTUAL.TXT
error: illegal argument for -d: java.nio.file.InvalidPathException: Illegal char >*> at index 18: MY_PATH\main\java*.java
error: no source files
please help 😦 thank you
4
@theodoreleebrant no, they are all in the same folder ._.
5
@JingYenLoh hi, thank you for replying! Just to clarify, is "text-ui-test" folder supposed to be inside or outside src? Because currently it is inside src folder.
6
@erisjacey thanks 😄 I will try again!
7
Hi, so somehow I managed to make it run.
Error: Could not find or load main class Duke
Caused by: java.lang.ClassNotFoundException: Duke
Comparing files ACTUAL.TXT and EXPECTED.TXT
***** ACTUAL.TXT
***** EXPECTED.TXT
...bot's output
so it runs but when I go to ACTUAL.TXT, it is empty.
8
@HynRidge thank you!
9
@erisjacey it works now! thank you for your help.
10
I got this exact same problem 😦 Can you share your solution in case you solved this? Thank you 😊
11
Hi @madanalogy Thank you for your reply!
I found the problem and solved it. Turns out, somehow I accidentally deleted the main/java folder, so all of my codes are directly in duke folder. When I created new directory main/java, everything works fine.
@Nahoyhp
(11 posts)1. Helps With CI
Hi all,
I have this problem when I try to run CheckSttyle on our desktop and it shows no error.
But when I upload to a branch which is submitted as a PR, the CI test always fail, and the reason is always some checkstyle, mainly trailing white space or no new line at EOF. [Example below]
I have tried following the instruction from the 'A-CheckStyle' portion in IP.
Anyone knows what can I do to get the same level of CheckStyle as the CI???
Thanks.
2. Cant find Gradle Tool Bar (aka the elephant / Execute Gradle Task
Hi all, for the level "A-Gradle", I have merged the branch "add-gradle-support" into my new branch "branch-A-Gradle'.
I followed the instructions but at the end I am confused whether or not I did successfully.
IntelliJ managed to run everything without error and generated Gradle-related files under External libraries. But I can't find the Gradle tool bar at the top.
I have tried to delete the .idea file but don't help. Anyone have suggestions on what to do?
And how can I check if my "gradle installing" is successful?
3
@tohyuting Are you using Windows? Because I can't find it on my screen.
4
@tohyuting Thanks. It works.
Sorry for causing the trouble. Totally don't see it.
5
Hi @thutahw, i think you have installed it successfully.
I encountered the same problem before and apparently the Gradle button is now on the right, (as shown in picture below)
6
Upz la. I goggled for 20 mins and can't find an answer. I try my luck on forum and got it.
Really thanks man.
7
I think another way to work around to wrap the class around Optional. So the time variable will return Optioanl.empty. With that you can do it with one if statement.
Alternatively, you can implement a general toSaveFormat() in Task interface/abstract class, then Override it in either TimedTask (if you decide to have another layer) or in both Deadline and Event.
Hope this help.
8
Hi,
Did anyone success in getting it on Window 10 Home?
I try the links above and it is not working. Apparently, Sandbox is supposed to be features for Pro and Enterprise and some said that Microsoft has found the bugs that allow us to use on Home Edition.
So I am just wondering if anyone success and can share their methods.
Thanks
9
@damithc Sorry Prof, I take the screenshot from the wrong PR. But the forum that you mentioned indeed solved my problem. Thanks Prof.
10
For those who want to set up your intelliJ in one go, take a look at these following related issues:
#276 - To automatically remove trailing white spaces.
To remove the wildcard in imports, [For Window] Go to Setting > CodeStyle > Java.
Then "set class count to use import with *" and "name count to use static import with *" as 999.
Scroll down and re-order of Packages as the following:
*PS: I learn the second method from the same website that teaches us how to set up Gradle and everything. But I can't find the website link now. Appreciate if someone can post the link. Thanks.
11
Is there a way to just disable it?
For now, I just remove the whole block.
I have try commenting out the whole block of code in .github/workflow/gradle.yml.
but does not seem to work [Have other weird error].
@theodoreleebrant
(10 posts) 1. Appropriateness of top-level static class
The question is simple: would it be appropriate (in the context of this project) to have a "static" class?
I define a "static" class in the following manner, since top level classes can't be static by definition:
Only the default constructor is used, i.e. not declared
All methods are static
Take for example the Parser class (talked in A-MoreOOP last week). I do not see a reason to make the class not "static" for the following reasons:
The default constructor will work fine (I do not need to pass anything, there are no instance variables)
For every single method, there would not be a difference in behavior if I:
a) Make the class non-"static" and instantiate it (e.g. Parser parser = new Parser();
followed by parser.parseCommand();
)
b) Make the class "static", and use the class (e.g. Parser.parseCommand();
)
And this introduces several advantages, without any apparent disadvantages that I can see directly:
There is no need to pass by reference if you need it - it's available for every single class to use
Save a little bit of space in coding since you do not need to instantiate it
Again restating the question: would it be appropriate to have a "static" class? Looking for any input. Thanks!
2. Exception Handling
If I'm not mistaken, an exception would cause the program to terminate. Is there any way to throw an exception without exiting the program?
For context, I have the following pseudocode:
while (true) {
wait for input
receive input
try {
do something with input (e.g. todo, bye, etc.)
} catch (Exception e) {
print stack trace
}
}
But this would exit the program given an illegal input.
3. Advantages of inheritance(Level 4)
What is the inherent advantage of using inheritance instead of, let's say, enums for the type of tasks in Level 4? As I see it, using inheritance introduces certain inflexibilities (e.g. having a need to add new classes to create any further type of task) as compared to enums. Additionally, enums might have some advantages in pattern-matching (although Java being Java...)
4
Actually now that I think again about it, they might have differing behaviours in the future...
5
Do you have more than one java file? The above suggestion changing Duke.java
to *.java
works for me.
6
Related stackoverflow: https://stackoverflow.com/questions/48871445/javac-java-windows-command-line-error-as-illegal-chacter
Do you put your java files in separate directory @florenciamartina?
7
Dis you branch it out from branch-A-JavaDoc instead of master? Just to resolve ambiguity.
If that is the case, here is a solution: https://stackoverflow.com/questions/8428587/git-created-new-branch-from-a-wrong-branch
8
Thanks for the insight!
9
If not wrong, there is also a button to restart the CI! So you don't need to close and open the PR.
10
(no idea how to reopen, but super closely related qn, help @MarcTzh @damithc )
How do we then draw this if there are more than 3 branches?
@xnmng
(10 posts)1. NullPointerException in MainWindow.java
Hello I'm unsure why I'm encountering this error in my MainWindow.java (line 28)
Basically, I want to print my intro message on JavaFX but I don't see where the bug is...
Attached below is the error I encountered.
2. JavaFX not showing list + responses properly
When I run my launcher and type list, it works as per normal. however, when I test out other commands, my program responses are shortened with "...".
Also in general, all the responses from my program have 2 white lines above... how do I remove this?
Did anyone encounter this issue and how did you solve it?
(first pic: everything is as intended)
(second pic: issue I encountered)
3. gradle unable to run after implementing JavaFX
I'm unable to run my project using Gradle after implementing the JavaFX component of iP.
I'm certain it has something to do with my build.gradle, so I included my file below, along with the error message.
4. problem with javaFX tutorial part 4
I'm currently at the end of part 4 in the JavaFX tutorial (which I followed to a T) but I encountered an error...
Could anyone suggest how to fix this? Im thinking it has something to do with the weird implementation in DialogBox.java
5. Typo in UML Class Diagrams → Associations → Multiplicity
I believe "linked to" is missing in the mentioned exercise option (d)
was reading https://nus-cs2103-ay2021s1.github.io/website/schedule/week4/topics.html when this caught my attention.
6. iP Level-10 Error: Caused by: java.lang.NoSuchMethodException: Duke.
Hello does anyone know how to solve this error?
followed the JavaFX tutorial but encountered this error...
7. Typo on https://se-education.org/guides/conventions/java/intermediate.html#conditionals
There seems to be an extra bracket on this "bad" example, at the end of line 2.
(sorry in advance if this is the wrong place to post a typo)
edit: sorry i meant bracket
8
You can just remove the
new ImageView
from thehandleUserInput()
function. The twogetDialog
functions are expecting anImage
and not anImageView
.
thanks! i also replaced userText and dukeText with userInput.getText() and getResponse(userInput.getText()) respectively. (for anyone else who might need this)
9
@tankangliang it worked! thanks!
10
@tankangliang thanks!
@jh123x
(10 posts)1. Unable to Run address book level 3
>br>
>br>
>br>
Literally uninstalled all Java versions and installed >b>Java 11>/b> before starting this module
>br>
Tried running it on IntelliJ but encountered the exact same code trace
>br>
Things I have tried:
Tried to run using IntelliJ
Tried to run using command prompt
Tried removing 1/2 of the paths at a time and running addressbook.jar
Things I might try later (Will update here later after I try)
Cloning the Java file and compiling it and running it
Compile the Jar file from source code and running it
>br>
It mentioned the bug was fixed in Intellij as mentioned:
>br>
But I am still encountering the bug, not sure what is causing it
Has anyone encountered any similar issues when trying to open addressbook 3?
2
Tried removing 1 at a time and running addressbook.jar
The path on both the local user path and the system paths are the same
Same error on both instances
3
You can open the conflict in visual studio code, there will be buttons to allow you to accept one side or another or edit either one of them before resolving the conflict.
4
Is the path for the module test marked correctly?
You can refer to here if that is the case.
5
You can significantly speed up Git on Windows by running three commands to set some config options:
git config --global core.preloadindex true
git config --global core.fscache true
git config --global gc.auto 256
This might help with sourcetree lagging
You can take a look here too!
Source: here
6
It will look something like this when you draft a release.
the A-jar goes into the Tag Version and the Duke v0.1 goes into the release title I think
7
Intellij was using JDK 11
There was a weird bug where there was 2 JDK but they were not showing up in the control panel correctly and not reflected in Intellij.
Went to the Java folder and manually deleted the rest of the java files and the address book worked.
Thank you for all the help @j-lum !
8
Maybe add this to your build.gradle might help
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
9
It might be because the constructor for Duke has an argument.
Might need to make a constructor which has no arguments as input.
10
https://github.com/google/gson This is pretty good as well
@Caiyi34777
(9 posts) 1. Merging PR not detected, where have I done wrong?
Sorry for asking at the last minute but I do not know what went wrong with my merging PR.
What I have done was:
commit in a branch
go to github and create pull request from that branch to master in my fork
merge to my fork ip/master with commit
My current state is:
Here's the screenshot of my GitHub "branches" page:
Here's the screenshot of my GitHub "pull request" page:
Here's the screenshot of my tracking diagram in sourcetree:
I thought that it was not detected is due to dashboard not updating and did not think it as a big issue. However, I got to know that dashboard has updated today in the afternoon and I went crazy 😰
😭Thank anyone who will help me with my issue
2. Creating jar again no main manifest attribute
Previously I have followed tutorial from https://se-education.org/guides/tutorials/jar.html to create a JAR file with Intellij IDEA, and everything worked. When this week I attempted to create a new JAR file, it says "MANIFEST.MF already exists in VFS".
So I did the following things:
delete the whole folder in src/main/java/META-INF
delete the old jar file "ip.jar" in out/artifacts/ip-jar
follow the tutorial again to try to create a new jar file again
However, it showed "no main manifest attribute, in ip.jar". When I copy & paste the new MANIFEST.MF file into the folder out/artifacts/ip-jar, it showed the same error message as well as the "duke.Duke" is highlighted as red. (I guess it is due to the wrong directory but I try different forms and fail to correct it) (Duke.java is inside the duke package)
The content of MANIFEST.MF is simply:
"Manifest-Version: 1.0
Main-Class: duke.Duke"
My directory is like this.
I have seen the post https://github.com/nus-cs2103-AY2021S1/forum/issues/207 but I do not understand it clearly and I am still confused. Also because I am using IntelliJ instead of gradle to generate jar files.
Please help 😦(
3
Is this the correct tutorial of building jar files with gradle? https://se-education.org/guides/tutorials/gradle.html#creating-a-jar-file
I do not think it provides enough details to follow...
4
Hi, I have met the same issue yesterday when I used IntelliJ to build the new Jar file. However, I later tried to use shadowJar in Gradle to produce the new jar file and it finally worked. Hope it helps!
Thanks! I have generated the jar file by using gradle!
5
Thanks prof! That is way clearer!
Another thing (not related to this issue) I want to bring up is that instructions installing checkstyle plugin using intelliJ may not be updated since the window is slightly different on my computer. For example, instead of "Browse Repository" which is stated in the instructions, it should be directly searching in the "marketplace".
6
Hi, I think your jar file is somehow complied using java 13. Maybe double-check your intellij java settings and create the jar file again?
7
Thanks prof! I feel better now!
8
I guess I have a similar problem with codecov. After some googling, I changed fail_ci_if_error to false in the file workflows/gradle.yml and everything works. I don't know exactly how it works though😂 but I hope this will provide some insights to your team
9
Change fail_if_ci_error to false and everything will work then
@Lingy12
(9 posts) 1. Problem with using launcher to trigger the app
I follow the tutorial and try to run my app, but this error occur:
I trace the stack, it seems like it hasn't reached the launcher.main(), it seems like the setting problem. Is there anyone can solve this?
2. Uable to perform unit test using gradle
I have set up the Gradle and it can run the program, but when I try to perform unit test, there are some problem. Here are the pictures of my build.gradle and one unit test class:
From these pictures, it seems that my test class cannot recognize another package, also, it cannot recognize assertEqual as well, the error message is like this:
Does anyone know what's the cause of this? Is it the dependency problem?
3. Question About Immutability of Class
Regarding the convention described in the code standard, there is nothing say about immutability.
As we know, immutability can support method chain for testing, so when is a good practice to have an immutable class?
Here is one concrete example of the testing:
I did not make my arraylist as private final. If I want to make it private final, I need to make my method markDone(),add,delete... etc return a TaskList object.
Now my testing is like this:
If I make the TaskList and Task immutable and declare a getter function for specific index of TaskList, it is easier for testing. We can just use:
AssetEquals(sample.markAsDone().getStatus(), list.add(sampleInList).markDone(0).get(0).getStatus())
after instantiating three objects to test the output.
So the main point is, when should we have an immutable class?
4
Since the IntelliJ's encoding is correct, maybe the problem of encoding of command prompt or windows system?
5
Sorry for the confusion, what I mean is just about immutability. Nothing about static.
6
Hi, if you mean to use the jar file for testing. Is it possible that you haven't rebuilt the jar file? So the source code still cannot recognize the clear command.
7
actually IMO the whole concept of immutability in java is kinda pointless because it does not have "const-correctness" like other languages. Just because your
taskList
is markedprivate final
, it doesn't mean the list itself is immutable, only that the reference to the list is immutable.
you can't reassign the list to another new list, but you are totally free to append/delete items to/from the list. in fact, having a getter allows other people to do
list.getTasks().clear()
or something else to modify the list.
Oh yeah. If it is really immutable, I should not have the getter method, since all class are passing by reference. But there is a possibility to always use the clone() method to clone the list and pass it out. Because my usage of the getter is just to see the content, it's kind of force the use of the getter method is only to see the content because modifier on this list after cloning is kind of useless (because it will not change the object itself). But I just feel like this is not a good practice considering the efficiency.
8
Hi there Lingy12 I am not entirely sure since your screen shot cut off the import lines above, but you could try adding this import line. The error looks like its due to u importing the wrong line. Cheers!
import static org.junit.jupiter.api.Assertions.assertEquals;
Yes you are right. After merging the branch to support gradle, the import line just magically disappear. After I add it back, it works now.
9
Solved,Turns our I put the images to a wrong directory.
Thanks for the reply above.
@MatthiasLHK
(9 posts)1. What kind of actions are considered to be breaking the Brown-Field aspect of the TP?
For those groups who are doing MORPH, what are some of the actions that will break the idea of a brown field project?
2. Why in AddressBook3, Parser is an interface while Command is an abstract class?
What is the point of making these 2 super classes different? As personally, i feel that Parser should also be an abstract class as it does not make sense to be able to instantiate an Parser object.
3. My Github CI fails for all 3 platforms, but I can run the tests locally.
Currently trying to fix my my CI fails for all platform.
Here are the fail errors in Ubuntu, MacOS, Windows respectively
And here is my gradle.yml file:
name: Java CI
on: [push, pull_request]
jobs:
build:
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
runs-on: $
steps:
- name: Set up repository
uses: actions/checkout@master
- name: Set up repository
uses: actions/checkout@master
with:
ref: master
- name: Merge to master
run: git checkout --progress --force $
- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
- name: Setup JDK 11
uses: actions/setup-java@v1
with:
java-version: '11'
java-package: jdk+fx
- name: Build and check with Gradle
run: ./gradlew check
4. Tasks not being marked as completed in the iP progress dashboard
Hi, so I have push and completed all the levels and increments and push them to the Github, but some of them are not being marked as done. For example, both my merge level 8 and merge level 9 are being being marked as done despite it being completed. But later levels are being marked as completed, so I am not sure if its become I did it wrongly. Anyone can help? Thanks!
5
So based on what I know, generally it is safer to us immutability. I understand that using mutable objects are easy to work with and use, the benefit of using immutable objects is the reduction of side effects. I'm sure you have seen first hand the possible side effects of using mutable objects. Immutable objects are more troublesome to use, but it allows you to add-on future areas without having to worry about the side effects it may cause your existing functions. But having said that, I'm currently not using immutable objects as well purely due to it being more troublesome to work with and due to time constraints hahah.
6
Dear, prof
Im so sorry that I just show this. But may i ask how do i fix this? Do i revert back to this commit and push again?
7
I reverted back to the merge commit and re-tagged this level and pushed into the repo. I hope this will work!
8
still doesnt work
9
After consulting with prof, this is what I understand:
We should not be starting on a clean slate and copying the relevant codes into the new slate.
We should keep our new morphed idea as close to the AB3 as possible, it shouldn't be too different from the code provided.
Do not make too much deletions of the current legacy code.
For those who have broken any of these rules, you should start to get back on the brown field track asap.
@printinghelloworld
(9 posts)1. Warning whenever I run my GUI app
I'm facing a weird issue whenever I run my GUI application. Although it doesn't affect the functionality of my application, it's kinda irritating.
Whenever I launch my application either using IntelliJ or from Windows cmd, I'll keep seeing these warnings appearing.. Currently, my javaFxVersion in build.gradle under dependencies is '11'. Does anyone have any idea on how to resolve this? Thanks in advance!
2. Wrap text bug for GUI
Hi everyone, I'm facing a rather weird bug for my GUI and I think it's related to wrap text.
When I first run my program, I'm able to view all the items in my list.
However, once I reach the bottom of the application, the items will be 'cut off' as shown in the image below
I've checked the Wrap Text option for my Label (that stores the replies from Duke) and I'm currently using the option 'USE_COMPUTED_SIZE' for all the height and width settings (min width, min height, pref width, pref height, ... etc)
Please give me some advice, thank you in advance! 😃
3
Just curious, may I know how do yall know that the version of the checkStyle is 8.32? I know it's mentioned in the GitHub's commit for the checkstyle.xml but I don't see '8.32' appearing in the checkstyle file itself. I wonder how Gradle checks for this number. 😕
4
Go to the
[root]/build.gradle
file, you should see this:
Hope this helps!
Oh I think you misunderstood my question haha, I'm asking how does gradle check for the number 8.32, as it was only mentioned in the commit header but it wasn't mentioned in the xml file itself. Thanks for answering though!
5
Sorry I realised this question was already answered and I was searching with the open issues filter on 😅
6
I think this warning is caused when you use scene builder to edit the fxml. I was able to clear this warning by changing the xml namespace of the root elements in the FXML files to this
xmlns="http://javafx.com/javafx/11.0.0"
.
I also experienced the same issue, but what I did to fix it was change my JavaFX version in my build.gradle to 11.0.1
Both methods works! Thank you @ktaekwon000 and @AdithyaNarayan!
Just wondering though, is there a preferred way or are both ways acceptable?
7
I think Gradle does not actually know the version, and completely relies on whatever number you put in the build.gradle file. Its just that the structure between checkstyle of version 8.32 and 8.23 is different so if you tell gradle that you are using 8.23 then they will give you an error because the structure seems wrong to them. I only knew the correct version from the commit header too.
Ah I see.. Thank you @qlchan24!
8
I guess my method might cause our build.gradle to deviate from the rest of the cohort? I'm not sure what downsides this will have, but I suspect its not very relevant because there's already people modifying their build.gradle to use external libraries and such.
About Adithya's method, I personally havent tried it myself so I'm not 100% sure, but I suspect you'll have to edit the .fxml file to change the version string every time you edit something in it with the scene builder. I don't have experience with this though so it would be nice if someone who did that could test it for me.
Thanks ktaekwon for sharing! I guess the best option right now would be to follow his method and change the JavaFX version in our build.gradle to 11.0.1. I'll be closing this issue.
9
In case anyone is still struggling with Graphviz installation:
Simply go to download link to install the zip file
Extract the folder to your Program Files
Open your command prompt, navigate to the location of the bin folder and type dot -c
Type dot -v
and you should see the version of Graphviz that you've installed.
Follow Step 2 in the diagram below and everything should work fine.
@junlong4321
(9 posts)1. TEAMMATES final evaluation bug
Expected : module-related
2. Week 13 Project Bug
Expected : Contacts Plus
Actual : ContactsPlus
3. W11.2 Typo
4. JUnit Vs Assertions
Can we see assertions as a form of unit testing for functional code?
Since it is mentioned in the textbook that "junit and assertion are similar in purpose but JUnit assertions are more powerful and customized for testing"
5. Whats the difference between these 2 types of association lines on the UML diagram?
6
Hi Prof, just to clarify further. This means both children and fiction are in the same arraylist of the same class, and hence they "know about each other"? (Ie Bidirectional navigability)
7
8
I think in that case, for Q52 Week 5 Quiz, it is more suitable if the question is framed as "Java assertions are used in unit testing" rather than "Java assertions are used for unit testing." ?
And assert can refer to either Assert.AreEqual in unit tests or assert in functional code so it wasn't stated clearly in the qn?
Not sure if i'm missing anything out in my reasoning but please do lmk if anything seems wrong
9
@damithc I think "appear" missing in here?
@mkeoliya
(8 posts) 1. [External Library Permission Request] Jackson Dataformats Text
Use the csv
submodule to write/read between JSON and CSV files.
2. Throwing checked exceptions in constructors
Is the throwing of checked exceptions in constructors considered poor practice in software design?
For illustration, consider a checked exception called DukeException
, a class called Task
and the scenario of say, writing a command "todo" without any description.
Case 1: The Task
constructor throws a DukeException
on being passed a null
string as description.
The benefit (per my understanding) is that it localizes exception logic to the Task
class. However, this would imply that any user of the Task
class must always wrap object creation in a try-catch
block (not sure if this is problematic).
Case 2: The user creating Task
objects raises a DukeException
for a null string before calling the Task
constructor. A benefit is that it avoids problems with object initialization, creation or memory usage. However, this might lead to duplication of code (for example, if neither Todos
, Events
or Deadlines
(which are all Tasks
) are permitted to have empty descriptions).
Could someone throw some light on my dilemma (or possible point out flaws in my reasoning?). Thanks in advance!
3
Sorry Prof, my bad! I meant for the first sentence to read as follows (with the addition of the bolded text):
Is the throwing of checked exceptions in constructors considered poor practice in software design?
Should I edit the question inline with this, to keep the discussion here more streamlined?
4
I think that rounds it off! Thanks @erisjacey @sudogene @tankangliang for the holistic suggestions.
@damithc Is it fine to close the issue?
5
Building off OP's question (note sure if this is tangential), in the case where we do indeed pick an arbitrary non-boundary value, does it help by picking the most likely option? In other words, if I know that a particular option is most liable to be selected by the user, and I use that option as my "arbitrary" value?
If so, would this fall under scenario testing?
6
Alternatively, would it be wise to include designs for potential features that the team doesn't plan to add for this semester, but would be useful for, say, v2.0
? This is an approach that the AddressBook-3 Developer Guide uses.
7
Ah, so there's a lot of considerations (type of test, type of bug, catchability) that I should keep in mind while writing tests in EPs. Thanks for highlighting Prof!
8
Can you click on "Details" for the MacOS job to view the error message, and let us know exactly what the issue was?
@kormingsoon
(8 posts) 1. 💡iP Week 5: PR Increment Tip (PR made to nus-cs2103-AY2021S1 instead of own fork)
I noticed a (small) number of people having the issue as I had following the instructions from the Week 5. The issue being that when we followed the instructions in the for the merging of Pull Request (PR), the PR was instead made to the nus-cs2103-AY20221S1 fork instead of our own master branch.
I will just do up a short guide to aid others alongside what is given in the iP instructions to aid those not as well versed with github (as I am).
The assumption so far is that you are able to push the branch to your fork in github. I will continue the steps thereafter from the assumption.
Go to your iP Repository
Go to the branch that you want to create the PR from. (e.g click on branch-A-Lambdas)
From here you can then proceed to create the pull request, the interface thereafter from here is rather intuitive, hence, I will only cover up to this point. Feel free to ask questions if you encounter further errors!
2. Cannot run JavaFX
Anyone encountered this error as well?
Followed the steps in the github but can't seem to run JavaFX despite setting up all the stuff.
Based on what I see, my MainWindow.fxml and DialogBox.fxml cant seem to be able to access my MainWindow.java and DialogBox.java
String value = "Exception in Application start method
Exception in thread "main" java.lang.RuntimeException: Exception in Application start method
at javafx.graphics/com.sun.javafx.application.LauncherImpl.launchApplication1(LauncherImpl.java:973)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication$2(LauncherImpl.java:198)
at java.base/java.lang.Thread.run(Thread.java:834)
Caused by: java.lang.IllegalStateException: Location is not set.
at javafx.fxml/javafx.fxml.FXMLLoader.loadImpl(FXMLLoader.java:2459)
at javafx.fxml/javafx.fxml.FXMLLoader.load(FXMLLoader.java:2435)
at duke.Main.start(Main.java:23)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:919)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$11(PlatformImpl.java:449)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$9(PlatformImpl.java:418)
at java.base/java.security.AccessController.doPrivileged(Native Method)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:417)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:175)
... 1 more
"
💡 You can use Markdown to format your text
3
Resolved it, naming issue due to Package
4
This is likely got to do with the path settings as Kang Liang, I spent a great deal of time solving it and resolved it just as how Kang Liang suggested.
Suggestion for places to check:
the .getResource( >file path> ) > mine is /view/DialogBox,fxml (or /view/MainWindow.fxml for Main.java)
.getResourceAsStream("/image/>filename>.png")
5
Thanks for the tip!!
6
Repost, please pardon the naughty pichu 😄
7
Hey bro!
Can I check if you put the Launcher class in the package / folder? e.g if your package name is duke
then you should have it as follows.
In my case, the package of which my Launcher lies in is in the package duke
.
application {
mainClassName = "duke.Launcher"
}
8
Hello! For this I realised the issue was in build.gradle
under my main application
. I resolved it by redirecting my mainClassName with the package name e.g duke.Launcher
.
I would suspect it might have to the with the package / directory issue given the similarity of the error. But note that I did not encounter the load() error as you did. But I would strongly suggest looking at how you reference the class names or file names.
Also, if your JAR files are not being added inside (as per your suspicions):
Maybe you can check your dependencies
in build.gradle
? Does it contain the JavaFX dependencies as shown below. I also encountered this but realised I carelessly deleted the dependencies as I drowned in gradle.
dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.5.0'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.5.0'
String javaFxVersion = '11'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
}
@Royxuzeng
(8 posts)1. cannot import the gradle file
For increment A-Gradle, I created a new branch and merged the given "add-gradle-support" branch to it. After that, I clicked on the file->open, and opened the build.gradle file as a project. Then I closed the intellij and restarted it and imported the gradle script as suggested by intellij. However, I do not have the project tasks in the gradle toolbar and I also got an error that says "Cause: zip END header not found". Can anyone give me some suggestions on how to fix this? Thanks!
2
Hi, sorry but what do you mean by corrupted cache?
3
Hi, sorry but what do you mean by corrupted cache?
I think you can try to delete the .idea folder and re-import the project, then rebuild the project. Hope it helps! : )
Hi, thanks for the advice. But when I delete the .idea file and restart the intellij project, it still tells me that zip END header not found. And another issue that arises by deleting .idea and restarting the project is that intellij now cannot run the java files(i.e, the java files are not recognized as runnable). so I am very confused about it..
4
Try clearing gradle's cache instead of intellij's cache.
Hi Jeffry, how do I clear gradle's cache?
5
how do I clear gradle's cache?
Sounds like this is a general-enough question to have answers on the interwebs already. 😃
Try Googling and see if something useful comes up. If it does, don't forget to share.
so I tried to delete the gradle-6.2-bin and run the project in intellij again. But when I entered gradlew --version in the command line, the following error occurred.
And again in intellij it tells me that it cannot import the gradle file and the error message says "Cause: zip END header not found". So I am not sure if clearing gradle cache works. I also tried to reinstall intellij but that couldn't work either.
6
@Royxuzeng You can also try using a fresh clone of the ip repo, and go through the steps carefully to step up gradle for it, just to see if the same problem occurs there as well. That will help you determine if the problem is inside your current iP project setup or more systemic to your computer/OS setup.
I tried to use a fresh clone of the ip repo but the same problem occurred so I think the ip does not have problems. When running gradlew --version in the command prompt in the project root folder, the error occurred that it cannot unzip the gradle-6.2-bin.zip so I think it might have something to do with it but I am really not sure how to fix this issue.
7
Update: problem solved! It was because the internet was not very good so the gradle file was not properly downloaded and therefore it cannot be unzipped.
8
@GilbertTan19 , hi can I ask how did you manage to solve that issue?
@seanjyjy
(8 posts)1. Queries regarding string for coding standard
Take for example a class that holds strings like that
public static final String DASH = "-";
public static final String SPACE = " ";
Lets say we have another string which is something like
public static final String EXAMPLE = "How-Are You?";
Should we abstract it to become
Version 1
public static final String EXAMPLE = "How" + DASH + "Are" + SPACE + "You?"
or remain the same?
One of it will improve consistency but deprove readability, vice versa
2. Format of Parameters in method and array
Hi, take for example, let's say I have a method with many parameters. what is the proper way of formatting it?
Q1) Adapted from ab3
Format 1
/**
* Constructs a {@code JsonAdaptedPerson} with the given person details.
*/
@JsonCreator
public JsonAdaptedPerson(@JsonProperty("name") String name, @JsonProperty("phone") String phone,
@JsonProperty("email") String email, @JsonProperty("address") String address,
@JsonProperty("tagged") List<JsonAdaptedTag> tagged) {
this.name = name;
this.phone = phone;
this.email = email;
this.address = address;
if (tagged != null) {
this.tagged.addAll(tagged);
}
}
Format 2
/**
* Constructs a {@code JsonAdaptedPerson} with the given person details.
*/
@JsonCreator
public JsonAdaptedPerson(@JsonProperty("name") String name,
@JsonProperty("phone") String phone,
@JsonProperty("email") String email,
@JsonProperty("address") String address,
@JsonProperty("tagged") List<JsonAdaptedTag> tagged) {
this.name = name;
this.phone = phone;
this.email = email;
this.address = address;
if (tagged != null) {
this.tagged.addAll(tagged);
}
}
Q2) For long array indentation what should be the indentation be then? And should it be 4 or 8 indents?
Format 1
int arr[] = {
"hello world",
"hello world",
"hello world",
"hello world",
"hello world",
}
Format 2 (8 indents)
int arr[] = {"hello world", "hello world", "hello world", "hello world",
"hello world", "hello world", "hello world", "hello world" }
Format 3 (4 indents)
int arr[] = {"hello world", "hello world", "hello world", "hello world",
"hello world", "hello world", "hello world", "hello world" }
Thanks in advance.
3. Unable to run JavaFX GUI for Java 11
IntelliJ version: IntelliJ IDEA 2020.1.2
Java version: 11.0.8
OS: macOS Cataline Version 10.15.5
Problem: Unable to run the JavaFX GUI.
Error Message: Error: LinkageError occurred while loading main class Launcher
However, if I were to change the Java Version to 14, it will work. Is there any way to make it work for java 11?
4
Not sure whats the problem but for java 14, i can press the green button to run as well as gradle run to run.
However in java 11, i have to use gradle run to run, green button doesnt seem to be working.
5
@damithc Thanks for the clarification.
6
Hi Kc, I believe most of the properties in FXML are available in the JavaFX documentation under the properties portion. And most of it follows the notation that we have often use such as setSOMETHING. And SOMETHING would be the FXML properties.
Some examples are
setAlignment (java) -> alignment (fxml)
setBottomAnchor (java) -> AnchorPane.bottomAnchor (fxml)
In the case where properties are not available, most likely than not, that method you have seen is only available as a method in java such as binding of heights
Also if you are ok with CSS, you can consider using JavaFX CSS instead. Note that there are some FXML properties that are not available in CSS as well. https://openjfx.io/javadoc/11/javafx.graphics/javafx/scene/doc-files/cssref.html
You can also look at the CSS properties to convert it to fxml properties like fx-fill-height
in CSS is equivalent to fillHeight
in FXML.
7
Thanks for the insight @damithc
8
@damithc . Hi Prof, can this be applied to the sequence diagram as well? (or whatsoever diagrams). It helps the diagram to be more compact and readable.
@daongochieu2810
(8 posts) 1. [External Software Permission Request] IKonli
Provides modern icons and fonts
Apache
2. [External Software Permission Request] DataFX
As a bridge between fxml and java classes
NA
3
Class-level members can be accessed by using class name AND an object/instance of the class. So the answer should be correct.
4
I tried adding a conflict marker in a text file ( with an existing commit id) and it seems like git won't generate such conflicts and manually entering conflict markers will not work. If you want to create conflicts yourself, you need to use git commands as https://stackoverflow.com/questions/52614012/manually-create-markers-like-git-merge-with-conflict-from-a-diff shows
5
To delete a tag, I use git tag --delete origin tagname
. Just make sure that the tagname does not clash with any branch's name or it will delete the branch as you said. The former method you used is indeed safer and it works for me, but remember to delete to local tag also.
6
The AnchorPanel should have fx:controller
, you should add the package path to your MainWindow here (default is MainWindow)
e.g fx:controller="duke.MainWindow"
7
The above response is expected as your code violates some coding standards which could be found in the html file generated. To resolve this, simply open the html file and fix all errors specified.
8
I suppose the runtest script is not linking javafx (3rd party library), thats why it says those classes do not exist.
On a side note, the runtest is to test the text UI, but since you have added GUI, the text is not in standard output anymore which could not be tested by the script. You can use Junit to test methods output though.
For actuall GUI testing, we need another 3rd party library, maybe Espresso?
@Wincenttjoi
(8 posts)1. Typos for Week 10 slide and quiz
Hi Prof, am here to just report a few small typos made in week 10 slides
Under Command Pattern section
In week 10 quiz
Not here to nitpick but just informing in case you're unaware and want to make changes, thank you!
2. Clarification regarding peer review frequency
Hi Prof! I would like to clarify if peer reviews only need to be done in week 4 (as assigned) or do we have to
review 4 out of 6 weeks too?? Thank you! Although we pretty much can't change anything by now..
3. Error: JavaFX runtime components are missing
I have this error when running from the Main class. The thing is everything runs fine if its initiated from Launcher class.
Does anyone have the same issue?
My current implementation in Launcher class is this:
'
public static void main(String[] args) {
Application.launch(Main.class, args);
}
'
4
That is because your path will read from where you run the command, meaning running from runtest.bat vs Duke class would have different starting file location. One way to solve this is by doing this:
public final static String FILEPATH = System.getProperty("user.dir") + (System.getProperty("user.dir").endsWith("text-ui-test")
? "/saved-tasks.txt"
: "/text-ui-test/saved-tasks.txt");
This assumes that you put your storage inside text-ui-test, you have to adjust the accordingly depending on where you put your storage file.
Use this FILEPATH as an argument in your FileReader/Writer. Hope this helps!
5
Are you trying to merge the level branches with master branch? If so, you have to ensure that you are at master branch before pulling other branches.
Use git branch
to check the branches available in your code, and use git checkout >branch_name>
to enter the branch.
Once you're at master branch, enter git merge --no-ff >branch_name>
Not really sure whats the best way to move forward as I do not know your current github status (since udk too..) but the best bet would be forcing yourself to move to a particular commit. You can check on github with commit code you want to revert your work to, and enter git reset --hard >commit_id>
or git reset --hard HEAD
I think from here onwards, you should be able to push and pull, just take note of the changes you have done before the issue came about.
You can also check https://github.com/nus-cs2103-AY2021S1/forum/issues/77 to see if you have the same issue
6
In your build.gradle, you have to change the versioning to '8.29'
'checkstyle {
toolVersion = '8.29'
}'
The bug was just found recently and prof just made the changes to the branch. Hope this helps!
7
IntelliJ will direct you to the exact location when you click on the link. Sadly checkstyle can't be used to automate correction so you have to do it manually.
8
In terms of functionality, whether it is interface or abstract class it will work the same way.
However, in my opinion, since Command only have a contract of public abstract CommandResult execute(Model model) throws CommandException;
where there is no method body, interface would be better suited in this case.
This however, would change if in the future you want to add more methods that have a method body in Command, hence the need for an abstract class arises as this will reduce the amount of code to be rewritten to those classes that extends Command.
@wireseo
(8 posts)1. Question on UML directional arrows
Is it wrong to use a line when it the code hints a certain direction? E.g. If it's clearly meant to be in a certain direction, would it be wrong to represent it as just a line?
2. Association Roles and Association Labels (Week 8 Quiz Clarification)
In the Week 8 Quiz, there is a question regarding association roles. I initially thought that association labels and association roles are distinct, s.t. only association "roles," and not "labels," may represent the "highlighted association role." Prof Damith clarified the different uses of roles and labels during the lecture, but this concept of "representation" still feels a bit ambiguous to me personally. Since roles and labels are basically describing the same association with a different format, is it correct to say that a diagram depicting an association label represents the highlighted association role?
3. [FIXED] javafx.fxml.LoadException and errors with xmlns and xmlns:fx
Hi, whenever I try to run the Launcher, it keeps giving me this error:
and my code in MainWindow.fxml doesn't seem to be able to compile:
Does anyone know why this is not working for me but fine for everyone else?
Thank you!
4
I faced this error too. If you took the FXML from the guide, make sure that the field
fx:controller="MainWindow"
is changed to include the package name likefx:controller="duke.MainWindow"
.
I changed the fx:controller variable but the links are still not recognized. 😕
5
@kormingsoon thank you! I eventually solved it by just moving the files and directories around a bit
6
Not many visual upgrades, but for DaMemes. 😄
7
@damithc Okay, thank you for the clarification!
8
Ah okay, thank you for the response!
@tohyuting
(7 posts) 1. Question regarding Level 8 minimal requirement
Hello! I would like to ask for Level 8 minimal requirement, do we assume that the dates inputs are restricted to yyyy-mm-dd format only (without any time or words like Today/June 6th/No idea etc that was seen when we were dealing with date/time prior to Level 8)?
Do we need to consider cases where users give input such as dd/mm/yyyy?
Appreciate any help provided! 😃
2
Alright noted, thank you prof for the prompt reply! 😃
3
Hello, not too sure if this will work for you, have you tried changing the command to run the program to
java -classpath ../bin dobby.Dobby > input.txt > ACTUAL.TXT
4
😃 glad to hear that it solves your problem! Also, here is a link that explains why dobby.Dobby is required instead of just Dobby when you invoke the command to run your program:
https://stackoverflow.com/questions/17408769/how-do-i-resolve-classnotfoundexception
5
Hello, the gradle toolbar can be found on the right side of the IntelliJ window as shown in the photo below (you can view the gradle panel/toolbar by clicking on the 'gradle' tab:
6
Yes, I am using windows. Can you try to click the gradle tab I have circled in your image to see if the gradle tool bar shows up for you? 😃
7
Hello, what I did was to create the config/checkstyle directory myself. Afterwards, I proceed to add checkstyle.xml and suppressions.xml obtained from the link given in the Checkstyle tutorial https://github.com/se-edu/addressbook-level3/tree/master/config/checkstyle into the checkstyle directory. The structure of the folders and files is shown below:
Do remember to install the checkstyle plugin and do the relevant configuration mentioned in "Using Checkstyle" guide.
This worked for me, let me know if it works for you as well 😃 Not too sure if there is another way to go about solving this issue without manually creating the directories and xml files.
@Vielheim
(7 posts) 1. Adjusting GUI Layout
Hi guys, my team and I are trying to modify the GUI such that a panel will contain multiple sections, each with their own list of information.
Our target layout will be a header of the section, followed by cards that encapsulate the info we want to display, for multiple sections. Our target is to be able to scroll across the sections but currently we can only scroll within a section.
We used the stackpane implementation used by the initial GUI, and we got multiple scrollbars on the panel (see right panel on screenshot). Any ideas on how to modify the right panel so that it displays the header, followed by all the cards of the respective section?
Right now, the hierarchy is in the Scenebuilder screenshot:
We wrap everything inside a VBox followed by the headers (Labels) and Stackpanes (ListView).
Because of the different layouts of the cards and headers, we can’t fit everything inside a stackpane, and i don’t think we’re supposed to do that either ._.”
Current GUI Layout:
SceneBuilder:
2. Unable to configure checkstyle
Hi all, does anyone know how to set up checkstyle properly?
I'm using the default version for checkstyle defined in build.Gradle (v8.23). I downloaded the config/checkstyle folder from the addressbook repo and when I tried to configure checkstyle, I'm have to initialise config_loc and have the following error. Wasn't really shown in the tutorial so I'm not sure how to go around this.
3
I got the same issue but for testing wise I changed from System.err to System.out. I think it might be better because we can track the errors that we are testing as well
4
I've tried that too but I still ran into errors. Thanks though!!
5
Yup works now, thank you! Would the older version affect our iP?
6
Added some basic layouts! Probably would make it responsive to resizing and more styling!
7
Adjusted the layout to different orientation
@jiaweiteo
(7 posts) 1. iP Progress Dashboard not detecting branch
Hi,
The iP progress dashboard has not been detecting my branch-A-CodeQuality, even though it is on my remote github. Anyone have any idea on how to resolve this?
Thank you!
2. Did A-JavaDoc, A-CodingStandard and Level-9 on Master branch
Hi,
I got carried away and did the levels of A-JavaDoc, A-CodingStandard, and Level-9 on the Master branch by accident. I committed the changes and push all 3 levels on the master branch before realizing my mistake.
I have then created the branches separately and checked out the branch.
Now my git history looks like this:
Is there any way to revert it or can am I able to leave it as it is? Any advice will be appreciated.
Thank you!
3
Alright got it. Thank you!
4
Thanks for the helpful tip!
5
Yes I have merged it to the master
branch.
6
Sorry for the late response, the origin/branch-A-CodeQuality
is shown in the screenshot below.
As for the commits that haven't been pushed, I tried pushing it to my remote branch, the commits as shown in your image will still be present even after I pushed it to my remote branch.
7
Hi Prof,
I just checked and the branch has been detected in the dashboard after my last commit of merging it into master.
Thank you for your help!
@joshtyf
(7 posts)1. What is code complexity?
On codecov, there is a metric called code complexity. What is it, should we be concerned by the percentages and if yes, what can we do to increase the percentages?
2. Integrating Gradle and JUnit into my project
To setup Gradle for my project, I created a build.gradle
file and added these into the file:
plugins {
id 'java'
id 'application'
id 'checkstyle'
id 'com.github.johnrengelman.shadow' version '5.1.0'
}
test {
useJUnitPlatform()
}
dependencies {
testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter-api', version: '5.4.0'
testRuntimeOnly group: 'org.junit.jupiter', name: 'junit-jupiter-engine', version: '5.4.0'
}
These were taken from the Gradle tutorial and the JUnit tutorial.
Afterwards, I imported the project using scenario 1 as mentioned in the Gradle tutorial and all seemed to work fine.
However, when I tried to add the annotation @Test
and imports org.junit.jupiter.api.Test
, org.junit.jupiter.api.Assertions.assertEquals
, org.junit.jupiter.api.Assertions.fail
, to my test files, I encountered an error and the suggested fix was to add JUnit5.4
to the class path. However, nothing happened after clicking on it.
I've tried looking at my project settings and under "Libraries", it tells me that the library "Gradle: org.junit.jupiter:junit-jupiter-api:5.4.0" "cannot resolve external dependency org.junit.jupiter:junit-jupiter-api:5.4.0 because no repositories are defined"
Anyone could help explain how to integrate Gradle and JUnit properly, that would be greatly appreciated.
3. Implementing stretch goal after completing the minimal goal
Is it possible to do the stretch goal after completing the other levels? How would I tag my commits then?
4
I assume you are referring to level 7 and level 8. Please correct me if I'm wrong but I believe you just need to push your branches normally. So just git checkout
the branch you want to push and then just git push
. This will push the branches to your fork. Then go back to your master
, and merge the level 7 and level 8 branch. then you commit the merge and tag afterwards. Once done just push your commits and tags from the master branch.
5
Okay thanks Prof!
6
Adding
repositories {
mavenCentral()
}
to the build.gradle
file seems to have resolved the issue but I'm not entirely sure what what I was doing the entire time I was integrating Gradle and JUnit.
7
I have learnt in CS2030 that classes are better if they are immutable, so I kept all my classes immutable.
I don't think classes are necessarily "better" if they are immutable. But it's better in the sense that they allow for more control and helps in debugging.
And so to answer the question:
Is immutability no longer strictly desirable in higher level programming modules?
I believe it's still desirable as you want to have greater control over your program flow. So, I think a better question to ask would be "do I want my class to be immutable?" (so as to get the benefits from immutability) rather than does this programming module require/desire immutability for my classes.
Someone do correct me if my understanding is wrong.
@TanLeYang
(7 posts)1. Activity Diagrams: Parallel Paths
When we use parallel paths in activity diagrams, does it mean that the corresponding code runs asynchronously or does it just mean that the actions are independent? For e.g let's say there is a method with 3 lines and each of the 3 lines runs the same way regardless of the result of the other 2 lines. However, they are technically executed sequentially in the code. Would it be wrong to represent each of the 3 lines as being done in parallel in the activity diagram?
2. tP - Running tests with gradle
I've cloned the tp project onto my machine and imported it into Intellij as per the instructions, however, when I try to run gradlew clean test
, it fails and gives the following error:
I thought it could be a JDK issue, but I've tried reinstalling the JDK, using both OpenJDK 11 and OracleJDK 11.0.8 but the problem still persists. Also the other gradle tasks (checkstyle and coverage) run fine. Running the tests through Intellij works fine as well. Any help would be greatly appreciated!
3. 💡 IntelliJ check for unused declarations
While working on removing unused code, I found out that we can get IntelliJ to perform an inspection of your whole project and flag out any unused variable and method declarations!
Here's how to do it:
Navigate to Analyze > Run Inspection by Name. A small popup should appear.
In the popup, search for and select "Unused declaration"
Choose the inspection scope and options (I left it as it is)
The inspection results should appear like so:
4
When you deleted the Level-5 tag, I think you did not delete it from the remote. Went to take a look at your repo and your Level-5 tag commit hash does not match the one that is shown when you did git log
Maybe you can try the following:
git tag -d Level-5
- This will delete the Level-5 tag locally
git push origin :refs/tags/Level-5
- This will delete the Level-5 tag on the remote. If that doesn't work, try:
git push --delete origin Level-5
Create the Level-5 tag at the commit you want again
git push origin refs/tags/Level-5
or git push origin Level-5
- This will push your local Level-5 tag onto the remote
You can skip 1 and 3 if you are sure there's nothing wrong with your Level-5 tag locally.
5
I did some basic styling and made the GUI responsive to changes in window size so the GUI window can be maximised!
6
Personally, I would use streams to make use of map
, filter
and reduce
. These functions are well known and quite commonly used in many other programming languages like javascript or python, hence developers who read your code will find them familiar and easy to understand. Furthermore, you can chain them together. For instance, something like:
list.stream()
.map(x -> x * 2)
.filter(x -> x < 1000)
.reduce(0, (a,b) -> a + b)
Imo this is very concise, one look and you will know what the intended result is. Doing this without streams, you will need a for loop, some if statements, another variable to keep track of the sum and i think it'll generally be a little harder to understand.
However, if the logic starts become too complicated to be succinctly expressed in terms of chaining the lambda expressions, then yea I do agree that perhaps it'll be clearer not to use streams.
7
I think I found the issue. The issue was with the jacoco plugin: I think it was by default using a version that is incompatible with jdk 11. Adding the following into build.gradle to specify the latest version of jacoco solved the problem.
jacoco {
toolVersion = "0.8.5"
}
@g-erm
(7 posts)1. Unspecified multiplicity
Is there a default value if the multiplicity isn't specified for an association in a class diagram? Or is it just no limit which is like *
?
2. Fast forward merge
I believe I made a fast forward merge for branch-Level-7 instead, by accident. Is it okay to leave it like that or is there any way to revert the merge? Thanks!
3
Ok, will take note! Thanks prof!
4
Not sure if you solved it yet but I encountered the same problem and solved it by going to Run > Edit Configurations
and changing VM options to -Dfile.encoding=UTF-8
5
Found this thread really informative and useful to get ideas!! heres my updated GUI:
6
Thank you!!
7
@ktaekwon000 I modified the version string before and its true, the version string reverts back after every update in the scene builder. It wasnt a very ideal solution, so thanks for sharing your method, i think ill use that instead!
@yyutong
(7 posts)1. Gradle for tp fails
Gradle for tP is not working and the error reported is shown in the screenshot
Thanks in advance!
2. Tasks on iP progress board marked as overdue and not done yet
Hi guys! I checked on the ip progress board yesterday and found that all the tasks suddenly got marked as overdue and not done yet.
It seems to be that the script can not pull my repo due to some extra files. However, these files are automatically downloaded when I was building Gradle.
Does anyone have the same issue? Thanks a lot in advance!
3. Cant push or pull
Hi guys!
I forgot to create a new branch and did the level 8 implementations as well as A-More-OOP on the master branch. I couldn't really remember the exact steps I took but apparently I must have done something wrongly. I'm currently having trouble both pushing or pulling
The branches now look like this
Can anyone enlighten me how to resolve the problem? Lot of thanks in advance!
4
@yyutong IIRC, this problem got resolved around that time, so I didn't bother to reply here. But you mentioned you are facing a new problem now. Can you give the details?
Yes sure!
When I was trying to merge the GUI branch which is branch level 10 to my master brunch, the error below occurs.
If the problem can not be resolved, can I just redo the GUI in my master branch?
5
The rogue files are in the first commit of your gui branch.
I suggest the following (I tried on a clone of your repo and seems to work).
- Switch to the gui branch
- Reset the branch to the start but do a mixed (not hard) reset so that your code is not lost. At this point the branch will have no commits but you'll still have all the changes. The rogue files will not appear among the changed files as they are ignored by the .gitignore file
- Stage all the changes and commit. Now you should have only one commit in the branch.
- Switch to the master branch
- Merge the gui branch to the master -- there will be conflicts; resolve, stage, and complete the merge.
- Push master branch to the fork
- Force-push the gui branch to the fork
Hi Prof,
for the second step, do you mean resst the gui branch to the first commit of the gui branch?
6
@yyutong which country are you in at the moment?
@damithc I am currently in China now.
7
While waiting for a solution, you can temporarily remove the shadow plugin from gradle as you only need it when creating a JAR file.
@damithc Thank you prof! I removed the shadowJar part from gradle and it works now!
@siddarth2824
(7 posts)1. Getting an error when I end my application
When I end my program, I get this error:
This error does not affect my program in any way but it would be much appreciated if anyone knows how to fix this.
Thank you very much.
2. Error shows up on IntelliJ console when application is running
Does anyone encounter this issue when running their application. When I went online to find out what this error means, it says that "Crash on focus loss from dialog on macOS 10.14 Mojave". I would really appreciate it if someone could help me out with this issue. The image below shows the full description of the error displayed when the application is running:
3. When is it appropriate to use streams
I am currently attempting the A-Streams increment for iP and I have encountered various instances when I am uncertain on whether I should keep my existing code or change it to utilise streams. This dilemma stems from the fact that the textbook says that we should practice "Keep it simple, stupid" and when I change my code to use streams, it looks more complicated for another reader to understand what is going on. So my question is, is there any guidelines that we can refer to so that we can use streams appropriately and not overuse it?
4
Added a bit of background styling to the dialog container as well the dialog itself
5
I think Java assert cannot be used as a form of unit testing because it just checks that the assumption at a certain point in code is correct. It does not verify that the logic of code you have written is entirely correct. Because if your assumption is incorrect then the assertion will be incorrect. Java assert is also used mainly for debugging and improving your code quality.
This is why I think that using java assert is not the best for unit testing. I may be wrong on this but this is my take on why java assert should not be used as a form of unit testing but more so to make sure your assumptions at a certain point in your code is correct.
6
I tried to update the javafx version in my build.gradle file to 11.0.2 but I still face the same error.
7
Thank you so much that worked.
@WM71811
(7 posts)1. Potential multiple calls to a same method in a sequence diagram
For a sequence diagram in DG, if depending on the situation, a method may be called once only or for multiple times, it is okay to draw the diagram as if the method is called only once and state the assumption that this diagram assumes the method is called once?
Thank you!
2. Rationale behind AB3 handling of extra parameters
May I ask for commands that does not have additional parameters, for example, help command in AB3, is there a reason behind the handling of extra parameters in AB3? For instance, help 1
will give the same outcome as help
.
3. iP Level-10 Warning: Java has been detached already, but someone is still trying to use it
Hi, may I ask if anyone has encounter this warning: "Java has been detached already, but someone is still trying to use it at -[GlassViewDelegate dealloc]:/Users/jenkins/workspace/OpenJFX11-mac/modules/javafx.graphics/src/main/native-glass/mac/GlassViewDelegate.m:198"?
This warning is there when I try to exit from GUI using >Platform.exit>
when the response of Duke is an exit response. I searched online but did not find good solutions for this.
4
To add on, "compare with Clipboard" is helpful to check where the missing empty spaces are.
5
I am not sure if my interpretation is correct, but if you would like to put the image in GUI, maybe you can move it to resources/images?
6
Noted, thank you so much!
7
Noted, thank you so much!
@zhaohuanqdcn
(7 posts)1. Error in Plantuml Plug In
I am facing issues using the Plantuml in Itellij.
I have reinstalled the plugin / Graphviz multiple times but it still does not work.
2
set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
I am using this but have an issue:
_Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8
java.lang.UnsupportedClassVersionError: Duke has been compiled by a more recent version of the Java Runtime (class file version 55.0), this version of the Java Runtime only recognizes class file versions up to 52.0_
I am currently using JDK 11 as required
3
I am currently using JDK 11 as required
The batch file does not follow Intellij settings. It will take the JDK that is in the path variable (if on Windows).
Actually the java version in my system (environment variable) is jdk11.0.5 and I'm using that for intelliJ also. Cannot figure out whats wrong 😦
4
If it turns out the terminal is using Java 8, try uninstalling it entirely. Java 8 is stickier than other versions of Java.
Thanks prof, it's finally fixed! Seems that I have some remaining JDK8 pieces on my computer
5
I had this error as well.
Alternatively.
If you check your javac -version it will be JDK11, but if you check your java -version it is likely not 11.
You can change your java runtime environment to the required environment it should then work.
Thanks for your help! I have solved it by uninstalling Java 8 entirely.
6
Hi, I faced the same problem and if I recall correctly I solved it by downloading and using the 32-bit version of graphviz. The result of running
dot -v
on my computer gives this:
dot - graphviz version 2.44.1 (20200629.0800)
Thanks for the reply but this does not work for me.
7
I solved this by downloading the zip version and manually set environment variables.
https://www2.graphviz.org/Packages/stable/windows/10/msbuild/Release/Win32/
@e0316059
(6 posts)1. Not able to load from and write to txt file when running jar
Hi,
I encounter this "file not found" error when running jar file, however the storage function has no problem when building in IntelliJ, and other functions are also ok when running jar.
2. javafx running component are missing when running Duke.main()
Hi prof, TAs and classmates,
I encounter the error "JavaFX runtime components are missing, and are required to run this application" while running Duke.main(), (Duke is my main class), however when running Launcher.main(), the gui is shown properly and the functionality is ok.
3. Unable to run runtest.bat/runtest.sh for text-ui-tesing
Hi prof, TAs and classmates,
I encounter this problem when doing text-ui-testing, I'm not sure how should I modify the script to make it run?
4. Unable to run code in IntelliJ
Hi Prof, TA and classmates
I encounter this problem in project set up: after importing the cloned ip in IntelliJ, the run button is disabled. I strictly follow the instruction but there is no "Run Duke.main()" option when right click as step 4 stated.
5
As you are on Windows, shouldn't yo be using a .bat file, not a .sh file?
You can check out a few batch files used by other class mates from the RepoSense dashboard.
I tried to run .bat file but it closes immediately after i open it.
6
Thanks very much! It's solved after I add code to handle this case.
@Ebolaeater
(6 posts)1. JavaFX stage throws error
After following the tutorial for gradle, I tried using the launcher class to run my code but it throws an error saying class file javafx.event.EventTarget not found. This error is at stage.setScene(scene) on line 38 as well as stage,show() on line 39.
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.stage.Stage;
/**
* Initializes the chatbot and starts up the UI to take in user input
*/
public class Duke extends Application {
/**
* ui refers to the User Interface object which will be used to accept user input
*/
private UI ui;
/**
* Uses the filepath to intiialize the storage and hence, the UI object
* @param filePath
*/
public Duke(String filePath) {
Storage storage = new Storage(filePath);
this.ui = new UI(storage);
}
/**
* Looks for user input using the UI object
*/
public void run() {
ui.welcome();
ui.run();
ui.escape();
}
@Override
public void start(Stage stage) {
Label helloWorld = new Label("Hello World!"); // Creating a new Label control
Scene scene = new Scene(helloWorld); // Setting the scene to be our Label
stage.setScene(scene); // ERROR - cannot access javafx.event.EventTarget
stage.show();
}
public static void main(String[] args) {
new Duke("Data/duke.txt").run();
}
}
💡 You can use Markdown to format your text
2. Unable to run duke using gradle
After following the tutorial given on the website, I am unable to run Duke using gradle because of this error - Could not find or load main class seedu.duke.Duke
3. Able to run Duke on intellij but the runtest.bat throws an invalid flag error when I run it.
Remember to give sufficient details e.g.,
Your development environment (IntelliJ version, Java version, OS, ...)
Relevant code, error message, stack trace
Relevant code snippet (an example given below), or link to the relevant code on your GitHub repo
String value = "
@ECHO OFF
SET MY_PATH="my_file_location"
REM create bin directory if it doesn't exist
if not exist "%MY_PATH%\bin" mkdir "%MY_PATH%\bin"
REM delete output from previous run
del ACTUAL.TXT
REM compile the code into the bin folder
javac -cp "%MY_PATH%\src\main\java" -Xlint:none -d "%MY_PATH%\bin" "%MY_PATH%\src\main\java\Duke.java"
IF ERRORLEVEL 1 (
echo ********** BUILD FAILURE **********
exit /b 1
)
REM no error here, errorlevel == 0
REM run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT
java -classpath "%MY_PATH%\bin" Duke < input.txt > ACTUAL.TXT
REM compare the output to the expected output
FC ACTUAL.TXT EXPECTED.TXT"
💡 You can use Markdown to format your text
4
Regarding this line:
SET MY_PATH="my_file_location"
Did you encase your location path in double quotes (")? If you did, try removing the double quotes.
i.e. Suppose my path is something like
C:\Users\blah\CS2103\ip
. Then that line would be:
SET MY_PATH=C:\Users\blah\CS2103\ip
The former (I just tried) gave me a similar error in your post while the latter worked just fine.
Regarding this line:
SET MY_PATH="my_file_location"
Did you encase your location path in double quotes (")? If you did, try removing the double quotes.
i.e. Suppose my path is something like
C:\Users\blah\CS2103\ip
. Then that line would be:
SET MY_PATH=C:\Users\blah\CS2103\ip
The former (I just tried) gave me a similar error in your post while the latter worked just fine.
Removing the quotation marks made the program run. Thanks sooo much!!!
5
just to check do u have doublequotes surrounding these lines:
"%MY_PATH%\bin"
I also have the same problem even if i removed the doublequotes regarding the SET_MY_PATH line
Yup I have quotation marks around them
6
In the
build.gradle
file (should be in your root folder), I think you will need to make the following change:
Change the class name according to your main class name (and package).
Hope this helps!
Thanks a lot!!!
@zhXchD
(6 posts)1. tp dashboard does not detect my assertions
I remember that last week when I checked the tp dashboard the "assertions" tag has been marked as done. While now as I check the dashboard, it says overdue. I did use a few assertions in last week's commits which have been merged into master last week.
May I check why this happened? My GitHub name is zhXchD
, student number is A0194512H
and my Git author name is Zhu Xiaochen >zhuxiaochen1005@gmail.com>
.
2. Published UG and JAR released undetected
I have updated my user guide and released the .jar
file, and A-UserGuide
can be deteced on the iP progress dashboard. However, Published UG
and JAR released
are not detected.
May I ask whether I did something wrong when publishing the page (rooted at /docs
and can be checked here) or releasing the .jar
(released here), or the detection script has not updated (but my increments have been detected)?
3
Perhaps you uploaded this after the dashboard was updated? Let me know if still not detected after the next update (which will happen before this time tomorrow)
They have been detected today and I will be closing this issue.
4
You may want to have a look at this commit, which was committed by me 7 days ago, at here. I think I included assertions in this commit.
5
We go by what's shown in the cod dashboard. Check if any asserts are included in the code that is shown as your code in the code dashboard.
I just checked the reposense code dashboard. I found the commit (named Add assertions
, on 2020-10-20, can check at here). This is the commit I mentioned in the previous comment. The screenshot is shown below
Inside this commit, you can find there are assert()
used in my code.
6
It doesn't matter if the commit is detected as past commits can be overwritten by later commits. What matters is the code view which shows the final state of the code. Check if those lines are shown under your name in the code view (click on the
</>
icon to see the code view)
I checked the code and it shows something like this.
Only the assert() lines are not highlighted as green, does this mean that the assertions are not detected as my code? I think it is because that someone else in the group make changes after I wrote the code because last week this item was detected as done but not this week. If I use the author
tags to indicate these lines are actually my code, will the system detect this and mark this item as done (it is now marked as overdue)? Thanks prof!
@li-s
(6 posts)1. PR review
Hello guys, I have a quick question.
If reviewing PR, and the code has multiples of the same mistake (eg. wrong indent for multiple files), do we flag every single mistake, or just flag one? I'm thinking that if you flag every mistake, it will just make the other member angry at why you are focusing on such minor mistakes.
Any thoughts on this?
2
So for each coding violation that is the same, I should just write "I noticed this issue as well"? It seems like it will clog the comments section.
3
Ok thanks, so I just wite that line.
4
Where did you read the part that methods must be less than 30LOC? I think I missed that part
5
I got something similar, when I right click the red import and chose the fix issues by intellij somehow it was fixed
6
This is mine without tweaks 😦 looks so bad compared to some of the ones here
@kunnan97
(6 posts)1. Codecov not reflecting coverage
Group: CS2103T-T17-1
Issue:
Our code coverage is average~80%, but on codecov it is not reflecting coverage in our Ui components, currrently showing 67%.. Need some help!
2. tP dashboard not reflecting v1.3trial
My team: T17-1
Our team had release our v1.3 trial last week(week 10) and it passed the checklist on the tP dashboard in week 10. This week, however, the v1.3 trial released failed, v1.3 release passed instead. Not sure what happened there, help or clarification would be appreciated!
3
Yup i think we replaced a new one afterwards for our own downloads. Did not know that is not allow!
4
Is there any way to resolve this, we did not know updating the release will fail the check.
5
Alright i see, thank you!
6
alright thank you!
@raythx98
(6 posts)1. Gradle showing tick/cross as ?
On the left was the output on screen from running using IntelliJ IDEA, whereas on the right was the output on screen using gradle. Even though trivial, is there a way to correctly display the tick/cross on the screen?
I've tried the solutions from stackoverflow answers here (which modifies the build.gradle) but to no avail: https://stackoverflow.com/questions/21267234/show-utf-8-text-properly-in-gradle
2. package duke does not exist when running runtest.bat
This is a old problem that I'm facing, after repackaging my classes into their respective packages, I could not use runtest.bat anymore. I will attach some screenshots below!
3
Try using
javac -cp ..\src\main\java\ -Xlint:none -d ..\bin ..\src\main\java\*.java
with the-cp
flag changed to..\src\main\java\
Omg worked like a charm, how did packaging change the classpath?
4
I've tried the following method from this issue but doesn't solve the problem for me: https://github.com/nus-cs2103-AY2021S1/forum/issues/95
Run > Edit Configuration (Duke) > VM options: -Dfile.encoding=UTF-8
5
Adding
systemProperty "file.encoding", "utf-8"
to both my run{ ... }
and test{ ... }
helped me solve the problem, thank you!
6
I've updated my GUI to have better aesthetics! (rounded corners, borners etc) Big thank you to other contributors!
@BILLXYR
(6 posts)1. JAVA CI fail
When I try to PRs, I found that my JAVA CI fail and I go on to investigate the error, the error messages show some line got " no newline at EOF" and some line got " trailing whitespace"
Any one knows what the messages mean and how to resolve them?
Thanks!
2. 💡Some tips on generating the jar
Not sure whether anyone have the similar issue of unable to generate jar from IntelliJ (like what we did previously) or generate the jar using Gradle but encounter "no manifest attribute error"
I had this issue yesterday and it took me 2 hours to debug
let me share a useful Youtube Video first: https://www.youtube.com/watch?v=BwdkyrnJQsg&t=194s
I follows the steps shown in the video and add in jar {xxxx} in my build.gradle as shown in the video
Then I run the following command in the terminal: ./gradlew clean build
the Jar file should be available in build/lib folder
Then you can run the jar in the terminal using the following command: java -jar [your jar address]
Take note, there are two jar files and choose the correct one, most people might be duke.jar (I guess) ?
Anyway you can trial and error to see which jar is the correct one
Hope it helps
3
Yes, the tip is very insufficient.
I encountered this and debug for 2 hours yesterday
Use this command on terminal ./gradlew clean build
To run the programme, you need to locate the folder, then use this command java -jar [your jar address]
Useful Youtube video https://www.youtube.com/watch?v=BwdkyrnJQsg
Hope it helps
4
I've taken a few examples out of your failing CI:
ERROR:../src/main/java/seedu/address/logic/commands/RemarkCommand.java:98: no newline at EOF.
This means that your
RemarkCommand.java
file does not have a newline at the end of file. To resolve this, simply add an empty line at the bottom of the file.
ERROR:../src/main/java/seedu/address/model/person/Person.java:54: trailing whitespace.
This means that at line 54 of your
Person.java
file, you have extra whitespace. To resolve this, delete off the additional whitespace at the end of the line. You can see the additional whitespace if you select it.
Thanks for the reply! I manage to solve the "no newline at EOF" error but " trailing whitespace" still exists despite I delete the whitespace at the end of the line. May I know how should I properly delete the whitespace?
5
To automatically strip trailing white space in intellij, you can go to
settings -> editor -> general
, then scroll toother
and changestrip trailing white space on save
toall
Thanks! This one helps ! 👍
6
Thanks for the reply! I manage to solve the "no newline at EOF" error but " trailing whitespace" still exists despite I delete the whitespace at the end of the line. May I know how should I properly delete the whitespace?
In case the problem is in multiple places, check carefully that you have deleted trailing whitespaces in all locations reported by CI.
Yup, some parts I did not check carefully 😦
Now resolved already, thanks! 😃
@YuunoKun
(6 posts)1. iP smoke test failed
Hi guys, this is what I encountered:
I've done some research online and it might be related to some missing graphic library, but I have no idea where to start.
The solutions I found online are mostly related to JVM options and libraries, not sure what to do with my code D:
2. Questions regarding iP
Hi, I have some concerns about my level-5/6 not being found though I've pushed the local repo with the completed iP on 18 Aug(the dashboard says last updated 19 Aug). Is there anything I can do to fix this or I can only wait for the next dashboard update?
...and how heavy is the penalty if there's late submission?(just in case)
Here are some screenshots fyi:
Thanks!
3
Problem solved.
The actual issue is that I can't push the detached HEAD without actually merging so I thought I pushed those commits but actually didn't, I'm a beginner to git/sourcetree so didn't know this. xD
4
May I know if javaFX runtime/lib is installed during the Linux smoke test? It seems like it requires .so
files for javaFX programs.
5
I had this problem because when I was refering to filepaths in my program, I used the full filepath(D://joven//UNI//CS2103... ) for the storage(and even in the javafx libraries to select an image).
So I solved it by changing the name to a generic filepath.
Im not sure did this solve the problem on linux since I do not have linux to test my program on, but on a fresh mac and windows, it did work.
Seems like my problem is different from yours. I've checked file paths and they are all relative paths. 😦
6
Problem solved. The issue is the version of openjfx.
@augustinekau
(6 posts)1
@GilbertTan19 , hi can I ask how did you manage to solve that issue?
Try going to the Gradle toolbar and under the build option double click everything. Not sure which was the specific one that solved it for me 😅
Hi! I cannot find the build option in the Gradle toolbar you are referring to. Could you provide a ss? I am having the same error of "JavaFX runtime components are missing, and are required to run this application". Thx in advance.
2
Try all the build options and clean as well
@RuiFengg hmm oh no doesn't seem to work for me .-.
3
Okay, sorry, I realised I had to either change the main class in the build gradle file.
Hi I am facing the same issue. Can you describe how do you do it? Thanks in advance.
4
Try all the build options and clean as well
@RuiFengg hmm oh no doesn't seem to work for me .-.
Do you still get the same "JavaFX runtime components are missing" error?
yeap sadly. only when running Duke
5
Try all the build options and clean as well
@RuiFengg hmm oh no doesn't seem to work for me .-.
Do you still get the same "JavaFX runtime components are missing" error?
yeap sadly. only when running Duke
I ran mine with launcher instead of Duke shown in the ss I sent beside the green play button. If that doesn't work I'm not really sure how to fix it 😅
it's ok! thanks for the help. appreciated 👍🏻
6
@yuming7144
(6 posts) 1. Plugin not found when building gradle
I got this error when I try to build gradle:
I tried to run gradlew assembleDebug as suggested by one of the previously closed issues, but got the following message:
May I please seek some help on how to fix this?
Really appreciated!
2
Hi. I thought shadow is one of the important plugins needed in Duke. In this case, can I just remove the mention?
Thanks!
3
Hi. Thanks for the reply!
My build gradle looks like this:
Attached is the output I got when running with stacktrace.
output when running with stacktrace.txt
Thank again for the help!
4
Hi. Thanks for the suggestion! The same error still pops up after adding in that:(
5
Hi, I haven't solved my problem here. I will update later if I managed to solve it.
6
Hi, gradle was build successfully after I deleted the entire directory at C:/Users/username/.gradle and restart the whole process. While this is a weird solution, do try and see if it works!
@keanecjy
(6 posts)1. Mock exam answers
Hi Prof @damithc,
Where can we find answers to the mock exam?
Thank you in advance.
2. Where to use assertions?
Having read up some online forums, I noticed that there is a divide between programmers supporting the use of assertions in parameter checking and those that are against it. That said, where are the best uses of assertions?
3. Saving tasks to harddisk
Level 7 says:
Save the tasks in the hard disk automatically whenever the task list changes.
Can I check if if we need to write to the hard disk whenever there is a change to the task list? I was thinking writing to the hard disk after the user inputs "bye" would be more efficient.
4
Alright thank you Prof! That made a lot of sense.
5
I noticed for array the checkstyle insists on 4 indents. Does anyone know what is the configuration for Intellij to support 4 indents for array and 8 indents for wrapped lines?
6
@aidoxe-123 That would make the indentation for wrapped lines 4 too though :x
@AdithyaNarayan
(6 posts) 1. Something to lighten up your day
Three amigos: in the future, we can use UML to generate code
2020: we need to learn PlantUML code to generate UML diagrams
2. Dynamic Subclass Instance returned in Factory Method
Suppose there is a Class Toy
and there subclasses BigToy
, MediumToy
and SmallToy
. All toys have to be either Big, Medium, or Small. There is a static Factory method createToy
in Toy that returns an object of the respective subclass depending on the arguments passed to it. Pseudocode:
class Toy {
Toy createToy(identifier) {
switch (identifier) {
case BIG: return new BigToy();
case MEDIUM: return new MediumToy();
case SMALL: return new SmallToy();
default: throw exception;
}
}
}
This solution to dynamically return a subclass in a factory method, albeit working, is in clear violation of the Open-Closed Principle as there is need to modify/change the factory every time a new Sub-Class is created. Is there a better, more-dynamic solution to the problem of returning the appropriate sub-class object in the super-class factory method?
One solution I can think of is to have a "map" of the identifier to the subclasses and modify that. However, I am unsure as to how the value of this "map" can be made to create an object. Something like: return new map[identifier];
. Is this solution a valid approach or does it fall prey to the Open-Closed Principle also?
3
I would like to ask exactly how much freedom do we have with respect to the Individual Project. Is it only limited to the appearance level? Or do we have some freedoms with respect to the actual functionality of the chatbot? For example, let's say that the user enters the command: todo finish ip /by Thursday 2359
. Should we interpret it as the description is "finish ip /by Thursday 2359"
(which is what the current documentation on the website implies)? Or are we allowed to customize it in such a way that it throws an exception as there is an additional parameter?
4
@halcon-blanco Thanks a lot! This works perfectly in the context of the iP!
5
Mine is just a visual increment too!
6
I think this warning is caused when you use scene builder to edit the fxml. I was able to clear this warning by changing the xml namespace of the root elements in the FXML files to this xmlns="http://javafx.com/javafx/11.0.0"
.
@Diwu-Yi
(6 posts)1. Unable to use STEP IN in the debugger
Hi ,
I am having a strange problem relating the debugger function. I followed the Tutorial : Tracing Code and everything was smooth until I ran debug.main.
I started by Edit Configuration and I changed the Program arguments as shown:
Then , I clicked Debug button.
I can see the GUI pops up:
However, when I go back to check the debugger, it is empty (i.e. Not showing any variable/ steps) and the STEP IN buttons and other buttons are also grey, as shown below:
Please may I ask, what might be causing this issue ? I am really confused as this moment.
Thank you in advance for your help.
2. Changed Tag Naming
Hi everyone
I discovered today that my tags' naming was not right and thus the issue tracker didnot catch my commits for all levels. Therefore I edited my tags today, may I know if this change can be captured in time ? Also, may I ask if the catching of the tag names is case-sensitive ? As I have name some level using small letters and for git, it is the same (NOT case sensitive).
Thank you for your help !
3
Noted, thank you Prof Damithc !
4
@Raymond0212 Hi friend, I found out to update the tag letter cases, we need to $ git push origin :refs/tags/level-1 to delete the original lower case tag and then $git push --tags to push our new local tags (Suppose you alr have Level-1 tag locally).
Hope this helps!
5
Thanks to everyone who has taken time to read this issue, I have managed to resolve it with trial and error.
Basically, I resolved this problem of unable to use buttons like STEP IN by changing the way of running the debugger. So, this is a workable route for me :
Set a break point as usual.
Instead of using the top menu Run > Debug, use Gradle at the right side bar to run Debug 'tp[run]'.
Then pass in the argument of 'edit 1 n/Alice Yeoh' through the GUI.
Now go back to the debugger and all steps and variables are shown correctly.
Furthermore, after one single run with Gradle, the top bar menu is updated to be the same as what is present in the side bar containing Gradle. From this observation, I suspect the initial problem I encountered is caused by the design of cache of intelliJ, i.e. the project is not properly imported from Gradle and some cache information which should be changed are not changed. However, this is just a very rough feeling in my guts and I have no evidence to support it. (I think I am the only person, but ) if anyone by any change faced the same problem as me, try File > Invalidate Cache/Restart and use Gradle to run the debugger.
6
Not an answer but I don't think you can use the
program arguments
property like that. I think it's meant for applications that take arguments when you run the main program. e.g.,java HelloWorld arg1 arg2
^
Noted, thank you Prof Damithc for the information !
@abdurrahmanfaqihiskandar
(5 posts)1. My test cases are passing on local machine but not on github CI.
The test cases for my PR are passing on my local machine and also on the machines of other teammates but it is not passing in the CI checks on github. How do I go about with this? I don't know how to debug this because the test cases are all passing as it should be.
This is the link to my github PR for reference:
https://github.com/AY2021S1-CS2103-F10-1/tp/pull/148
Let me know if additional information is needed.
2
Yes Prof. I know which exact tests are failing and they are failing on Mac OS and Unix OS. The windows OS check was cancelled because the other two OS failed their checks.
3
I just asked my other teammate running a mac to do the tests. And the tests fail on his machine. May I know what the cause of this is? Why can the tests pass on one OS but not another?
4
Alright thanks Prof. We managed to fixed the issue. I'm just intrigued why the test cases give different results on different OS because our issue was not with the file path.
I will close this issue for now.
5
It was the use of one of our testUtil classes. One of the test cases added into the new PR modified the testUtil variables which caused the failure of 2 other tests. Though I'm not sure why it only fails in an OS other than Windows.
@Joven-Heng
(5 posts)1. Automated Text UI Testing classpath for the Runtest .bat File
Hi, for the Automated Text UI Testing for IP week 2, we are required to replace the classpath for the .bat file(on Windows)
From the guide, it mentioned:
Update the javac and java commands in the script to match the name/location of your main class.
If you are using packages, the two commands need to take the packages into account too.
However, im not sure what javac and java commands that we would have to change. What I did was to change the locations after the ..\bin command to the directory of my java files. But everytime I ran the .bat file, a command prompt window opens and quickly closes. There is no ACTUAL.txt in the same directory as well.
Thanks for helping 😄
@ECHO OFF
REM create bin directory if it doesn't exist
if not exist ..\bin mkdir ..\bin
REM delete output from previous run
del ACTUAL.TXT
REM compile the code into the bin folder
javac -cp ..\src -Xlint:none -d ..\bin ..D:\24092014\Joven\UNI STUFF\CS2103\IP\src\main\java\Duke.java
IF ERRORLEVEL 1 (
echo ********** BUILD FAILURE **********
exit /b 1
)
REM no error here, errorlevel == 0
REM run the program, feed commands from input.txt file and redirect the output to the ACTUAL.TXT
java -classpath ..\bin D:\24092014\Joven\UNI STUFF\CS2103\IP\src\main\java\Duke < input.txt > ACTUAL.TXT
REM compare the output to the expected output
FC ACTUAL.TXT EXPECTED.TXT
2
First issue regarding the cmd window closing:
Try putting a
PAUSE
command at the end of the script, so something like:
Second issue regarding the
.bat
not working properly:
I'm not sure where your respective directories are but here's what you should be inputting for each command
javac
andjava
:
javac -cp <your_source_code_directory> Xlint:none -d <destination_directory> <file(s)_to_compile>
-cp <your_source_code_directory>
: (classpath) your.java
files should be in this specified directory.
-d <destination_directory>
: (destination directory) where your.java
files will end up in after compilation (as.class
files).
java -classpath <your_source_code_directory> <file_to_run> < input.txt > ACTUAL.TXT
classpath <your_source_code_directory>
: note this should match the directory where your.class
files ended up after compilation.
As a reference here is what my
.bat
file looks like atm:
Hope this helps!
Edit: fixed typo
Thanks so much, but right now I realised that I have multiple java files since I have more than 1 class,
So what I did was to just to repeat the javac statement multiple times.
I.e
REM compile the code into the bin folder
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\Task.java
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\ToDo.java
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\Deadline.java
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\EventTask.java
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\Duke.java
But it is still treated as if Task.java is not compiled, resulting in an error when ToDo tries to extend from Task.java but is unable to find Task.java
May I ask please ask how to then compile multiple java files?
Thanks!
3
You can try the following:
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java*.java
But iirc if you compile your top-level class first (in terms of dependencies) every other relevant class should be compiled as well. Hence why calling
javac
on justDuke.java
works for me
THANKS so much it worked:D
4
hey there i also having a similar problem now. I have checked my file paths and it seems to be correct. The window also appears. The error comes when i am type an input and press enter. Anyone has a solution to this?
Hi, if you packaged your duke class, perhaps you want to try going to your fx:controller="MainWindow"
in the fxml file and changing it to duke.MainWindow?
5
I had this problem because when I was refering to filepaths in my program, I used the full filepath(D://joven//UNI//CS2103... ) for the storage(and even in the javafx libraries to select an image).
So I solved it by changing the name to a generic filepath.
Im not sure did this solve the problem on linux since I do not have linux to test my program on, but on a fresh mac and windows, it did work.
@davidsqf
(5 posts)1. CATcher: Unable to verify CATchers version.
I have retried, but CATcher still "Unable to verify CATcher's version".
2. tp failed: Data error (cyclic redundancy check)
I cloned tp onto my computer and imported it into IntelliJ, then it told me "tp failed: Data error (cyclic redundancy check)"
The screenshot is below, sorry that my system language is Chinese, the Chinese characters mean "Data error (cyclic redundancy check)"
I tried to re-clone the repo and reinstall IntelliJ, the problem still exists.
3. question about cyclic dependency
This example is shown in W4.2b, however, wouldn't this result in a cyclic dependency?
4
There has been a similar discussion in issue #100, please refer to the reply by Prof
thank you, I'll close this question!
5
thank you prof! I retried just now and the problem was resolved!
@munharsha
(5 posts)1. JavaFx tutorial 4 error when running
I have set up all the files for stage 4 of javafx tutorial however, when i am running the code i run into the following error. I have made sure the images are in the correct path. How do i go about fixing this?
2. unable to run graddle
I have been getting this error when i tried run graddle. How do i go about fixing this. I have merged the branches properly and deleted the .idea file before doing this step
3
Thank you works now
4
hey there i also having a similar problem now. I have checked my file paths and it seems to be correct. The window also appears. The error comes when i am type an input and press enter. Anyone has a solution to this?
5
yup i did not change anything from the website
@SherryWu178
(5 posts) 1. > Task :processResources NO-SOURCE
As I am switching to gradle and use FXML, I encountered this problem.
2. Correct way of naming package
I mark my src folder as source root and following the naming convention by naming my package as "package main.java.commands;" However, it gives me Package name 'main.java.commands' does not correspond to the file path 'commands' error. The quick fix suggest me to use "package commands;" directly. Is this the appropriate way to do it?
3
solved: unmark main as module
4
It also gives a new error now.
5
The source error was due to the missing resources folder in main
@wltan
(5 posts)1
I'll also have to find a way to create a file with my code if there isn't any file right?
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html#createNewFile()
https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/io/File.html#exists()
https://stackoverflow.com/questions/9620683/java-fileoutputstream-create-file-if-not-exists
Some of the information here might be useful to you.
2
I would like to add on to mention that you can also "prevent" the instantiation of such a class by declaring a private (inaccessible) constructor. e.g. private Parser() {}
3
Perhaps you could check your project structure? (ctrl+alt+shift+S
)
Under Project Settings > Project
check that the Project SDK and language level is still correct.
4
https://github.com/Criss-Wang/ip/blob/master/src/main/java/META-INF/MANIFEST.MF
If your main class has changed, you might need to change the manifest so that the JAR can find the correct main method.
5
Oh okay, so the quiz bonus deadline is also pushed to 28 September?
Yes, all deadlines basically "pause" for 7 days during Recess Week.
@bchenghi
(5 posts)1. Scaling Duke window
Hi everyone, I'm not sure how to ensure the search bar can be seen after scaling the window down. Any tips or tricks?
2
I also encountered this when I ran my bat file. For me it was because I had both java 8 and java 11 in my environment variable paths 😕 I removed the java 8 environment path, and it worked.
3
My method is:
Add something like this to your CSS file.
Then
Add this to your MainWindow.fxml
Hope this helps!
4
Hi and thanks so much for the fast reply. But now I am facing another issue.
Now when I extend the window, the send button doesn't move with the text box.
5
Oh thank you so much! It works now
@lerxcl
(5 posts)1. 💡 [Windows 10 Only] Test your .jar file using Windows Sandbox (isolated environment)
If you are running Windows 10, you can make use of a new Windows feature called Windows Sandbox.
"Windows Sandbox provides a lightweight desktop environment to safely run applications in isolation. Software installed inside the Windows Sandbox environment remains "sandboxed" and runs separately from the host machine." - From https://docs.microsoft.com/en-us/windows/security/threat-protection/windows-sandbox/windows-sandbox-overview#:~:text=Windows Sandbox provides a lightweight,and the state are deleted.
If you do not know which version of Windows 10 you have, you can check by going into Settings -> Update & Security -> OS build info (on the right, under related links), then scroll down. You should see something like this:
(If you are running the Home edition, follow this link:
If you are running Pro edition, it's even easier! First, follow the guide below to add Windows Sandbox.
After you are done setting up, proceed to install Java SE 11 inside of Windows Sandbox.
After you are done installing, to transfer your .jar file from your main windows to Windows Sandbox, simply right click and copy (in your main Windows), then right-click and paste (in Windows Sandbox).
Try running your .jar file by double-clicking on it. If all works well, you should see your application running inside!
This way, you can isolate any Java issues you have on your main Windows, and try it on a fresh copy of Windows.
2. 💡 Unable to open your .jar file after implementing JavaFX + rebuilding?
Remember to change your mainClassName in build.gradle!
Chances are that if you follow the JavaFx Tutorial, you would use a "Launcher" class instead.
Hence, if your .jar does not open, try changing from "Duke" to "Launcher".
3. Unable to display ✓ and ✘ properly in executable JAR file
Hi guys,
The respective ✓ and ✘ shows up as an empty "?" box in the command line. (Tried using Window's CMD and WSL Bash)
Running my ip project in IntelliJ works perfectly fine though.
I've tried googling for solutions, such as changing all my file encoding to UTF-8. But it seems to still not work. 😦
Thank you for your attention. 😃
4
Thanks for the help 😃
Turns out its the console font issue, and using Windows Terminal solves it!
5
Sorry, I realized that another user has posted a similar tip!
@EthanTheGoondu
(5 posts)1. How to go about installing gradle
Hi, I plan to set up Gradle for my iP, but I have no idea if it is already installed and if it is not I'm rather confused on how to install it. My question is by default which scenario applies to us?
Is it scenario 3? I remember seeing "added gradle support" in a previous commit from the repo, does that mean anything?
Any help is appreciated!
2
Assuming you have been doing the project on Intellij, then like (me and many others) yours should fall under Scenario 2!
As per the instructions in A-Gradle, merge the branch that "added gradle support" into your current master branch and follow the instructions in Scenario 2 from there.
I managed to merge it, thank you so much for the help!
3
Hi I'm facing the same exact issue, do update if you find any solutions, thanks!
4
Hi! I had the same problem as well! The error only went away after I added the
suppression.xml
file.
Hi sorry, where do you add this? @zhengweii
5
@zhengweii Got it! It works now thank you!
@TCQian
(5 posts)1. How to make stackpane scrollable
As you can see on the right part of the ui, it is able to scroll horizontally but not vertically.
In scene builder, I put the scroll pane in a VBox.
For the component named projectDashboard which I want it to be scrollable is placed in the scrollable pane.
I don't see why the stack pane is still not scrollable. I can't even find a solution on how to solve this issue online.
2. Gradle Build successfully but it fails the checks in PR.
This is the link of corresponding PR: https://github.com/AY2021S1-CS2103T-W10-3/tp/pull/101
3
Yes, it helps. Thanks a lot!
4
@fall9x It shows the vertical bar now but it is still not able to scroll up and down. @JinHao-L I have set the vgrow of stack pane to be place in the scroll pane and the vgrow of scroll pane to be always.
5
I solved it by removing the stackpane of my projectDashboard.
The height of scrollpane doesn't affect the vertical scroll bar.
But the stackpane of my dashboard restricts the grow of my vbox. Even though i set the max height of the stack pane to be max_integer but it still doesn't allow the grow of the vbox inside. So i use only the vbox for my project dashboard and set the max height to be max_integer.
THANK YOU ALL FOR YOUR EFFORT!! : )
@GilbertTan19
(5 posts)1. JavaFX level 10
I have followed the same exact steps fro using javafx with gradle and i tried running launcher.java after doing the hello world GUI and it gives me this error.
Caused by: java.lang.NoSuchMethodException: duke.Duke.>init>()
before implementing javafx i can run the class.
2. Wrong branch naming.
Dear Prof,
I used the wrong name for one of the branch, do i need to change the name of the branch or i do not need to as long as the tags is still the same?
3
Thank you @damithc
4
@ypinhsuan the Launcher now works but not my Duke program. For the Duke program it give me the error of JavaFX runtime components are missing, and are required to run this application
5
@Royxuzeng I change the build.gradle to run the launcher.
@ChengJiyuqing
(5 posts)1. .jar file shows java.io.IOException: No such file or directory error when I use relative path to create storage file
The programme runs well on IntelliJ regardless whether I use absolute path or relative path to create new file.
However, .jar file only works if I use absolute path. From my understanding, we are supposed to use relative path so that the application can run on other devices too.
this is my code to create the file.
And the relative path I've been using is
seedu/duke/todo.txt
Is there something wrong?
2. tests cannot recognise the ✗ symbol?
When I run Duke.java manually everything is fine as expected. However when I try the test, the following error shows up:
"Task.java:10: error: unmappable character (0x97) for encoding US-ASCII
return "[???] "
this is line 10 of Task.java
May I ask how should I solve this issue? Does it matter?
3
I think you need to install dos2unix
If you are using Mac, simply run
brew install dos2unix
on your terminal (if you have homebrew haha)
4
What is the exact error you get?
Does it make a difference if you specify a filename only e.g.,
todo.txt
(i.e., without folders)
Ahh yes, this works! Thanks so much!
The error I got was
java.io.IOException: No such file or directory
at java.base/java.io.UnixFileSystem.createFileExclusively(Native Method)
at java.base/java.io.File.createNewFile(File.java:1024)
at seedu.duke.Storage.<init>(Storage.java:30)
at seedu.duke.Duke.<init>(Duke.java:47)
at seedu.duke.Main.<init>(Main.java:15)
... 11 more
5
Ahh yes, this works! Thanks so much!
In that case most likely the folder doesn't exist and your code needs to create the folders as well.
I see! Thank you!!
@lettuceman4
(5 posts)1. Tests fail on Ubuntu but not on MACOS and Windows
Hi when I uploaded the tests to GitHub, the checks for Ubuntu said they fail for the 3 tests but it passed on Windows and MACOS. May I ask what is the problem? The filepaths used are all relative paths.
@Test
public void read_notJsonFormat_exceptionThrown() {
assertThrows(DataConversionException.class, () -> readCommonCents("notJsonFormatCommonCents.json"));
}
@Test
public void readCommonCents_invalidPersonCommonCents_throwDataConversionException() {
assertThrows(DataConversionException.class, () -> readCommonCents("invalidAccountNameCommonCents.json"));
}
@Test
public void readCommonCents_invalidAndValidPersonCommonCents_throwDataConversionException() {
assertThrows(DataConversionException.class, () -> readCommonCents(
"invalidAndValidAccountCommonCents.json"));
}
2
Hi prof, this is the error (in case this link https://github.com/AY2021S1-CS2103T-T13-4/tp/pulls doesn't work)
3
and this is the test report when I build on my com
4
and got this time when the check on MACOS runs first
5
Ah I see thank you very much!
Note that file/folder names are case insensitive in Windows but case-sensitive in Linux/OS-X.
Furthermore, name case changes (if you are using Windows) might not get reflected in the repo as git on Windows may ignore such changes.
You may want to look at file/folder names involved carefully, in the GitHub repo in particular.
@IlyaRin
(5 posts) 1. Actual output does not match expected output
Hi, I've just run into a problem where my actual output (file is always empty) does not match expected output, unless the expected.txt is empty. I am able to run the runtest.bat , but says that the files do not match, even though my expected output matches the output I get when running Duke.java.
2
It may help to post the full output you see when you run the batch file.
This is the output from running the file
3
I see. looks like there are no compilation errors. Can you post the code of
Duke.java
as well?
Also. delete the bin folder and run again, to confirm that the latest .class file is being used.
This is the Duke.java file and the result after deleting the bin folder and running again
4
The same output occurs (There was a line Cannot find file .... /ACTUAL.TXT the first time I ran it, the error was gone the second time I ran it)
5
so i must cd twice to the previous directory to go to the main iP folder directory. Then mkdir there ah.
You can also go to where your main iP folder is and create a new folder inside called data. It will appear in intellij, then right click on the new folder in intellij and create a new file (Duke.txt) from there. Hope this helps!
@nweiyue
(5 posts)1. runtest.sh not working after importing javaFx classes
Hello, runtest.sh does not run after I added javaFx into my class files for Level-10.
May I ask how can I solve this issue?
Any help is much appreciated! Thanks!
2
Thank you everyone for the response. Like what @daongochieu2810, I think the problem is likely due to runtest script not linking to javafx. Since we are moving to GUI, I think I will focus my efforts on JUnit testing for now.
3
Hi, I was facing the same issue when I tried double-clicking on it. Maybe you can try opening it on the command line using java -jar >filename>.jar
. Not too sure what is the issue here though.
4
Hello, I am facing the same issue. May I ask how did u resolve it?
5
It works! Thank you. I found an explanation online regarding this if anyone is interested. https://stackoverflow.com/questions/46053974/using-platform-exit-and-system-exitint-together
@ameliatjy
(5 posts)1. Gradle Checks
Hi! I recently merged a pull request (which has passed all the checks) to my team's tP repository.
However, after merging it, I was notified that checks were failing on our team's pull request to nus-cs2103-AY2021S1/tp:
with the following error:
I am wondering why there is a difference in the checks outcome and I hope to get some help on how I can resolve this issue.
2. iP Duke JAR File
Hello, I found a small bug in my uploaded iP JAR file and would like to correct it.
However, I noticed that the iP tracker for JAR released was defined by: "The JAR file was released via GitHub releases in the period 2020-09-10 00:00:00+08:00 to 2020-10-02 00:00:00+08:00" where the end date was last midnight.
I have already released it once and passed the tracker for JAR released but I was wondering if modifications to my file and reuploading of a new JAR file is allowed and whether I would fail the tracker?
Thank you! 😃
3
Here is my really super duper ultra simple GUI without tweaks!
4
@damithc Noted, thank you!
5
@damithc I see, thank you! 😃
@sagarsureka
(5 posts)1. ClassNotFoundException while running runtest.sh
Greetings!
JDK 11; IntelliJ 2020.2
After I improved the packaging of my classes and added J-Unit tests, the runtest.sh file is unable to give a successful result. I tried to fix it with extensive searching and help from peers but I am unable to solve still.
Following is the error I get when I run runtest.sh (My bot name is Dobby):
Error: Could not find or load main class Dobby
Caused by: java.lang.ClassNotFoundException: Dobby
dos2unix: converting file ACTUAL.TXT to Unix format...
dos2unix: converting file EXPECTED-UNIX.TXT to Unix format...
I also made a shell-script configuration (script path is of runtest.sh) for runtest.sh which gives a build failure:
no matches found: ../src/main/java/dobby/*.java
********** BUILD FAILURE **********
Compiling code in runtest.sh:
javac -cp ../src/main/java/dobby -Xlint:none -d ../bin ../src/main/java/dobby/.java ../src/main/java/dobby/task/.java
Code to run the program in runtest.sh:
java -classpath ../bin Dobby < input.txt > ACTUAL.TXT
My code structure is as follows:
ip/src/main/java/dobby/Dobby.java (and other java files- package dobby)
ip/src/main/java/dobby/task/Task.java (and other task related java files - package dobby.task)
The java folder inside main is the sources root.
Thank you in advance! I can clarify anything if required!
2
Can you check if you have indicated the correct folder as Test Sources Root.
It should be the java folder inside the test folder.
Hope this helps!
3
I tried that. It did not work. Tried again just now but same result.
4
Thank you so much for your help!
@tohyuting, I did what you said and it worked.
Link for my fork- https://github.com/sagarsureka/ip
Made a modification in the configuration setting with the working directory set as the text-ui-test directory. That works as well now.
Thanks once again!
5
Noted. Thank you so much!
@sc-arecrow
(4 posts)1. JUnit testing assertEquals fails with identical arguments
I am trying to use JUnit to test my Ui class, specifically testing if my showList method is printing the correct result to standard output.
Here is part of my UiTest class
private static final String TICK_ICON = "\u2713";
private static final String CROSS_ICON = "\u2718";
private static final List<Task> DEFAULT_TASKS = Arrays.asList(
new Todo("t1", false),
new Deadline("t2", true, LocalDateTime.of(2020, 8, 24, 10, 0)),
new Deadline("t3", false, LocalDateTime.of(2020, 8, 27, 11, 0)),
new Event("t4", true, LocalDateTime.of(2020, 8, 24, 11, 0)),
new Event("t5", false, LocalDateTime.of(2020, 8, 27, 12, 0)));
//@@author sc-arecrow-reused
//Reused from https://www.baeldung.com/java-testing-system-out-println with minor modifications
private final PrintStream standardOut = System.out;
private final ByteArrayOutputStream outputStreamCaptor = new ByteArrayOutputStream();
@BeforeEach
public void setUp() {
System.setOut(new PrintStream(outputStreamCaptor));
}
@AfterEach
public void tearDown() {
System.setOut(standardOut);
}
//@@author
@Test
public void showList_emptyModifierAndDate_success() {
new Ui().showList(DEFAULT_TASKS, "", "");
String listMessage = "Here are the tasks in your list:" + System.lineSeparator() +
"1.[T][" + CROSS_ICON + "] t1" + System.lineSeparator() +
"2.[D][" + TICK_ICON + "] t2 (by: Aug 24 2020, 10:00)" + System.lineSeparator() +
"3.[D][" + CROSS_ICON + "] t3 (by: Aug 27 2020, 11:00)" + System.lineSeparator() +
"4.[E][" + TICK_ICON + "] t4 (at: Aug 24 2020, 11:00)" + System.lineSeparator() +
"5.[E][" + CROSS_ICON + "] t5 (at: Aug 27 2020, 12:00)";
String expectedResult = putInChatBox(listMessage);
String actualResult = outputStreamCaptor.toString();
assertEquals(expectedResult, actualResult);
}
private static String putInChatBox(String message) {
return HORIZONTAL_LINE + System.lineSeparator() +
message + System.lineSeparator() +
HORIZONTAL_LINE + System.lineSeparator() +
System.lineSeparator();
}
and my showList method in the Ui class
public void showList(List<Task> tasks, String modifier, String dateString) {
String finalDateString = dateString.isEmpty()
? dateString
: ("occurring " + (dateString.equals("today")
? dateString
: "on " + dateString) + " ");
speak(String.format("Here are the %ss %sin your list:\n%s",
modifier.isEmpty() ? "task" : modifier,
finalDateString,
convertTaskListToString(tasks)));
}
private String convertTaskListToString(List<Task> tasks) {
String result = "";
for (int i = 0; i < tasks.size(); i++) {
result += (i == tasks.size() - 1)
? String.format("%d.%s", i + 1, tasks.get(i).toString())
: String.format("%d.%s\n", i + 1, tasks.get(i).toString());
}
return result;
}
Below is the result that I get for both expectedResult and actualResult
__________________________________________________
Here are the tasks in your list:
1.[T][✘] t1
2.[D][✓] t2 (by: Aug 24 2020, 10:00)
3.[D][✘] t3 (by: Aug 27 2020, 11:00)
4.[E][✓] t4 (at: Aug 24 2020, 11:00)
5.[E][✘] t5 (at: Aug 27 2020, 12:00)
__________________________________________________
Even though there is an AssertionFailedError,
IntelliJ tells me that the contents are identical
Why is this happening?
💡 You can use Markdown to format your text
2
I am facing the same problem with a similar setup as OP.
package viscount;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
public class UiTest {
@Test
public void dummyTest() {
assertEquals(2, 2);
}
}
When I right click the class and select Run 'UiTest' as instructed here, IntelliJ tells me that no tests were found. My current project structure is (renamed Duke to Viscount):
3
Hello, I think I found the problem! All this while, the wrong directory was marked as the module in my project structure (it was [project root]
but it should be [project root]/src/main
). I followed these steps to solve the issue:
Remove old [project root]/src/test
directory as module and delete it
Remove [project root]
directory as module
Go to File > New > Module from Existing Sources and choose [project root]/src/main
, then selecting Create module from existing sources
followed by all the default settings.
Mark [project root]/src/main/java
as source root if you havent done so
Now follow the instructions here again and it should work!
4
The solution that @luo-git suggested worked! Thank you so much
@jeffreytjs
(4 posts) 1. Updating email of committer
So I was wondering why some of my commits seemed to not have my profile pic then I noticed that the commits made through sourcetree were being attributed to another email of mine. Long story (included below) short, I am trying to correct it but currently facing some difficulty. I am following this guide and it is resulting in duplicated commits. And when I try to preview the PR, it is showing 900+ commits.
Including this here partly because it was meant to be my initial issue post:
Previously my tp fork was quite messy because I tried to resolve the conflicts arising from the duplicated commits by merging and I made a mistake by mass merging without checking. After quite a bit of searching. I managed to hard revert it back to the commit before all the above were done.
Would appreciate any help if anyone has been through this or knows a bit more about the process! Thanks!
2
@AlexCQY try using a more powerful diff tool such as WinMerge to compare the two files. There may be differences not visible to the naked eye.
Thank you @AlexCQY, I had the same issue and the suggested program by prof helped to identify the differences (mine were due to white spaces) that were indeed missed by sight.
By the way, I would like to ask if there is a solution/need to address the weird characters appearing on the terminal as seen in the screenshot above. It's working fine in the ACTUAL.TXT though.
3
Sharing my simple GUI too! Featuring nana 😃
4
Oh thank you Prof for the fast response, I believe most of my commits are detected but I will definitely look through the reposense again.
I shall delay the email update to after this module has concluded then so as not to cause inconveniences.
@sudogene
(4 posts)1. iP: Users without Java (JRE/JDK)
As I'm wrapping up iP, I tried sending to a few friends the duke.jar
file to test out the bot. Most of them (coming from non-CS background) do not have java and hence cannot open the program. It feels super strange to request them to install java on their own systems.
I did some digging around and found out that many products now are also bundled with their own JRE so users can run them without native java. However, I have two questions regarding that:
How do I do that? I tried launch4J but it didn't really work (I probably did it wrongly)
Doesn't this bloat up your program by a lot? duke.jar
itself is around 11 mb, adding a JRE is like ~100+ mb
2
In case 2, duplication of code can be mitigated if you have a single method for creating the subclasses of Task.
public Task createTask(String type, String description) throws DukeException
Then there will only be a single check for whether description is empty or poorly formatted, which throws exception.
This was how I attempted this issue, hope it provides some clarity.
3
Here's my gui
4
I encountered InvocationTargetException in the past. For my case it was because the path for the image in userImage/dukeImage didnt exist/typed incorrectly
Had this issue too, just to add on: path is case-sensitive
@marcus2k
(4 posts)1. Unable to run Gradle checkstyle
When I tried running ./gradlew checkstyleMain checkstyleTest, the following error appears:
Execution failed for task ':checkstyleMain'.
Unable to create Root Module: config {[root]/config/checkstyle/checkstyle.xml}, classpath {/Users/marcus/Desktop/workspace/ip/build/classes/java/main:/Users/marcus/Desktop/workspace/ip/build/resources/main}.
I already placed the checkstyle configuration files in the directory [root]/config/checkstyle/checkstyle.xml. Does anyone have any idea on where the error is?
2
@zhengweii Yup I had the suppressions.xml
file as well, but it still wouldn't work
@qlchan24 which version number did you change it to? I took the following screenshot of the error message:
3
@qlchan24 I changed my version to 8.32 and I think it works (it produced an HTML file showing the errors), but the following still appears:
Is it running properly?
4
ok thanks! @zhengweii @qlchan24
@royleochan
(4 posts) 1
Hi I'm using a mac as well and also have the dos2unix error but I left it because it doesn't seem to affect my test cases and I can run them just fine. As others have said the problem is probably with the ACTUAL and EXPECTED files and not the dos2unix error.
2
You can also use your IDE to help you with conflicting changes. If you are using intellij, more details about resolving conflicts can be found here https://www.jetbrains.com/help/idea/resolving-conflicts.html#distributed-version-control-systems
3
Added some basic styling as well!
4
The official java docs gave some nice concrete examples and reasoning (such as the default clause in switch case blocks, method preconditions and postconditions) where assertions can be used. Maybe reading it can help shed some light (link provided in the textbook as well): https://docs.oracle.com/javase/8/docs/technotes/guides/language/assert.html#intro
@josuaaah
(4 posts)1. How do I find out class file versions for a .jar file?
I have recently received an email titled iP JAR file failed our smoke test
, and it said that an automated testing of my .jar file found that the application crashes with the following error(s) upon launching:
On Windows, using Java 11:
Error: LinkageError occurred while loading main class duke.Launcher java.lang.UnsupportedClassVersionError: duke/Launcher has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 55.0
On Linux, using Java 11:
Error: LinkageError occurred while loading main class duke.Launcher java.lang.UnsupportedClassVersionError: duke/Launcher has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Therefore, I have deleted all my Java JDKs on my computer and reinstalled Java 11, and remade my .jar file.
However, I am still uncertain whether my .jar file is able to pass the automated smoke tests.
Is there any way for me to check whether all class files inside my duke.jar file has versions that are less than or equal to 55.0?
2. Unable to run Duke after editing VM options due to differences of hash for javafx
I have followed the instructions for JavaFX tutorial part 1, where I
Downloaded the JavaFX 11 SDK and unzipped it.
Imported the libs folder into my project
Added the following line to my VM options for the duke.Duke class
--module-path /Users/joshuachewjianxiang/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml
However, after I followed the instructions above and tried to run the program, I received the following error:
Error occurred during initialization of boot layer
java.lang.module.FindException: Hash of javafx.base (7d002bf1e3ab1a71413dc71407f8cd5b5825a50d4fa6ce72af927935b58075a0) differs to expected hash (6f82f10f1e646a3d56e40b4e8fa51bc207c27591688524db7074c5285269ed24) recorded in java.base
Does anyone face a similar issue?
3
@EugeneTeu Yep, I decided to use Gradle instead, and the problem is resolved. What I did was as follows:
build.gradle
:
repositories {
mavenCentral()
}
dependencies {
String javaFxVersion = '11'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-base', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-controls', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-fxml', version: javaFxVersion, classifier: 'linux'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'win'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'mac'
implementation group: 'org.openjfx', name: 'javafx-graphics', version: javaFxVersion, classifier: 'linux'
}
./gradlew build
.After that, I was able to follow the rest of the instructions for JavaFX tutorial part 1 with no problem. I shall close this issue.
4
I am currently experiencing the same problem after I made some commits where I increased the number of JUnit tests.
@nopenotj
(4 posts)1. Anyone facing issues opening their reposense link from their pdf PPP?
Using preview to open my PPP pdf and because the reposense link includes a "#" character
https://nus-cs2103-ay2021s1.github.io/tp-dashboard/#breakdown=true&search=nopenotj&sort=groupTitle&sortWithin=title&since=2020-08-14&timeframe=commit&mergegroup=&groupSelect=groupByRepos&checkedFileTypes=docs~functional-code~test-code~other
Somehow when I try to click on this link it the "#" transforms into "%23" and results in this link which leads me to an error page.
https://nus-cs2103-ay2021s1.github.io/tp-dashboard/%23breakdown=true&search=nopenotj&sort=groupTitle&sortWithin=title&since=2020-08-14&timeframe=commit&mergegroup=&groupSelect=groupByRepos&checkedFileTypes=docs~functional-code~test-code~other
Not sure why this is happening........
2. What is refs in git?
just looking through the git config file in .git/config
which looks something like this
does anyone know what does the fetch = +refs/heads/*:refs/remotes/origin/*
mean? can't really seem to find much on google... I assume it means something like fetch all head refs + and all refs in remote/origin.
What sort of path syntax is this?
3
Thank you!!! @ianyong
4
I think the issue has to do with preview because I was able to open the same link in chrome's pdf reader
@drake25122000
(4 posts)1. The system cannot find the file C:\ProgramData\Oracle\Java\javapath\java.exe.
How to fix this error?
2
I tried to run the runtest.bat, but then that error showed up.
3
Hmm okay, let me check it
4
Thanks!
@duckmoon99
(4 posts)1. Modifying CheckStyle for Stream and Lambda
Can we modify the CheckStyle? Currently I am trying to write something like
But CheckStyle insists that the left parenthesis '(' of line 117 and 121 should be on previous lines, even though they are parenthesis for lambdas. What do you guys think?
2
I believe in most cases this can be solved by using an association class. Similar to Student, Book, and Loan.
3
Seems like this is mis-configuration between your jar builder and your packages. Did you package your Duke class under seedu.duke? Because the default jar builder configuration from the gradle support is under that, but I doubt any of us are packaging it under seedu.
4
However I am not too sure how to go about this without just straight up disabling check for left parenthesis. Because there are legitimate reasons for have '(' on the previous line for function calls (such as line 115). It's just that now CheckStyle cannot differentiate parenthesis for lambda or for function calls. Any idea how I can go about this?
Update:
For those interested, here is the link to the modified CheckStyle file that disables the check for "(" to be at EOL.
You can check the history of the file to find what exactly changed. I am still a bit iffy with this change but I don't know how we can do better straight disabling the check for "(" since there are cases where that needs to be enforced.
@Christopher-LM
(4 posts) 1. Im having issues trying to add a background image using CSS
Hi, does anyone have a simple guide on how to add a background image using CSS? I've been following a few guides that I found online but I'm not sure how to apply the css background to the mainwindow fxml file.
2
hi this is my gui
3
u can select the textfield here in the main window here
next click the bring to front button on the top which would bring the text field on top of the dialog box so that when u rescale it, it will be in front.
Hope this helps u out! 😃
4
thanks for the share, really appreciate it!
@wakululuu
(4 posts)1
Adding export LC_ALL=en_GB.UTF-8
in runtest.sh works for me
2
Have you handled the case where dataFile
doesn't exist?
3
Could you try printing the dataFile
object and see what the output is?
4
Sorry for the unclear suggestion previously but maybe print it right before fos = new FileOutputStream(dataFile);
instead. Could you also show the part of your code where you call saveData?
@qlchan24
(4 posts)1
Try to post the error message for the sub process, it will give more info on the error. The error message that you posted will be shown regardless of why checkstyle failed.
That being said, when I first transferred the files, i had to change the checkstyle version number on build.gradle to the one mentioned in the github where i downloaded the file.
2
Oh it still doesn't show the error. I think you can run gradle checkstyleMain alone to run with --stacktrace to get the error message.
mine is 8.32
3
put this in your gradle.build so that it compiles in utf8:
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
also put this to ensure the jvm runs with utf8:
applicationDefaultJvmArgs = ["-Dfile.encoding=utf-8"]
4
I think Gradle does not actually know the version, and completely relies on whatever number you put in the build.gradle file. Its just that the structure between checkstyle of version 8.32 and 8.23 is different so if you tell gradle that you are using 8.23 then they will give you an error because the structure seems wrong to them. I only knew the correct version from the commit header too.
@geoboom
(4 posts)1. [External Library Permission Request] JFoenix
Make our UI look elegant and feel native
2
I think reading each others' data
refers to (directly) accessing other objects' instance variables, which is widely known as bad practice.
However, for sending each other messages
, it could refer to method invocation in the case of Java/C#/C++
(see this answer) which is a more "desirable" method (no pun intended) for objects to interact with other objects (as methods serve as encapsulation of the object's variables).
3
From 'error: invalid flag: C:\Users\Rui' and the line after, it seems as if 'javac' in 'javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\Duke.java
' in 'runtest.bat' is attempting to use 'C:\Users\Rui' as a flag. And as you correctly pointed out, this is caused by having whitespaces in folder or file names.
I can think of two possible solutions:
remove the whitespaces in your file and folder names, or
replace 'javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\Duke.java' with 'javac -cp "..\src" -Xlint:none -d "..\bin ..\src\main\java\Duke.java"' in 'runtest.bat' (line 10). Basically surround all paths with " ".
Hope this helps! Do let me know if 2 works so I can submit a PR to the repo to prevent future occurrences of this issue for anyone else.
4
Ah I see.
What I meant was double quoting "..\src" and "..\bin" in runtest.bat so that javac can recognize them as file paths rather than options.
As for the disappearing \, trying double backslash \\ rather than single \ backslash for each path in sources.txt might work... if my memory of hosting minecraft servers serves me right 😂 (as each backslash character needs to be escaped within " ") .
eg "C:\foo\bar" -> "C:\\foo\\bar"
@joeychensmart
(4 posts)1. 💡 Github actions (CI) can fail sometimes (and its not your fault)
This happened when one of my team members added his AboutUs picture in a PR. The only change was the addition of 1 .png file, and no code was changed so the CI should not fail. But it did.
We can see from the CI logs that the build process failed because gradle failed to download and install the shadow package. Note that this build process happens one one of github's cloud VMs, and not on your local machine.
To fix this, you can close and reopen the PR, making github restart the CI process.
Note that this will only fix problems that are github's fault (e.g. failing to download a package). It will not magically make your CI pass. In particular, the CI may fail again if your code does not pass all the test cases (repeatedly closing and opening the PR will never fix this!).
2. [External Software Permission Request] Apache commons-cli
Implements some basic command parsing functionality and automated help generation for commands.
Allows me to build up even more complicated features for the command line (e.g. creating easier syntax, allowing users to create simple macro commands, etc..).
3. [External Software Permission Request] Google Gson library
To implement robust storage features in the iP.
4
Yes, my team will be using jackson for the tP, but I have been using Gson for my iP. Only just found out that we need to request permission to use external libraries in the iP as well.
@chrisgzf
(4 posts)1. [External Library Permission Request] Apache POI
Write .xlsx MS Excel files
2. 💡Disabling wildcard imports in IntelliJ IDEA
According to this section of the style guide:
This means that we should configure our IDE to not use wildcard imports.
To do so in IntelliJ IDEA:
Open Preferences > Editor > Code Style > Java > Imports
Set both Class count to use import with '*'
and Names count to use static import with '*'
to an unreachably high number.
Packages to Use Import with '*'
.3
We'd need more details in order to help you! When using Git, when in doubt and confused, always look at git status
and git log
. git status
tells you the current status of your source directory, which should tell you which files are having merge conflicts. git log
helps you to see how your commit history is like, to see if you've perhaps added some commits wrongly.
4
Wow! Thanks for sharing such a great tip! Great guide as well!
@pooty3
(4 posts) 1. Adding Gradle to project causes it to break
I added gradle to my project as per the instructions given. However, now everything seem to not work. the Java files no longer seem to be recognised by Intellij. Gradle run command still seem to work though
2. Regarding conflicts
Git uses this format
//>>>>>> HEAD
//XXX
//=======
//YYYY
//>>>>>> ZZZ
to indicate that there is a conflict. (I had to add // to prevent weird formatting)
My question is what if for some reason (maybe you are writing a txt tutorial on how to deal with git conflicts), that segment format is actually part of your content? Will git think it is an actual conflict? Is it thus possible to generate fake conflicts by inserting this segment intentionally to your code?
3
I meant to say that intellij no longer recognise the java libraries, as shown from the red markers. (unable to resolve symbol error) Gradlew run still manages to compile the code.
4
I checked the project settings, the SDK and everything seem to be correct
Edit: I reinstalled the JDK and it works now
@halcon-blanco
(4 posts)1. Testing random values within equivalence partitions
Currently, our only heuristic for picking cases within equivalence partitions is to pick boundary values and a few non-boundary values. Instead of picking an arbitrary non-boundary value, would it be a good idea to test a random value within the equivalence partition, so that every time the test suite is run, it covers a different possible value.
The main issue I see with this is that the testing functions are non deterministic and failed test cases become hard to reproduce, but if we simply log the values used, it shouldn't be an issue.
2
Hey Naumie, did you try and javac all the files instead of just the Duke.java in the script
3
http://tutorials.jenkov.com/java/enums.html#enum-abstract-methods
You can try something like the abstract methods for enums mentioned here. Each enum type will then implement a method like makeToy() that returns the appropriate Toy. Then in your Toy class you can just return identifier.makeToy()
4
Did you download the checkstyle xml files into your project. If you look at the Gradle tutorial, you'll see a resource called Checkstyle Tutorial. It is in that resource where it is explained the further steps you need to take
@yongping827
(4 posts)1. iP JAR File fails smoke test
Development Environment
IntelliJ version: 2020.2.1
OS: Windows 10
Java version: 13.0.1 (Erroneous)
I received an email stating that my iP JAR File failed the smoke test. The error messages were:
Error: LinkageError occurred while loading main class duke.Duke java.lang.UnsupportedClassVersionError: duke/Duke has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Error: LinkageError occurred while loading main class duke.Duke java.lang.UnsupportedClassVersionError: duke/Duke has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Following which, I realized that the SDK I have been using was JDK 13 instead of JDK 11.
File >> Project Structure >> Project >> Project SDK
set to java version 11
File >> Settings >> Build, Execution, Deployment >> Build Tools >> Gradle >> Gradle projects >> Gradle >> Gradle JVM
set to java version 11
gradlew properties
reveals that:sourceCompatability: 13
targetCompatability: 13
even when the actions in (1.) were taken. Currently I have no way of knowing if those properties are the cause, nor of how to change the values in those properties.
2
Try specifying the following in your
build.gradle
:
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
Running gradlew build
after making those changes returns the following error:
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\Users\Yong Ping\repos\ip2\build.gradle' line: 63
* What went wrong:
A problem occurred evaluating root project 'ip2'.
> Could not set unknown property 'sourceCompatability' for root project 'ip2' of type org.gradle.api.Project.
3
The spelling error has been corrected. The following error message is returned.
> Task :checkstyleMain FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':checkstyleMain'.
> Unable to create Root Module: config {C:\Users\Yong Ping\repos\ip\config\checkstyle\checkstyle.xml}, classpath {C:\Users\Yong Ping\repos\ip\build\classes\java\main;C:\Users\Yong Ping\repos\ip\build\resources\main;C:\Users\Yong Pin
g\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-fxml\11\d5ff9262ef49d166db658d15f37e3ecff38fde4b\javafx-fxml-11-win.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-fxml\11\e0f5bb81e21054b59f2ebfa
727d40a90ee0260d3\javafx-fxml-11-mac.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-fxml\11\e7a757b580fc3e2e1a121768606c7836eef418c\javafx-fxml-11-linux.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\f
iles-2.1\org.openjfx\javafx-controls\11\af8d24de44e16a19ae959028eb23a48c145fb682\javafx-controls-11-win.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-controls\11\e3a24a14e8732abc6dc173f15872dc63e2a32e1
6\javafx-controls-11-mac.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-controls\11\794488e3b1f4635d9a1b842bdc872a5eb8fd54ca\javafx-controls-11-linux.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\file
s-2.1\org.openjfx\javafx-controls\11\58d961774262ec972bf304e16c154a8e18c2050b\javafx-controls-11.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-graphics\11\9345c7ea43dbcc73a62eca5332717b4ce617e6c6\javaf
x-graphics-11-win.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-graphics\11\af47a6d3668d3ce1c61e1fe13c44471b6f8d469\javafx-graphics-11-mac.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\files-2.1\org.
openjfx\javafx-graphics\11\4ab9edd8d481a420044c473fdb5718ccdd35c836\javafx-graphics-11-linux.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-graphics\11\a736dd079047ec0b72b8c4970842a5c5e0c19f2f\javafx-gr
aphics-11.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-base\11\ad3a4acfaa28b484d30c40c1f009445cc3f6e68b\javafx-base-11-win.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-
base\11\4b060dad0affd866df9d959e064faa8a1a2f4af0\javafx-base-11-mac.jar;C:\Users\Yong Ping\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-base\11\f8d1ced6047b010f1e3bb92dc060862179ce5897\javafx-base-11-linux.jar;C:\Users\Yong
Ping\.gradle\caches\modules-2\files-2.1\org.openjfx\javafx-base\11\9fcd3e8e3227ec97bf503f7991fad1f3b14d005\javafx-base-11.jar}.
4
Thank you Prof @damithc and @ianyong!
@RuiFengg
(4 posts)1
@GilbertTan19 , hi can I ask how did you manage to solve that issue?
Try going to the Gradle toolbar and under the build option double click everything. Not sure which was the specific one that solved it for me 😅
2
@GilbertTan19 , hi can I ask how did you manage to solve that issue?
Try going to the Gradle toolbar and under the build option double click everything. Not sure which was the specific one that solved it for me 😅
Hi! I cannot find the build option in the Gradle toolbar you are referring to. Could you provide a ss? I am having the same error of "JavaFX runtime components are missing, and are required to run this application". Thx in advance.
Try all the build options and clean as well
3
Try all the build options and clean as well
@RuiFengg hmm oh no doesn't seem to work for me .-.
Do you still get the same "JavaFX runtime components are missing" error?
4
Try all the build options and clean as well
@RuiFengg hmm oh no doesn't seem to work for me .-.
Do you still get the same "JavaFX runtime components are missing" error?
yeap sadly. only when running Duke
I ran mine with launcher instead of Duke shown in the ss I sent beside the green play button. If that doesn't work I'm not really sure how to fix it 😅
@rtshkmr
(4 posts) 1. Suggestion on Handling Unintended Termination of Application💡
Hi everyone. I was looking into how to handle the case when a user accidentally terminates the java program without the proper exit command (e.g. via the "bye") keyword and I came across the idea of adding a JVM Shutdown hook. This seems to be one solution to handle this situation, and I tried implementing it like so:
Thought this might be useful for others. Also if anyone can explain more in-depth into what's happening under-the-hood for how the ShutdownHook works (the JVM is the one that executes the code within the hook?) ...
Started this thread to point others to this and get pointed at similar concepts to understand this better. (Also, not sure if there's any better way than to use System.exit()
for the ExitCommand
)
2
Is there any thing that I have to note when implementing this shutdown hook? 'cause when I try to use it, I cannot pressing ctrl + c to terminate the program any more
Hi @aidoxe-123 , did you manage to make it work?
I didn't have to add any other code other than the screenshot on the left (with the relevant import statements magically added by IntelliJ).
If you implemented your main class as suggested, I don't think you'll need to use
System.exit()
since the program will automatically terminate when it reaches the end of themain()
function.
@seowalex I'm not fully sure about this. I added in the System.exit()
just in the meantime because prior to adding it:
after user is done and sends the exit command to Duke, the exit greeting is displayed by the UI and Duke.main()
is done running
this shuts down the JVM since everything is done, and the hook runs, doing the necessary saving and displaying the exit greeting a second time
So I decided to just call System.exit()
for the execute
method for ExitCommand
On a side note the hooks will not execute in the event of an unexpected termination of JVM, so its still a safer choice to save on add.
@LeeEnHao Thanks for the heads up man! yes I realise now that OS related signals (SIGKILL) and other situations can prevent the hook from running, and you're right about writing onto the hard disk upon add being a safer option.
This is a neat trick, but ensure you are using it for the right reasons (if you are doing this because you want to save only at the shutdown, see this comment).
Thank you Prof @damithc ! This echoes @LeeEnHao 's point about writing on every add/change to the TaskList being a safer option. Now that I realise this may not be that useful a tip, should I just close this Issue?
3
Thanks @kormingsoon for such a detailed description!
4
I tried using gifs and the scene builder, here's it now:
@ZhangWanlin98
(4 posts)1. Unable to run test cases in removing field tutorial with Gradle
I am currently facing difficulties running test cases for removing field tutorial but encountered errors as the pic shows. I have run it via intelliJ and it was perfectly fine, but just failed when using Gradle to run.
Will really appreciate if someone can help!
2
Hi Prof, can I know if commenting affects the grading?
3
@ZhangWanlin98 is this blocking your tP progress, or are you able to proceed by using intellij to run tests instead?
this occurs in running the tutorial tests, but i can use intellij to run.
while this is the case, i think it would be better if i can know the reason why gradle run for tests failed
4
@ZhangWanlin98 doesn't look like this is a common problem as no one else reported it. Did you manage to solve it?
No, I have not solved it.
I think it is somehow because of the setting problem since within the tp code, I can only run new tests that are written locally with Gradle.
I have tried to add jvmArgs '--enable-preview' into test, but did not work.
In the end, I adapt to choose IntelliJ in the setting for the test and all tests works.
@ya0-yuan
(4 posts)1. Application icon not updated for windows
we've changed our group icon but it is not update for windows user. Is there any way to resolve this?
(updated icon)
(non updated AB3 icon)
2. JavaFX cannot resolve symbol inside start method
I got this error when i tried to add the code from tutorial2 inside my project. I have added the dependencies in build.gradle as well as set up JavaFX 11 SDK. Has anyone encountered the same problem as me?
3
ya i missed that part out carelessly, thanks for the help! @tanweijie123
4
it works! thanks for the help :>
@GabriellaTeh
(4 posts)1. Cannot find Graphviz
Hello, I followed the instructions on how to install graphviz and installed the PlantUML integration plugin on intellij. However, I am unable to see the diagrams and keep getting the error below. I am not sure why this is happening.
2. Jar file cannot open
I tried to do a smoke test by dragging the fat jar file out of Intelli-j onto my desktop. But I get this error and I do not know what the issue is. Please help me.
3. Cannot access Task class after merging gradle branch
Task cannot be accessed by the other classes after merging gradle branch and following the gradle instructions. I also cannot run the Duke class. Please help, I have been stuck on this for very long.
4
@ianyong Thank you I am able to run Duke now!
@ruilingk
(4 posts) 1. White spaces in class path, leading to errors in running runtest.bat
Development environment:
IntelliJ IDEA 2020.2 (Community Edition)
Build #IC-202.6397.94, built on July 27, 2020
Runtime version: 11.0.7+10-b944.20 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Windows 10 10.0
Issue:
I was trying to do the Automated Text UI Testing for Individual Project and initially it has the same problem as mentioned in Issue #3. Therefore, I have replaced line 10 with the codes given in the solution. However, when I tried to run runtest.bat
, another error appeared. I googled and I think it has to do with the white spaces in the name of the folders containing the classes. This was the error message shown:
>pre>>code>cmd.exe /c runtest.bat
Could Not Find C:\Users\Rui Ling\Desktop\uni y2s1\cs2103t\ip\text-ui-test\ACTUAL.TXT
error: invalid flag: C:\Users\Rui
Usage: javac > options > > source files >
use --help for a list of possible options
********** BUILD FAILURE **********
Process finished with exit code 1>/code>>/pre>
I would appreciate any help given, thank you in advance!
2
Hi, thank you for the prompt reply!
For solution 1, I have tried to rename the "Rui Ling" folder but I am unable to do so, since it is under Users folder. To create a new folder with no white spaces would be to create a new user account.
For solution 2, as I used these:
>pre>>code>dir /s /B ..\src\main\java*.java > sources.txt
javac -cp ..\src -Xlint:none -d ..\bin @sources.txt>/code>>/pre>
all the paths are in sources.txt
file, and therefore I am unsure of what to do next.
Other than that, I have tried double quoting all paths in sources.txt
but it does not work, meaning it will be as such:
C:UsersRui LingDesktopuni y2s1cs2103tip
when I run runtest.bat
.
Was this what you meant? Sorry if I didn't catch you!
3
Hmm for the first solution do you mean this way:
>pre>>code>dir /s /B ..\src\main\java*.java > sources.txt
javac -cp "..\src" -Xlint:none -d "..\bin" @sources.txt>/code>>/pre>
I have double quoted ..\src and ..\bin in the second line.
I will try the second solution tomorrow!
Thank you!
4
@erisjacey Yes, it worked for me, thank you!
@Nikhilalalalala
(4 posts) 1
Hi, I tried the aforementioned solution of following the steps under "if you are not using Gradle" as well, but I am still facing the issue, anyone managed to solve it?
2
Okay, sorry, I realised I had to either change the main class in the build gradle file.
3
Hi more things that I checked are here:
The tutorial mentioned the use of a Launcher class, so the main class name has to be changed to "duke.Launcher" or whatever other name used.
Also, since the Launcher class has the main method, the main method in Duke needs to be removed.
One more thing is to follow the step 3 of the tutorial for those without gradle,
" 3. From Run > Edit Configurations, add the following line into your VM options for each of the main classes.
--module-path {JAVAFX_HOME}/lib --add-modules javafx.controls,javafx.fxml
e.g., --module-path C:/javafx-sdk-11.0.2/lib --add-modules javafx.controls,javafx.fxml "
Find the configuration with gradle task run and add the above into the VM options of that particular configuration. Not sure if this is clear, do sound out for any further clarifications.
Hope this helps!
4
Hello, here's my gui, Kept it simple and neat
@zhengweii
(3 posts)1
Hi! I had the same problem as well! The error only went away after I added the suppression.xml
file.
2
@marcus2k yup! These errors will go away once you fix the coding style violations!
3
@EthanTheGoondu Hello! By convention suppressions.xml
should be placed in the same folder as checkstyle.xml
. So it should be placed at ip/config/checkstyle/suppressions.xml
@jeannetoh99
(3 posts)1. 💡 Be careful of IntelliJ automatically removing trailing white spaces in EXPECTED.TXT
I faced this issue myself, whereby test cases were failing due to differences in trailing white spaces between my ACTUAL.TXT and EXPECTED.TXT. The trailing white spaces were indeed expected, but not saving properly in my EXPECTED.TXT file. This is despite:
copying and pasting EXACTLY my expected output, and also
manually adding trailing white spaces that were expected to the EXPECTED.TXT file.
I noticed that whenever I added the trailing white spaces to EXPECTED.TXT, the moment I saved the file the trailing white spaces were automatically removed by IntelliJ, causing my test cases to fail.
Solution: This can be easily solved by configuring your IntelliJ settings. Under Preferences (or Files) > Editor > General > Save Files (or Other), change the setting for "Strip trailing spaces on Save for:" to "None", as shown below.
Hope this was helpful! 😃
2
Perhaps you can put the wait for input and receive input inside the try block as well? That way exceptions from the input process will be caught as well.
Just a little add-on (in case the “catch Exception” was not just an example): It would also be better practice to catch more specific Exceptions as opposed to a catch-all Exception, so you can handle each type of exception appropriately, and also avoid bug masking. And you can also use a finally block to clean up after the try catch blocks! 😃
You can read up more on some exception handling best practices here .
Cheers!
3
This is my GUI, inspired by my favourite game :"")
@Stefan-Jiang
(3 posts)1. accidentally branch onto a branch
I accidentally create the branch-A-CodingStandard onto the previous branch (branch-A-JavaDoc) instead of onto the master branch, I kinda scared that ill mess it up if I just try out myself, so could anyone help fix this? thanks in advance
2
thanks a lot for the tip!
3
yup that's the case, and I fixed it by interactive rebase, thx.
@Zhang-Yunjie
(3 posts)1. Text formatting error due to different encoding methods while running Duke from jar file
Hello, I am currently testing my program from jar file and realise that certain decorative texts in my Ui cannot be shown properly.
Error message is as follows: error: unmappable character for encoding US-ASCII
I understand that it may be the issue of encoding method chosen for compilation, but I do not know how to solve this exactly.
Please help!
Screenshot of my Duke while running from IntelliJ (all texts shown as intended)
Screenshot of my Duke while running from jar file (decorative text messed up)
2
Hello, I think you may try to copy and paste the jar file instead of dragging it. It works for me.
3
Some possibly relevant past issues https://github.com/nus-cs2103-AY2021S1/forum/issues?q=is%3Aissue+utf+
Thank you prof, problem resolved!
@zeying99
(3 posts)1. runtest.sh dos2unix: command not found
Dear professors, TA and fellow course mates.
I tried to run the runtest.sh file but there is an error showing line 30: dos2unix: command not found. Moreover, there are random numbers around the output which I do not know why they appear. My actual output and expected output looks similar. I am running the file in macbook intelj IDE.
2
3
Thank you so much guys!!!!!
@jerrylchong
(3 posts)1. Launcher.main() error: Caused by: java.lang.NoSuchMethodException: duke.Duke.
I setup JavaFX using gradle on intelliJ, After that, I followed the code to setup Duke and Launcher in the JavaFX instructions. But when I tried to run Lacunher.main(), I got error "Caused by: java.lang.NoSuchMethodException: duke.Duke.>init>()".
Duke.java (My Duke class extends Application):
Launcher.java:
2. Relative path differs depending on file that is running the main program
In my Duke.java, I have a FileWriter than writes to "./src/main/java/data/list.txt".
When I run main using IntelliJ, it runs the program from my project folder and the path works.
However, if I run runtest.bat, an IOException is thrown with message ".\src\main\java\data\list.txt (The system cannot find the path specified)".
May I know what is the proper relative path I should be using?
3
Oh yea, implementing one solved my issue. Thanks @erisjacey !
@akgrenSoar
(3 posts)1
Hi, I think you are confusing the keywords final
with static
Final keyword:
// Use 'final' to make a variable immutable
private final List<Task> taskList = new ArrayList<>(100);
// Error because taskList is final
taskList = new ArrayList<>(100);
Static keyword:
// 'static' keyword ensures that there is one and only one instance at all time
class TinyCircle {
public static int MIN_SIZE = 1; // Note: static only
public static final int DEFAULT_SIZE = 100; // Note: static final
}
class Main {
public static void main(String args[]) {
// Modifying static variable
TinyCircle.MIN_SIZE = 10; // Success
// Modifying static final variable
TinyCircle.DEFAULT_SIZE = 50; // Error
}
}
So, should we use final
to make List<Task> taskList
immutable? Yes, we should. It prevents accidental modifications to taskList.
But should we use static
so that we can use TaskList.add()
instead of new TaskList().add()
? I would say no, to accomodate for future versions of our project in case we need to have multiple TaskLists.
2
I managed to get it printed correctly after some google
It involves 3 steps
Step 1: Type chcp 65001
to change set your terminal to use UTF-8
Step 2: Run java -Dfile.encoding=UTF-8 -jar ip.jar
Step 3: Change your terminal font until you see the correct symbol shows
DejaVu Sans Mono
worked for me
To revert to original settings:
Type chcp 437
I use consolas
as the default terminal font.
3
Whoops! i got confused by the immutability part.
I can kind of see where you are getting from, but i will not venture there.
My short opinion is that if you make the classes immutable, you could adopt a more functional style instead of OOP. There's nothing wrong with that, it mainly depends on the style you adopt.
My code doesn't look too different from yours. Maybe someone else could give a better analysis.
List<Task> taskList = new ArrayList<>(5);
Task task1 = new ToDo("Todo 1");
taskList.add(task1);
Command c1 = new DoneCommand(task1);
c1.execute();
assertTrue(taskList.get(0).isCompleted());
@hopinxian
(3 posts) 1. Gradle hangs whenever it prints error:
I have just started using Gradle inside my project. I tried to run the project using Gradle and everything went fine (e.g. testing whether it could print list, add a proper task) until I gave an invalid command and the project failed to give me the expected error notification output I wanted.
For instance, when I typed in "event ". I was expecting to get the following, from printing the exception message:
ERROR: Please provide a summary and date of event.
Separate the dates from summary using " /at " and separate the two dates using a space.
However, what I got was the following screenshot.
I left the project loading for a few minutes but nothing came out and eventually it just remained loading there. I could not type anything.
I tried running using Intellij instead and managed to print out the expected message as seen here.
I fiddled a bit more and realised that as long as my error message did not contain "error:", it would work fine. So the following examples of error messages would work under Gradle.
ERRORS: Please provide a summary and date of event.
Separate the dates from summary using " /at " and separate the two dates using a space.
ERROR| Please provide a summary and date of event.
Separate the dates from summary using " /at " and separate the two dates using a space.
However the following would not work.
Error: Please provide a summary and date of event.
Separate the dates from summary using " /at " and separate the two dates using a space.
I have already changed my error message to allow my project to run, but I'm confused about why something like this would happen. Hope somebody can clarify this for me. Thank you.
2
Thank you prof. The link below directs to the directory right after I changed the error message.
https://github.com/hopinxian/ip/tree/edf3563dd13317a61b999e300d535a1f9713898e
The change is on this line in this link. https://github.com/hopinxian/ip/blob/edf3563dd13317a61b999e300d535a1f9713898e/src/main/java/butler/io/Ui.java#L54
It is possible to reproduce the error by changing "ERRORS:" to "ERROR:" and typing in an invalid command.
3
Thank you very much for the explanation!
@Michaeliaaa
(3 posts) 1. Able to compile and run on terminal but faced errors when running runtest.sh
Development environment:
IntelliJ IDEA 2019.3.5 (Community Edition)
Runtime version: 11.0.6+8-b520.66 x86_64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.15.5
Issue
I was able to run on my terminal without any problem, as seen in https://ibb.co/6XWdCLk.
However, when I tried to run the runtest.sh, there seem to be many errors in compiling.
I am confused over this issue and would appreciate any help here!
Error message
Michaelias-MacBook-Pro:text-ui-test mich.aelia$ /bin/bash /Users/mich.aelia/Desktop/ip/text-ui-test/runtest.sh
../src/main/java/Duke.java:56: error: cannot find symbol
ArrayList<Task> tasks = new ArrayList<>();
^
symbol: class Task
location: class Duke
../src/main/java/Duke.java:67: error: cannot find symbol
Task.getListOfTasks(tasks);
^
symbol: variable Task
location: class Duke
../src/main/java/Duke.java:72: error: cannot find symbol
ToDos.createTask(tasks, task);
^
symbol: variable ToDos
location: class Duke
../src/main/java/Duke.java:74: error: cannot find symbol
ToDos.invalid_input();
^
symbol: variable ToDos
location: class Duke
../src/main/java/Duke.java:82: error: cannot find symbol
Deadlines.createTask(tasks, task, due);
^
symbol: variable Deadlines
location: class Duke
../src/main/java/Duke.java:84: error: cannot find symbol
Deadlines.invalid_input();
^
symbol: variable Deadlines
location: class Duke
../src/main/java/Duke.java:90: error: cannot find symbol
Events.createTask(tasks, event, scheduled);
^
symbol: variable Events
location: class Duke
../src/main/java/Duke.java:92: error: cannot find symbol
Events.invalid_input();
^
symbol: variable Events
location: class Duke
../src/main/java/Duke.java:97: error: cannot find symbol
Task.done(tasks, index);
^
symbol: variable Task
location: class Duke
../src/main/java/Duke.java:106: error: cannot find symbol
Task.delete(tasks, index);
^
symbol: variable Task
location: class Duke
10 errors
********** BUILD FAILURE **********
Link to my fork:
https://github.com/Michaeliaaa/ip/
Thanks guys!
2
Here is my simple GUI with BT21 characters!
3
I had experienced the same problem with preview as well, "#" just transforms into "%23". @nopenotj 's solution of using chrome's pdf reader works fine for me.
@nottiffchan
(3 posts)1. java.lang.reflect.InvocationTargetException when trying to run GUI
When I try to give Duke a command it does nothing and throws java.lang.reflect.InvocationTargetException and nullPointerException. The only thing that works is the "Bye" command and I suspect it has something to do with how the other commands attempt to manipulate elements within Duke like the TaskList.
I tried to make the command call return just the toString of a Task but the exceptions were still thrown. Anyone encountered similar problems or know what could be causing this?
Does the run function also happen to be able to show the line number where the exception was thrown?
2. ignore this
3
It launches fine with the images, if I type rubbish the "OOPS!!!" message comes up fine as well. It's only when the other commands are called that those exceptions are thrown 😦
@soaza
(3 posts)1. [External Software Permission Request] jfxtras (calendar)
Display a calendar for appointment scheduling.
2
Here's GUI with a cascading background 😄
3
Ok thanks Prof!
@Avalionnet
(3 posts) 1. 💡 [Solved] Error generating a new fat jar file caused by java.lang.UnsupportedClassVersionError
Some of you may have encountered the following error when attempting to create a new fat jar file using Gradle.
Error: LinkageError occurred while loading main class duke.Launcher
java.lang.UnsupportedClassVersionError: duke/Launcher has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 55.0
Essentially, the error occurred as we tried to run our class with an older version of Java compared to the version used to compile it.
More specifically, in this case, we compiled our class with Java 13 and tried to run it with Java 11 as specified by versions 57 and 55 respectively.
To solve this error, navigate down to your system environment variables and set JAVA_HOME to the java 11 sdk.
Do refer to the following tutorial for a more detailed guide: https://mkyong.com/java/how-to-set-java_home-on-windows-10/
You can also print the directory of your java installation by typing where java
in the cmd.
Hope this helps!
2
Hi @xnmng, I managed to solve the issue by creating a default constructor in my Duke class. It can be as simple as
public Duke()
Hope this helps!
3
Here's my variant of duke!
@AlexCQY
(3 posts)1
Hi all,
I am still facing the issue of some weird characters appearing in the console despite the ACTUAL.TXT and EXPECTED.TXT file has the exact output.
I am using windows 10 OS terminal on intellij to run the runtest.bat.
I have followed the thread:
Added SET JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8 to the runtest.bat
Copied the ACTUAL.TXT contents to the EXPECTED.TXT and then run test agn
Below is a screenshot of the issue.
2
@AlexCQY try using a more powerful diff tool such as WinMerge to compare the two files. There may be differences not visible to the naked eye.
Thanks prof indeed it is due to white spaces
3
Hi the information on this thread solved the same issue i faced too.
But I have a clarification that I would like to make. I am using a windows 10 OS with java version openJDK 11.0.5
Thank you.
@Licheng-Wu
(3 posts) 1. iP - No response from jar file upon pressing Enter or clicking Send?
After building my jar file using "gradle shadowJar", there is no response when I press "Enter" or click on the "Send" button in the GUI. However this does not happen when I run the GUI from IntelliJ. Does anyone else face the same issue?
2
That didn't work though, still having the same problem. Tried running the jar file from the command line using java -jar duke.jar and got this exception:
3
Just found the error, it's in my DialogBox.java when setting my fxmlLoader.
@peter-yeh
(3 posts)1. JavaFx is not displaying the text, Duke properly
After implementing javaFx, my duke logo is not displaying properly, I have tried playing around with the width and height to no avail. My other text is not truncated as well.
String logo = ""
+ " ____ _ \n"
+ "| _ \\ _ _| | _____ \n"
+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|";
2
Hi @damithc , I have this issue as well, when the repo I am reviewing also commits many of the same mistake. After reading the Best practices for reviewing PRs, I still did not find the answer I am looking for.
3
Thanks prof, and everyone who helped.
Set dialog.setStyle("-fx-font-family: monospace");
in DialogBox, where dialog is of type Label
@yongmingyang
(3 posts) 1. class org.codehaus.groovy.runtime.InvokerHelper could not be initialized.
I encountered this error when running gradlew checkstyleMain
which says that class org.codehaus.groovy.runtime.InvokerHelper could not be initialized.
This was solved after updating the gradle version from 6.2 to 6.3 as shown in the image below. Hope this helps!
2
Hi, I ran into the same issue. I fixed this by downloading the javaFX 11 SDK and following the steps under "if you are not using Gradle". Hope it helps!
3
Hi! I'm not sure if I understand your question correctly. But if it is the case where your assert failing does not give an error message, it may be due to your JVM options. Here's the link that I used to rectify mine: https://stackoverflow.com/questions/48396274/how-to-enable-assertions-in-the-gradle-run-task
@pennhanlee
(3 posts)1. Gradlew checkstyleMain failing
I see that there are some solutions for getting Gradle checkstyle to work
The current exception message is: Unable to create Root Module .... (shown in picture)
I tried changing from version 8.23 to 8.29 and 8.1 following some advice from other issues but i'm still met with this error.
May I know what else can I do to resolve this issue? Thanks!
2
I also had that error.
In the end, I compared my project structure to that of my friend's and apparently I had an extra Main module.
I also had an extra Main method in the Duke class which might have been the cause of it.
Delete the extra Main module using the tiny Minus button on top to make it like this
I then reimported the whole project and ran Launcher and it worked.
*edit: grammar edits
3
Turns out I missed the part where I had to download the Checkstyle.xml and put it in the config file (Selfcreated)
Thanks for all the help! Really appreciate it
@pr4aveen
(3 posts)1
Maybe you can try adding System.exit(0)
after Platform.exit()
2
Hi I just left a comment on #180 but maybe you can try adding System.exit(0)
after Platform.exit()
?
3
Here's mine
@claraadora
(3 posts)1. Is using semantic commit style acceptable?
I have been using the semantic commit style to do the IP. However, I just read 2103's Git Convention and realized that the style is not included in the convention. While it is mentioned that the format scope: change (e.g. Person class: remove static imports) is acceptable, the semantic commit style differs in capitalization and the addition of the type of change. As such, I would like to ask if it is acceptable to use the semantic commit style.
Thank you!
Reference:
The format of semantic commit style is >type>(>scope>): >subject> (e.g. feat: add hat wobble, feat(parser): add the ability to parse arrays).
(https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716)
2
Thank you for the reply, Prof @damithc.
With regard to your answer, I would like to ask if I need to change my last week's IP commit messages to match CS2103's convention, to avoid any penalty?
Thank you!
3
Noted, Prof @damithc
Thank you for your help and clarification!
@TianYong-Goh
(3 posts) 1. java[5301:299207] unrecognized type is 4294967295 and java[5301:299207] *** Assertion failure in -[NSEvent _initWithCGEvent:eventRef:]
Hello,
does anyone know how to solve this error? It appears a few seconds after I run my Launcher. Everything works fine and I am still able to continue the operation on my duke window.
Thank you in advance:)
2
@EugeneTeu Yup I am on macOs and my current version is JDK11.0.5. I look through the website you provided but it doesn't seem to provide any solution on this error except updating JDK, but we are restricted to JDK11 right?
3
I think it works. Thank you very much.
@kevnw
(3 posts)1. java.lang.NullPointerException: Input stream must not be null when running Debug Main
The problem is ICON_APPLICATION is trying to use address_book_32.png image from images folder but I got no image with that name in the folder.
This is the error message:
2. java.lang.NullPointerException: Input stream must not be null when running Debug Main
The problem is ICON_APPLICATION is trying to use address_book_32.png image from images folder but I got no image with that name in the folder.
This is the error message:
3
Hi @luo-git ! My team faced a similar issue and I think this will help you.
try {
if (SystemUtils.IS_OS_LINUX) {
// Workaround for Linux because "Desktop.getDesktop().browse()" doesn't work on some Linux implementations
if (Runtime.getRuntime().exec(new String[] { "which", "xdg-open" }).getInputStream().read() != -1) {
Runtime.getRuntime().exec(new String[] { "xdg-open", urlString });
} else {
showAlert("Browse URL", "xdg-open not supported!", true);
}
} else {
if (Desktop.isDesktopSupported())
{
Desktop.getDesktop().browse(new URI(urlString));
} else {
showAlert("Browse URL", "Desktop command not supported!", true);
}
}
} catch (IOException | URISyntaxException e) {
showAlert("Browse URL", "Failed to open URL " + urlString , true);
}
This is a workaround I found on the internet.
@benclmnt
(3 posts)1. 💡 [Solved] Generating a new fat jar file caused ClassNotFoundException
After creating a jar file using shadow plugin, I tried to run it but encountered this error
The way I solved it was to change the mainClassName
under application
in build.gradle
.
Assuming your main entrypoint is src/main/java/Launcher.java
, you can change the mainClassName
from main.java.Launcher
to just Launcher
and re-run the shadow task
2. [iP] : Project Management
Hi prof, I am not too clear on what is included as the project management part of the individual project, and the team project. Can you clarify on this matter?
3
Thanks prof! @damithc
@AudreyFelicio
(3 posts)1
I encountered the same bug as you did and I have done the following to fix the bug.
*It seems this bug is only encountered if you use Windows because it works fine when I run from UNIX terminal using WSL2.
in the build.gradle
file, add the following lines:
compileJava.options.encoding = 'UTF-8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
and inside run{ ... }
and test{ ... }
in the build.gradle
file, add the following:
systemProperty "file.encoding", "utf-8"
Now at this point, it should not display ?
anymore when you run your chatbot using IntelliJ
. However, since powershell
by default does not use UTF-8
, you will need to configure powershell
to use UTF-8
encoding or else you will see ?
replaced with other random characters. To configure, I simply typed the following commands inside powershell
$OutputEncoding = New-Object -typename System.Text.UTF8Encoding
[Console]::OutputEncoding = New-Object -typename System.Text.UTF8Encoding
Your powershell
now should be able to display unicode characters 😃
Hope this helps!
References:
https://gist.github.com/xoner/4671514
https://stackoverflow.com/questions/21267234/show-utf-8-text-properly-in-gradle
2
I encountered the same bug as you did and I have done the following to fix the bug.
*It seems this bug is only encountered if you use Windows because it works fine when I run from UNIX terminal using WSL2.
in the build.gradle
file, add the following lines:
compileJava.options.encoding = 'UTF-8
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
and inside run{ ... }
and test{ ... }
in the build.gradle
file, add the following:
systemProperty "file.encoding", "utf-8"
Now at this point, it should not display ?
anymore when you run your chatbot using gradle
in IntelliJ
. If you use powershell
to run gradle
you will need to configure powershell
to use UTF-8
encoding or else you will see ?
replaced with other random characters. To configure, I simply typed the following commands inside powershell
$OutputEncoding = New-Object -typename System.Text.UTF8Encoding
[Console]::OutputEncoding = New-Object -typename System.Text.UTF8Encoding
Your powershell
now should be able to display unicode characters 😃
Hope this helps!
References:
https://gist.github.com/xoner/4671514
https://stackoverflow.com/questions/21267234/show-utf-8-text-properly-in-gradle (Fernando Sanchiz's answer)
3
Here's my very minimalistic GUI which will be updated in future increments 😄.
@jiaqi20
(3 posts)1. Retrieve image file from data folder
Does anyone know how to get image files (the right image file path to use) from the data folder? I was able to write the images that were downloaded using URL into the local data folder which has the same directory as jar file but couldn't retrieve them to display in the application.
I tried using ("data/" + filename) as the image path but doesn't seem to work.
2
Ohh thanks for your reply! but I meant like how to get the correct image filepath (files in data folder) to parse and create an Image(filepath) object so that I can do imageView.setImage(Image) to display in the application for jar file testing 😢
3
Yes. I solved the issue by adding these paths to the original image path then it works. Thanks everyone for the help!
"file://"
Using this.getClass().getProtectionDomain().getCodeSource().getLocation();
to get the location of folder where user saves the jar file
@tanweijie123
(3 posts)1. [External Software Permission Request] ControlsFX
To provide autocomplete feature and UI-related add-ons to JavaFX
{BSD 3-Clause License}(https://github.com/controlsfx/controlsfx/blob/master/license.txt)
2
Hi. I encountered the same problem as you, and managed to fix it by changing:
Run > Edit Configuration (Duke) > VM options: -Dfile.encoding=UTF-8
3
Hi. You might have missed out the class attributes
@Elgoh
(3 posts)1. Unsure which tag name is required for release of .jar file
Should the tag for the release of my .jar file be named A-Jar, or should it be named v0.1?
2. *** not recognized as an internal or external command, operable program or batch file.
Hi all, I am facing this problem when running the runtest.bat file on my terminal.
First I encountered this
-> 'Javac' is not recognized as an internal or external command, operable program or batch file.
I managed to solve it by writing this in my terminal
-> ...\text-ui-test>set path=C:\Program Files\Java\jdk-11.0.5\bin;
Then I ran into this error
->'FC' is not recognized as an internal or external command, operable program or batch file.
smh my head... did anyone encounter this or is facing the same problem?
3
@xnoobftw @damithc Thank you very much! After much searching, it finally works!
@maguireong
(3 posts)1. MacOS Compilation error in the sh file
Hi guys, on my mac, If i were to create a separate package for all my exceptions, the sh file doesn't seem to be able to read that package, any idea how to change my sh file such that it can read the package too? Currently, its as such:
error message says:
2
Hi if i were to create a separate package for all my exceptions, the sh file doesnt seem to be able to read that package, any idea how to change my sh file such that it can read the package too?
3
Yeap its working now, thank you very much!
@solkim-83
(3 posts)1. CI test fail due to Gradle error
I merged one of my team member's PR into our own tp master branch (that passed all CI tests), and have received an error message of
Error:getaddrinfo ENOTFOUND downloads.gradle-dn.com
from [nus-cs2103-AY2021S1/tp] Java CI workflow run
Anyone knows how to solve this issue?
Thanks in advance.
2
@damithc I re-ran the CI tests under our own tp repo and have passed the tests. However, I'm not passing the CI thats done under [nus-cs2103-AY2021S1/tp] Java CI workflow run and unable to rerun as well.
If the merge action has passed the CI on our own tp repo side, can the above issue be ignored?
3
@damithc okay sure thank you for your help Prof! 😃
@aizatazhar
(3 posts)1
I encountered InvocationTargetException in the past. For my case it was because the path for the image in userImage/dukeImage didnt exist/typed incorrectly
2
Late to the party 😂 but now that everythings finalised, heres mine
3
hello, this is likely because the path for the image in userImage/dukeImage doesnt exist or was typed incorrectly
can see #219
@plosslaw
(2 posts)1. Question regarding the grading script for the individual project (ip)
Hi I have a question regarding how the grading/progress checking is done for the individual project
For the grading script used for the individual project, is it sufficient to push all changes to the master branch of our own repository forked from https://github.com/nus-cs2103-AY2021S1/ip
or do we have to submit a pull request to the master branch of https://github.com/nus-cs2103-AY2021S1/ip
?
Also do we have to work purely on the master branch or can we create a new branch from the master branch and work on the branch created and then merge that branch into the master branch?
Thank you
2
Okay thank you Professor
@UnicornJin
(2 posts)1. Label cannot display completely
I just followed the tutorial of JavaFX step by step.
But found this problem:
At first, the label from Duke is displayed well, but once Duke displays a shorter label, the previous labels will become short too.
And later labels cannot be displayed well also.
Does anyone know how to fix this?
2
I think this is a similar issue to the one in #125
IT WORKS! THANKS !!!!!👍
@justintzuriel
(2 posts)1. branch-A-Assertions not detected by script
I had pushed the assertions branch earlier than the code quality branch, yet the script somehow only detected the code quality branch. How do I solve this? Thanks!
2
No, I haven't. Does the script only detect branches merged to master/up to date with master?
@dianneloh9
(2 posts)1
For the NoSuchElementException, it might be the case that sc.nextLine()
is called without checking sc.hasNext()
. Since the test input.txt file is empty, it will throw an error when the scanner cannot find the next line.
2
For me, for the .sh (or .bat) file, I added a line that deleted the data file before running the test if the file exists initially. So that the test can run from a clean slate.
@Jillzyt
(2 posts) 1. Tags not in sequence
Dear Prof,
I have added the tags after commit sequentially which results in
My commits are in sequence.
Will it cause any issues in grading or testing?
2
Thank you prof ☺️
@Jaylenlee
(2 posts)1. Cannot push to GitHub
Versions:
IntelliJ : 2019.3.1
SourceTreeSetUp-3.3.9
JDK: 11
Context (What I did step by step):
Did not create branch for JavaDoc, CodingStandard and Level 9. Did all on master branch. Pushed to GitHub.
Decided to revert master branch on local repo to the commit before all those changes. (Point A-Jar).
Created the 3 branches but named some branch wrongly (A-JavaDoc, A-CodingStandard)
Did the coding on the branches and push to GitHub. (Before merging to master branch)
Merged the branches to master branch, retag the commit.
Realised branch is name wrongly and went to rename.
Revert master branch to the commit before all changes again (Point A-Jar).
Merge branch to master again, retag.
Try to push but failed.
Went to GitHub to delete the wrongly named branch and pushed local repo again but failed.
tl;dr: My branch-A-JavaDoc and branch-A-CodingStandard is not appearing as local repo option to push. When I try to push there is some error which I do not know how to resolve.
Thank you for the assistance in advance. I can clarify again if there is anything not clear.
Screenshot below:
![Error1](https://user-images.githubusercontent.com/54731199/91254557-46ab5b80-e795-11ea-807e-e14120c90d6c.JPG
2
Thank you so much Prof! I managed to push it to GitHub with that! However 2 of my branches (branch-A-CodingStandard and branch-A-JavaDoc) is still missing from the push option. May I know why is this so and how to resolve?
*Edit: I manage to push my branch to GitHub using CLI but it's still not showing on SourceTree.
@Syasyazman
(2 posts)1. Jar file cannot load main class
Hii !
When I copied the jar file to an empty folder and used the required command, it said that the file could not be accessed. Here are some things I've noted :
-> I can run Duke smoothly with no errors but when I compiled Duke.java manually, it produced errors but I suspect the root issue is because the package does not exist. However, the packages were set by Intellij automatically for me.
-> In the Manifest.MF file, the main class reference to Duke is in red
-> For some reason, I am unable to create new directories in my iP root folder (Intellij doesn't give me the option to). Im unsure if my Intellij configurations are affecting this issue
These are the main errors from compiling Duke.java :
This is how my project structure looks like:
I followed the instructions in creating the JAR file and it was created, just could not access it. Pls advise me on this ! Thankyouu 😃
2
Thanks for the recommendation prof ! It prompted me to relook at my project configurations and I realised that there was an issue with packaging because my src>main>java folders were configured as packages by Intellij. After manually converting them to Sources Root folders, I could compile successfully and my JAR file works now 😃
This is where I converted src.main.java under Project Structures :
Might be useful for those who have issues with Intellij configurations. Thanks prof ~
@Hazel1603
(2 posts)1. CodeCov failing JavaCI
My team has had this issue several times and am wondering how we should manage it.
Thanks!
2
Hi Prof,
I reverted my PR and remerged so the problem is fixed alr. But just wanted to check if there's a way to determine what the issue is. Because what happened was when I merged my PR, it was passing all the JavaCI. But it then turned red after it merged into the master (about 1 hour after).
The above image is from my PR.
@raysonkoh
(2 posts)1. 💡Fold all file diffs in PR for easy viewing
By default, github unfolds all files in the Pull Request file diff view.
Sometimes it may be helpful to get an overview of the directory structure before going straight into reviewing the code. You could fold each file manually, but it can take a lot of work to fold all the files that has been changed.
In order to fold all files, hold down the alt
key and click on the inverted caret icon in any file header.
src: https://github.blog/changelog/2018-08-17-collapse-all-diffs-in-a-pull-request-at-once/
2
This may be because the text content in your label
exceeds the height of the label and hence it is being cut short.
What worked for me was adding minHeight="-Infinity"
as an attribute to the label
component in DialogBox.fxml
to show the full content of the text. Maybe you could try this?
@justweihong
(2 posts)1. GUI: running launcher shows java.lang.reflect.InvocationTargetException and then java.lang.NullPointerException
I have just configured the mainwindow for part 4 of the FXML setup and when I run launcher, it shows this
Caused by: java.lang.reflect.InvocationTargetException
Caused by: java.lang.NullPointerException: Input stream must not be null
Has anyone faced this problem as well?
2
@aizatazhar @sudogene alright thank you guys it worked for me 👍
@nuovonatura
(2 posts)1. Deadline conflict for week 4 tP TEAMMATES submission
I noticed that there's this submission via TEAMMATES for week 4 tP.
Do we follow the general deadline for tP (which is 23:59 before the tutorial day, in my case is this Wednesday 23:59) or the deadline given on TEAMMATES submission page (which is this Friday 23:59)?
2
OK, noted! Thank you!
@Asthenosphere
(2 posts)1
Hi prof,
May I ask whether the grading bot follows redirections? Since I have a personal domain and somehow github by default published my ip to my personal domain and https://asthenosphere.github.io/ip/ is redirected to http://asthenosphere.me/ip/. I have checked github settings and couldn't find any place to stop using my own domain (I didn't add custom domain either). Thank you!
2
Hi prof,
Thank you very much for the help! I think my domain server has some problem as I could access it sometimes but other times it will be a 502 bad gateway. Will investigate that more.
@eugene3231
(2 posts)1. Issues getting tick and cross to appear correctly in JavaFX GUI
Remember to give sufficient details e.g.,
JavaFX 11.0.2, Gradle 6.6.1, IntelliJ IDEA 2020.2.1 (Ultimate Edition), Java 11.0.8, Windows 10
Hi, I'm having trouble getting the tick and cross symbols to appear in my JavaFX gui.
I'm currently using the unicode characters in my code as seen in the first screenshot:
After some testing I realised that the only instance the symbols get output correctly is when I run the task directly from IntelliJ.
The second screenshot shows when I run Duke as a run configuration and it outputs the tick and crosses perfectly:
The third screenshot is when i try to run the gradle task (as you can see from the elephant symbol) to start Duke (run task) it outputs the symbols incorrectly.
I have viewed others' code who have successfully output the symbol in their sample GUI as seen here: #147, and they have used the same unicode in their code. My gut feeling tells me it could be some unicode character issues with gradle and possibly JavaFX, but I have no clue on how to remedy it, does anyone have any idea how to do so?
2
Yup this worked for me
Not sure if you solved it yet but I encountered the same problem and solved it by going to
Run > Edit Configurations
and changing VM options to-Dfile.encoding=UTF-8
after some digging in #95.
Thanks for the replies!
@blackonyyx
(2 posts)1. Level 8 Tag not detected
Hi I realise its been a while since but ,my tag for Level-8 was not detected even though its clearly been up for a while already. Could I get some help on rectifying this? Thanks!
2. How to jUnit Test a Method inside a Class that when constructed throws a error.
Hi I would like to ask how to test such a method, for example my deadline class throws a exception in the constructor
@Test
public void testDeadlineClassAutoCorrectsBlankDateField(){
try{
Deadline deadline = new Deadline("random_desc","");
assertEquals(deadline.getDateby(),LocalDate.now().toString());
}catch (Exception e){
e.printStackTrace();
}
}
As show, i need to enclose it within a try catch method in order to even get it to function. Is there some cleaner way to do this in jUnit?
Googling this, I saw some code examples where they did:
@Test(expected = Exception.class)
But i am unable to reproduce this on my intelij
Thanks
@Nauman-S
(2 posts)1. Error cannot find symbol
the file strucutre is as follows
I can run the main method in Duke.java by using the green run button next to the method however when i open the intellij terminal and try to run the .bat file i get the following errors:
Appreciate any help. Thanks
2
Thanks Saad. That worked!
@chewypiano
(2 posts)1. Do we need to create issues for every task?
For instance, do we need to create individual issues for uploading .png images to AboutUs page or just individual pull requests is fine for this?
Also, for the initial week 7 v1.1 minor changes to docs, do we need to create individual issues per change?
Regards and Thanks,
Kamil
2
noted with thanks sir
@justacasul
(2 posts)1. Error handling
I have 2 options to handling errors, the System.out.println way and the throw DukeException.something way.
More specifically, in the todo example in Level-5,
If I do System.out.println("todo bad"), Duke continues running, which is good*
If I throw DukeException.empty("todo bad"), Duke exits, which may not be good*
*personal preference
Since Level-5 recommends implementing Exceptions, does this mean it's ok for Duke to exit upon encountering an error?
Is there a 3rd approach I'm not seeing? Something that uses Exceptions but allows Duke to continue running?
2
Thanks for the replies,
inside my catch block is simply a
sys.out.println(e.getmessage())
this solved my problem.
@athuyaoo
(2 posts)1. Is it ok if the table of contents in the UG has points?
Right now we're using the initial table of contents, which as points for each section shown below.
Is this ok? Should we change it?
2
https://github.com/nus-cs2103-AY2021S1/forum/issues/361, found the answer here.
@seowalex
(2 posts)1. Checkstyle tutorial out-of-date
In the Checkstyle tutorial, we are directed to the checkstyle.xml
found in AB3. However, under the header "Using Checkstyle with Gradle", a sample build.gradle
file is given as such:
plugins {
id 'checkstyle'
// other plugins
}
checkstyle {
toolVersion = '8.23'
}
However, the checkstyle.xml
file found in AB3 uses Checkstyle v8.29, which notably causes the LineLength
rule to fail with an ambiguous error (Unable to create Root Module
) if one follows the sample build.gradle
as seen above. The build.gradle
file provided in the add-gradle-support
branch of the ip
repo also fixes Checkstyle at v8.23. Should these references be updated?
2
If you implemented your main class as suggested, I don't think you'll need to use System.exit()
since the program will automatically terminate when it reaches the end of the main()
function.
@Ziyang-98
(2 posts)1. Do we keep relevant user stories in DG?
My group brainstormed user stories before we started on the tp and noted them in our DG. However, at the end of v1.4 we realize some user stories are not relevant anymore as we did not manage to implement the features related to those stories. Do we keep the irrelevant user stories in the DG or should we remove them to and only keep relevant user stories? (By relevant, I mean user stories which the related feature is implemented)
2
Ok thank you prof!
@Rogerlys
(2 posts)1. Java Fx unable to work after closing intellij
After completing level 10 got this error
I tried to revert the commit and that didnt help also
2
I manage to fix the problem by setting up java Fx and gradle again. Thanks
@thutahw
(2 posts)1. Intellij not showing files after adding gradle
Hi everyone,
I followed the instructions under the scenario 2 of "adding gradle to the project". However, after closing the project and reopening it, I am unable to see my files in intellij (as shown below). I have tried closing and reopening the project a few times but there is no difference.
If anyone else had a similar issue before, may I ask how you managed to resolve it? Thank you!
2
Thank you Prof and @Nahoyhp. I actually forgot to import the project using the build.gradle file and I think that could be a reason why my files were not accessible on the left panel. I copied my files to another folder (e.g ip2) and imported the project (pointing to the build.gradle file this time) and it works fine now.
@LinkedInk
(2 posts) 1
Does anyone know how to disable codecov? I can't seem to find an instruction on how this is done.
2
Can confirm
@chshen1998
(2 posts) 1. DukeTest not working after installing Gradle
After following the guides for using Gradle, I now get this error when running DukeTest. Anyone knows how to fix it?
2
Thanks! That worked!
@PhongTran98
(2 posts)1. Implementation Section in DG
How much should we write into the Implementation Section of the DG? Do we have to write about the features we inherited from AB3?
2
I see, thank you Prof!
@juandavinlie
(2 posts)1. Question regarding grading criteria
Hi Prof,
Lets say I have done Level-1 and have pushed everything to the remote repo but realised later on that there is a bug in Level-1 and fixed it at Level-8 and pushed it to the remote repo along with the Level-8 tasks. Do I get penalised for that? Or only the end product matters?
Thank you!
2
Alright thank you Prof!
@caleblyx
(2 posts)1. Importing project with Gradle causing issues with project structure
Hi,
after importing my project with Gradle, I found that my project structure had changed. It had marked my /src/main/java folder as the sources root causing issues with my import statements, as main.java is no longer as a package. When I tried marking /src/ as the sources root instead of /src/main/java, my class files are no longer recognized as class files by intelliJ.
I was wondering if anyone else had encountered such an issue and was able to resolve it. Any input would be appreciated.
Thanks in advance.
2
Thanks!
I realized that I may have been using an incorrect initial project structure and packaging.
I have changed my project structure and packaging, and everything seems better now.
@nicktohzyu
(2 posts)1. Should we rename AddressBook class/packages?
Our product is called HairStyleX, should we rename the AddressBook class/packages to reflect this?
2
Sorry I realised this question was already answered and I was searching with the open issues filter on 😅
It would be better to link to that issue so people can find it when they arrive here.
It was #125 . The solution was adding minHeight="-Infinity"
as an attribute to the label
component in DialogBox.fxml
@lowjiefeng1998
(2 posts) 1
I had a similar problem when I was first setting up. I resolved it by resetting up the project, but this time using IntelliJ's "Import", instead of "Open".
i.e.
2
I think codecov is back up. It is working for my team.
@jonasngs
(2 posts) 1. Package does not exist error when running JUnit test
Hello, I followed all the instructions for creating a JUnit test but when i tried to refer to Duke from the DukeTest class when running the test, I got a "java: package duke does not exist" error message. I tried imported the Duke class as well but it didnt help. I've attached my JUnit test code below. Any help is greatly appreciated!
2
hello prof, yes i used option 1 where Intellij helps me add the main module as a dependency. However, when I went to check the module dependencies for my 'test' module i saw this. Is this supposed to be correct? Thank you!
@yanbingtao
(2 posts)1
Okay, sorry, I realised I had to either change the main class in the build gradle file.
Hi, I'm also having the same problem, do you mind to share more details? thanks in advance!
2
Okay, sorry, I realised I had to either change the main class in the build gradle file.
@yanbingtao You could try the solution posed in #101. Hope this helps!
thanks!
@chiamyunqing
(2 posts)1. UML Diagram for Derived Class
I was looking at the new example videos for UML diagrams and was wondering if we need to include the functions from the base class in the derived class. In the videos, the classes all inherits from an abstract class so the functions should be included in the derived class. However let's say we have the following example:
class Human {
void sleep()
}
class Male extends Human
Do we need to write the method sleep() in the Male class (assuming the function is not overridden) since it is already in Human class?
2. Bi-directional Associations & Cyclic Dependency
Hi all,
I was reading the textbook and under the section OOP Associations -> Multiplicity and there is an example regarding bi-directional association as below:
In the code below, the Foo class has a variable to hold a Bar object and vice versa i.e., each object can have an association with an object of the other type.
class Foo {
Bar bar;
//...
}
class Bar {
Foo foo;
//...
}
I was just wondering since this code leads to cyclic dependency and considering how cyclic dependency makes it harder to test your code and thus should not be used from OOP perspective, when will bi-directional associations actually be useful or important?
@angrybunny123
(2 posts)1
I had this problem too, managed to fix it by shifting the test folder into this specific directory: src/test/java
2
Thanks for the tip!
@joshruien
(2 posts)1. Launcher does not work as expected, only works with Duke.class and not Main.class
I am having trouble with the launcher. My application seems to work fine when it is Application.launch(Duke.class, args), however when i change it to Application.launch(Main.class, args), the application echos back whatever i type to it. This means that my Duke class is handling everything. I have followed the tutorial step by step.
I am also only able to launch the GUI from the launcher class and not from gradle. Am very confused at this point.
2
I managed to solve it. I think i was a little confused, I had a start and handleUserInput methods in Duke.java as well, after i removed the methods it works with Main.class.
@gabztcr
(2 posts)1. [External Software Permission Request] fx-progress-circle
We want to incorporate this JavaFX implementation to show the % progress of a product's development in a circular manner.
Licensed under the Apache License 2.0. See more at https://github.com/torakiki/fx-progress-circle/blob/master/LICENSE
2
Hi @xnmng, I had this issue also. I just commented out the entirety of the old code and followed the JavaFX tutorial. Only after you finish the tutorial should you figure out how to incorporate both together. Hope this works! ⛄
@shadowezz
(2 posts)1. Unable to run jar file
Hello, when I try to run the jar file that I created, I run into this error message:
Error: LinkageError occurred while loading main class duke.Launcher
java.lang.UnsupportedClassVersionError: duke/Launcher has been compiled by a more recent version of the Java Runtime (class file version 57.0), this version of the Java Runtime only recognizes class file versions up to 55.0
My project sdk is 11.0.5 but the java version on my com is 13.0.2 Do I need to download java 11 on my com to run it? or is there some other issue?
Thanks!
2
I see thanks so much!
@ypinhsuan
(2 posts) 1
I had a similar problem and solved it by adding set JAVA_TOOL_OPTIONS=-Dfile.encoding=UTF-8
in the runtest.bat file
2
Maybe you can try adding an empty constructor public Duke() {}
in the Duke class. I managed to solve the problem after adding it.
@kkangs0226
(2 posts)1
Hi, perhaps you should check the console for the error messages! My jar file worked perfectly fine in the original directory within the ip folder, but it didn't work in another directory because of bugs in my Storage code. If your jar file works in your original directory, I think there might be an issue with retrieving/creating data files in your new directory. Hope it helps!
2
Here's my KING BOB chat bot!!
@fall9x
(2 posts) 1
Hi @TCQian , perhaps you might want to look at the Vbar policy of the ScrollPane under"properties". By default it is vbarPolicy="AS_NEEDED" but you can consider changing it to vbarPolicy="ALWAYS" to force the scrollbar to appear.
If your UI is not resizable, you can try setting a fixed value to your MAX_HEIGHT as your VGrow properties might cause the ScrollPane to grow larger than your Stage and hence the excess will not be shown.
2
@TCQian Try removing your prefHeight for the scrollpane, and/or your vBox wrapper
@jimvae
(2 posts)1. My test classes stopped working after incorporating Gradle
I keep getting this error after adding Gradle to my project. My test classes stopped working too even with my old import statements. Anyone encountered this?
2
I shifted my test classes to the test root folder. I overlooked this as it worked before I incorporated it with Gradle
@vanGoghhh
(2 posts)1
upz leh
2
Here's my gui 😃
@BreadPeanutButter
(2 posts)1. [External Library Permission Request] Apache Commons Validator
To validate format of url links that users input
Apache License (http://www.apache.org/licenses/LICENSE-2.0)
2
@GabrielTeo
(2 posts)1. Adding audio
Hi, does anyone know how to add audio to the application using JavaFX? I've tried importing the relevant packages but IntelliJ doesn't seem to be able to detect them.
Any help would be appreciated! Thanks!
2
Thank you prof! @damithc . I think I will be closing this thread for now as it doesn't seem like anyone has any suggestions regarding this feature.
@danadi7
(1 posts)1. Handling tasks with | in description 💡
Just testing my iP for final submission and thought I should share this little edge case which others should consider handling:
If you use "|" or any other symbols for storage, consider disallowing your user from using them for task description. Otherwise, if a user does:
event CS2103 | Lecture /at 2020-09-18
This will cause an error when the file is saved and reloaded the next time the application is launched.
Personally, I show an error message when the user uses "|" and "" in their description. Hope this is not too late for others to make changes! 😃
Edit: Grammar
@Raymond0212
(1 posts)1
Hi guys,
Is the checking program case-sensitive? I just noticed that I wrote all my tags in lowercase but in instruction, the first character of the tag should be capitalized, like 'Level-1'. Do i need to change my tag and make it exactly the same as the instruction?
Thanks a lot.
@gloon99
(1 posts)1
edited my gui so that it now has max kawaii-ness :DDD
@hakiem526
(1 posts)1
Hi,
I had the hardest time fixing this error. Don't forget to check for Java version on IntelliJ terminal using java --version
, if it still says Java 13, restart your computer. I've found that IntelliJ does not register the changes to environment variables until I restarted my computer (I've done "File -> Invalidate Caches/Restart" at least 10 times before to no avail).
Here's a few extra tips to ensure you're compiling correctly:
Ensure your JAVA_HOME points to the Java 11 sdk folder and not the bin folder.
Double check your Path variables as well. Path variable should point to your Java 11 bin folder.
IntelliJ, File -> Settings -> Build, Execution, Deployment -> Compiler -> Java Compiler, ensure that bytecode version is set to 11.
IntelliJ, File -> Project Structure -> Project Settings -> Project, ensure that project SDK is set to Java 11.
IntelliJ, File -> Project Structure -> Project Settings -> Modules, ensure module SDK is set to Java 11.
IntelliJ, File -> Project Structure -> Platform Settings -> SDKs, ensure JDK home path is pointing to correct Java 11 folder.
Check your build.gradle file, ensure that all dependencies are compatible with Java 11.
Cheers!
@jflim98
(1 posts)1. Checkstyle and type-casting
Checkstyle is failing me when I do type-casts; it tells me that the left parenthesis should be on the previous line. It does not really make sense though. How do I fix this?
@JingYenLoh
(1 posts)1
@florenciamartina Your screenshot shows that it's looking for ACTUAL.TXT
in the src\text-ui-test
, but that folder isn't supposed to be in src
. I don't use Windows but I'll give this a shot.
To fix this we first need to understand what this command is doing. Those tokens starting with a -
e.g. -cp
and -d
are flags you can pass to javac
to specify certain arguments. Running javac -help
gives a brief description of what each flag does. So -cp
specifies a class path, and -d
where to place the generated class files.
Now, back to the command. You modified -cp
to ..\src\main\java
, which is probably fine for now (it'll look for your Java Files in that folder). You then modified -d
to ..\src\bin
. This means that it'll place your generated class files in that folder. You probably don't want that, because Line 22 runs Duke
from ..\bin
. Since your files are in different folders, it's likely the cause of your Could Not Find
error.
How might we fix this then? You need to fix the paths. You'll probably want to change the ..\src\bin
back to ..\bin
. Btw, I also suggest removing -source 1.8 -target 1.8
, as the website tells us to use Java 11 and those 2 will make it use Java 8.
So something like this might work:
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\*.java
@youyingfeng
(1 posts)1. Can user interfaces be considered an enhancement for DG purposes?
Most of my work has been either adding additional fields to existing classes or integrating pull requests, and the only thing worthy of a DG entry is the user interface. Am I allowed to explain the user interface for the DG assignment?
@constancensq
(1 posts)1
Abit late but heres my GUI!
@esmanda3w
(1 posts)1
Here is my GUI with a spongebob theme!
@dextertanyj
(1 posts) 1
I met the same issue and narrowed it down to the following line in PersonBuilder
:
public static final String DEFAULT_REMARK = "She likes aardvarks.";
Because we set every Person
to be built with the above default remark unless they have a remark specified, when building each Person
in TypicalPersons.java
, every person without a specified remark will have the default remark. However, in the equivalent json file, each person is built with their respective empty remarks.
In the original tutorial that does not ask us to modify the equals
method, this bug is not apparent because we do not compare the Remark
of each Person
.
Edit: Not sure if this was the intended effect of the tutorial, or if this was a bug?
@Robinho98
(1 posts)1
just to check do u have doublequotes surrounding these lines:
"%MY_PATH%\bin"
I also have the same problem even if i removed the doublequotes regarding the SET_MY_PATH line
@KohHanMing
(1 posts)1. Why do the different commands for runtest.bat work?
I had a lot of problems with runtest.bat, which (thankfully!) got solved eventually. My question is why are there so many different solutions, and why do they not work for some? Referring to the solutions found in #3 #4 #7
I'm curious as to why some only need an extra path to get their .bat to run while some need complete overhauls like:
dir /s /B ..\src\main\java*.java > sources.txt
javac -cp ..\src -Xlint:none -d ..\bin @sources.txt
which replaces
javac -cp ..\src -Xlint:none -d ..\bin ..\src\main\java\Duke.java
and also what does the overhaul even mean? In the original, I roughly understand what the flags mean, but I have no clue what the overhaul is talking about.
Thanks in advance! 😃
@afroneth
(1 posts)1. [External Library Permission Request] Apache Commons IO
To facilitate in file operations such as displaying external PNG, JPEG files in our team's application
@Liu-2001
(1 posts)1. A-CodeQuality and BCD-Extenstion not detected by script
I pushed the A-Assertion, A-CodeQuality, and BCD extension tags last Thursday, but somehow only the A-Assertion tag was detected. How could I solve this? Thanks in advance!
@siangernlow
(1 posts) 1
Hi, I would like to suggest an alternative to the two methods above. In this case, it could be good to separate out the functionality into another class. You've accurately determined that both the deadline tasks and event tasks could be referred to as "timed tasks". So, you could try having an abstract class, TimedTask, for example, to be a child of the Tasks class.
In this case, all timed tasks will extend this new class and have the additional functionality of a returnTime() method while still maintaining the functionality of a Task class itself. While it does not fix the typecasting issue as you would still have to typecast the tasks to TimedTask in order to access the returnTime() method, it will prevent code duplication in this case.
Hope this comment was helpful in helping you find your solution.
Personally, I don't think using exceptions as logic statements (using exceptions to determine a Todo class) is a very good practice, but it may just be me.
@sebastiantoh
(1 posts) 1
I'm guessing that runtest.bat
is using an outdated version of the Duke.class
file. This might occur after you implement packaging.
First, try deleting all the files in ./bin/
, then running the batch file again. There should be some error about not being able to find the Duke
class, which you can then resolve by using java -classpath ..\bin duke.Duke > input.txt > ACTUAL.TXT
instead of java -classpath ..\bin Duke > input.txt > ACTUAL.TXT
@SONGYI98
(1 posts)1
Try replacing the cross symbol with the unicode u2718 i.e. "\u2718" and see if it works.
https://medium.com/@osamadwairi/unmappable-character-for-encoding-java-compiler-issue-e2c5cfc28273
@LeeMingDe
(1 posts)1
Hi, i think you need to change the mainClassName under application in build.gradle. For example,
@gordonfgz
(1 posts)1. Tag exists, but the commit does not belong to any branch on the repository
Hello, Im having issues with my Level-5 tag... Basically it says that my commit does not belong to any branch on my repo.
Below is a snapshot of my sourcetree.
Also, when i do git log Level-5, it shows that it is linked to my previous commits as shown below.
When i try to push all tags on Master,
I get these error messages:
I tried deleting the Level-5 tag, pushing, and re-creating the Level-5 tag at the same commit and pushing it again.
The same error occurred.
Any help will be greatly appreciated... Thanks in advance!
@chuyouchia
(1 posts) 1
Hi there Lingy12 I am not entirely sure since your screen shot cut off the import lines above, but you could try adding this import line. The error looks like its due to u importing the wrong line. Cheers!
import static org.junit.jupiter.api.Assertions.assertEquals;
@jonahtanjz
(1 posts)1
Hi and thanks so much for the fast reply. But now I am facing another issue.
Now when I extend the window, the send button doesn't move with the text box.
In SceneBuilder, click on the send button, then on the right panel, click on layout and make sure the value in this box is the same as the textfield.
This will ensure that the button will scale together with the textfield.
@galvinleow
(1 posts)1
I had this error as well.
Alternatively.
If you check your javac -version it will be JDK11, but if you check your java -version it is likely not 11.
You can change your java runtime environment to the required environment it should then work.
@FH-30
(1 posts)1. CI keeps rejecting my code
Technical details:
Using a Mac
Working on IntelliJ
Java Version 11
My code works perfectly fine, i have also resolved all checkstyle issues. However, when I push onto my team's repo I always get the following error message that fails the CI:
ERROR:../docs/UserGuide.md:146: prohibited \r\n line ending, use \n instead.
ERROR:../docs/UserGuide.md:147: prohibited \r\n line ending, use \n instead.
ERROR:../docs/UserGuide.md:148: prohibited \r\n line ending, use \n instead.
WARN:../README.md:7: trailing whitespace.
WARN:../docs/AboutUs.md:25: trailing whitespace.
WARN:../docs/DeveloperGuide.md:245: trailing whitespace.
WARN:../docs/DeveloperGuide.md:294: trailing whitespace.
WARN:../docs/DeveloperGuide.md:296: trailing whitespace.
WARN:../docs/DeveloperGuide.md:302: trailing whitespace.
WARN:../docs/DeveloperGuide.md:304: trailing whitespace.
WARN:../docs/DeveloperGuide.md:306: trailing whitespace.
WARN:../docs/DeveloperGuide.md:310: trailing whitespace.
WARN:../docs/DeveloperGuide.md:316: trailing whitespace.
WARN:../docs/DeveloperGuide.md:318: trailing whitespace.
WARN:../docs/DeveloperGuide.md:319: trailing whitespace.
WARN:../docs/DeveloperGuide.md:336: trailing whitespace.
WARN:../docs/DeveloperGuide.md:338: trailing whitespace.
WARN:../docs/DeveloperGuide.md:340: trailing whitespace.
WARN:../docs/DeveloperGuide.md:367: trailing whitespace.
WARN:../docs/DeveloperGuide.md:388: trailing whitespace.
WARN:../docs/DeveloperGuide.md:390: trailing whitespace.
WARN:../docs/DeveloperGuide.md:394: trailing whitespace.
WARN:../docs/DeveloperGuide.md:396: trailing whitespace.
WARN:../docs/DeveloperGuide.md:424: trailing whitespace.
WARN:../docs/DeveloperGuide.md:485: trailing whitespace.
WARN:../docs/DeveloperGuide.md:486: trailing whitespace.
WARN:../docs/DeveloperGuide.md:495: trailing whitespace.
WARN:../docs/DeveloperGuide.md:503: trailing whitespace.
WARN:../docs/DeveloperGuide.md:509: trailing whitespace.
WARN:../docs/DeveloperGuide.md:513: trailing whitespace.
WARN:../docs/DeveloperGuide.md:525: trailing whitespace.
WARN:../docs/DeveloperGuide.md:533: trailing whitespace.
WARN:../docs/DeveloperGuide.md:541: trailing whitespace.
WARN:../docs/DeveloperGuide.md:571: trailing whitespace.
WARN:../docs/DeveloperGuide.md:594: trailing whitespace.
WARN:../docs/DeveloperGuide.md:614: trailing whitespace.
WARN:../docs/DeveloperGuide.md:616: trailing whitespace.
WARN:../docs/DeveloperGuide.md:618: trailing whitespace.
WARN:../docs/DeveloperGuide.md:626: trailing whitespace.
WARN:../docs/DeveloperGuide.md:628: trailing whitespace.
WARN:../docs/DeveloperGuide.md:630: trailing whitespace.
WARN:../docs/DeveloperGuide.md:631: trailing whitespace.
WARN:../docs/DeveloperGuide.md:634: trailing whitespace.
WARN:../docs/DeveloperGuide.md:646: trailing whitespace.
WARN:../docs/DeveloperGuide.md:658: trailing whitespace.
WARN:../docs/UserGuide.md:31: trailing whitespace.
WARN:../docs/UserGuide.md:33: trailing whitespace.
WARN:../docs/UserGuide.md:124: trailing whitespace.
Error: Process completed with exit code 1.
So the scenario is that I accidentally deleted my docs folder and I already committed with new code afterwards so i asked my team member who happens to be using windows to pass me a zipped copy to replace it. Since CI kept rejecting, i decided to try cloning the docs folder from my previous git commit on the master branch and placing it inside the branch i'm working on, however the error message as shown above still keeps popping up. Is there any way to fix this issue?
@UncleGrandpa925
(1 posts)1
@StopTakingAllTheNames Thank you for the guide!
@tanwayne890
(1 posts) 1
Here's mine
@kelvinvin
(1 posts)1
Were you at iteration 2 of part 3? I previously had this problem there too. Have you added the 2 images to the main/resources/images folder before running Launcher?
If it was at an earlier stage, I guess you could ensure that your Duke class is public. https://coderanch.com/t/646737/java/subclass-javafx-application-Application-public
@w-yeehong
(1 posts) 1. [External Software Permission Request] Mockito
Allow dependency-free unit testing using mocks. Reduce time needed to write stubs.
Licensed under the MIT License.
@theyifan
(1 posts)1
Is there any way to solve this issue without updating JDK? I encountered the same problem on macOS as well.
@zhaojj2209
(1 posts)1
Added a bit of styling and changed the icons!
@hhdqirui
(1 posts)1
Hi Prof, can I ask a question about the format of the command that the user inputs? If for a command, for example "list", there are white spaces in front of the word "list", should it be considered as the same as the command where there are no white space in front of the word or should it be considered as a different command? Thank you very much!
@yeohhq
(1 posts)1. System.err.print(ex) not appearing on ACTUAL.TXT
I have another issue when testing using the runtest.sh file after including error messages thrown using custom exception classes for Level-5.
Not sure if it is caused due to using System.err.print(ex)
; instead of System.out.print(ex);
, causing the error messages to not be captured in the EXPECTED-UNIX.TXT and ACTUAL.TXT files although I included them in my EXPECTED.TXT file for testing.
Hence would like to ask if it's alright to not include "expected" error messages thrown using System.err.print(ex);
in our EXPECTED.TXT file?
@successs404
(1 posts)1. JavaDoc for Constructors
Hi everyone
When I was typing JavaDoc comments for Constructors, I searched up examples online and decided to go with this format:
/** Constructor.
*
* @param num The index of the task to be marked as done.
*/
public DoneCommand(int num) {
this.num = num;
}
I have a question though. Since the constructor is also a public method, should the Javadocs comment also start with a verb?
i.e. instead of "Constructor." its "Constructs a DoneCommand.'
I also seek for a quick clarification. Are JavaDoc comments not needed for private fields and methods?
Thank you!
@bowei-yu
(1 posts) 1
solved: unmark main as module
Hello! may I ask how did you unmark main as module please?
@pockii
(1 posts) 1. [External Library Permission Request] Font Awesome 5
Add icons to improve the app's UI
@cwenling
(1 posts)1
Hii! Here's my simple GUI, changed it to a cat theme and increased the width. 😃))
@Wong-ZZ
(1 posts)1
You can try using assertThrows as seen here https://howtodoinjava.com/junit5/expected-exception-example/