Pythagoras’ Theorem In APL

Below is Pythagoras’ theorem interpreted into APL. To the left of the function simply enter a 2 element numeric vector for example 3 4 and to the right enter a scalar for example 10.

Pythagoras Theorum APL

A result of 1 means the triangle is right angled, a result of zero means it is not a right angled triangle.

The left vector represents the two shortest legs of the triangle and the right scalar represents the hypotenuse. Below are a couple of examples:

Pythag proof APL

Give it a try…

How To Fix Moodle’s Re-Direct and Access Issues

Recently I have been experimenting with Moodle and I have to say I have been impressed. However the installation was less than straight forward for me. The actual installer was very simple to follow however the bugs that proceeded were a nightmare.

The first error I came across was one which prevented me from going anywhere but my personal profile page. This is the re-direct bug. A picture of the screen displayed in chrome can be found below:


This error is fairly straight forward to fix however it did take some research. Anyway to amend this and access Moodle simply navigate to:


And open in a program such as notepad++. Then find this line (line 795 for me) in the text:

redirect($CFG->wwwroot, get_string(‘wwwrootmismatch’, ‘error’, $CFG->wwwroot), 3);

And replace it with this one:

redirect($CFG->wwwroot, get_string(‘wwwrootmismatch’, ‘error’, $CFG->wwwroot), 0);

This should fix the issue and you should now have a fully accessible site. SHOULD. But I didn’t… When trying to access the site from another computer (which was also inside the network) I got this error:


This error also required some hunting to find a solution but eventually a definitive one was found… Delete the moodledata folder. Please make backups and I am not liable for any damages or loss of data on your systems. This solved the problems for me.

There was one last issue that I run into however it was purely because of how I was hosting the site and how people were accessing this but just in case I will explain: after all of these solutions had been applied some people were just receiving a blank screen when punching in the IP of the hosting machine.

The solution to this is to navigate to:


Then open with a program such as Notepad++. Then locate the following line (line 20 for me):

$CFG->wwwroot   = ‘http://localhost’;

And change it for this line where ‘*.*.*.*’ is replaced with the IP of your hosting machine:

$CFG->wwwroot   = ‘http://*.*.*.*’;

I hope this resolves issues for some of you using Moodle, once it’s working it is incredibly powerful and well made however getting to that stage was a bit of a mission for me.