Access to a Matlab gui from the web - matlab

Is there a way to place a matlab gui I have on a website, such that users could use or play with, similar to java applets etc? Would I need to compile it differently in some sense?

MATLAB Compiler allows you to create a standalone exe which can be called by your web server using the Common Gateway Interface (CGI).
The CGI script outputs HTML by printing it to the screen (stdout). You can input to a CGI script through the environment variable query_string . A simple CGI script can be written Using the Matlab functions getenv and fprintf.
But don't forget to check that you have configured your web server properly in order to run CGI programs, and that you are able to execute a CGI program that is independently.
There's an example which demonstrates how to do this in Mathworks website. Perform the following steps to compile and run this example:
Compile the MATLAB file into a standalone application. This can be done with the following command in MATLAB: mcc -m mycgimagic.m
Copy the HTML file to the web server and place it in a directory with the proper permissions. Consult your web server documentation for how to do this.
Copy the exe and CTF files to the web server and place them in the "/cgi-bin" directory of your website. You will need to configure the web server to have the proper permissions to be able to execute the exe-file. Consult your web server documentation for how to do this.
Install the MCR on the web server.
Execute the exe-file for the first time from the web server system itself in order to force the CTF-archive extraction.
Load the HTML-file in a web browser from the remote computer and submit the form to execute the CGI program.

Related

Package a unix executable within a MacOS app

My organization has built a signal simulation tool that has a very large c++ codebase. Currently, a user has to download the entire codebase, then run cmake to get the executable. The executable itself is then run from the command line. An xml file containing configuration data is passed as an argument.
Essentially, the utility (called twang) is run with the following command:
./twang --xml config.xml
Everyone in our organization uses macs, so I would like to distribute the tool as a self contained app. Ideally the executable and the xml file would be contained within the app. A GUI would allow a user to easily edit the xml file, then run the executable with said xml file passed as an argument. This app will only be distributed within our organization, so it doesn't need to abide by App Store rules. So far, I haven't found any way embed a pre-compiled executable within a swift app, and then pass arguments using swift. Furthermore, the executable sends data to a peripheral that is attached via ethernet. Is it possible for a compiled executable to be packaged and run within an app, yet have the same access to peripheral devices as an executable that is run from the command line?

Lua CGI fails on call to socket

I have written a simple Lua script that reads from and writes to an XML database. I want to use it as CGI, eventually returning data to display in a web page, but when, for testing purposes, I go straight to the script in a browser, it blows up on require("socket.http") with a 500 Internal Server Error and it apparently can't find the Lua socket library when run in a browser.
I haven't used CGI in years and I'm very new at Lua, so thanks for any assistance.
it apparently can't find the Lua socket library when run in a browser.
I assume your script is using socket.http. If so, you need to make luasocket (both its binary libraries and Lua files) available to your script. My suggestion is to make it work when you run it locally, before you try to make it run as a CGI script. You'll need to either get a pre-compiled luasocket for your platform or compile and install it yourself. You'll then need to use LUA_PATH and LUA_CPATH in your script to reference the locations of Lua (PATH) and binary (CPATH) files.

Run Perl code into GUI

I have been working in a Perl script to read log files, but none of the people at work
want to use it as it requires run it from CLI, Im looking to integrate my Perl code which mainly
reads a txt file and produces and output (Already more than 2,000 lines) into a GUI which can be used with Windows or MAC PCs,
Example:
my perl script:
#./perl -i myfile
# HELLO this is the output!
Instead I want users to run the App and give them the chance to upload file and a Run button.
Thanks!
Then you can either write a web based frontend or use a GUI library such as Tk, Wx or Gtk.
Run as a CGI script which should ouput as HTML. For more you use template system like Template tool kit
In my experience, Tk is the most cross-platform GUI framework for Perl. It is very primitive (both in looks and API), but it works as expected almost everywhere with minimal fuss. Even with Gtk, I found there were some combinations of platforms and Perl deployments that just wouldn't work.
If you want to go the CGI route, try POEx::HTTP::Server. This will run a small web server within Perl without needing all the configuration of a full web server like Apache.

Correct deployment tool to copy files & run SQL Script

What would be the best way to deploy upgrades to a piece of software with the following requirements:
The upgrade:
Must be run from a client machine, not a server.
Must Show a dialog to select a network location and copy files to a share.
Must show a dialog to enter SQL Server connection information and the upgrade must connect to SQL Server to run an upgrade script.
Must not change anything on the client machine from which the upgrade is run. (Nothing in Add/Remove programs, registry, etc. I.e. no Windows Installer.)
Must not rely on any additional dlls or frameworks. The user must be able to download a single file and run it from Windows XP SP2 without having to install anything else.
Some things I have looked into:
Batch files (can’t show a dialog to allow the user to enter connection information)
OSQL (can’t show a dialog and can’t copy files)
WiX (runs on top of Windows Installer so it puts things on the client machine from which it is run)
Custom C#/VB app (requires .NET framework)
Winzip/WinRAR (can't show a dialog, can’t run SQL Scripts)
If you don't want to rely on any dlls and frameworks, you should make a native app, this can be, for example, custom winrar sfx (you can run additional scripts after extraction, this can be a batch that executes sqlcmd).

Why is my Perl source code being displayed in the browser?

What does it mean when I access my Perl script via URL, but when I do, the source code is printed on the screen?
Does this mean that Perl isn't properly set up? I'm using Apache on Fedora.
This means your webserver isn't set up to execute the script at that url. What server are you using?
It could also mean you are putting the Perl script in the wrong folder. The cgi-bin folder is still widely used as the folder where CGI scripts should be stored and run from. Other folders may just open the file and read it as text, similar to an HTML document, instead of running the document as code. But it can also mean the server is just not setup properly to run Perl scripts or other types of server-side scripts.
This means that you probably aren't doing what your server is expecting. Usually servers expect either that every file in a CGI directory is an executable, or that files with a certain extension are executable and it can serve any other file as its content.
Figure out which file extension your server expects your CGI program to use.
Ovid's CGI Course may help you (if you use CGI of course)