how to integrate a software to run from another? - windows

I am working on a project and I am using a closed software package. In this software I browse for images on my computer and run the program and it executes. What I want to do is create a matlab gui where I browse the images from matlab itself and make a push button that executes the software.
what kind of files do I need to work on in order to be able to integrate the function of a certain feature in a program to run from another one?

Your question can be divided into 2 parts.
1. How to run external program from Matlab?
To do that, you need first find out how to run your program using cmd. Once you know that, you can create a string with system commands in Matlab, that you can pass to cmd using system. Learn the arguments and syntax that you need to following during the system call. Wrap the whole routine into a function to be further used in GUI.
2. How to embed my program into GUI?
Consult the guide on Mathworks website. All you need to do is to instruct Matlab to run your function from previous part using the user-set arguments.
The rest is technicalities and you might need to ask more specific questions in future.

Related

How to build a command line package from scripts?

I have spent time working on a bioinformatics project and produced numerous scripts and now I would like to use them for building a bioinformatics software that runs in the command line terminal, with the costumary manual and binary files. I would like to be able 1. to protect the code, 2. Make it fancy by not having to count with multiple scripts and 3. share the code with any one interested.
Since I don't really know where to start from, I would like to ask for orientation on the topic. I have been reading about script compilation and I think this could work, but I have scripts in three different coding languages, mainly python and bash, so I have not seen any tutorial on this specific case.
Any help as sharing resources (videos, manuals, software, etc.) or giving tips is appreciated. I know this is a VERY open question, so open answers are also welcome.
You could use the python argparse library to build a command line application that accepts arguments and flags. With this method, you can provide flags for user input and run your different scripts, including the bash scripts, based on user input.
https://realpython.com/command-line-interfaces-python-argparse/
Similarly, you can do this in a bash script that provides the user with options and run your other scripts based on input.
https://www.redhat.com/sysadmin/arguments-options-bash-scripts
I'm not sure what you mean by protect the code? If you mean hide the code, as far as I know, you cannot easily hide bash and python code or turn them into binaries if you want to share the script.

Dyalog APL: how to write standalone files that can be executed?

I now know how to use the APL interpreter, but I'm quite confused about how to write APL into a file and then run the said file. I currently write Dyalog APL using the ride IDE. What I now want to do is to:
Use the ride IDE to develop programs (how else do I access the keybindings?).
Save my program to a file.
Run the program from the command line, with command line arguments (how do I take command-line arguments?)
Distribute my program so others can use them.
Most of the documentation online refers to an "APL session", which makes me think that perhaps there's some Smalltalk like thing going one, where one can only distribute the "live image" or some such. If that is the case, I have a different set of questions:
How do I save and load these image files?
How do I distribute image files?
Can I execute such code from the command line, to take command-line arguments?
In general, I'm quite confused about how to write software in APL!
EDIT: I'm on Ubuntu, and I'd like to target Linux in general. Windows/macOS support would be a plus, but I'm currently interested in Linux support.
For now, the ability to create a stand-alone executable (a single .exe file) only exists on Windows, but Dyalog is working on making this possible cross platform. However, you can get pretty close. Before we get to that, let me answer your initial questions:
Use the ride IDE to develop programs (how else do I access the keybindings?).
There are several convenient ways to enter the glyphs outside RIDE, both through editor extensions and separate system-wide methods for prefix and/or shifting key input. For details, have a look at APL Wiki's article on typing glyphs.
Run the program from the command line, with command line arguments (how do I take command line arguments?)
⊢2⎕NQ#'GetCommandLineArgs' returns the command and the arguments to the command that was used to start the current application. This works cross-platform. Try it online under Linux!
The "live image" you talk about would be what APLers call a workspace. Once your application is working as you want, enter set the ⎕LX (Latent eXpression) variable to a statement that starts your application and then closes APL when done, e.g. ⎕LX←'myApp.Run ⋄ ⎕OFF'.
Next, save your application as a workspace with )save /tmp/myapp.
You should now be able to run your application with dyalog -hello=world /tmp/myapp etc. You can of course put this in a shell script for ease of use.
What you'll distribute to your customers would at a minimum be the workspace and the runtime interpreter, but you probably want to package some companion files/dependencies too. However, before making money off your application, look at Dyalog's prices and Licences.
This is how I do it (not an official Dyalog recommendation):
Use the ride IDE to develop programs (how else do I access the keybindings?).
RIDE is cool (I'm biased), especially in the beginning when you want to explore the language interactively.
But in practice I prefer to edit plain text files with Vim with this plugin.
It provides keybindings with a configurable prefix key.
I think there's also a way to configure Vim or Emacs as an external editor for RIDE - that way you could have both the shiny session interface and the brutally efficient editor familiar to your fingers.
Alternatively, for the keybindings you could do:
setxkbmap -layout us,apl -option grp:win_switch
Pressing the "Windows key" and another key together inserts an APL char in any X11 app - convenient for email, chat, etc.
Save my program to a file. Run the program from the command line,
I put this on top:
#!/bin/bash
(echo ∇M;tail -n+3 $0;echo -e '∇\nM\n⎕off')|dyalog -script;exit $?
⎕io←0⋄⎕ct←0⋄⎕pw←32767 ⍝ opinionated :)
and do
chmod +x file.dyalog
./file.dyalog
with command line arguments (how do I take command line arguments?)
That's a bit of a problem. There's 2⎕NQ#'GetCommandLineArgs' for Windows but no working solution I'm aware of for Linux.
See the comments below and Adám's answer.
Distribute my program so others can use them.
Any way you like - github, gitlab, bitbucket, your own site, pigeons, etc
"APL session"
That's just the traditional APL term for "REPL".

VS 2015 Form/Console Functionality in Application

This is more of a general theory question as I'm stuck on how to proceed since this is my first time developing an application...
I'm developing a reporting application in VS 2015 that requires two types of functionality. It needs to have a GUI so that users can interact with and create reports and those reports need to be scheduled via Windows Task Scheduler. I'm planning on using a Console Application for the scheduling portion. My question is, what would be the best way to implement this? As of right now I have two separate Projects in a single Solution. Is this the best route to take considering my needs or is there a better option that I'm not aware of? I've done some searching online but have not been able to find a valid solution. It's especially difficult since the scheduling portion needs to pull the application settings from the Windows Form Application.
Any help or guidance would be greatly appreciated. Thank you in advance!
The only reason you would need a console application would be if you actually needed a console interface. It doesn't sound like that's the case—the interface will be written in WinForms. Therefore, you don't actually need two separate applications. You can combine all the necessary functionality in a single executable.
The way to do this is by checking for command-line parameters that indicate whether the app should run interactively or headless. Probably, what you'll want to do is make the app run interactively when no command-line parameters are passed. This would be the normal case, the situation the user gets into when they double-click your app to launch it from Explorer.
When it comes time to schedule your app to run a task in the background (with Task Scheduler or anything else), you signal this by passing a special command-line parameter to your app. You can decide what this is, and you may need several of them if your app can do multiple things in the background. If configuration information/parameters need to (or can) be passed to the app to configure how it should perform the background task, you can pass these on the command line, too. Or, as you mention in the question, you could pull these settings from whatever was set/saved by the user the last time they ran the interactive version of the app.
The trick is just checking for these command-line parameters in your application's Main method. In the design I proposed, if there are no command-line parameters specified, then you just go ahead and create the main form like you normally would. If there are command-line parameters, then you need to parse them to see what action is being requested. Once you've parsed them and determined which background task should be run, you just run that background task—without ever creating/showing a form.
There are lots of different solutions for parsing command-line parameters. Using a library would probably be the easiest way, and also give you the most features. But if you just needed something really simple, like a /background mode, then you could easily write the code for this yourself, without taking a dependency on a library or needing to learn how to use it.
So you could do all of this with a single project in a single solution if you wanted to. Or, you could split different aspects of the functionality out into different projects that compile to libraries (e.g., DLLs), but still have only a single executable for simplicity.

GUI interaction

I am trying to write a program/script but I am not able to find a coding language (out of many) which would allow me to perform the tasks I want it to do.
I am aware of the fact that there are perhaps numerous coding languages which would allow me to do so, therefore, to make this question a bit more specific: 'Which coding language would you recommend a beginner to write a program which will be able to perform the following tasks (see below)?
Read some variables from a local HTML page
Fill in this variable in a textbox in a running application/program
Click a predetermined button
Loop the above mentioned on some predetermined condition (i.e. whether the variable has changed).
Thanks in advance!
This depends on your programming background, for which platform you are developing application. For windows C# will be good option, java is also another option.

How can I call an executable to run on a separate machine within a program on my own machine (win xp)?

My objective is to write a program which will call another executable on a separate computer(all with win xp) with parameters determined at run-time, then repeat for several more computers, and then collect the results. In short, I'm working on a grid-computing project. The algorithm itself being used is already coded in FORTRAN, but we are looking for an efficient way to run it on many computers at once.
I suppose one way to accomplish this would be to upload a script to each computer and then run said script on each computer, all automatically and dependent on my own parameters. But how can I write a program which will write to, upload, and run a script on a separate computer?
I had considered GridGain, but the algorithm is already coded and in a different language, so that is ruled out.
My current guess at accomplishing this task is using Expect (wiki/Expect), but I have no knowledge of the tool.
Any advice appreciated.
You can use PsExec for this:
http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx
You could also look at the open source alternative RemCom:
http://rce.sourceforge.net/
It's actually pretty simple to write your own as well but RCE will show you how to do it if you want. Although, using PsExec may just suffice your needs.
Have a look into PVM, it was made for the type of situation you're describing, but you may have to annotate your existing codebase and/or implement a wrapper application.

Resources