ClassCube https://classcube.com Mon, 20 Nov 2017 13:30:00 +0000 en-US hourly 1 https://classcube.com/wp-content/uploads/2017/03/cropped-cube-1024px-32x32.png ClassCube https://classcube.com 32 32 Unchecked or Unsafe Operations Message https://classcube.com/java-unchecked-or-unsafe-operations/ https://classcube.com/java-unchecked-or-unsafe-operations/#respond Mon, 20 Nov 2017 13:30:00 +0000 https://classcube.com/?p=1116 If you’ve started writing your own JUnit test cases for your problems in ClassCube you may have come across the following message on a dialog box. It’s a bit confusing for students because they see that their tests are successful, but that there was also some extra output. And that output looks like an error […]

The post Unchecked or Unsafe Operations Message appeared first on ClassCube.

]]>
If you’ve started writing your own JUnit test cases for your problems in ClassCube you may have come across the following message on a dialog box.

Dialog with unsafe or unchecked operations message

It’s a bit confusing for students because they see that their tests are successful, but that there was also some extra output. And that output looks like an error message.

Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details. 

What Java is telling you is that there might be an error, but it’s not bad enough to stop compiling.

What causes it?

When Java compiles it looks through your code and tries to find any errors during the compile. Sometimes you’ll do things like forget a semicolon or have extra parenthesis and Java will fail to build. Sometimes Java finds something that might be an error, but isn’t bad enough to warrant failing the compilation.

Let’s look at an example.

ArrayList list = new ArrayList();

In Java 7 and up this will trigger the unchecked or unsafe operations message. The “right” way to code this would be to specify the data types inside the ArrayList.

ArrayList<String> list = new ArrayList<>(); 

How to fix it?

First way is to no do something that triggers the message like the example above. Normally, this will probably come from your test case file. But sometimes it comes from your student code, which you can’t do all that much about.

Or, you can ignore it.

If you’re compiling the code directly you can add -Xlint:unchecked to the javac command line and the messages won’t pop up.

If you’re using a tool, like ClassCube, where you don’t have direct control over the command that’s used to compile code you can’t just add a command line flag. So what you can do is put a flag in your code that does the same thing.

@SuppressWarnings("unchecked")
class ChickenTest {
  // Whatever unit test code you need
}

The line just above the class signature will tell JavaC to not display any unchecked warnings from within the class. You also can use the same @SuppressWarnings("unchecked") above method signatures if you only want to ignore the check in specific methods.

Why do we have to?

Admittedly, this seems like something that something we could take care of for you. And, we considered adding -Xlint:unchecked to the command that compiles your students’ code.

We decided against doing it though.

First, this should only show up when you build full JUnit test files. If you’re doing simple tests cases this is already added to the test cases that are built.

We left turning on the suppress flag to you in this case because we assumed there may be cases where you want your students to know about these messages. It might be something you want to teach your students how to not have the error message. That way you can actively turn it off. If we did it automatically there would be no way for you to turn it back on.

You might also see this pop up when using output matching. In that case though, it’s your student’s code that’s triggering the message. In this case it’s a good teaching moment between you and your student to explain why the messages are coming up.

Does it matter?

Not really.

If you’re using unit tests and this message pops up, it doesn’t affect the grading. If you look at the screenshot on the top of this post you’ll see that there’s still the message that all tests passed. It will still show up as completely passed even though that message shows up.

In most cases you can just ignore it.

The post Unchecked or Unsafe Operations Message appeared first on ClassCube.

]]>
https://classcube.com/java-unchecked-or-unsafe-operations/feed/ 0
Update to Moodle Gist Filter Plugin https://classcube.com/update-moodle-gist-filter-plugin-0-2/ https://classcube.com/update-moodle-gist-filter-plugin-0-2/#respond Tue, 24 Oct 2017 12:30:00 +0000 https://classcube.com/?p=1052 Small update to our Moodle Gist Filter plugin. Now when you embed a gist with multiple files you’re also able to only embed single files. If you’re pasting in the normal link from a gist it’ll still work the same way. All files from that gist will show up on your Moodle page. But, now […]

The post Update to Moodle Gist Filter Plugin appeared first on ClassCube.

]]>
Small update to our Moodle Gist Filter plugin.

Now when you embed a gist with multiple files you’re also able to only embed single files.

If you’re pasting in the normal link from a gist it’ll still work the same way. All files from that gist will show up on your Moodle page. But, now if you only want to embed a single file you can add ?file=filename.ext to the end of the URL that you paste into Moodle and only that file will embed.

Gist embedded into Moodle post

You can find documentation on the Moodle Gist Filter plugin here, or view the source on GitHub.

The post Update to Moodle Gist Filter Plugin appeared first on ClassCube.

]]>
https://classcube.com/update-moodle-gist-filter-plugin-0-2/feed/ 0
ClassCube in Moodle Demo https://classcube.com/classcube-in-moodle-demo/ https://classcube.com/classcube-in-moodle-demo/#respond Mon, 23 Oct 2017 12:30:00 +0000 https://classcube.com/?p=1056 Are you curious about what ClassCube looks like inside Moodle? We’ve got you covered. If you click over to Moodle.ClassCube.com you can see how well ClassCube and Moodle work together. On the demo site you’ll be able to create an account and enroll in an example course. In that course you’ll find several examples of […]

The post ClassCube in Moodle Demo appeared first on ClassCube.

]]>
Are you curious about what ClassCube looks like inside Moodle?

We’ve got you covered.

If you click over to Moodle.ClassCube.com you can see how well ClassCube and Moodle work together.

On the demo site you’ll be able to create an account and enroll in an example course. In that course you’ll find several examples of ClassCube problems embedded into Moodle.

Moodle.ClassCube.com

The post ClassCube in Moodle Demo appeared first on ClassCube.

]]>
https://classcube.com/classcube-in-moodle-demo/feed/ 0
Output matching with a runner https://classcube.com/output-matching-runner/ https://classcube.com/output-matching-runner/#respond Thu, 31 Aug 2017 19:45:06 +0000 https://classcube.com/?p=999 During the year you'll probably assign a lab for students to write code in one class and have a separate runner class. It's pretty easy to do in ClassCube.

The post Output matching with a runner appeared first on ClassCube.

]]>
Sometime during the year you’re probably going to assign your students a lab where they’ll write code in one class and have a separate runner class. Fortunately, that’s pretty easy to do in ClassCube.

For this example we’re going to create a simple output matching lab assignment with two files. One is a class called PrintSquare where the student will implement a method to output a 5 by 5 grid of # symbols. The other is PrintSquareRunner which is already implemented to call the printSquare method inside the printSquare class.

Here are the two files that we’re going to load into ClassCube.

Problem Settings

We’re going to create a new problem and set grading to output matching.

ClassCube Problem Settings

You can set timeout and visibility to whatever you choose.

Given Code

Since we’re going to be using multiple files, we’re going to go ahead and turn off the starter code. When you do this you’ll get a notice to be sure to include editable files in your problem. That’s okay. We’ll do that in a bit.

Disable Given Code

You can paste your runner code in here if you want. It does need to be a full class though. The reason we’re not is so that we can hide the runner if you don’t want your students to see it.

Expected Output

Next step is to add the expected output. For this one it’s going to be a 5 by 5 square of # symbols like this.

Expected Output

Of course, change this to whatever you’re looking for with your lab.

Adding Files

Now it’s time to add the files. Click on the Problem Files tab. You should see a screen that looks like this.

Problem Files Tab

Click on the green Add File button and the screen should look like this.

Add File

Enter the full filename, including the extension, into the top field. The contents go in the large edit panel on the bottom.

If you’ve already created the file you can also drag and drop it onto the top section – the part with the filename field and toolbar buttons – and the filename and contents will fill in for you.

Do the same for the second file. If you’re using the same files as I am, it should look like this.

Problem Files Added

In this case I left the implementation of the printSquare method up to the student, but went ahead and implemented the main method in the PrintSquareRunner class. If you’d rather leave the runner unimplemented, you can do that as well.

Saving and Testing

Switch back to the Settings tab and click on the Save button. That should take you to the problem edit page.

Problem Editor

Notice that there’s a dropdown next to the Text button. This lists all files that are editable by the student. In this case it’s the PrintSquare.java and PrintSquareRunner.java files. They’re sorted alphabetically, so the PrintSquare.java file comes first.

Running

Now, it’s like any other problem. Your students type in their code and press the Test button. Since this is an output matching question the expected output will be compared to the output from the submitted code. If there’s a match

And, it doesn’t matter which file they currently have selected. All the files will be sent to our servers to get compiled.

Hiding the Runner

If you’d rather not show the runner to your students, that’s easy to do.

Go back and edit the problem and click on the Problem Files tab. Next to the filename there’s a set of 3 buttons. One is an eyeball. Click that one and it should turn gray and switch to an eyeball with a slash through it like this.

Hiding the runner

Now when your students attempt this problem the runner will not be visible. But, it will still get sent with their code to our servers for compilation and running.

Be sure that if you hide the runner it is fully implemented since it won’t be editable.

Which file runs?

And before I go, just a little background on how output matching problems work.

When the files are submitted ClassCube looks for a main method. All files are compiled, but the file with the main is run. Specifically, the first file with a main method is run. So you’ll want to make sure there’s not more than one main.

Trying it out

If you don’t already have a ClassCube account and would like to see this in action this problem is available as a practice problem.  The interface is slightly different on our public practice problems compare to inside of ClassCube, but the idea is the same.

The post Output matching with a runner appeared first on ClassCube.

]]>
https://classcube.com/output-matching-runner/feed/ 0
Pseudocode practice quiz https://classcube.com/pseudocode-practice-quiz/ https://classcube.com/pseudocode-practice-quiz/#respond Wed, 23 Aug 2017 13:00:00 +0000 https://classcube.com/?p=988 Just learning to code? Is the language getting in your way? Give this pseudocode practice quiz a shot and see how well you think algorithmically.

The post Pseudocode practice quiz appeared first on ClassCube.

]]>
Just learning to code? Is the language getting in your way? Give this pseudocode practice quiz a shot and see how well you think algorithmically.

What is output from the following code?

a = 2
loop while a < 10
   print a + " "
   a = a + 2
 
 
 
 
 

What is output from the following code?

x = 20
loop while x > 10
   x = x - 4
print x
 
 
 
 
 

What is output from the following code?

x = 10
loop while x > 85
   x = x - 5
print x
 
 
 
 
 

What is output from the following code?

x = 15
if x > 15 
   print "go"
if x < 20 
   print "stop"
 
 
 
 

What is output from the following code?

x = 10
sum = 0
loop while x > 3
   sum = sum + x
   x = x - 2
print sum
 
 
 
 
 

Question 1 of 5

The post Pseudocode practice quiz appeared first on ClassCube.

]]>
https://classcube.com/pseudocode-practice-quiz/feed/ 0
Full Screen PDFs https://classcube.com/full-screen-pdfs/ https://classcube.com/full-screen-pdfs/#respond Mon, 21 Aug 2017 12:30:00 +0000 https://classcube.com/?p=993 Are your labs already typed up as PDFs? Now you can attach them to your problems in ClassCube. No more retyping.

The post Full Screen PDFs appeared first on ClassCube.

]]>
Over the summer we added a new feature where you can attach PDFs to problems. Linked PDFs will automatically embed in an iframe. If your lab assignments are already in PDF format you can just attach them to your problems and ClassCube will automatically embed.

We just made it even better.

Now, if the only text in the problem instructions is a link to a PDF ClassCube will now make the PDF fill the instructions panel.

Full Screen PDF

The editor is on the left side. On the right is the attached PDF, now taking up the full panel.

The post Full Screen PDFs appeared first on ClassCube.

]]>
https://classcube.com/full-screen-pdfs/feed/ 0
Deleted code is debugged code https://classcube.com/deleted-code-is-debugged-code/ https://classcube.com/deleted-code-is-debugged-code/#respond Thu, 10 Aug 2017 13:00:00 +0000 https://classcube.com/?p=976 Deleted code is debugged code Jeff Sickel   Sometimes it’s just better to start over.  

The post Deleted code is debugged code appeared first on ClassCube.

]]>

Deleted code is debugged code

Jeff Sickel

 

Sometimes it’s just better to start over.

 

The post Deleted code is debugged code appeared first on ClassCube.

]]>
https://classcube.com/deleted-code-is-debugged-code/feed/ 0
Find nth Occurrence https://classcube.com/find-nth-occurrence-challenge/ https://classcube.com/find-nth-occurrence-challenge/#respond Mon, 07 Aug 2017 13:00:00 +0000 https://classcube.com/?p=973 The post Find nth Occurrence appeared first on ClassCube.

]]>

Find nth Occurrence

This problem comes from a given, but unimplemented, method from the 2017 AP Computer Science exam called Phrase.

In one part you were tasked with replacing the \(n^{th}\) occurrence of one string within another string. And they gave you a method findNthOccurrence to help you out.

But the implementation for findNthOccurrence was not shown. So for this coding challenge, that's you job.

As an example, the call findNthOccurrence( "dogdogdogdog", "dog", 2 ) should return 3 because the 2nd "dog" starts at index 3. findNthOccurrence( "dogdogdogdog", "dog", 3 ) would return 6.

If find does not occur in str the method should return -1. Likewise if there is no \(n^{th}\) occurrence the method should also return -1.

findNthOccurrence("dogdogdogdog", "dog", 1) => 0
findNthOccurrence("dogcatdogdodgdogddd", "dog", 3) => 13
findNthOccurrence("dogdogdog", "dag", 1) => -1
findNthOccurrence("catcatcat", "dog", 3) => -1
findNthOccurrence("fishchickendogcatplatypus", "chicken", 5) => -1

The post Find nth Occurrence appeared first on ClassCube.

]]>
https://classcube.com/find-nth-occurrence-challenge/feed/ 0
Attaching PDFs to problems https://classcube.com/attaching-pdfs-to-problems/ https://classcube.com/attaching-pdfs-to-problems/#respond Fri, 04 Aug 2017 13:00:00 +0000 https://classcube.com/?p=965 New feature for the new school year. Now, if you already have a lab assignment typed out as a PDF you can attach that PDF to a problem in ClassCube instead of retyping the instructions. One the rich text editor you should now find a PDF icon. It’s the third icon from the right in […]

The post Attaching PDFs to problems appeared first on ClassCube.

]]>
New feature for the new school year.

Now, if you already have a lab assignment typed out as a PDF you can attach that PDF to a problem in ClassCube instead of retyping the instructions.

One the rich text editor you should now find a PDF icon. It’s the third icon from the right in the screenshot below, hightlighted in blue.

Quill Toolbar

Clicking that icon will bring up a dialog where you can select a PDF from your computer.

Once saved the PDF will show up in the problem instructions as a resizable frame.

PDF embedded in problem

And if needed, your students can download the PDF by clicking on the link above the embed.

Video

Are you a video person? Here’s a demo for you.

Questions

Is this not working like it should for you? Please get in touch and let us know.

Is there something that ClassCube doesn’t do that you wish it would? Let us know that too. We’re always looking for ways to improve this tool and make your job teaching easier.

The post Attaching PDFs to problems appeared first on ClassCube.

]]>
https://classcube.com/attaching-pdfs-to-problems/feed/ 0
Make it correct, clear, concise, and fast; in that order https://classcube.com/make-it-correct-clear-concise-and-fast-in-that-order/ https://classcube.com/make-it-correct-clear-concise-and-fast-in-that-order/#respond Thu, 03 Aug 2017 13:00:00 +0000 https://classcube.com/?p=956 “Make it correct, make it clear, make it concise, make it fast. In that order.” – Wes Dyer This is a great quote for new coders. I think every teacher can think of a student that is way to fixated on writing fast code. But that leads to two problems with newbie coders. Well, probably […]

The post Make it correct, clear, concise, and fast; in that order appeared first on ClassCube.

]]>

“Make it correct, make it clear, make it concise, make it fast. In that order.”

– Wes Dyer

This is a great quote for new coders. I think every teacher can think of a student that is way to fixated on writing fast code.

But that leads to two problems with newbie coders. Well, probably more than two. But two come to mind.

First, they might spend so much time trying to make the code perfect that they’re never actually able to get a working algorithm. And that’s something that can carry over once they leave the classroom. Code that solves a problem is better than fast code that doesn’t, and way better than fast code that doesn’t even run.

And two, often really efficient code isn’t intuitive to look at. Sure, they might understand what they wrote when it’s turned in. But what about a few weeks or months later? Would their peers be able to look at the code and immediately tell what it’s doing?

Now, I’m not suggesting that students shouldn’t work towards writing efficient code. It’s just that maybe it shouldn’t always be the first priority.

The post Make it correct, clear, concise, and fast; in that order appeared first on ClassCube.

]]>
https://classcube.com/make-it-correct-clear-concise-and-fast-in-that-order/feed/ 0