Friday, February 28, 2014

Week 7: OAuth Library is Overdue

We left off last week trying to use an OAuth library for signature verification in order to continue working through the Canvas LTI modules. This proved a more complicated task than we anticipated.

There are libraries in every language, and so many of the resources online give tutorials on how to build your own library, which the modules do not suggest and seems far beyond our abilities. We decided to find an OAuth library in Ruby so we get more familiar with parsing that language in Canvas.

Starting in the Canvas forum, we found a plethora of "helpful" resources, but there were so many in so many different languages that it quickly became difficult to sort through them all. Some of the more useful sites for Ruby OAuth libraries were linked from here and here, and the one we're currently working through right now is here.

In trying to install oauth I got an error that oauth-instructure was interfering with the install (a question I posted here). But for some reason I was able to install oauth-simple without any trouble and so proceeded with that version.

With it we started writing our own ruby test code.

Using this...

...we wrote this.

Since we're still not super familiar with Ruby, implementing the proper code is proving challenging as we get seemingly simple errors like: 


that we're not sure how to fix yet.  By the end, I'm sure we'll know more about Ruby and OAuth libraries than we ever thought we wanted to....

Goals for next week:
  1. Learn to use Ruby's OAuth Library for signature verification
  2. Complete Canvas LTI modules


Thursday, February 20, 2014

Week 6: The LTI Structure for Randomness

Now that we are more familiar with the Canvas coding structure and have built a working question type, we wanted to look into the real goal of our project: Adding an option in Canvas to create randomized quizzes and question practice for students.  Canvas has a similar option to this already, but the teachers still have to create a question bank and then "random" questions are pulled from that question bank.  Our goal is to make the process more automated and easier for students to access a wide range of practice problems given specific parameters.

I began by looking into creating random Math problems in general and came across this helpful resource. But the more important goal at the moment is to find a way to integrate this "Random Quiz" option into the Canvas interface.  Our first thought was to simply add a button in the Manage Question Bank area of Canvas and link our "Random Quiz" from there.

I found some useful tips here and more specifically here for how to add buttons in Canvas.  They mostly pointed me in the direction of using LTI and building our own app (an idea we had had in the background for awhile), so we started pursuing those learning modules more earnestly.

I recommend using Safari as your browser for these modules, as the server launch interface was very straightforward there and less buggy than in Chrome or Firefox (at least on my machine). We used the URL for our own server for these modules.

The first module was fairly straightforward - teaching us to recognize required parameters to build/use an app in Canvas and to ensure we had the proper setup. It wasn't until we got to the second module on signature verification that we ran into trouble.


The module suggested we use a library for signature verification, but neither of us knew how to implement one. So, we trudged along until we reached a point where manual verification was too tedious and time consuming (see above screenshot).  

Luckily, others ran into trouble at this exact spot, and we found what looks to be very useful advice in the Canvas forum

Goals for next week:
  1. Find out how to implement library to automate signature verification
  2. Continue LTI modules




Thursday, February 13, 2014

Week 5: Bugs in Canvas - Painting the Ugly Picture

This week we worked on de-bugging the code in Canvas to create our own question type.  We decided to do an additional walk-through on my mentor's system to copy the steps I took and see if similar errors cropped up.  When we finished the process, his version was a success, so we had to go back to my code and check in further detail.

I found some easy-to-fix, rookie mistakes that I had made (mostly boolean logic in conditional statements).  However, by the end of the first day we discovered I had apparently missed a curly brace in one of the files - most likely due to a difference in style in the original code. Once again a major facepalm on my part - the whole world broken by a single curly brace.

At that point we decided it would be easier to revert my files to their original state and re-do the question development steps now that we were more familiar with the structure of the code.  We used the "git status" command in terminal to see what files specifically had been changed and used "git checkout ." to revert the tracked files to their original state.  The base file that we created in the first step of the tutorial remained since it was never being tracked.  I worked through the steps a second time with a more familiar eye, and it worked! We were able to access our own question type at the front end of Canvas.


Our next step will be to become familiar with the front end interface to see if we can create a question that will meet our needs.  This mainly means increased student interaction with questions types via the ability to generate truly random questions and specify number or question type ranges for the kinds of problems they would potentially want to practice. 

On a side note, we are also working on making our private server faster, as development flow is nearly impossible at its current speed.  Our workaround for now to get familiar with the front-end interface has been to create a teacher's account in canvas (a free service offered by the website).  We are also looking into further tutorials linked on the Canvas Quick Start Guide. 

Goals for this week: 
  1. Keep working on LTI learning modules in the background
  2. Become familiar with question tools already present in Canvas - strengths and weaknesses


Friday, February 7, 2014

Week 4: Coding Blind

Our main goal this week was to create our own question type in Canvas using the following tutorial.  I had never coded in Ruby or HTML before, so it was an entirely new and worthwhile learning experience.  For ease and speed of testing purposes, we are modeling our question after the multiple choice question (as far as settings, answer type, etc), but naming our type "sympy_question."

Our first step was to create a new file in "app/models/quiz_question/" that extends QuizQuestion::Base.  Since we're modeling after multiple choice, we just copied the multiple choice file in terminal using the "cp multiple_choice_question.rb sympy_question.rb," making sure we were in the "quiz_question" directory.

Next we added our question type String to the list of question types in "Assessment Question" and created a new struct in QuizzesHelper in the method answer_type, once again modeling after the multiple choice question format.


Modeling after the multiple choice made the coding process much easier because there was a straightforward template to work from.  Once we get more familiar with coding in Ruby, we'll be able to add more detailed design. 


I skipped over updating "parse_question" since there are no new features to add yet, so my next step was to add a question form description that works with HTML and update the quizzes.js file to recognize my "sympy_question" type. 



Since we're not adding any new features yet, I didn't need to update _multiple_answer.html.erb or _form_answer.html.erb, but that may come later. 

Once I had the code together, we tried creating our own question type from the front end - which failed utterly. At this point, the "Add Question" button is unresponsive, so I've done just enough coding to break everything.  I suppose it's some kind of progress...

Goals for next week:
  1. Debug 'create new question' code
  2. Familiarize ourselves with LTI learning modules on Canvas as possible alternative
  3. Look at Mathjax for inspiration


Week 3: Snow Day + Facepalm

So we did not make as much progress as we had hoped this week.  Part of this I will blame on the closing of the university due to "snow," but mostly I blame a brilliant moment of utter incompetence, which I will explain below.

We left off replacing some code that we got from the Google Canvas forum in order to fix a problem in the Canvas install.

Our next step was to start the server and log into Canvas using the "bundle exec script/server" command, a step we expected to be pretty straightforward.  First we had to make sure that our Ruby version matched our Gems version (1.9.3) with a simple "rvm use 1.9.3," but when I tried to start the server, I kept getting this message:

WARNING: Nokogiri was built against LibXML version 2.9.1, but has dynamically loaded 2.7.8
=> Call with -d to detach
=> Ctrl-C to shutdown server

I spent the rest of the week frantically searching forums looking for a solution and functionally getting nowhere.  When we were finally able to reconvene at the end of the week, we realized that the WARNING was just that - only a warning.  The server had been working the whole time (major facepalm).  

I think that's one of the most valuable lessons I've learned in this process so far: sometimes you get so deep in the weeds that you almost expect things to go wrong at every step and end up losing sight of the real problem.  Often the best solution is to pull back and look at the bigger picture. 

So now that we were finally able to log in to Canvas on our server, we familiarized ourselves with the interface (creating classes, quizzes, etc) and then began trying to make our own question type, which we will hopefully be able to incorporate SymPy into. 

The tutorial to create a new question type was shared on the Google Canvas forum and can be found here

Goals for next week: 
  1. Create/code new question in Canvas (finish 'create question' tutorial)
  2. Familiarize ourselves with LTI learning modules on Canvas as possible alternative
  3. Mathjax for inspiration