Wednesday, February 25, 2015

How to run CourseBuilder on Eclipse


If we could run CourseBuilder on Eclipse, we will be able to run coursebuilder step by step. By using debugging tools in eclipse, you could see what happens inside the code.

1.  Download and install the right version of Eclipse

2. Add the google plugin for eclipse:

Youtube Video about how to add it to eclipse.

3. The safest way to create a new project is that to open a sample project on  Google App Engine Project.

Then replace all the file with coursebuilder's files (1.6 version for me)

Replace with:

Ignore the red error symbol -- Just run it as google app run.

Finally, you could enjoy the sense of control toward your code -- coursebuilder.






Monday, February 16, 2015

How to put question into coursebuilder--1.6?


Single Question:


Code:
var activity = [
  '<p> Description in HTML <p>',
  '<p><b>1.</b> Imagine that you are chatting with a group of female students and trying to attract them into your CS class, which role model (One of your former students) do you think is the best to connect with them?</p>',
  { questionType: 'multiple choice',
    choices: [['A male average student (or average GPA)?', false, 'Please try again, reminder 1'],
              ['A female average student', false, 'Please try again, reminder 2'],
              ['A male top student', false, 'Please try again, reminder 3'],
              ['A female top student', false, 'Please try again, reminder 4'],
              ['Pick one from 2 or 4 with similar background to those students', true, 'Correct! ']]},
];

Multiple Single Question Group:
Code:
var activity = [
  {questionType: 'multiple choice group',
    questionsList: [
      {questionHTML: '<b>1.</b> We shouldn’t worry about less girls than boys choose a Computer Science major<br/>',
        choices: ['True', 'False'],
        correctIndex: 0},
      {questionHTML: '<b>2.</b>If teachers take initiative to recruit girls, there will be more girls who choose to enroll in computing class. <br/>',
        choices: ['True', 'False'],
        correctIndex: 0},
      {questionHTML: '<b>3.</b>We could recruit students anytime and anywhere.<br/>',
        choices: ['True', 'False'],
        correctIndex: 0}
    ],
    allCorrectOutput: 'You have known a lot about this topic! Good job!',
    someIncorrectOutput: 'Think about why we need active recruiting. Please try again.'
  }
];

Multiple Questions Group:
Code:
var activity = [
  { questionType: 'multiple choice group',
    questionGroupHTML: '<p>This section will test your understanding on active recruiting.</p>',
    questionsList: [
           {questionHTML: '<b>1.</b> Why do we need active recruiting (AR)? <br>',
           choices: ['A. Few girls consider computer science (CS) because of stereotypes', 'B. Most of girls don\'t realize the benefits of pursuing a computing career', 'C. A very small amount of girls explored computer science before and hardly know about the possible relationship between computing and their interests.', 'D. Many girls have no confidence in majoring in computer science', '5.As for a girl, few of their girl friends will major or have majored in computer science'], correctIndex: [0, 1, 2, 3,4]},

          {questionHTML: '<b>2.</b> When should we recruit students?',
           choices: ['A.  After the course are ready', 'B. Anytime, anywhere', 'C. During the class, do AR for the coming relevant classes'], correctIndex: [0, 2]}
    ],
    allCorrectMinCount: 2,
    allCorrectOutput: 'Great job! You know the material well.',
    someIncorrectOutput: 'You must answer all these two questions correctly.'
  }
];

Be careful when you put question option. If there  is a single quote, you have to use slash to escape it:
For example.
"Most of girls don\'t realize the benefits of pursuing a computing career"

You can't write as follow:
"Most of girls don't realize the benefits of pursuing a computing career"

Otherwise, it would promote error message, when you save it.



Monday, November 17, 2014

Show the Process Button in Unit Page of Course Builder 1.6

Simple Solution:

Chose to active the tag:
 gcb_can_persist_activity_events =  True;

The reason behind this:
In utils.py, gcb_can_persist_activity_events let CAN_PERSIST_ACTIVITY_EVENTS become true
              IN lesson.py, CAN_PERSIST_ACTIVITY_EVENTS set is_progress_recorded true:
IN course_base.html, when is_progress_recorded is true, then it would show the progress image.






Monday, November 10, 2014

How to change templates of Coursebuilder?

1. Add module
This also works for adding personal module to the coursebuilder.

2. You have to understand Jinja template. How it works:
When you  register your own module,  you need to create a handler and inside the handler method, there are get method and post method. It would render the html template of jinja. Inside the method, you could notice that how they set the value of template: for example:
Self. template_value["transient_student"] =  zero

If you understand how these template works, then you could do a lot of customization inside the html page of coursebuilder.

Details:





  

Monday, October 27, 2014

Add Share and like button on Coursebuilder


Result--

Firstly, there already exists google plus share button. But we may also need facebook share button at the same time.
Here is the link to get the customized code from facebook developer page --
https://developers.facebook.com/docs/plugins/like-button
Similarly, the link for google plus button API:
https://developers.google.com/+/web/share/
After getting the code, we put the code at which google plus button puts. It is in the bast.html under the view directory. It includes both the javascript code  and html one.


Another thing should be mention is that we could specify the url link to be liked. But also we could leave it empty, and then it will set the current page link as the sharing URL. This is more adaptive to the course. Because students may just want to share certain unit of content to their friends.

Test sharing current page --












Debug Log -- Operation error: Database is locked when running coursebuilder

Because course builder use sqlite3 as its database, but it can't support the concurrency very well. So when there are two threads to compete on a database, it would create the error message -- Database is locked.

That's the reason why sometime you get the error message like this:

1. One possibility is that you have two coursebuilder courses running with the same ids. So you need to change one of them into different one.

2. Another possibility is that you may need to delete other courses. They may compete resource at the same time. So don't run too many coursebuilder courses in your local computer at the same time. It may trigger the database problems. Even it seems like there is no obvious connections among running courses.


Monday, October 20, 2014

Data Components we have in downloaded data


Firstly, go to Google App Engine, click one of applications:
Secondly, go into the back end management page, You would see data section, and then click datastore viewer:

Thirdly, And then You could do the query you want and see the available data in the site:


Monday, October 13, 2014

Use Google Analytics and Google Tag Manager to get data from Coursebuilder

Lesson, You had better use Google tag manager to implement google analytics. It works!

In Course.yaml, you could find the options to put your own google analytics id and google tag manager id: 

Introduction on Google Tag Manager  ---
Google tag manager would help you manage the tag for your website. Usually, there are 20+ tags in some big website.  They are use to track all kinds of important marketing data.

Use google tag manager to implement google analytics tag management tool!!
  1. Video how to use google tag manage — https://www.youtube.com/watch?v=3HnSmz2ENn8
  2. Webpage on How to use google tag manage ---   https://support.google.com/tagmanager/topic/6062343?hl=en&ref_topic=6063853


Google Analytics --
What is session in google analytics?
https://support.google.com/analytics/answer/2731565?hl=en#terms
A session is a group of interactions that take place on your website within a given time frame. For example a single session can contain multiple screen or page views, events, social interactions, and ecommerce transactions.

A single user can open multiple sessions. Those sessions can occur on the same day, or over several days, weeks, or months. As soon as one session ends, there is then an opportunity to start a new session. There are two methods by which a session ends:
Time-based expiry (including end of day):
After 30 minutes of inactivity
At midnight

Campaign change:
If a user arrives via one campaign, leaves, and then comes back via a different campaign.

What is the bounce rate?

Bounce Rate is the percentage of single-page sessions (i.e. sessions in which the person left your site from the entrance page without interacting with the page).

Another kind of description — 
Bounce rate (sometimes confused with exit rate)[1] is an Internet marketing term used in web traffic analysis. It represents the percentage of visitors who enter the site and "bounce" (leave the site) rather than continue viewing other pages within the same site.

A visitor may bounce by: 
Clicking on a link to a page on a different web site 
Closing an open window or tab 
Typing a new URL 
Clicking the "Back" button to leave the site 
Session timeout  


Other information -- 



How to create forum and announcement in Google Course Builder

Add forum and announcement into coursebuilder


Firstly, In course.yaml, there offers options for us to put our own google group links into Coursebuilder.
So If we want to create forum and announcement, we should start with building two google groups.
As for the details about how to build these two groups, you could see two links:
a.  Discussion Forum --  https://code.google.com/p/course-builder/wiki/WebForums
b. Annoucement -- https://code.google.com/p/course-builder/wiki/CreateEmailList\

Notes:
1. Remember to setting correctly for two groups!

Be careful that announcement is just an email list. So it just allows the owner or managers to post email. 

2. Remember to let all the students to subscribe email list(announcement)

The discussion forum could allow anyone to post even they don't register the class. In that case, people don't need to join(subscribe) the discussion group officially, but still be able to involve in the discussion. 

The email list(Announcement) has to be subscribed before students register the class. 
Put  HTLM notes in register.html page

3. Remember to create organized categories





4. After you create the email list, remember to click sending email button before publishing an announcement.






Wednesday, July 30, 2014

How to delete the error message when downloading data from Coursebuilder

Problem:
When we use coursebuilder to download data from remote server, we would come across a error message.
Fortunately, it doesn't hurt the data downloading obviously. But it is a danger.  For whatever reason, error message means there are some problems on going!

So I go through the code in etl.py, the error message is coming from there:

It shows that this app is empty. but it doesn't matter at that time. The app is not downloaded now, SO we could choose move this 1098 code to the place where the app has been downloaded.
And then we could see the error message has been gone!






How to download data from Coursebuilder

1. Set up Google App Engine

Firstly, the assumption is that you have downloaded and installed the GoogleAppengine launcher and coursebuilder. You may get this image:


2. Implement the global environment variable for running etl.python

Secondly, if we want to download or upload data, we need use /tools/etl/etl.py. In order to run etl.py, we firstly need to set the environment, so we need create a file named gcbpaths.py and add the following code to gcbpaths.py:

import sys
// the only change for us -- put the directory where coursebuilder is stored
sys.path.insert(0,'/Users/haoyuchen/Developer/Mooc/coursebuilder-07-29/')

sys.path.insert(0,'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine')
sys.path.insert(0,'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/fancy_urllib')
sys.path.insert(0,'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/jinja2-2.6')
sys.path.insert(0,'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2-2.5.2')
sys.path.insert(0,'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webob-1.2.3')
sys.path.insert(0,'/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/yaml/lib')

import argparse
import etl
if __name__ =='__main__':
    PARSER = argparse.ArgumentParser(add_help=False, parents=[etl.PARSER])
    etl.main(PARSER.parse_args())

Notes: This is the exactly directory for etl, you can't miss it

3. Understand input for running gcbpaths.py

Thirdly, We will try to download the course material data. The command line would be:
python tools/etl/gcbpaths.py download datastore <course_url_prefix> <app_name> <app_server_name> --archive_path <archive_path> --datastore_types <model1,model2>

Real example: 
python tools/etl/gcbpaths.py download course /tapestryworkshop mycourse0724 mycourse0724.appspot.com --archive_path ./tapestryworkshop.zip

Command description:
action : download
data type:  course 
course_url_prefix: /tapestryworkshop
app_name: mycourse0724
app_server_name: mycourse0724.appspot.com
archive_path:  ./tapestryworkshop.zip



After run the command, then you need fill your gmail and password.

Example  1 --Download event entity data 
There are two data types .
1. course  --  All is about course information
2. datastore -- All is about the user information (included the watching behaviors!)

In order to monitor the event entity data, we need set download data type as datastore. And we also need set the related tag to be true. If not, we could just get small amount of data.

Steps to turn on the event tag monitors:
1. Go to the course admin page as following.
2. Click setting here and select these three tag to be active:

3. Set the true tag to be true and active, then remember to save:

4. run python code: For instance, 
python tools/etl/gcbpaths.py download datastore /mediatesting lighthouseprojectmooc lighthouseprojectmooc.appspot.com --archive_path ./6_06_9.enventenity.zip



Then we could get event entity data from the datastore:
On the other hand, the entity data from course material:


Example 2 -- Download course from online then upload it to another online server.
Steps:
1. Download course data
The course we want to transfer:

Command:
python tools/etl/gcbpaths.py download course /tapestryworkshop mycourse0724 mycourse0724.appspot.com --archive_path ./tapestryworkshop.zip

result:
Download result -- tapestryworkshop.zip

2. Upload course data to another server(use local server as example)
from GoogleAppEngineLauncher, it shows the local server's ID is chenhaoyu1992, app_server_name is localhost:13080

Before uploading, we need firstly create a new empty course:
The context path (/new_course) will be used as course_url_prefix(one of input parameters for etl.py).
New Empty Course

     


Command:
python tools/etl/gcbpaths.py upload course /new_course chenhaoyu1992 localhost:13080 --archive_path ./tapestryworkshop.zip

Command description:
action : upload
data type:  course 
course_url_prefix: /new_course
app_name: chenhaoyu1992
app_server_name: localhost:13080
archive_path:  ./tapestryworkshop.zip

After uploading successfully, we could run it in our local server.

New course with uploaded content
Important:
But one thing should be remembered is that we could upload course data to a new server. But now we couldn't upload the student's data into the server. Because the google team doesn't implement that code.