-
-
Notifications
You must be signed in to change notification settings - Fork 68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Activity: 7.12.13 ActiveCode (ch8Ex7q) #467
Comments
I am not able to reproduce this error. I think there may be an error in your own code. Please try this code. |
[cid:8076e900-a62a-448d-aa0f-2380202dcdd1]
I still get the same error.
Also I believe your suggested code on line 14 should be:
else count++;
(but this isn't causing the compile error)
Lisa Ryder
Mathematics and Computer Science
[cid:8d785ea4-ac45-4537-a921-adcb29334329]
…________________________________
From: Beryl Hoffman ***@***.***>
Sent: Wednesday, January 31, 2024 5:15 PM
To: RunestoneInteractive/rs ***@***.***>
Cc: Lisa Ryder ***@***.***>; Author ***@***.***>
Subject: Re: [RunestoneInteractive/rs] Activity: 7.12.13 ActiveCode (ch8Ex7q) (Issue #467)
You don't often get email from ***@***.*** Learn why this is important<https://aka.ms/LearnAboutSenderIdentification>
CAUTION: This email is from an external sender. If this message looks suspicious, please report the message<https://conejousd.sharepoint.com/sites/TSKB/SitePages/Reporting-Email.aspx>.
I am not able to reproduce this error. I think there may be an error in your own code. Please try this code.
public static void removeLongStrings(ArrayList list)
{
int count = 0;
while (count < list.size())
{
if (list.get(count).length() > 4)
{
list.remove(count);
}
count++;
}
}
This passes all the unit tests for me.
—
Reply to this email directly, view it on GitHub<#467 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/BFOMI5EPCNEZHV5GQUUTY5TYRLUEVAVCNFSM6AAAAABCTRLNEKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRQGI4TMMBRGE>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
My thought is the compile error is coming from a unit test in a file called RunestoneTests that is calling the method on line 16 with 2 arguments, instead of one. |
You can see the tests if you view source on the page. When I do that on https://runestone.academy/ns/books/published/csawesome/Unit7-ArrayList/listPractice.html?mode=browsing I see this test code starting at line 1484: import static org.junit.Assert.*;
import org.junit.*;
import java.io.*;
import java.util.ArrayList;
public class RunestoneTests extends CodeTestHelper
{
@Test
public void testMain() throws IOException
{
String output = getMethodOutput("main");
String expect =
"Expected Result:\t [fish, cat, foo]\n" + "Your Result:\t\t [fish, cat, foo]\n";
boolean passed = getResults(expect, output, "Expected output from main");
assertTrue(passed);
}
@Test
public void testRemoveLongStrings()
{
ArrayList<String> mylist1 = new ArrayList<String>();
mylist1.add("longword");
mylist1.add("dog");
mylist1.add("longword");
mylist1.add("wee");
ArrayList<String> mylist2 = new ArrayList<>();
mylist2.add("dog");
mylist2.add("wee");
Test1.removeLongStrings(mylist1);
boolean result = mylist2.equals(mylist1);
boolean passed = getResults("true", "" + result, "removeLongStrings method test");
assertTrue(passed);
}
} What do you see? |
Also, what's the URL of your CSAwesome. It feels like you somehow have a different version than the latest? |
This is the URL where I am experiencing the issue https://runestone.academy/ns/books/published/csawesome/Unit7-ArrayList/listPractice.html |
Thanks, but this is a mystery! I am not seeing that behavior. The tests do not have that error-producing code, see line 724 in https://github.com/bhoffman0/CSAwesome/blob/master/_sources/Unit7-ArrayList/listPractice.rst?plain=1. I'm thinking that this is an error in a particular server which is perhaps compiling the wrong Java code. @bnmnetp is it possible to clear the cache for Java files like you do periodically on server2? |
[Edit: oh, whoops. Beryl already asked you about this. Sorry.] Okay, next debugging step: can you open the developer tools and scroll to the top of the console where the first line should be something like:
What does it say for you? It's possible that some server has a cached version of the compiled tests that's wildly out of date or something. |
This page served by server2 |
@bhoffman0 I have a cron job that cleans the cache on all of the jobe servers every day, removing files more than 4 days old. The server you are assigned is based on the IP address of your computer, so @lryderWHS would get the same server and JOBE server regardless of the course. Now, on server 2 if I check the cache of files I do see various definitions of the removeLongStrings function with and without the second parameter sometimes called maxLength, toMaxLength, m, or x ... These files are dated january 27 or newer. No files like that are found on server3... |
@bhoffman0 where could the different versions of that code be coming from? The test code is not editable by the user, unless these are variations that have been created by instructors in the web interface? |
I'm on server1 and Peter is on server5 and we created some removeLongStrings functions with 2 args to try to get the same error without success, but not on server2 and just in the student code area, not in the unit test code. I checked the question bank in assignments for 7.12 and there were no copies of any exercises in that lesson and nothing with that name or function in the exercises lesson. |
@bnmnetp maybe delete the files with |
I thought of that, but I was hoping we could get to the bottom of why this happened before I make the problem vanish. |
yeah all I could think of was the weird cache problem. |
There are 3 questions in the database that call Two of the cached files have the second parameter:
and stonecf111f2de0694dbce8df108ecddb5f32
And timestamps:
|
With that, I have now removed those two files from the cache on server2. @lryderWHS hopefully that solves your problem. |
Was the removal of the second parameter a change that @bhoffman0 or @gigamonkey made recently? A change you recall from the distant past? |
No, I looked at git blame and that problem hasn't been touched in 4 years, other than the reformatter 7 months ago which only changed spacing. (line 724 in https://github.com/bhoffman0/CSAwesome/blame/master/_sources/Unit7-ArrayList/listPractice.rst). |
Looks fixed on my end :) Yay!! I appreciate all the time an energy!!! |
@bnmnetp We've had reports of two more incidents of the code working on one server but not another: in email in 7.4.6.3.1 ActiveCode CookieOrder and https://discord.com/channels/1013815439161315348/1013892589776281620/1204144692174790686 on server1. All in Unit 7 but that might just be because that's where most classes are. |
Please check the current issues Many bug reports are duplicates, this just creates more work for us. Searching the issues first may give you your answer or a workaround! If not adding new information to an existing report is much more helpful than a new report.
What Course are you in
CSAwesome
What Page were you on
7.12. Code Practice with ArrayLists
Activity: 7.12.13 ActiveCode (ch8Ex7q)
What is your username
[email protected]
Describe the bug
The activity requires implementation of this method
public static void removeLongStrings(ArrayList list)
The error reported by the test is:
./RunestoneTests.java:16: error: method removeLongStrings in class Test1 cannot be applied to given types;
Test1.removeLongStrings(values, maxLength);
^
required: ArrayList
found: ArrayList,int
reason: actual and formal argument lists differ in length
Which seems to imply that the tester is calling the method with 2 arguments instead 1.
The text was updated successfully, but these errors were encountered: