MolframAlpha for Moodle?

MolframAlpha for Moodle?

by Rajakumar Jillella -
Number of replies: 39

I'm using Moodle 2.9 version.


Do we have WolframAlpha for Moodle 2.9 version?



Thanks in Advance

Average of ratings: -
In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Colin Fraser -
Picture of Documentation writers Picture of Testers

erm, a Wolfram Alpha plugin... not that I know of. But, you  can have a link direct to the site, or if you subscribe to Wolfram Alpha, as a "school" I would think, then you could work some automagic to ensure your students can take advantage of the services offered there. 

In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Andy Chaplin -

This may not be quite what you want, but it could be a step in the right direction...

Using Justin Hunt's Generico filter, you can add Wolfram Alpha widgets - see this thread:  https://moodle.org/mod/forum/discuss.php?d=269835#p1164138

Hope this helps!


Andy

Average of ratings: Useful (3)
In reply to Andy Chaplin

Re: MolframAlpha for Moodle?

by Colin Fraser -
Picture of Documentation writers Picture of Testers

What a great suggestion, Andy... would work better than just linking to the site. This way you can pick and chose what courses would use which widgets, without having any concerns about students being sidetracked by something they find interesting but off topic. 

In reply to Andy Chaplin

Re: MolframAlpha for Moodle?

by Rajakumar Jillella -

Andy,

i have installed Generico filter and got the code for one of the widget.

<script type="text/javascript" id="WolframAlphaScript3974b54c99c1042c0d55a0e962242873" src="//www.wolframalpha.com/widget/widget.jsp?id=3974b54c99c1042c0d55a0e962242873"></script>


Where i have to place this code and where i'm able to see?



Thanks in Advance

In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Andy Chaplin -

Hi Rajakumar

You need to create a Label in your course.

Then you insert the following text...

{GENERICO:type=wa,id=3974b54c99c1042c0d55a0e962242873}

NOTE:  I used the name wa for the template.  If you used something different then you need to change it to the name you gave.  The id is copied from the script you provided.  If you make another widget, you will need to use the id from the script you obtained.

All the best


Andy

Average of ratings: Useful (2)
In reply to Andy Chaplin

Re: MolframAlpha for Moodle?

by Rajakumar Jillella -

Andy,


I have created "Lable" in course and inserted the following as you suggested.

{GENERICO:type=wa,id=3974b54c99c1042c0d55a0e962242873}

and in Generic filter filled as in attached. Please find attached.



See the second attached, the output displaying like this.



In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Andy Chaplin -

I can't see any obvious error, but this is what I did...

I entered the script you posted in the Generico Filter in Site Administration like this:


Then I entered the following text in a label...

{GENERICO:type=wa,id=3974b54c99c1042c0d55a0e962242873}


And the output was as follows...


The only thing I can think of is, case sensitivity or maybe a space after the name of the filter.

Hope this helps!


Andy

Average of ratings: Useful (1)
In reply to Andy Chaplin

Re: MolframAlpha for Moodle?

by Andy Chaplin -

I think I may have found the problem...

WA is not the same as wa!

The tag and the setting have to agree.  The only other possibility I can see is did you leave a space after the comma in the tag?  There shouldn't be one.

In reply to Andy Chaplin

Re: MolframAlpha for Moodle?

by Rajakumar Jillella -

Thanks for supporting Andy,

i did whatever you suggested, but didn't enabled Generic Filter in Admin settings.

Enabled now and got the result finally.


I have posted one more my question with Justin's reply.

Please make me with reply.


Thanks in Advance.


In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Andy: LOL. No doh required. Just thought it was good info to pass on.

Rajakumar: The exact advice I gave in the earlier post is what you need. Replace the numeric id with @@id@@ in the template body. Then when a student add a generico string, the id the student puts in will become the correct widget.

If you need to pre-make widgets and have students simply select them, thats possible. But its a bit more complex.

Average of ratings: Useful (1)
In reply to Justin Hunt

Re: MolframAlpha for Moodle?

by Rajakumar Jillella -

Could you please guide me to get pre-make widgets (widgets gallery) for student selection.


Thanks in Advance

In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers


In the "body of template"  put this:

<div id="@@AUTOID@@" />

In the "variable defaults" put this:

widget="anagram|chat|timezone"


In the "custom js" put this:

jQuery.browser={msie: false};
var widgetid = '';
switch(@@widget@@){
 case 'anagram': widgetid='6a0e2dca338fde14d0b193d4e282fb8b';break;
 case 'chat': widgetid='f050b89031686bec86ab3242ae76fd70';break;
 case 'timezone': widgetid='aa3ce899c2fa89601d1e3756847143f3';break;
}
$('#' + @@AUTOID@@).attr('id','WolframAlphaScript' + widgetid);
$.getScript("https://www.wolframalpha.com/widget/widget.jsp?id=" + widgetid);
That is three pre-made widgets. As the admin to add a new pre made widget, you would 

  1. make a widget on wolframalpha site
  2. copy the id number
  3. give your widget a name and enter that in the defaults section
  4. in the script make the name return the id number you copied


That should work. You will need jQuery on the site, or to check the "amd" checkbox if you are on Moodle 2.9.  This will work best if you install https://moodle.org/plugins/view/atto_generico

Then your users can select from the atto editor, the generico icon, choose wolframalpha from the template buttons, and then from a dropdown for the widgets, a bit like this:

choose wolfram widget



Average of ratings: Useful (2)
In reply to Justin Hunt

Re: MolframAlpha for Moodle?

by Rajakumar Jillella -

Thanks Justin,

What i have to give to "id" in the Label?


In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Generico gives us great power. But first we must understand. smile

[I am joking, but its also true]

The template body puts html tags on the page. There is no javascript yet. Javascript loads last at the very end of the page. But we don't want all our wolfram widgets at the end. So we put some empty divs as placeholders.

The defaults allow us to make default value for a variable (eg @@widget@@). But when we define default values like this, widget="one|two|three", the Generico Atto editor icon/dialog will make a nice drop down list for people to choose a value from

The custom javascript area is the most complex. Here we replace the placeholder div from template body with the original wolfram alpha javascript. We use the "widget" variable so we know what wolfram alpha widget we want. But the id for each widget that wolfram gives us, looks like this "23y3436578478675." Students would not be able to choose from that. That is why we created the "widget" variable ,with nice values like "chat" that students understand. Students choose that instead of an id number.

However the wolframscript needs the strange long id number, so we match that with the widget name in the "switch(@@widget@@){ ..." part of the script. 

And that answers your question! You don't need an id. 

You do need the widget name. But your students won't need to type it in. They should just choose it from the Generico atto editor icon/dialog, and the correct Generico tags will be inserted on the page for them. It would look like this probably:

{GENERICO:type=wa,widget=chat}


Average of ratings: Useful (1)
In reply to Justin Hunt

Re: MolframAlpha for Moodle?

by Rajakumar Jillella -
still i'm in confusion.

as you suggested, i placed everything in their places.

Still not getting these three widgets in the output.


In the "body of template"  put this:

<div id="@@AUTOID@@" />

In the "variable defaults" put this:

widget="anagram|chat|timezone"


In the "custom js" put this:

jQuery.browser={msie: false};
var widgetid = '';
switch(@@widget@@){
 case 'anagram': widgetid='6a0e2dca338fde14d0b193d4e282fb8b';break;
 case 'chat': widgetid='f050b89031686bec86ab3242ae76fd70';break;
 case 'timezone': widgetid='aa3ce899c2fa89601d1e3756847143f3';break;
}
$('#' + @@AUTOID@@).attr('id','WolframAlphaScript' + widgetid);
$.getScript("https://www.wolframalpha.com/widget/widget.jsp?id=" + widgetid);

in the label



The output it is showing.


And you suggested me to install https://moodle.org/plugins/view/atto_generico

There is no version to support Moodle 2.9.


In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

You are almost there. You need

{GENERICO:type=WA,widget="chat"}

or

{GENERICO:type=WA,widget="anagram"}

or

{GENERICO:type=WA,widget="timezone"}

Yes, I suggest you install Generico for Atto. I did not know it was not marked good for 2.9. Thanks for letting me know. I have added "2.9" just now. Please install it as per the instructions. Then adding Generico strings to html areas is very easy.

(in the template if you are on Moodle 2.9, you should probably check the "AMD" checkbox)

Average of ratings: Useful (1)
In reply to Justin Hunt

Re: MolframAlpha for Moodle?

by Rajakumar Jillella -

Hi Justin,

I have followed your steps, but didn't get the result.

installed new Generico filter which is you added in the forum recently.

and filled the fields "body of template", "variable defaults" and "custom js" with code you provided. And in the label pasted the below code.

{GENERICO:type=wa,widget="chat"}

Displaying nothing in output. And also didn't get Generico icon in editor.

Please provide me the exact code of all the field which is we required.


Thanks in Advance.

In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

You will have to hurry because it resets at 9AM Japan time. But on the PoodLL demo site,  I made the WolfgramAlpha template as per the code I posted.

The URL is here: http://demo.poodll.com/course/view.php?id=4#section-5

If you want to login as admin, the details are on the site top page. Then you will be able to see the template. 

For the Atto editor, you have to actually instruct Moodle to add the icon to the editor. IT won't do it by default. Please read the docs for the plugin, and it will tell you how to do that.

Average of ratings: Useful (1)
In reply to Justin Hunt

Re: MolframAlpha for Moodle?

by Rajakumar Jillella -

Justtin, Those are the steps i have followed. Didn't get the output.


Step - 1



Step - 2



Step - 3



Step - 4



Step - 5



Step - 6






In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Actually that looks fine. So I am not sure what the problem is. 

What version of Generico Filter is it?

If you look in the browser console, there are probably some javascript related errors there, they would be helpful to see.

Also there looks like there might be a bad template that is breaking the html. I see a strange looking @@autoid@@} just above "common module Settings" in the update label screenshot, step 4 and step 5. It could be that one of your other templates is breaking the page. That could also be the problem.

Average of ratings: Useful (1)
In reply to Justin Hunt

Re: MolframAlpha for Moodle?

by Rajakumar Jillella -
I have used Generico version which is you given the url link in your website.

http://demo.poodll.com/mod/page/view.php?id=134

It shows the version is 1.2.2



And when i console the browser, it shows the error is


Javascript error is




Is this below javascript code is correct? to use in "custom js" field in template?

jQuery.browser={msie: false};
var widgetid = '';
switch(@@widget@@){
 case 'anagram': widgetid='6a0e2dca338fde14d0b193d4e282fb8b';break;
 case 'chat': widgetid='f050b89031686bec86ab3242ae76fd70';break;
 case 'timezone': widgetid='aa3ce899c2fa89601d1e3756847143f3';break;
}
$('#' + @@AUTOID@@).attr('id','WolframAlphaScript' + widgetid);
$.getScript("https://www.wolframalpha.com/widget/widget.jsp?id=" + widgetid);
The above error shows error with first line only.

Please provide me the correct one.

in the earlier post you found strange one above "common module settings" @@autoid@@.

i have used id="@@autoid@@" instead of  widget="chat" in the label. That only you found after editing the label.



If possible please add the template in your website with the selection of widget.

I will go with same as.


Thanks in advance

In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

I will add the wolframalpha template to the Moodle demo site. But its just what you have. The scripts you have pasted are the same scripts I use.

The error that you see in the console is probably the cause, the one that says "cannot set property browser of undefined." This is because I added the line

jQuery.browser={msie: false};

to the custom js because wolframalpha widgets would error on my sites. it errored because jquery no longer contains that "browser" object. So thats a funny javascript thing. Remove that line from custom js and see if it works.


Average of ratings: Useful (1)
In reply to Justin Hunt

Re: WolframAlpha for Moodle?

by Rajakumar Jillella -

Yes. getting the output from selection, removed the following line with your suggestion from "custom js" in template.

jQuery.browser={msie: false};

But, This selection works for Admin only right.

How about if the user wants to?

One user wants to go with "chat". One user wants to go with "anagram".

Then how we will give this option to end user (student) to select themselves.


Thanks in Advance.

In reply to Rajakumar Jillella

Re: WolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

They choose it from the Generico icon on the editor. Is that not what you wanted to do?

If you just want to present a place with all the wolfgramalpha resources on it. You would just prepare a Moodle page and insert Generico tags for each resource. To split them all up so they don't load at once, perhaps instead of a "page" ... you could use a database activity, or maybe a "book" activity.

Average of ratings: Useful (1)
In reply to Justin Hunt

Re: WolframAlpha for Moodle?

by Rajakumar Jillella -

Tried with those 3 options which is you suggest on Page, Database and Book.

The student didn't get the editor.


Here is clear explanation.

I have mathematics widget in dropdown as a admin. Not only mathematics, many widgets i have.

One student wants to go with Mathematics, He should select himself only on his course page.

How he will select?


Thanks in Advance

In reply to Rajakumar Jillella

Re: WolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Actually its still not clear. 

If you want the student to use the editor to insert the widget somewhere, then use a forum. The students have an editor there. They can insert widgets into posts.

If you want to just put math widgets somewhere, put the widget there.

If you want to provide a set of widgets for student, and let them choose which one they want, then make a database activity and put one widget per database entry. 

If you want to provide a set of widgets they can choose from a block,  you might be able to do that if you use a dataform instead of a database activity. But that is quite complex.


Average of ratings: Useful (1)
In reply to Justin Hunt

Re: WolframAlpha for Moodle?

by Rajakumar Jillella -

Okay, Let me say simple.


1). I have to provide all the widgets in dropdown (Admin will provide the list).

2). Student will select one of them from the list whatever he wants (Student will get the list).

3). Whatever the widget selected by the student, that widget should be display.


Thanks in Advance.

In reply to Rajakumar Jillella

Re: WolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Thanks for making it simple for me.

body


script




Average of ratings: Useful (1)
In reply to Justin Hunt

Re: WolframAlpha for Moodle?

by Rajakumar Jillella -

Thanks for your patience replay.

i have added the code same as , but it is loading many times.

It is not stopping loading the widgets. See the attached on red marked.


In reply to Rajakumar Jillella

Re: WolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Please look on http://demo.poodll.com I changed it a bit there.


Average of ratings: Useful (1)
In reply to Justin Hunt

Re: WolframAlpha for Moodle?

by Rajakumar Jillella -

Yes Justin.

This is what i want. Finally got the solution.

Thank you so much for your patience replies.

And http://demo.poodll.com helps me a lot.


Thank you so much. smile smile smile

In reply to Rajakumar Jillella

Re: WolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Cool. I am glad we got there in the end.

Thanks for sticking with it.

Average of ratings: Useful (1)
In reply to Andy Chaplin

Re: MolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Andy 

Your template looks good. 

I just noticed that you don't use the "id" variable anywhere in the template body. You could put @@id@@ in the template body in place of 3974b54c99c1042c0d55a0e962242873 , to make the template ..... generic. Then your template would cover any WolframAlpha widget.

In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

It looks to me that the Generico filter is not enabled.( If it were enabled, but the tag did not match, the whole generico string will disappear.)

In site admin -> plugins -> filters -> manage filters

enable the generico filter. And then test again.

Average of ratings: Useful (2)
In reply to Justin Hunt

Re: MolframAlpha for Moodle?

by Rajakumar Jillella -

Hi Justin,

You are right, i didn't enable Generic filter in admin. And now enabled as you suggestion.

Finally got the result.

Thanks for supporting.

This is the widget only for Matrix which is i have used and displayed.

Is this possible to get all the widgets with single code.


Suppose, one student wants to use "distance", another student wants to use "mathematics", another student wants to use "currency calculation".

Wants to all the widgets at a time.

In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers

I just deleted your other post. Please don't start a new thread for the same issue. It just confuses things...

In reply to Howard Miller

Re: MolframAlpha for Moodle?

by Rajakumar Jillella -

Thanks Howard.

I really don't know. I though may get solution soon. That is what posting with new post.


How can i get the output of this filter?

In reply to Rajakumar Jillella

Re: MolframAlpha for Moodle?

by Justin Hunt -
Picture of Particularly helpful Moodlers Picture of Plugin developers

Also I changed the template body a little, because it was not positioning the widgets properly. It should now be:

<div id="@@AUTOID@@"></div>
The whole thing is on the Generico course on the PoodLL demo site. 

That is at: http://demo.poodll.com/course/view.php?id=4 

If you log in as admin (credentials are on the site top page), you can view the template or try to insert widgets into pages and forums etc. There is a page already with some wolframalpha widgets on it, in the course.

Average of ratings: Useful (1)