GithubHelp home page GithubHelp logo

suever / matl-online Goto Github PK

View Code? Open in Web Editor NEW
6.0 2.0 3.0 2.2 MB

Online Interpreter for MATL

Home Page: https://matl.io

License: MIT License

Python 68.35% HTML 12.25% MATLAB 4.59% Mako 0.23% CSS 3.13% JavaScript 9.28% Makefile 0.32% Dockerfile 1.10% RobotFramework 0.75%
octave socketio flask-socketio celery flask python

matl-online's Introduction

MATL Online

tests Coverage Status Code Climate

This is a Python-based online interpreter for the MATL programming language, a golfing language based on MATLAB and Octave. A live version of this application is hosted at matl.io.

The Stack

The core of the application is the lightweight Python web framework, Flask. Two-way communication between the JavaScript front-end and the application is handled by SocketIO. MATL code and input arguments are submitted to the server and celery assigns the task to one of many available worker processes. Each worker process uses the octave_kernel library to communicate with an underlying Octave instance to evaluate the provided code. All Octave output from the process (including text and graphics) is streamed in real-time back to the browser via SocketIO.

Technologies:

Running Locally

The easiest way to run the application locally is to use Docker Compose which will start the web service, celery worker, redis instance, and postgres database. Prior to running docker-compose, be sure to build the local docker image:

docker-compose up --build

You will then be able to access the application at http://localhost:5000.

Planned Future Improvements

Contributing

We welcome contributions from any member of the user community. Free free to submit a pull request or open an issue with your contributions.

License

This software is licensed under the MIT License.

matl-online's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar dependabot[bot] avatar lmendo avatar pyup-bot avatar suever avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

matl-online's Issues

Support errors

We want to overload error.m so that any errors get a custom [STDERR] tag or similar. These should then appear within the results to the browser.

Server not working?

The "Run" button is not doing anything, at least for me. Can you please check? Sorry to bother you with this

Handle newlines in code

Since we switched to using eval for all command execution, newlines cause an issue because they look like a break in the code. We fixed the input arguments box but we need to fix the code block as well.

Determine cause of first-hit 504 on help endpoint

Whenever the documentation for a version is fetched for the first time, the backend has to do some conversions to convert the documentation into a JSON output which is causing a 504 Gateway Timeout for some reason. I need to figure out at what layer this timeout is coming from and address it by either optimizing how we compute that JSON or increasing the appropriate timeout

Incorporate support for audio output

MATL now has an implementation of sound, soundsc, and audiowrite to produce audio output. They need to be overloaded in our .octaverc file so that an mp3 file is generated on the server and then streamed back to the client. Each separate sound should appear as it's own <audio> block which will automatically get the browser's native audio controller.

Multiple Figures are not showing up

Currently, when multiple figures are plotted, they should appear as multiple figures in the output console; however, currently only the last figure is shown. On the backend, it appears that both images are actually being created so it's just a matter of them not getting properly send to the client.

[IMAGE]/tmp/cdfac32e28824c9ab76187d978110214/image0.png
[IMAGE]/tmp/cdfac32e28824c9ab76187d978110214/image1.png

Add additional input options

It's always a pain to convert python style multi-dimensional arrays to MATLAB multi-dimensional arrays. Similarly, converting text to a 2D array is annoying. It should be easy to make a simple converter for these basic types that would allow users to copy/paste inputs from challenges more easily.

Supported format conversion would include:

[[1, 2, 3], [4, 5, 6]]     to   [1, 2, 3; 4, 5, 6]

Depfu Error: No dependency files found

Hello,

We've tried to activate or update your repository on Depfu and couldn't find any supported dependency files. If we were to guess, we would say that this is not actually a project Depfu supports and has probably been activated by error.

Monorepos

Please note that Depfu currently only searches for your dependency files in the root folder. We do support monorepos and non-root files, but don't auto-detect them. If that's the case with this repo, please send us a quick email with the folder you want Depfu to work on and we'll set it up right away!

How to deactivate the project

  • Go to the Settings page of either your own account or the organization you've used
  • Go to "Installed Integrations"
  • Click the "Configure" button on the Depfu integration
  • Remove this repo (suever/MATL-Online) from the list of accessible repos.

Please note that using the "All Repositories" setting doesn't make a lot of sense with Depfu.

If you think that this is a mistake

Please let us know by sending an email to [email protected].


This is an automated issue by Depfu. You're getting it because someone configured Depfu to automatically update dependencies on this project.

Add ability to run multiple test cases

Currently we have to write a do...while loop in the code to link to create a version that will run multiple test cases. We should modify the UI slightly so that the user can provide multiple test cases that will be run. Need to think of the best way to display this to the user (both input and output) and how to handle this on the server side (i.e. do we send each separately or in bulk)

Animation Expands the Page

When we display images in an animation, each new image that appears seems to append a newline to the output box. This causes the animation to get slower with each iteration as the rendering time increases due to the additional vertical height of the div. Need to look into the transmitted data to see where that newline is being appended.

Online Help Search for 1-2 characters

To help in finding MATL statements, it would be nice to treat 1-2 character search strings as literals rather than smart search. This would result in T matching the statement true rather than all possible "T" occurances

Handle single double quote in search box

Overload the search functionality of datatables so that a single " character is treated as a literal double quotation mark and only in the case where there are 2 should it be treated as a literal search.

Pull overloaded functions out into separate .m files

This would help with checking for errors. Initially they were all placed within the .octaverc file but we can put them in separate files and just source each of them from within the .octaverc. This should work, but we'll have to do some testing to make sure.

Crop whitespace from around figures automatically

By default, MATLAB will print the entire figure which includes whitespace outside of the axes. It may be nice (but not necessary) to get rid of this. Something like the following may work with imagemagick

convert -trim input.png input-trimmed.png

`pause` and `clc` are not being evaluated properly

When using pause and clc commands (e.g. the Clock example), the screen is not refreshed properly and the control sequences of characters show through.

I suspect this is related to recent changes in the octave kernel.

Ensure Octave is running all necessary packages

>> ver
----------------------------------------------------------------------
GNU Octave Version: 4.0.0
GNU Octave License: GNU General Public License
Operating System: MINGW32_NT-6.1 Windows 7 Service Pack 1 i686
----------------------------------------------------------------------
Package Name  | Version | Installation directory
--------------+---------+-----------------------
       image *|   2.4.1 | C:\Octave\Octave-4.0.0\share\octave\packages\image-2.4.1
          io *|   2.4.0 | C:\Octave\Octave-4.0.0\share\octave\packages\io-2.4.0
  statistics *|   1.2.4 | C:\Octave\Octave-4.0.0\share\octave\packages\statistics-1.2.4
    symbolic *|   2.2.4 | C:\Octave\Octave-4.0.0\share\octave\packages\symbolic-2.2.4

Transition to using control characters for message encoding

Right now we use special strings like [IMAGE] to provide information about the data that we are passing around, but in theory these could interfere with the actual data. Ideally we would use a format which uses ASCII control characters and some content length information. This would handle multi-line output much better as well.

Handle control character output from disp

Specifically char(2) and char(3) are used by oct2py to determine the start and end of transmission. It is possible that we should handle these in a special way either within MATL or this app.

Allow code and input areas to expand vertically

Initially this was disabled, but they should definitely be able to expand vertically to accommodate code with lots of newlines or solutions with many inputs. It's a simple css fix

#code_input {
    resize: vertical;
}

Add ability to share an image via imgur

Since we use either temporary files or binary data for displaying images, it is not possible for users to easily share URLs of the images with others. We can add a link to share which will upload to imgur for posting externally

Octave not successfully being killed

After a certain amount of time (or the types of jobs), the octave process isn't properly killed and then it is unable to startup again which just causes the CPU to churn and the memory gets consumed until celery ultimately crashes due to no available RAM.

I suspect that this happens when the directory in which octave is running is removed and there is some stored state within Octave that tries to load that directory when starting.

To fix this, there are two main things to address:

  1. Make sure that Octave is completely killed

  2. Make sure that each Octave session that boots is completely independent of previously-run sessions. I think this can be done through a combination of command line switches such as: octave-cli --norc --no-history

Even when we can launch octave with all of these command line switches, it never exits and when we finally force kill everything, we get the following:

attempting to save variables to 'octave-workspace'...
save to 'octave-workspace' complete
save to 'octave-workspace' complete

It may be that we are having issues with it attempting to save the crash files when we kill jobs from within celery. We should add the following to prevent crash files from being saved

crash_dumps_octave_core(false);

Documentation

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.