Mathematics tools

STACK version 3.0

 
 
Picture of Christopher Sangwin
STACK version 3.0
 

Dear all,

Over the last month Tim Hunt and I, together with Matti Pauna from the University of Helsinki, have been working on STACK 3 and I'm posting to provide some details of what we are doing, and to reassure you that work is going on.

We have decided to create a "STACK question type" for the Moodle quiz and not to maintain a separate "STACK server" connected to Moodle via the Opaque (SOAP) webservice protocol. We have now reached a point where it is clear that this is the right approach, and are confident that ultimately we will be able to make this work. The major disadvantage of this approach, from my point of view, is that STACK loses some identity, and flexibility, as a separate project. It will be harder to include STACK questions in other websites. But, once we are happy STACK is really working well I'm confident we could separate STACK from Moodle should demand make this worthwhile.

One reason for doing this is my belief that it gives us the shortest path to the point where other people in the open source community will be able to contribute to the development of STACK.

This significantly simplifies the installation process, reduces dependencies and the number of separate components. It will also make it much easier for teachers to include questions within quizzes, and easier for us to ensure options set in quizzes are respected by questions. These are all major advantages of our decision.

We have just reached a point where we are able to "round trip" a demonstration question as a teacher testing, and this is a key proof of concept, so I'm confident this will work. We still have a lot of work to do. Matti has written a skeleton import mechanism to ensure old STACK 2 questions can be imported, which is clearly a key requirement. We hope parallel work to Tim and I will produce an authoring interface through the Moodle quiz (or I'll eventually write this myself).

We are taking the shortest path to "getting STACK basically working". We have no intention of introducing significant new features. We are also not, in the first pass, implementing all the existing features. For example, I've put the matrix element input type to one side for now. We will continue to work on this and in about a month I'll have a much better estimate of when we will be ready.

At that point I'd very much appreciate recruiting some "testers" and "early adopters" who will work hard to break, and hopefully help fix, the new code. I will also have a list of outstanding jobs, and would be very grateful for help from people willing to contribute to the development. This will ensure the majority of STACK 2 features, and hence existing questions, can be uploaded and used as before.

I'm very pleased and excited about how things have progressed in the last month, and will certainly keep this forum updated.

Chris Sangwin
School of Mathematics
University of Birmingham

 
Average of ratings:Useful (3)
Picture of Victor Hugo Huerta
Re: STACK version 3.0
 

Hi Chirs.

This is good news, I've used since its early versions STACK with excellent results for my students. I currently work with about 100 students at the high school level,so I like to contribute any failure to report the new version of STACK

Greetings and congratulations to you and your team.

 
Average of ratings: -
Picture of David Gilpin
Re: STACK version 3.0
 

very exciting news.  thanks for your work on this guys.  can't wait till we can try this out.

 
Average of ratings: -
Picture of Renate Mittelmann
Re: STACK version 3.0
 

Hi Chris

Good to hear!

When can I download Stack 3.0? I would like to be an early-adopter.

 
Average of ratings: -
Picture of David Gilpin
Re: STACK version 3.0
 

I too, would be willing to test this out with my students when you are ready.  Thanks again!

 
Average of ratings: -
Picture of Christopher Sangwin
Re: STACK version 3.0
 

Dear all,

Thank you for your interest in STACK 3.0. In the last couple of weeks we have made substantial progress. I've spent this afternoon creating a list of jobs which are yet to be done which is now online at

https://github.com/sangwinc/moodle-qtype_stack/blob/master/doc/en/Developer/Development_track.md 

and drafting the installation guide to STACK 3.0

https://github.com/sangwinc/moodle-qtype_stack/blob/master/doc/en/Installation/index.md

I should warn you that only Tim, Matti and I have installed STACK.

It is possible to author and test a single part question through Moodle. However, there is a lot which remains unfinished! If people are really keen to have a
sneak preview of what we have been working on then please go ahead. It is certainly not yet ready for use with students.

I would strongly recommend you download the code using GIT, not as a zip file. This will enable you to "pull" code updates regularly and simply.

Please let me know how you get on but, since our priority is complete the development, we cannot offer support.

Chris

 
Average of ratings: -
Picture of Yasuyuki Nakamura
Re: STACK version 3.0
 

I am very excited to hear the news about STACK3.0. Mr Nakahara and I would love to contribute Japanese localization. 

 
Average of ratings: -
Picture of Christopher Sangwin
Re: STACK version 3.0
 

Thank you very much.  We would be delighted to accept an updated Japanese version for STACK.  We are using Moodle's system for localisation. Many of the "tags" - particularly those which relate to the more mathematical side of STACK - are unchanged, but we have changed a lot of the tags.  There are many fewer tags, because we no longer need a STACK front-end.  We'll be in touch when the code is stable enough to make starting this worthwhile.  

 
Average of ratings: -
Picture of Yasuyuki Nakamura
Re: STACK version 3.0
 

O.K. I hope the work goes well. 

 
Average of ratings: -
Picture of Éva Rácz
Re: STACK version 3.0
 

Hello Chris,

I am glad to hear about Stack 3. Today I have installed the 2.3dev Moodle along

with Maxima 5.26.0 and Stack 3. I have checked the installation of Maxima, the GUI

and the command-line version both work fine (as well as Moodle with the

math extensions from mpluga.zip, which can be found under "Advanced Math Tools").

For some reason, however, the healthcheck script fails to connect to maxima.

Do you have some idea about why this might occur?

Thanks,

Éva

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Can you turn on Moodle's Debugging, and also the CAS debugging option on Site administration Plugins Question types Stack. Then go to the healthcheck page again and see if that reveals any additional information that helps to debug the problem.

 
Average of ratings: -
Picture of Éva Rácz
Re: STACK version 3.0
 

Hello Tim,

After turning on debugging, the healthcheck script results in a couple of extra error messages. I cannot interpret the bit about maxima not having been found in the cache (the executable is located in the path; /usr/bin/); I have attached the error report. I guess I must have missed something during setup.

Thanks,

Eva

 

 

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

The references to the cache are because we get STACK to cache the results of any call to Maxima, because making a call out to maxima is by far the slowest thing we do.

The key bit from those error messages is where it says "The CAS timed out". If you look, you will find that the second time it tries to call Maxima, it actually gets somewhere. You can see some output starting "Maxima 5.26.0 http://maxima.sourceforge.net ..." before the time-out happens, so it is basically working, it is just too slow, so Moodle gives up waiting.

You can set the timeout in the STACK settings. Try making it bigger until things work. I had to bump it up to 15s on this Mac laptop.

Chris was telling me that recent versions of Maxima come with more complex standard libraries of functions, so it is actully getting slower and slower.

 
Average of ratings: -
Picture of Éva Rácz
Re: STACK version 3.0
 

Thanks, that worked smile

Éva

 
Average of ratings: -
Picture of Christopher Sangwin
Re: STACK version 3.0
 

Thanks Eva,

From my point of view it is very reassuring that the install "worked" even if we haven't resolved the speed of Maxima.  You are one of the very first to try this, and I've only installed STACK on two almost identical PCs.

Speeding up Maxima is a really important issue and some notes on this are also online.

http://github.com/sangwinc/moodle-qtype_stack/blob/master/doc/en/CAS/Optimising_Maxima.md

If you try any of these ideas, perhaps you could let us know?  If others have expertise in this area and are willing to look into this we would very much appreciate suggestions while we continue to work on the code in parallel.  (Otherwise we will sort this out in due course!)

Chris

 
Average of ratings: -
Picture of Cam Joyce
Re: STACK version 3.0
 

Just out of curiosity, did you consult with the LONCAPA project when creating STACK? I believe that STACK will be the system of choice because it is integrated with Moodle (much better user interface), but LONCAPA seemed to run faster for me when I used it (also uses Maxima). I'm sure you know this, but there's more info here:

http://www.lon-capa.org/maximaasserver.html

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Thanks for the tip, but if you look at our todo list (https://github.com/sangwinc/moodle-qtype_stack/blob/master/doc/en/Developer/Development_track.md) you will see that getting Maxima to run on a separate server is still on our todo list; and if you look at the link Chris posted (https://github.com/sangwinc/moodle-qtype_stack/blob/master/doc/en/CAS/Optimising_Maxima.md) you will see that Chris had already spotted this as one option to investigate.

Generally the recommendation for doing software development is first get the system to work right, and then optimise it to work fast. We are still working on the 'work right' part, though we are getting close.

 
Average of ratings: -
Picture of Christopher Sangwin
Re: STACK version 3.0
 


Dear Cam,

Thank you for posting. Yes, I've a lot of respect for LONCAPA. I've kept a number of systems similar to STACK firmly in my peripheral vision over the last few years. We are all aiming for the same thing: "better" questions for our students.

One of my goals is to enable teachers to write their own questions from scratch, online. This is a challenging goal, because these kinds of systems are sophisticated, so to get the most out of the tool the teacher has to learn quite a lot. I am guilty of underestimating this! In practice, teachers certainly start by modifying content rather than writing it from scratch. STACK 2 is distributed with over 350 calculus and algebra questions, each with random versions and full worked solutions. These start from numeracy and work up to integration by partial fractions. I'm going to convert, test and release these for STACK 3. But it will probably take a year for my students to work through the new versions and confirm they are still working.... I will also release a range of example questions from other areas of mathematics. Contributions from others are always very welcome.

I also wanted to not try to do everything. I'm most interested in mathematics, and mathematical assessment. Other things, e.g. online lecture notes, calendar and certainly username/passwords are important but too much work for one person. STACK 2 aimed at inserting a question into the Moodle quiz. STACK 3 provides a Moodle question type. I'd prefer to be part of a bigger Moodle community, and STACK 3 is the result.

I really don't want to start to compare and criticise other people's work because mine is far from perfect. But I do feel compelled to quote LONCAPA https://s10.lite.msu.edu/adm/help/Math_Response_Problems.hlp#Math_Response_Problems

"Math Response is a way to have a problem graded based on analgorithm that is executed inside of a computer algebra system. The use of this response type is generally discouraged, since the responses will not be analyzable by the LON-CAPA statistics tools."

The whole point of STACK is to make some kinds of mathematical questions natural for CAA. We can't do everything (e.g. certainly geometric and real analysis proof) but there is a lot which can be done in a valid and reliable way. I also want to analyse students' responses in a very mathematical way. 

There is a lot of other very good work around. I'm along way behind Michael Beeson's work on MathXpert, e.g. see

http://www.michaelbeeson.com/research/papers/hisc.pdf

What I'm aiming to do is provide a really useful mathematical question type. This is part of Moodle, and hence benefits from the work of the rest of this community. I don't know of anything which does this, otherwise I'd be collaborating with them!

Chris

 
Average of ratings: -
Picture of Cam Joyce
Re: STACK version 3.0
 

Hi Chris (and Tim)

I am really impressed by your efforts and I hope my comments are taken as constructive. I have stopped using LON-CAPA this year and intend to support STACK from 3.0 onwards. In fact, I have a meeting after Easter weekend to demonstrate some of its (and Moodle's) capabilites to my administration in the hopes they will purchase a server for it.

I agree that developing questions for STACK is quite a challenge. My undergraduate degree is in Computer Science so I'm not detered, but it is still quite a time consuming process to develop randomized questions with feedback. It's not unique to STACK, LON-CAPA was the same with the exception that it supports decision structures, loops, functions, and importing libraries which help improve productivity. I'm sure these language features are somehwere in your development plan.

Ultimately I think the STACK community will need a place to develop and share their questions in order for it to really grow, perhaps a development wiki of some sorts. One where people without any programming knowledge can still contribute by posting questions and possible feedback trees for developers to translate. They could even be involved in the algorithms to generate random questions, solutions and feedback. I'm not familiar with the STACK project itself but I could certainly help contribute to this aspect of the project. Let me know where I can help.

 
Average of ratings: -
Picture of Ramon Eixarch
Re: STACK version 3.0
 

Hi all,

following Cam comments I agree that a common place to share questions is interesting.

In WIRIS we have a repository of questions created with WIRIS quizzes, our upgrade to Moodle quizzes system. http://collection.wiris.com/quizzes

Maybe there would be a possibility to have a repository that combines STACK and WIRIS quizzes questions.

 
Average of ratings: -
Picture of Mark Adams
Re: STACK version 3.0
 

Chris,
I am using Moodle for the first time in my HS physics classes.  I am impressed with the STACK question type.  It would be very helpful in writing questions if I knew the maxima commands that STACK uses.  For example, when using plot (which I found out is a wrapper for plot2d), what options are allowed?  I was trying to print values on the axes, but xlabel is not an allowable option.  Is there a document somewhere that lists the available options?

Also, I am happy to share the questions that I write if anyone else would like to use them in their classes.  Thanks for making STACK available.

Mark

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Chris's recommendation is to install the Desktop version of Maxima on your computer, so you can experiment with Maxima commands there.

See also https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/CAS/STACK-Maxima_sandbox.md

 
Average of ratings: -
Picture of Mark Adams
Re: STACK version 3.0
 

I have done that, but the problem is that STACK does not use all of the maxima commands.  This is fine, but it would help me in writing questions if I knew the commands that STACK recognizes, not maxima.

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

The lists of allowed and disallowed commands are probably only documented in the code. See https://github.com/maths/moodle-qtype_stack/blob/master/stack/cas/casstring.class.php#L69

Note that the blacklist of CAS keywords forbidden to teachers line is very, very, long!

 
Average of ratings: -
Picture of Ken Krige
Re: STACK version 3.0
 

Chris, Tim and other developers

I started playing with Moodle last Wednesdy and discovered Stack 3 yesterday.  I have taught high school maths for 23 years and this is one of the best things I've ever stumbled upon.  Thanks for the hard work and everything you are doing.

Everything went smoothly with the installation of Moodle and Stack 3 on my Ubuntu Linux server.  I only have one small problem.  In following your Quick Start tutorial (which is very helpful), the answer rendered fine, but in the question I had to use double dollar signs throughout (Differentiate $$(x-1)^3$$ with respect to $$x$$)

The double dollar sign is an easy enough work around for now, but if I wondered if I had the wrong rendering tool.  The "healthcheck" seemed to suggest everything was fine.

Thanks again for the project.

Ken

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Mathematicians care about the difference between inline-style maths (a variable name or small equation in the middle of a paragraph) and display-style maths (an big equation displayed on a line on its own).

Since STACK created by mathematicians they want ot use both, and they want to use the standard delimiters $ and $ $ (without the space) for these.

Moodle has to work for everyone, and using a single $ as a delimiter is dangerous. A non mathematician might want to talk about "A payment of between $5 and $10." without having that messed up by the maths filter.

Therefore, by default, Moodle only recognises the double-$ form.

The STACK healthcheck page suggests how to set up MathJax on your side to process both single- and double-$ regions.

Anyway, what stack is doing makes it tricky to work with standard Moodle maths rendering, rather than MathJax, so this is probably going to be one of the things that Chris and I discuss on Wednesday.

 
Average of ratings: -
Picture of Christopher Sangwin
Re: STACK version 3.0
 

Ken,

Yes, this is a difficult issue.  I've been using $ (inline) and $$ (display) for nearly 20 years, and it is a difficult habit to break!  

I think that (i) having matching delimiters,

\(...\), \ [...\ ]

are much better, and (ii) as Tim says, these do not conflict with using $ as a currency symbol elsewhere.

I spoke with Tim about this yesterday, and as a result I've refctored the code so that STACK now only auto-generates LaTeX with the following  matching delimiters,

\(...\), \ [...\ ]

 That was easy.  The hard part was updating all the language strings and documentation!  STACK should now work fine without the use of $s at all to denote mathematics in LaTeX, so should display with Mathjax and other LaTeX filters.

A lot of the sample questions use single $.  Tim and I spoke about a "filter" which would assume that within a STACK question an unprotected $ sign means inline mathematics.  This will enable question authors to still write $x^2$, and STACK will filter this into \(x^2\) quietly.  That will have to wait for now...

Thanks for your interest.   Please let me know how you get on.

Chris

 
Average of ratings: -
Picture of Ken Krige
Re: STACK version 3.0
 

Chris

Thanks for the speedy action, and for the useful info.  You guys are doing a great job on this project.

 

I have been trying to restore your demo course, so far without success.  Moodle has a 7 stage restor process.  At Stage 6, having seen all your schema etc, I get the message:

"This backup file has been created with Moodle 2.4dev (Build: 20120920) (2012092000) and it's newer than your currently installed Moodle 2.3.2+ (Build: 20120927) (2012062502.04). This could cause some inconsistencies because backwards compatibility of backup files cannot be guaranteed."

There is a "Restore Role Mappings" dropbox.  When I click CONTINUE, the restore process hangs.

I don't know if this is a backwards compatibility issue and if there is anything that can be done about it, but it would certainly be helpful (though not essential given your excellent tutorial) to play with a demo before working on question banks and courses.

Sorry to trouble you and thanks for the help so far.

Ken

 
Average of ratings: -
Picture of Christopher Sangwin
Re: STACK version 3.0
 

Ken,

Thanks for confirming the demo course doesn't work.  It was rather thoughtless to build this in my DEV verision of Moodle.  Developers do this kind of thing occasionally.  Leave it with me!

Chris

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Acutally, when I try to restore, I get

Debug info: Incorrect string value: '\xEF\xAC\x80ere...' for column 'info' at row 1
INSERT INTO question_categories (name,contextid,info,infoformat,stamp,parent,sortorder) VALUES(?,?,?,?,?,?,?)
[array (
0 => 'CR_Diff_02',
1 => '176',
2 => 'Linearity in differentiation',
3 => '0',
4 => 'epsstack2.bham.ac.uk+120926134521+7xHrKP',
5 => '17',
6 => '999',
)]
Error code: dmlwriteexception

That is saying that the description of one of the question categories contains some bytes that are not valid UTF-8. Perhaps that is the problem.

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

It seem that the ff of differention is some funny diphthong charager (ff) which MySQL does not like.

I unzipped the .mbz file, and replaced them all with normal ff. Then I could import into 2.3.2+ (with the warning). Then I backed it up again, and put the cleaned up file back onto github.

I hope I have not broken anything while doing that.

 
Average of ratings: -
Picture of Ken Krige
Re: STACK version 3.0
 

Chris

My sincere apologies.  Even though the restore process hung at step 6, it had by that stage already restored a working version of the demo.  The joys of multitasking technology are such that I went on with other stuff and only revisited the home page of my Moodle site this morning to find 3 copies of your demo course.

It all seems to work fine, certainly well enough for me to learn from your examples.  If I have any problems, I can always install a dev version of moodle to play with the examples.

Ken

 
Average of ratings: -
Picture of Christopher Sangwin
Re: STACK version 3.0
 

Éva,

Are you using an MS platform or Linux?  If you are using MS, then you need to check the path to Maxima carefully.  If you've installed lots of versions of Maxima over the years it can be difficult for STACK to find a path to Maxima.  

Chris

 
Average of ratings: -
Picture of Éva Rácz
Re: STACK version 3.0
 

Hello Chris,

I am using Linux, and I have removed the previous version of maxima before installing 5.26... so it seems like that this is not the problem. I do have the previous version of moodle on my machine, but that should not cause a problem either, since they have separate directories and databases. 

Éva

 
Average of ratings: -
Picture of Marc Grober
Re: STACK version 3.0
 

This is going to be offered as a Moodle add-on question type via the plugin database?

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Yes, of course, once it is finished we will add a plugins database entry. The code is already on github if you want to try a pre-release version. We have given the link above: https://github.com/sangwinc/moodle-qtype_stack/.

 
Average of ratings: -
Picture of khaled baloul
Re: STACK version 3.0
 

Hello,

My Site hosting provider directed me to make my own GNUPLOT and Maxima binaries install on my account.

As for the Stack 3.0 install, which Stack file, containing the default binaries paths, should be adapted.

Thanks for your help!

 

K. Baloul

 

 

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

After you install Moodle and STACK, go to Admin -> Plugins -> Question types -> STACK in the Moodle admin UI, and set the paths there. Then, after you have saved the changes, use the Healthcheck link lower down that page to make sure everything is working.

 
Average of ratings: -
Picture of khaled baloul
Re: STACK version 3.0
 

 

I finally installed stack 3.0. 

Thanks for your help.

 

K. Baloul

 

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Chris and I really wanted to release STACK 3.0 this week, but in the end we were not quite brave enough, so we have released STACK 3.0 Release Candidate 1. You can get it from the Moodle plugins database at https://moodle.org/plugins/browse.php?list=set&id=17. We think everything is working, but would really appreciate some more testing.

Chris ran some STACK quizzes this week with some of his students, which went well, but he did find a couple of minor bugs (which we think are now fixed). Hence desire to do a bit more testing before we declare this version done.

At the OU, we have been doing a lot of testing, which has gone well, but we are not planning to put it in front of students until after Christmas.

There seem to be STACK users all around the world, and so far we have translations into Finnish and Sweedish. From now on, if you would like to translate STACK, you can do so using Moodle's translation system at http://lang.moodle.org/.

We hope that you will find STACK useful in your teaching.

Tim & Chris.

 
Average of ratings: -
Picture of mana mboh
Re: STACK version 3.0
 

Thanks Chris and Tim for the work on STACK. I have been interested for sometime now and finally completed the installation on  moodle2.3.2+ for a play during the half-term.

My initial exprerience is mixed.

I was very impressed with the power of the plugin and how quickly I could get to grips with its front-end workings. 

This experience was marred only by repeated timeouts when I tried to preview relatively basic questions, such as those described in the installation guide.

On this point, I would like to establish whether this is an issue with my server or a characteristic experienced by other users - and more importantly how to overcome it.

Some details:

I am testing on a winxp system with local installs of moodle on mowes, uniform and wampserver.  Reason for these diffrerent servers is to rule out issues with the server/versions of php, mysql or apache.

You may deduce from this that I am keen to see this work properly.

 I also managed to import the sample questions, no problem though I did have issues with $ delimiters and tried to search-and-replace with mathjax delimiters. Will STACK accept "`" delimiters, if I specify in mathjax config? I guess the question is between Mathjax and STACK, which one does its magic first and does it matter?  I think this would help as the opening and closing delimiters are the same, making a search-and-replace one-step.

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

The calls that the STACK question type makes to Maxima can be slow and cause time-outs. It does seem to vary a lot between servers, although for me it was fast on Windows XP, and slow on a Linux system.

The simplest thing you can do to get rid of the time-out errors is to go to the STACK settings page, and increase the time-out time, but that is not really a solution.

The best thing to do is to follow these instructions: https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/CAS/Optimising_Maxima.md (but I am not sure if anyone has tried that on Windows.)

I will have to leave the delimiters question for Chris.

 
Average of ratings: -
Picture of mana mboh
Re: STACK version 3.0
 

Thanks Tim,

I will have a go at the optimisation if I can and share the outcome.

My intuition tells me that quite a chunk of the scripts are relatively far. Mathjax must have a cost by size though it is on the server - in my setup. I don't know the size of the scripts copied from Maxima, not having had as close a look,  but they must be quite costly in terms of the relative lack of proximity to the server in local setups.

Are there any ideas/methods to place the scripts within the server?

 
Average of ratings: -
Picture of Christopher Sangwin
Re: STACK version 3.0
 

Hi there,

I've recently changed the internal STACK code so that is does not automatically produce single dollar inline mathematics delimiters.  It now uses the form \( \) instead.  I haven't updated the sample questions themselves, but will do so in due course.

I see no reason why opting for other delimiters, and setting this within your local config for mathJax, should not work but haven't tested it myself.  I'd rather keep the number of such supported features to a minimum though.  

We did think about writing a "filter" as part of STACK to auto-convert single dollars to \( and \), so that we are consistent.  This is on my do-to list.

Chris

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Last week, Chris gave a webinar about STACK. You can watch the recording here: http://www.transformingassessment.com/events_7_november_2012.php. I recommend it.

 
Average of ratings: -
Picture of Renate Mittelmann
Re: STACK version 3.0
 

Hi,

I followed the instructions from page and installed stack

https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/Installation/index.md and installed stack.

Even optimized the maxima with the help of page

https://github.com/maths/moodle-qtype_stack/blob/master/doc/en/CAS/Optimising_Maxima.md

Still I get the error "Timed out while waiting for session lock." while running healthcheck script or when creating a stack question. 

Attached the error from log.

versions:

Maxima 2.4.3+

MySql 5.5.31

Ubuntu 13.04

clisp-2.49

maxima 5.27.0 (compiled maxima source-code with clisp 2.49 and installed)

 


 
Average of ratings: -
Picture of Kevin Wheelock
Re: STACK version 3.0
 

Same problem on OSX Lion, Moodle 2.5 Stable (from git), mysql 5.5.28, Stack 3.0 (from git), maxima 5.28, Lisp SBCL 1.0.55.0-abb03f9, apache 2.2.22, completely clean install of both Moodle, the moodle database, moodledocs folder, and STACK.

No timeout problems prior to installing STACK. If I stop and restart MySQL, the Moodle site returns to normal functionality until I try anything with STACK again (e.g., running the healthcheck); once I try to use STACK, the session lock timeout problem immediately recurs.

Haven't found anything useful in the logs yet; I will post when and if I find something.

--Kevin

 
Average of ratings: -
Picture of Kevin Wheelock
Re: STACK version 3.0
 

Update: Just deleted Moodle 2.5 (including the database and the moodledocs folder), and replaced it with Moodle 2.4. No change in behavior.

However, I did manage to find the mysql query where it hangs:

SELECT GET_LOCK('moodle-mdl_-session-8', 120)

Using the MySQL Adminstrator tool, as soon as I kill this query, I get the "Timed out while waiting for session lock." message, and I can then navigate the Moodle site normally.

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Sorry, don't know off the top of my head. Session locking is something Moodle does to avoid your session being corrupted by sumultaneous requests. I don't know that on the healthcheck page that might be causing this.

Clearly something is. One option would be to start commenting out chunks of the code in healthcheck.php, to try to find the culpret. That is only an option if you know a bit about editing PHP code.

 
Average of ratings: -
Picture of Kevin Wheelock
Re: STACK version 3.0
 

Hi Tim,

Thanks for responding. It isn't just the healthcheck script; any call to anything that uses STACK (apart from the local documentation pages) causes the session lock.

Cheers,

K.

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Well, still, the health-check page is a convenient self-containged page to test with. The technique of randomly deleting chunks of code until it works, and hence isolating the problem, is still probably the best way to isolate the issue. Actually, we are mathematicians, we can probably do better than random. Working out the optimal bisection sort algorithm would make the process more fun.

The fact remains that I can't reproduce the problem, so I can't really investigate myself.

 
Average of ratings: -
Picture of Miguel Frade
Re: STACK version 3.0
 

Hi,

I'm new to both moodle and STACK. I've installed an ubuntu 12.04 server (64 bits) with:

- moodle 2.5 + postgresql
- MathJax
- Maxima 5.28.0 (compiled from source code with --enable-clisp)
- stack 3.0 from git

However, like Kevin Wheelock, my "healthcheck" scripts also looks moodle. I've found out that killing the maxima process allows the "healthcheck" to complete with this error at the end: "stack_cas_connection: could not open a CAS process. Killed" (see image bellow).

I've also tryed to compile maxima with sbcl, but I've got the same problem.

Now I'm stuck and I have no idea where to look to solve this problem. Any help would be appreciated.

Regards,

Miguel Frade


 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

OK, so that fact that there is a maxima process for you to kill means that Moodle has correctly started the maxima process, so at least that much is working.

So, we need to ask: why is the maxima process not exiting automatically?

The way to test that is for you to do, from the command-line, exactly what Moodle does to run STACK, and see what happens.

So, on your server, open a terminal window, and cd to the moodledata/stack folder.

Then type the command maxima to start maxima.

Then type (you are typing into maxima now, not the shell):

load("maximalocal.mac");
1+1;
quit();

You should be back at the command prompt.

 
Average of ratings: -
Picture of Miguel Frade
Re: STACK version 3.0
 
Hi Tim,
 
I've successfully run your test. However there are a few warnings about DEFUN/DEFMACRO being already defined in the directory where I compiled maxima -- I don't know if this is relevant (see output bellow). 
 
 
mfrade@server:/var/moodledata/stack$ maxima
Maxima 5.28.0 maxima.sourceforge.net
using Lisp CLISP 2.49 (2010-07-07)
Distributed under the GNU Public License. See the file COPYING.
Dedicated to the memory of William Schelter.
The function bug_report() provides bug reporting information.
(%i1) load("maximalocal.mac");
Loading maxima-grobner $Revision: 1.6 $ $Date: 2009-06-02 07:49:49 $
WARNING: DEFUN/DEFMACRO: redefining function TEX-MQUOTIENT in
/var/www/moodle/question/type/stack/stack/maxima/stacktex.lisp, was defined in
/home/mfrade/src/maxima-5.28.0/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-MATRIX in
/var/www/moodle/question/type/stack/stack/maxima/stacktex.lisp, was defined in
/home/mfrade/src/maxima-5.28.0/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-PREFIX in
/var/www/moodle/question/type/stack/stack/maxima/stacktex.lisp, was defined in
/home/mfrade/src/maxima-5.28.0/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-STRING in
/var/www/moodle/question/type/stack/stack/maxima/stacktex.lisp, was defined in
/home/mfrade/src/maxima-5.28.0/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-DERIVATIVE in
/var/www/moodle/question/type/stack/stack/maxima/stacktex.lisp, was defined in
/home/mfrade/src/maxima-5.28.0/src/binary-clisp/mactex.fas
WARNING: DEFUN/DEFMACRO: redefining function TEX-D in /var/www/moodle/question/type/stack/stack/maxima/stacktex.lisp, was
defined in /home/mfrade/src/maxima-5.28.0/src/binary-clisp/mactex.fas
0 errors, 0 warnings
[ STACK-Maxima started, library version 2013060300 ] 
(%o0) "maximalocal.mac"
(%i1) 1+1;
(%o1) 2
(%i2) quit();
 
Bellow I present the output of "ps aux|grep maxima" after I run the "healthscript". I have to kill the second process for the "healthscript" to finish (if I kill the first process nothing happens).
 
 
www-data 1563 0.0 0.0 4400 616 ? S 09:25 0:00 sh -c /usr/local/bin/maxima
www-data 1564 0.1 0.7 49524 15328 ? S 09:25 0:00 /usr/local/lib/maxima/5.28.0/binary-clisp/lisp.run -q -M /usr/local/lib/maxima/5.28.0/binary-clisp/maxima.mem --
 
 
 
Miguel Frade
 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

The healthtest script tries to display two separate bits of maths. The second one tests graph plotting.

So, now we have to work out why it works from the command-line, but not from Moodle.

If I was trying to diagnose this, my next step would be

  1. copy and paste the code from call_maxima in question/type/stack/stack/cas/connector.unix.class.php into a separate test.php script.
  2. Replace all the configuration variables like $this->command with the equivalend hard-coded values (e.g. 'maxima')
  3. Add lots of echo statements to track what is going on.
  4. Then run that script.

Basically, you are trying to build the simplest possible script that reproduces the problem. Trying to do that often reveals what the problem is.

 
Average of ratings: -
Picture of Miguel Frade
Re: STACK version 3.0
 

Hi Tim,

thanks for your tips. I've identified the problem in file question/type/stack/stack/cas/connector.unix.class.php. This code:

if ($err = fread($pipes[2], 1024)) {
 
throw new stack_exception('stack_cas_connection: could not open a CAS process. '.$err);
}

is trying to read something from maxima stderr, but maxima doesn't write anything (it has no errors to report) so it hangs the script. Probably the intention was to read the stdout, but maxima is started in quiet mode, so it doesn't writes anything either. Maybe windows systems behave differently. Commenting those lines solved the problem and healthscript runs as expected.

I'm not a PHP expert, but when calling the maxima process:

$casprocess = proc_open($this->command, $descriptors, $pipes, $cwd, $env);

variables $cwd and $env are not used, so they can be deleted:

$casprocess = proc_open($this->command, $descriptors, $pipes);

it makes the script easier to understand.

 

Regards,

Miguel Frade

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Great detective work! Thanks.

 

However, this does not fail on all unix systems. And, while maxima does not write anything to standard error, something else might if things go wrong, and the whole point of that line is to handle errors.

So, we need more detective work. Why does that line of code block on your flavour of unix, when it works fine on other flavours, and indeed is sometimes necessary to correctly report errors?

I don't really understand this stuff. In the code, I note we do call stream_set_blocking on stdout, but not on stderr. Looking at http://uk3.php.net/manual/en/function.fread.php does not help me.

Ah! http://uk3.php.net/manual/en/function.stream-set-blocking.php We are setting$pipes[1] to be non-blocking. Perhpas we should do the same for $pipes[2] before we try to read it?

 

Regarding cleaning up $env. I am afraid I am not brave enough to delete an un-explained line of code saying $env = array('why'=>'itworks'); That has been there since the start of the Moodle version of the code. Going through the old STACK CVS repository may find where that came from, but I am not going to do that now.

 
Average of ratings: -
Picture of Miguel Frade
Re: STACK version 3.0
 

Hi Tim,

Regarding the "fread($pipes[2], 1024)", I don't know either why it works on some unix flavors and not in ubuntu. But I know from personal experience that different linux systems don't always behave the same way for the same code ...

Regarding the proc_open function, in its definition (http://php.net/manual/en/function.proc-open.php):

resource proc_open ( string $cmd , array $descriptorspec , array &$pipes [, string $cwd [, array $env [, array $other_options ]]] )

the variables $cwd, $env and $other_options are all optional (at least for PHP 4 >= 4.3.0, PHP 5). So, I would risk to say it is safe to remove them, but tests should be made first to be sure (it works fine in my system).

Just for curiosity: why only versions 5.23.2 to 5.28.0 of maxima are supported? Does Maxima versions are not retrocompatible?

 

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

The list of maxima versions is a reasonable list of recent versions, from the last time Chris updated the list. 5.23.2 is also there because it is the version that is in Red Hat Enterprise Linux, which is what the OU is running on its servers.

Maxima is not always compatible between versions. Chris has to run all the Maxima unit tests, and perhaps fix things, before we can add a new version of Maxima to the supported list.

 
Average of ratings: -
Picture of Kevin Wheelock
Re: STACK version 3.0
 

I seriously doubt this will move us any closer to a solution, but FWIW, I see the same sequence of events, and the same failure, on OSX Lion--which is based on FreeBSD, more or less. And yes, killing the maxima process allows the healthcheck script (and every other script) to complete.

I haven't tried commenting out the lines in the PHP scripts, since Tim seems to have an idea about what the correct fix might be. But, if there is something useful I could check on my system, do please let me know.

EDIT: It just occurred to me: Could the culprit be in the version of PHP being used? For the record, here's mine:

php -ver
PHP 5.3.15 with Suhosin-Patch (cli) (built: Jul 31 2012 14:49:18)
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies

K.

 
Average of ratings: -
Picture of Miguel Frade
Re: STACK version 3.0
 

My php version is listed bellow. Let me know if there are any additional tests I could do to help solve this out.

php -version
PHP 5.3.10-1ubuntu3.6 with Suhosin-Patch (cli) (built: Mar 11 2013 14:31:48) 
Copyright (c) 1997-2012 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2012 Zend Technologies
with Suhosin v0.9.33, Copyright (c) 2007-2012, by SektionEins GmbH

Meanwhile I've been testing my system (with those lines commented) and applied "A test suite for validation of student's input" and "A test suite for STACK Answer tests", with maxima optimization for sbcl. In both cases there a few failed tests, is this normal? 

EDIT: The manual page about proc_open()(http://php.net/manual/en/function.proc-open.php) has some users notes worth reading. Luceo suggests to open stderr in append mode:

«It seems that stream_get_contents() on STDOUT blocks infinitly under Windows when STDERR is filled under some circumstances.

The trick is to open STDERR in append mode ("a"), then this will work, too.»

I've made that change, uncommented the lines related to stderr and runned the healthscript again and voilá! it works smile

 
Average of ratings: -
Tim at Lone Pine Koala Sanctuary
Re: STACK version 3.0
Group DevelopersGroup Documentation writersGroup Particularly helpful Moodlers

Kevin has misplaced faith. I have no idea how to solve this properly. I have had STACK working on MAC OS.

The append mode trick looks like a good idea, but I don't entirely understand why it works.

 
Average of ratings: -
Picture of Christopher Sangwin
Re: STACK version 3.0
 

Thank you to everyone for looking into this.  Things have calmed down a little here after this weekend and I'll find some time this week to look into this issue and, I hope, propose a fix.

Chris

 
Average of ratings: -
Picture of Miguel Frade
Re: STACK version 3.0
 

Hi Chris and Tim,

I've made a few more tests with the script "connector.unix.php".

1) I created a small C app "test "that writes to both sdtout and stderr. However, when it receives an argument it exits with an error (see below).

#include <stdio.h>
#include <errno.h>
#include <stdlib.h>
#include <unistd.h>

int main(int argc, char **argv){
  (void) **argv;

  printf("hello world\n");
  if(argc > 1){ // with args the program will terminate with an error
    perror("Exit with error\n"); // writes to stderr
    fflush(stderr);
    sleep(3);
    exit(EXIT_FAILURE);
  } else {
    perror("Normal exit\n");
    fflush(stderr);
    sleep(3);
    exit(EXIT_SUCCESS);
  }
  return 0;
}

 

2) in "healthscript" I changed "CAS result caching" to "do not cache"

3) and changed the "connector.unix.php" to  replace "$this->command" by: 

 

test --> stack_cas_connection: could not write to the CAS process. (I expected it to try to use "test");
test a --> stack_cas_connection: could not write to the CAS process. (here I would expect to have an error on "fread($pipes[2]";
testa (non-existent file) --> stack_cas_connection: could not open a CAS process. sh: 1: (as expected);

4) changed "2 => array('pipe', 'w')" to "2 => array('pipe', 'a')" in "connector.unix.php" and repeated the same tests:

test --> calls test, but returns "CAS failed to return any evaluated expressions. Please check your connection with the CAS." (as expected);
test a --> same as above, however I expected it to stop the script on "fread($pipes[2]";
testa (non-existent file) --> same as the 2 previous tests! this is the most strange result for me, I expected it to stop in "fread($pipes[2]" or "if (!is_resource($casprocess)) {";

 

I'm not sure what to conclude from these tests. I think that open stderr in write mode (w) is the correct way, but it's not working as expected (blocks the script while the app is running).

In my system it seems that the append mode for stderr has the same effect as not reading stderr at all. Finally, calling a non existing file should  stop the script, but it didn't and that makes me think that the problem could be in PHP engine. 

I hope this info can be useful to find a solution.

 

 
Average of ratings: -
Picture of Miguel Frade
Re: STACK version 3.0
 

Hi again,

it seems that php proc_open() function had lots of bug reports. Maybe this one is the culprit of hanging the healthscript. So, I decided to update my php version from 5.3.10-1ubuntu3.6 to 5.4.17RC1 (available in this ubuntu repository). And now the healthscript works as expected without any code change.

So I guess the problem is solved. But maybe you could add to the healthscript a few lines of code to check php version before running the proc_open() function.

 

Regards,

Miguel Frade

 
Average of ratings: -
Picture of Edfel J
Re: STACK version 3.0
 

Hi:

Relative new to Moodle. Experienced with Joomla and PHP (not a developer tou).

Just want to comment that STACK here healthcheck seems to work (graphs were shown) no error produced. Cas cached to DB, cache currently have 5 entries.

Will appreciate if someone could refer to additional documentation or examples to test STACK question functionality.

Setup Centos 6.3 (64bit), Apache 2.4.4, PHP 5.4.16, MySQL 5.5.30, Moodle 2.5+, Maxima 5. 23.2-1.

smile

 

See screen capture below


 
Average of ratings: -
Picture of Christopher Sangwin
Re: STACK version 3.0
 

This looks good to me.  You may need to install a TeX filter, e.g MathJax to get the mathematics to display, but the CAS is connected.  It is reassuring to know it can still be installed, given some difficulties reported above.

There are examples in the documentation (which you have, it is distributed with STACK).  I suggest you have a look a the quick start guide.  http://stack.bham.ac.uk/moodle/question/type/stack/doc/doc.php/Authoring/Authoring_quick_start.md

You should also be able to import a moodle course with lots of example questions and demonstration materials.  Look in your system for the file, probably in moodle/question/type/stack/samplequestions/STACK-demo.mbz

Or you can download the version from https://github.com/maths/moodle-qtype_stack/blob/master/samplequestions/STACK-demo.mbz

Please let me know how you get on.

Chris

 

 
Average of ratings:Useful (1)
Picture of Edfel J
Re: STACK version 3.0
 

Thank you very much Chris!

Installed LaTex at server and configured at Moodle, formula now displayed properly. What I don't find is how to install MathJax. Thanks for the reference too. Will play with it in weekend.

cool

 
Average of ratings: -