VisualNEO Win as CGI application - Forum

Forum Navigation
You need to log in to create posts and topics.

VisualNEO Win as CGI application

Thinking about how to work with both programs NeoWeb and NeoWin together I have been experimenting with the possibility to use a NeoWin executable as a CGI application for a NeoWeb app and finally I have succeed :)

Will try to explain myself:

  1. Based on a free tiny WebServer (500Kb) I have created a new application similar to neoPhpServer wich name is neoServer
  2. neoServer allows to configure and start the tiny WebServer very easily so it detects .neo file extension (similar as .php extension works in neoPhpServer) so you can execute something like this in NeoWeb: FileToVar "neo?name=[name]&surname=[surname]" [myvar]
  3. Then the server calls a predefined .bat script like this one (editable through neoServer menu):
    @echo off
    echo Content-Type: text/plain; charset=utf-8
    echo.
    @START /WAIT myapp.exe
    type temp.txt
  4. The .bat executes a NeoWin .exe application (myapp.exe) and waits for it to exit. Then send the temp.txt file back to the NeoWeb App (in the example it will be stored in [myvar]).
  5. The NeoWin .exe gets the parameters sent by the NeoWeb App using the QUERY_STRING environment variable with SystemInfo "%QUERY_STRING%" "[params]", then performs any action (for example searching on a database), writes the response to temp.txt and exits (need to do some experiments to know if it works in an already running .exe).

It's quite more easy than it seems. Please see atached screenshots.

Limitations:

  • Only GET parameters will work. I don't know how to read the StdIn directly in NeoWin, and thats needed to get POST parameters from any WebApp.
  • As I don't know how to write to StdOut from NeoWin it's necessary to write the response in a temp.txt file

Note that the same technique can be used with any executable (python, ruby, basic, delphi, c++...)
Any non visual NeoWin command will work, even plugins.
The WebServer is very easy to deploy with the WebApp.
My idea is to include this functionality in the next VisualNEO Web release.

What do you think?
Any idea about how to improve it?
I think it opens a lot of possibilities. Any thought is very welcome

Uploaded files:
  • You need to login to have access to uploads.
Vadim and CDY@44 have reacted to this post.
VadimCDY@44

Hi Luis,

For the moment, all these things are not very clear in my mind, but I am always ready to learn more with VisualNeo Web and Win! Thank you for your work !!

Best regards,
Denis

Very cool!! I really like when new opportunities appear!! But I don’t understand yet what it is now possible to do with the help of new technology. I do not understand this issue. Therefore, I can not offer anything yet. :)

What can now be done from what was previously impossible or very laborious?

What can now be done from what was previously impossible or very laborious?

@vadim  @cdy44-2 Imagine you can do something by creating a VisualNEO Win executable that's not currently possible with VisualNEO Web (doing a search in a SQL Server or Oracle remote database, processing the content of a file, using a plugin to move a robotic arm...) What I have done is to execute that .exe from a VisualNEO Web App, sending some parameters, and get the response back to the App.

The .exe does not need a visual Interface. It starts, read the parameters, perform any operation, write the response and then exits. This is the whole NeoWin source code:

SystemInfo "%QUERY_STRING%" "[params]"
SystemInfo "%REQUEST_METHOD%" "[method]"
SetVar "[data]" "Information sent from VisualNEO Win program:<br><br>"
SetVar "[data]" "[data]URL data: [params]<br>"
SetVar "[data]" "[data]Method: [method]<br>"
FileWrite "temp.txt" "All" "[data]"
Exit "" ""

So, once you have the server is working in a computer you can execute the WebApp (and the executable) from anywhere (any device, any place) and get the response. You have a web user interface for a remote .exe application.
Please let me know if you now understand what I'm doing.
Thank you!

Did I understand correctly that the VisualNEO Web application (located on the Internet) will be able to run the VisualNEO Win application (located on the local computer) and will be able to receive information from the local application (if this neoServer is running on the local computer)?

Or can I put an exe file created in VisualNEO Win on a server on the Internet and it will work as a web application?

I'm sorry Luis, I don’t understand yet. But I am very interested to understand.

@luishp

The NeoWin .exe gets the parameters sent by the NeoWeb App using the QUERY_STRING environment variable with SystemInfo "%QUERY_STRING%" "[params]"

According to this page ... https://www.computerhope.com/starthlp.htm ... the DOS command Start can take parameters which are then passed to the .exe program ... so could the .bat file do something like ...

@START /WAIT myapp.exe %*

... and myapp.exe can then query [CommandLine] for it.

need to do some experiments to know if it works in an already running .exe

I can't find it right now, but I recall some capability for a running NeoBook (VisualNEOWin) created .exe to examine command line parameters of a second/subsequent request to run the program ... but if you were thinking making myapp.exe not exit after servicing a request (but wait for additional requests), it might not work with ...

@START /WAIT myapp.exe
type temp.txt

... where the type command will only execute after myapp.exe is closed.

Note that the same technique can be used with any executable (python, ruby, basic, delphi, c++...)

For those users not wanting to learn a whole new language, AutoIt (https://www.autoitscript.com/site/autoit/) might be a suitable candidate ...

- extremely small footprint (less than 128 KB)
- very fast execution
- commands very similar to basic/javascript

- might also be able to handle STDIN/STDOUT better than VisualNEOWin

Hi @gaev, thank you very much for your comments.
The CommandLine doesn't store URL parameters, only the path to the executable and the URL file. Anything after ".neo" is lost.
I have learnt a lot about CGI programs and it seems console applications are quite better than windowed applications.
Anyway with this new server it's possible to use whatever language you choose including probably AutoIt.
Now thinking the best approach to facilitate the deployment of this kind of applications.

@vadim, please take a look here and here to better understand what CGI programs are. I'm just trying to facilitate VisualNEO Web users to use any server side programming language, specially VisualNEO Win.

Regards.

I'm afraid that with the direction things are going, the VisualNeo-Web project is moving further and further away from the spirit of "simplicity" born with Neobook (VisualNeo-Win, now). I regret it a little, because I who am not a programmer, I managed to do quite complex things with the operating policy of Neobook, and I hoped at the start that it would be the same with VisualNeo Web. I do not know if this feeling is shared by others.
Best regards,

I'm afraid that with the direction things are going, the VisualNeo-Web project is moving further and further away from the spirit of "simplicity" born with Neobook (VisualNeo-Win, now).

@cdy44-2 I'm very sorry you have this perception.
I know some concepts are tricky, specially if you don't have any web development experience. But believe me, I'm strugling everyday to make things as easy as possible. Web technologies are as they are and using some kind of CGI program (as PHP) is mandatory in order to work with databases, user autentication and many other functionalities.
I have just found a way to use VisualNEO Win as a server side programming language, and it works!
It makes possible to connect to a database using NeoDBpro for instance but with a Web interface!
Anyway I try to add beginners functionalities (neoQuiz or neoDrag for example) but at the same time open up as many web technologies as possible (possibilities are endless and quite more broad than those available in VisualNEO Win).
I know samples and documentation are something I have to work in.

Regards.

Vadim and CDY@44 have reacted to this post.
VadimCDY@44

@luishp Do I understand correctly that I can run the VisualNEO Win application on a web server, and the site will serve as the interface for it?

It turns out that the visual interface will create the VisualNEO Web application, and VisualNEO Win application can perform some work on the server side. I understand correctly?

That would be really very cool !!!

Two applications, but one programming language and common work! Super!!!

And thanks for the links!

Thanks so much for helping and developing VisualNEO!!!

CDY@44 has reacted to this post.
CDY@44
Quote from CDY@44 on January 23, 2020, 11:05 pm

I'm afraid that with the direction things are going, the VisualNeo-Web project is moving further and further away from the spirit of "simplicity" born with Neobook (VisualNeo-Win, now). I regret it a little, because I who am not a programmer, I managed to do quite complex things with the operating policy of Neobook, and I hoped at the start that it would be the same with VisualNeo Web. I do not know if this feeling is shared by others.
Best regards,

In a sense I can agree with this. I did purchase VisualNeo Web however after using it a while I no longer use it. But one must remember that Neobook (now visualNeo Win) is for windows only. The windows infrastructure is predictable and is designed by one single company with one single vision. VisualNeo Web on the other hand is for internet technologies of which there are thousands of technologies created by hundreds of companies in dozens of languages. The web is very very complicated. Therefore it stands to reason that VisualNeo Web will be complicated. I know that the Neo Dev team is doing there best to keep things simple. And I do hope that VisualNeo Web will stay as true as possible to the ease of use for citizen developers. There are already a million other web platforms out there that drill deep. Neobook always covered a smaller niche and that's catering to citizen developers with a "low code: RAD IDE. while citizen developers may not be the hardcore code junkies, they envelope a massive portion of the populace. I hope VisualNeo will remain true to citizen developers and not chase after the Visual Studio crowd. With that said, delving into web technologies, you will hit a brick wall very shortly without some HTML and ASP / PHP understanding.

But please yes, at least keep VisualNeo Win focused on citizen developers please. Right now it is actually FUN to make solutions with VisualNeo Win. Visual Studio drills deep, yes. But 90% of people with great ideas spend 2 hours on visual studio and they just give up. I've seen it happen many times. 90% of apps don't need to drill deep. Just eye candy and database connectivity and you cover the bulk of all app requirements. Really VisualNeo Win is perfeect as is except some nicer graphics options would be nice :) hint hint

hi,

I'm using this system and it works great

regards

@cdy44-2

I'm afraid that with the direction things are going, the VisualNeo-Web project is moving further and further away from the spirit of "simplicity" born with Neobook (VisualNeo-Win, now). I regret it a little, because I who am not a programmer, I managed to do quite complex things with the operating policy of Neobook, and I hoped at the start that it would be the same with VisualNeo Web.

@mazzu001 posted his response while I was composing mine ... so let me say that I agree with almost everyting he has said ... here is my response to your concerns ...

1) Look at this latest feature (VisualNEO Win as CGI application) as an extension of VisualNEOWeb (not NeoBook/VisualNEOWin).

2) I started programming when dinosaurs roamed the earth (1973), and I still think the NeoBook/VisualNEOWin scripting (full credit to Dave Riley) is the easiest, most productive and most enjoyable way to develop Windows based programs ... but the key phrase here is Windows based programs.

However, the resulting programs have one big short fall i.e. such programs do not facilitate (real time) sharing of data ... especially among users who are geographically dispersed.

Also, a minor issue is that the resulting programs need to be delivered and installed on Windows based PCs if the program (not the data) is to be shared ... most end users are scared of downloading programs on to their machines (fear of viruses) and shy away from installation tasks.

3) Applications that run within your Browser (nothing to install) addresses the minor issue ... but there is no getting away from the fact that, in order to share data among geographically dispersed users, you need the data to reside on a server that can be accessed by such users through applications that run inside Browsers ... and you need some server side scripting (php, java, ruby etc.) to service requests for data in a secure manner.

So, while NeoBook/VisualNEOWin exploited the facilities of the Windows Operating System, ViualNEOWeb needs similar assistance from both, the Browser facilities (html, css, javascript) and scripting platforms on the server side.

VisualNEOWeb has done a superb job of exploiting the client side of things (Browser technology, as well as platforms like jQuery and Bootstrap) ... making the client side as easy, productive and enjoyable as VisualNEOWin.

But the server side of things remains a challenge (for every development platform in the world) ... there is no similar scripting language on the server side that is as easy as VisualNEOWin ... BTW, in the past, I had suggested to @luishp that he offer a separate product that would generate php/nodejs server side scripts that users could upload to their servers (or neoCloud) ... but I digress :-)

With this latest sub-project, @luishp is just trying to chip away at this challenge (albeit for a limited use case) by providing a bridge from a web based application to a database on your Windows based PC (such that you can use visualNEOWin as the scripting program that services requests for data (local files or databases via neoDBPro). ... so your Windows based PC is now acting as a server and your VisualNEOWin program is the server side scripting program (CGI) that services data requests.

So, if you are developing applications that run under Windows (and do not share data), nothing has changed ... it is still the simple, easy, productive platform that it has been in the last 15+ years.

But if you want to develop Web Apps that can share data among users, you will still need some additional tech skills.

Hope that clears things a bit.

Darbdenral has reacted to this post.
Darbdenral

I also purchased VisualNeo Web but to date I can't create anything that is remotely what I created with Neobook, I'm also sorry because the Neobook mink was making sure that everyone could create something. I think computer science is moving only for professionals and no longer for amateur users.

Well, here I can not agree. VisualNEO Web allows you to create projects at different levels of difficulty. I have a couple of useful projects and at the same time quite simple for those who worked with VisualNEO Win.
For example, the diagnosis of motivation: http://orgpsiholog.com/1
Or a graph visualization program (for an article): https://vadimljovkin.github.io/GEG/

The last project I did in two versions (for web and for wines) and both of them are in the public domain. The project code shows that both of them are equally simple: https://github.com/VadimLjovkin