help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Online Octave Compiler


From: Oliver Heimlich
Subject: Re: Online Octave Compiler
Date: Mon, 6 Aug 2018 02:04:46 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1

On 04.08.2018 14:18, Shanthi_Roy . wrote:
> I would like to know if GNU Octave provides APIs to compile Octave code
> online .
> I want to implement Octave online compiler in my website, so I'm trying
> to figure out a way to do this. Any help would be really appreciated.
> 
> These are some of the sites where I could find online Octave compilers.
> My requirement is very similar to these. 
> https://www.jdoodle.com/execute-octave-matlab-online
> https://www.tutorialspoint.com/execute_matlab_online.php
> http://rextester.com/l/octave_online_compiler
> 
> Thanks

It looks like you want an Octave interpreter, which runs Octave script
files.  This is easier than an interactive Octave interpreter (like
octave-online.net).

There is no ready to use API, which will give you the functionality seen
in the examples.  You will have to build the infrastructure and the API
around it yourself.

A simple approach would be to save the script file as a new m-file, run
octave on this file and then return the output. But be prepared that
this is not trivial (especially when you want to put this on a public
web page):
 - How can the backend be secured against malicious script files?
 - How to handle long running processes (timeouts, denial of service)?
 - How to handle graphics output?

An Octave package which gives you sort of an API ist the cgi package
(https://octave.sourceforge.io/cgi/). It could be used to receive the
script file as a POST parameter from an HTML form, run it with the eval
function, and return the result as plain text.

To protect your backend from malicious scripts, you could run Octave
inside isolated docker containers, but I have no practical experience in
doing this.

HTH,
Oliver

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]