How to execute a Unix shell script via GWT? - shell

Im building an GUI that will help my team mates to execute some jars without going using the terminal (with all the validating and stuff).
At some stage, the gui sould gather params from the gui and execute them, something like : --start -Xbootclasspath/p:lib/OB-4.3.4.jar:lib/OBNaming-4.3.4.jar -Dmy.property.ns=corbaloc:iiop:localhost:900/NameService -Dmachine=energie -Dexecutable=MOREventd -DtypeArbo=1 -jar MOREventd
I was wondering how could i do that since Runtime Exec doesn't work with Google Web Toolkit)
thx for any help.

The GWT module will need to send details about the invocation to a server by using GWT-RPC, RequestFactory, or some other communication package. The server will then execute the commands on behalf of the browser client.

Related

Access to Express.js and Prisma console

So im building app based on Express and using Prisma ORM. What i need is to SSH to a server, open up express.js console and create new db entry using prisma. Something similar to python manage.py shell for Django or rails console for Rails. Is there a solution for this of any kind?
Like I pointed in the comment there is a way ( kind of ) to get access to a running express instance. If that's all you need follow:
How can I open a console to interact with Express app?
Express doesn't exactly have a feature like rails console which is a framework feature in that case.
That said, I question the long term implication of this approach. If you really just need to seed some data, write an "init" script, and call it after you ssh into a server or using some CI/CD approach. This is more re-usable, since you can even pass a json file to the script to load dynamic data.
Also, Prismajs has an official way to seed the data ( if that's what you need) that you can leverage:
https://www.prisma.io/docs/guides/database/seed-database
UPDATE:
If you are able to run to code on your machine and point the remote database, then you can use node --inspect to debug in a chrome console. Which should give you about the same effect as a rails REPL
https://medium.com/#tbernardes/debugging-nodejs-with-chrome-inspector-devtools-1cd2ef323b5e

Executing Perl/CGI script in AJAX without using server

I am having a Perl and a CGI file through which I want to fetch data from database. I've a UI where I am trying to use AJAX call which will hit the perl (.pl) or (.cgi) file and get the response in JSON. I've checked the perl/cgi file by running through command prompt and it works fine. This is how I am running my code in command prompt:
D:\>PerlExecutables\strawberry_32\perl\bin\perl.exe C:\Users\UserXYZ\Desktop\PerlExamples\test.cgi
The reason is I cannot do any kind of installation on my machine and also I don't want to run it through server like Apache or IIS.
How can this be achieved? Is there any way to make the script work in AJAX by passing the perl.exe path for execution or Any other alternatives?
Thanks!
One way to do this is to use Plack::App::CGIBin. It allows you to mount CGI scripts as apps with the PSGI/Plack protocol.
use Plack::App::CGIBin;
use Plack::Builder;
my $app = Plack::App::CGIBin->new(root => "/path/to/cgi-bin")->to_app;
builder {
mount "/cgi-bin" => $app;
};
Save that as myapp.psgi (or whatever your stuff is called) and run it like this:
$ plackup myapp.psgi
By default it will open up a server on port 3000 on localhost. You will need to be able to install Perl modules. Since you have Strawberry Perl that shouldn't be a problem. In the worst case, just use a local::lib.
You will also need to be able to open a port for listening. If you cannot there is no other solution than to get an admin to install you an actual full-scale web server.
The PSGI protocol and the Plack tools are a simple, easy to use replacement for CGI. They allow you to be very flexible while making it easy to have persistently running large applications.

How to debug a lotus script agent inside a lotus script agent

I am debugging a lotus script agent using debug a lotus script. Agent is debugging fine but I have another lotus script agent inside that and my debugger is not going to that code line by line.Please help me how to do this.
Thanks in advance.
An agent, that is called in script from another agent runs in the background. These agents can not be debugged easily. If the called agent runs on the server, you can use the remote debugger, to debug that agent: you have to enable it in the server document, start the remote debug task, and enable remote debugging in the properties of the called agent. Then you have to be fast. You define a delay that each agent waits for the debugger to attach, before it really starts with its code. During this time, you have to start the remote debugger, open the database and select the agent to debug... Quite painful. And the normal Debugger has to be off and the agent you startet has to run in client background mode, otherwise you will not be able to switch to remote debugger...
If both agents are LotusScript and it is not needed, that they:
Run with different rights or
Run on different servers,
then there normally is no need for an agent calling another agent.
Use script- libraries and subs / functions instead, then you do not need two agents...
I recommend to you use a simple log in the second agent. You can use NotesLog (look at Domino Developer's Help), or you can write your own class as you need it.
In my apps, I use a LotusScript framework, written by me. In that framework, I have a CS_Log class, who connects to a LogAgents.nsf database and writes all in simple documents. Also, I have a CS_Document class, with a Dump method, who writes the full content of a document, for example.
The most times, debugging it's the best option. But in cases like this, I prefer to write all in a log.

What is the best and most straighforward way to start a GUI application via a HTTP request?

What is the best and most straighforward way to start a GUI application via a HTTP request?
This question is specific to a windows server and the GUI application is likely to be running as the local SYSTEM user. The HTTP request will be from outside of the servers network i.e. over the web.
I've tried making use of PHP and failed miserably, anything else that I can try?
Thanks all
Update
I tried the perl suggestion but it seems to run the app in the background:
#!C:/Perl/bin/perl.exe
print "Content-Type: text/html\n\n";
$ExecString = 'Start C:/www/csharp/Test.exe 8998 "Test Message"';
exec $ExecString;
Create a CGI binary. Run it from the web-server. Have the binary start your application.
A Perl script will do the job, too.
The CGI/perl/whatever will need to have appropriate local permissions, or the OS will forbid it to start an application.

Do AutoIt scripts, executed as service, function for GUI actions?

I'm using an AutoIt script to start and automate a GUI application. I need to activate the script each hour.
Will AutoIt scripts (which perform actions on a GUI) work when used as a service? The script will be run as a service (not scheduled task).
You can easily make an autoit script run as a service using service.au3 written by archer of the autoit forums. Unfortunately or fortunately since it is a security measure. A service needs to start independent of the current user session (before login). It cant access send APIs for input manipulation of the current user session from there. It does sound much more like you need a scheduled task and not a service.
As mentioned above, a scheduled task is what you're looking for. To run a script as a service read this:
Q4. How can I run my script as a service?
This is also a question with multiple answers, and none of them are the only way to do it. The first question to ask yourself is whether or not you wish to install the service on other computers besides your own.
A1. If you only wish to install the service on your own computer, The easiest way to do this is to use Pirmasoft RunAsSvc. This program makes services easy to install and easy to remove when necessary.
A2. If you wish to make the service available to anyone running your script, you can use SRVANY.EXE and ServiceControl.au3. You can then use this code to install your script as a service:
#include "ServiceControl.au3"
$servicename = "MyServiceName"
_CreateService("", $servicename, "My AutoIt Script", "C:\Path_to_srvany.exe", "LocalSystem", "", 0x110)
RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\" & $servicename & "\Parameters", "Application", "REG_SZ", #ScriptFullPath)
or use the following code to delete this service:
#include "ServiceControl.au3"
$servicename = "MyServiceName"
_DeleteService("", $servicename)
There is one caveat to setting up AutoIt as a service. If the service is not installed using the above code, it must have the "allow service to interact with the desktop" setting or else automation functions such as Control* or Win* functions will not function. To assure the service does indeed have this setting, use the following code:
RegWrite("HKLM\SYSTEM\CurrentControlSet\Services[ServiceName]", "Type", "REG_DWORD", 0x110)
Taken from the FAQ topic on the AutoIt Forums. www.autoitscript.com/forum/index.php?showtopic=37289)
It sounds like you're want to use a scheduled task instead of a service. Scheduled tasks can execute every hour, while you're logged in, and should also be able to interact with your desktop. Just remember that a task run as a normal user can not interact (send input) to a elevated program if you're using Vista/Windows Server 2008 with User Account Control enabled.

Resources